-
Notifications
You must be signed in to change notification settings - Fork 255
Fix outer context hints overriding argument types in generic calls #2146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jackulau
wants to merge
3
commits into
facebook:main
Choose a base branch
from
jackulau:2136
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+471
−49
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…acebook#2136) Retry generic function calls without hint when errors occur, unless they are BadSpecialization (bound violation) errors that should be kept.
|
Diff from mypy_primer, showing the effect of this PR on open source code: anyio (https://github.com/agronholm/anyio)
- ERROR src/anyio/_core/_eventloop.py:77:34-38: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[T_Retval]` in function `anyio.abc._eventloop.AsyncBackend.run` [bad-argument-type]
+ ERROR src/anyio/_core/_eventloop.py:77:34-38: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[@_]` in function `anyio.abc._eventloop.AsyncBackend.run` [bad-argument-type]
- ERROR src/anyio/from_thread.py:91:9-13: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[T_Retval]` in function `anyio.abc._eventloop.AsyncBackend.run_async_from_thread` [bad-argument-type]
+ ERROR src/anyio/from_thread.py:91:9-13: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[@_]` in function `anyio.abc._eventloop.AsyncBackend.run_async_from_thread` [bad-argument-type]
- ERROR src/anyio/from_thread.py:119:9-13: Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> T_Retval` in function `anyio.abc._eventloop.AsyncBackend.run_sync_from_thread` [bad-argument-type]
+ ERROR src/anyio/from_thread.py:119:9-13: Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.abc._eventloop.AsyncBackend.run_sync_from_thread` [bad-argument-type]
- ::error file=src/anyio/_core/_eventloop.py,line=77,col=34,endLine=77,endColumn=38,title=Pyrefly bad-argument-type::Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[T_Retval]` in function `anyio.abc._eventloop.AsyncBackend.run`
+ ::error file=src/anyio/_core/_eventloop.py,line=77,col=34,endLine=77,endColumn=38,title=Pyrefly bad-argument-type::Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[@_]` in function `anyio.abc._eventloop.AsyncBackend.run`
- ::error file=src/anyio/from_thread.py,line=91,col=9,endLine=91,endColumn=13,title=Pyrefly bad-argument-type::Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[T_Retval]` in function `anyio.abc._eventloop.AsyncBackend.run_async_from_thread`
+ ::error file=src/anyio/from_thread.py,line=91,col=9,endLine=91,endColumn=13,title=Pyrefly bad-argument-type::Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[@_]` in function `anyio.abc._eventloop.AsyncBackend.run_async_from_thread`
- ::error file=src/anyio/from_thread.py,line=119,col=9,endLine=119,endColumn=13,title=Pyrefly bad-argument-type::Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> T_Retval` in function `anyio.abc._eventloop.AsyncBackend.run_sync_from_thread`
+ ::error file=src/anyio/from_thread.py,line=119,col=9,endLine=119,endColumn=13,title=Pyrefly bad-argument-type::Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.abc._eventloop.AsyncBackend.run_sync_from_thread`
meson (https://github.com/mesonbuild/meson)
- ERROR mesonbuild/interpreter/interpreter.py:3452:50-56: Argument `Executable | Jar | SharedLibrary | SharedModule | StaticLibrary` is not assignable to parameter `dict_object` with type `dict[@_, Dependency]` in function `mesonbuild.utils.universal.extract_as_list` [bad-argument-type]
+ ERROR mesonbuild/interpreter/interpreter.py:3452:50-56: Argument `Executable | Jar | SharedLibrary | SharedModule | StaticLibrary` is not assignable to parameter `dict_object` with type `dict[@_, @_]` in function `mesonbuild.utils.universal.extract_as_list` [bad-argument-type]
- ::error file=mesonbuild/interpreter/interpreter.py,line=3452,col=50,endLine=3452,endColumn=56,title=Pyrefly bad-argument-type::Argument `Executable | Jar | SharedLibrary | SharedModule | StaticLibrary` is not assignable to parameter `dict_object` with type `dict[@_, Dependency]` in function `mesonbuild.utils.universal.extract_as_list`
+ ::error file=mesonbuild/interpreter/interpreter.py,line=3452,col=50,endLine=3452,endColumn=56,title=Pyrefly bad-argument-type::Argument `Executable | Jar | SharedLibrary | SharedModule | StaticLibrary` is not assignable to parameter `dict_object` with type `dict[@_, @_]` in function `mesonbuild.utils.universal.extract_as_list`
trio (https://github.com/python-trio/trio)
- ERROR src/trio/testing/_raises_group.py:610:36-38: Argument `type[_ExceptionInfo]` is not assignable to parameter `cls` with type `type[_ExceptionInfo[BaseExceptionGroup[BaseExcT_co]]]` in function `_ExceptionInfo.for_later` [bad-argument-type]
+ ERROR src/trio/testing/_raises_group.py:610:13-38: `_ExceptionInfo[BaseException]` is not assignable to attribute `excinfo` with type `_ExceptionInfo[BaseExceptionGroup[BaseExcT_co]]` [bad-assignment]
- ::error file=src/trio/testing/_raises_group.py,line=610,col=36,endLine=610,endColumn=38,title=Pyrefly bad-argument-type::Argument `type[_ExceptionInfo]` is not assignable to parameter `cls` with type `type[_ExceptionInfo[BaseExceptionGroup[BaseExcT_co]]]` in function `_ExceptionInfo.for_later`
+ ::error file=src/trio/testing/_raises_group.py,line=610,col=13,endLine=610,endColumn=38,title=Pyrefly bad-assignment::`_ExceptionInfo[BaseException]` is not assignable to attribute `excinfo` with type `_ExceptionInfo[BaseExceptionGroup[BaseExcT_co]]`
schemathesis (https://github.com/schemathesis/schemathesis)
- ERROR src/schemathesis/generation/coverage.py:1644:56-76: Argument `(value: Any) -> str` is not assignable to parameter `pack` with type `(Any) -> bool` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:77:27-39: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:77:27-39: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:78:27-39: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:78:27-39: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:79:63-75: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:79:63-75: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:80:46-58: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:80:46-58: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:81:51-63: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:81:51-63: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:82:51-63: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:82:51-63: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:83:37-46: Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:83:37-46: Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:84:74-83: Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:84:74-83: Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/graphql/scalars.py:85:41-53: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/graphql/scalars.py:85:41-53: Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ::error file=src/schemathesis/generation/coverage.py,line=1644,col=56,endLine=1644,endColumn=76,title=Pyrefly bad-argument-type::Argument `(value: Any) -> str` is not assignable to parameter `pack` with type `(Any) -> bool` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=77,col=27,endLine=77,endColumn=39,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=77,col=27,endLine=77,endColumn=39,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=78,col=27,endLine=78,endColumn=39,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=78,col=27,endLine=78,endColumn=39,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=79,col=63,endLine=79,endColumn=75,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=79,col=63,endLine=79,endColumn=75,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=80,col=46,endLine=80,endColumn=58,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=80,col=46,endLine=80,endColumn=58,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=81,col=51,endLine=81,endColumn=63,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=81,col=51,endLine=81,endColumn=63,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=82,col=51,endLine=82,endColumn=63,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=82,col=51,endLine=82,endColumn=63,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=83,col=37,endLine=83,endColumn=46,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=83,col=37,endLine=83,endColumn=46,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=84,col=74,endLine=84,endColumn=83,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=84,col=74,endLine=84,endColumn=83,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(int) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
- ::error file=src/schemathesis/specs/graphql/scalars.py,line=85,col=41,endLine=85,endColumn=53,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> Any` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
+ ::error file=src/schemathesis/specs/graphql/scalars.py,line=85,col=41,endLine=85,endColumn=53,title=Pyrefly bad-argument-type::Argument `Unknown | None` is not assignable to parameter `pack` with type `(str) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map`
dulwich (https://github.com/dulwich/dulwich)
- ERROR dulwich/porcelain/__init__.py:641:38-50: Argument `(BaseRepo & PathLike[str]) | (BaseRepo & str) | T` is not assignable to parameter `obj` with type `Repo | T` in function `_noop_context_manager` [bad-argument-type]
- ERROR dulwich/porcelain/__init__.py:695:38-50: Argument `(BaseRepo & PathLike[str]) | (BaseRepo & bytes) | (BaseRepo & str) | T` is not assignable to parameter `obj` with type `Repo | T` in function `_noop_context_manager` [bad-argument-type]
+ ERROR dulwich/porcelain/__init__.py:641:16-51: Returned type `_GeneratorContextManager[(BaseRepo & PathLike[str]) | (BaseRepo & str) | T, None, None]` is not assignable to declared return type `AbstractContextManager[Repo | T, bool | None]` [bad-return]
+ ERROR dulwich/porcelain/__init__.py:695:16-51: Returned type `_GeneratorContextManager[(BaseRepo & PathLike[str]) | (BaseRepo & bytes) | (BaseRepo & str) | T, None, None]` is not assignable to declared return type `AbstractContextManager[Repo | T, bool | None]` [bad-return]
- ::error file=dulwich/porcelain/__init__.py,line=641,col=38,endLine=641,endColumn=50,title=Pyrefly bad-argument-type::Argument `(BaseRepo & PathLike[str]) | (BaseRepo & str) | T` is not assignable to parameter `obj` with type `Repo | T` in function `_noop_context_manager`
- ::error file=dulwich/porcelain/__init__.py,line=695,col=38,endLine=695,endColumn=50,title=Pyrefly bad-argument-type::Argument `(BaseRepo & PathLike[str]) | (BaseRepo & bytes) | (BaseRepo & str) | T` is not assignable to parameter `obj` with type `Repo | T` in function `_noop_context_manager`
+ ::error file=dulwich/porcelain/__init__.py,line=641,col=16,endLine=641,endColumn=51,title=Pyrefly bad-return::Returned type `_GeneratorContextManager[(BaseRepo & PathLike[str]) | (BaseRepo & str) | T, None, None]` is not assignable to declared return type `AbstractContextManager[Repo | T, bool | None]`
+ ::error file=dulwich/porcelain/__init__.py,line=695,col=16,endLine=695,endColumn=51,title=Pyrefly bad-return::Returned type `_GeneratorContextManager[(BaseRepo & PathLike[str]) | (BaseRepo & bytes) | (BaseRepo & str) | T, None, None]` is not assignable to declared return type `AbstractContextManager[Repo | T, bool | None]`
hydpy (https://github.com/hydpy-dev/hydpy)
- ERROR hydpy/core/selectiontools.py:709:60-62: Argument `Devices[Any]` is not assignable to parameter `self` with type `Elements` in function `hydpy.core.devicetools.Devices.copy` [bad-argument-type]
+ ERROR hydpy/core/selectiontools.py:709:25-62: `Devices[Any]` is not assignable to attribute `elements` with type `Elements` [bad-assignment]
- ::error file=hydpy/core/selectiontools.py,line=709,col=60,endLine=709,endColumn=62,title=Pyrefly bad-argument-type::Argument `Devices[Any]` is not assignable to parameter `self` with type `Elements` in function `hydpy.core.devicetools.Devices.copy`
+ ::error file=hydpy/core/selectiontools.py,line=709,col=25,endLine=709,endColumn=62,title=Pyrefly bad-assignment::`Devices[Any]` is not assignable to attribute `elements` with type `Elements`
antidote (https://github.com/Finistere/antidote)
- ERROR src/antidote/lib/interface_ext/_interface.py:464:46-58: Argument `Predicate[NeutralWeight] | Predicate[Weight]` is not assignable to parameter `*conditions` with type `NeutralWeight | Predicate[NeutralWeight] | bool | None` in function `antidote.lib.interface_ext._internal.create_conditions` [bad-argument-type]
- ::error file=src/antidote/lib/interface_ext/_interface.py,line=464,col=46,endLine=464,endColumn=58,title=Pyrefly bad-argument-type::Argument `Predicate[NeutralWeight] | Predicate[Weight]` is not assignable to parameter `*conditions` with type `NeutralWeight | Predicate[NeutralWeight] | bool | None` in function `antidote.lib.interface_ext._internal.create_conditions`
zulip (https://github.com/zulip/zulip)
- ERROR zerver/webhooks/intercom/view.py:95:39-66: Argument `(str, object) -> str | None` is not assignable to parameter `validator` with type `(str, object) -> str` in function `zerver.lib.validator.WildValue.tame` [bad-argument-type]
- ERROR zerver/webhooks/intercom/view.py:96:35-62: Argument `(str, object) -> str | None` is not assignable to parameter `validator` with type `(str, object) -> str` in function `zerver.lib.validator.WildValue.tame` [bad-argument-type]
- ERROR zerver/webhooks/intercom/view.py:122:42-69: Argument `(str, object) -> str | None` is not assignable to parameter `validator` with type `(str, object) -> str` in function `zerver.lib.validator.WildValue.tame` [bad-argument-type]
- ERROR zerver/webhooks/trello/view/card_actions.py:113:16-26: Argument `(var_name: str, val: object) -> bool` is not assignable to parameter `validator` with type `(str, object) -> Literal[False]` in function `zerver.lib.validator.WildValue.tame` [bad-argument-type]
- ::error file=zerver/webhooks/intercom/view.py,line=95,col=39,endLine=95,endColumn=66,title=Pyrefly bad-argument-type::Argument `(str, object) -> str | None` is not assignable to parameter `validator` with type `(str, object) -> str` in function `zerver.lib.validator.WildValue.tame`
- ::error file=zerver/webhooks/intercom/view.py,line=96,col=35,endLine=96,endColumn=62,title=Pyrefly bad-argument-type::Argument `(str, object) -> str | None` is not assignable to parameter `validator` with type `(str, object) -> str` in function `zerver.lib.validator.WildValue.tame`
- ::error file=zerver/webhooks/intercom/view.py,line=122,col=42,endLine=122,endColumn=69,title=Pyrefly bad-argument-type::Argument `(str, object) -> str | None` is not assignable to parameter `validator` with type `(str, object) -> str` in function `zerver.lib.validator.WildValue.tame`
- ::error file=zerver/webhooks/trello/view/card_actions.py,line=113,col=16,endLine=113,endColumn=26,title=Pyrefly bad-argument-type::Argument `(var_name: str, val: object) -> bool` is not assignable to parameter `validator` with type `(str, object) -> Literal[False]` in function `zerver.lib.validator.WildValue.tame`
Expression (https://github.com/cognitedata/Expression)
- ERROR expression/core/option.py:449:27-33: Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*_P]) -> _TResult` in function `Option.starmap` [bad-argument-type]
+ ERROR expression/core/option.py:449:27-33: Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*_P]) -> @_` in function `Option.starmap` [bad-argument-type]
- ::error file=expression/core/option.py,line=449,col=27,endLine=449,endColumn=33,title=Pyrefly bad-argument-type::Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*_P]) -> _TResult` in function `Option.starmap`
+ ::error file=expression/core/option.py,line=449,col=27,endLine=449,endColumn=33,title=Pyrefly bad-argument-type::Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*_P]) -> @_` in function `Option.starmap`
xarray (https://github.com/pydata/xarray)
- ERROR xarray/namedarray/core.py:148:41-48: Argument `_arrayapi[Any, _DType_co] | _arrayfunction[Any, _DType_co]` is not assignable to parameter `x` with type `_arrayapi[Any, _DType] | _arrayfunction[Any, _DType]` in function `copy.copy` [bad-argument-type]
+ ERROR xarray/namedarray/core.py:148:31-49: Argument `_arrayapi[Any, _DType_co] | _arrayfunction[Any, _DType_co]` is not assignable to parameter `data` with type `_arrayapi[Any, _DType] | _arrayfunction[Any, _DType]` in function `NamedArray.__init__` [bad-argument-type]
- ::error file=xarray/namedarray/core.py,line=148,col=41,endLine=148,endColumn=48,title=Pyrefly bad-argument-type::Argument `_arrayapi[Any, _DType_co] | _arrayfunction[Any, _DType_co]` is not assignable to parameter `x` with type `_arrayapi[Any, _DType] | _arrayfunction[Any, _DType]` in function `copy.copy`
+ ::error file=xarray/namedarray/core.py,line=148,col=31,endLine=148,endColumn=49,title=Pyrefly bad-argument-type::Argument `_arrayapi[Any, _DType_co] | _arrayfunction[Any, _DType_co]` is not assignable to parameter `data` with type `_arrayapi[Any, _DType] | _arrayfunction[Any, _DType]` in function `NamedArray.__init__`
strawberry (https://github.com/strawberry-graphql/strawberry)
- ERROR strawberry/types/object_type.py:297:13-20: Argument `type[Any]` is not assignable to parameter `cls` with type `T` in function `_process_type` [bad-argument-type]
- ::error file=strawberry/types/object_type.py,line=297,col=13,endLine=297,endColumn=20,title=Pyrefly bad-argument-type::Argument `type[Any]` is not assignable to parameter `cls` with type `T` in function `_process_type`
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- ERROR bson/__init__.py:1178:30-43: Argument `CodecOptions[_DocumentType]` is not assignable to parameter `opts` with type `CodecOptions[dict[str, Any]]` in function `_decode_all` [bad-argument-type]
+ ERROR pymongo/synchronous/pool.py:398:20-421:14: Returned type `Mapping[str, Any]` is not assignable to declared return type `dict[str, Any]` [bad-return]
- ::error file=bson/__init__.py,line=1178,col=30,endLine=1178,endColumn=43,title=Pyrefly bad-argument-type::Argument `CodecOptions[_DocumentType]` is not assignable to parameter `opts` with type `CodecOptions[dict[str, Any]]` in function `_decode_all`
+ ::error file=pymongo/synchronous/pool.py,line=398,col=20,endLine=421,endColumn=14,title=Pyrefly bad-return::Returned type `Mapping[str, Any]` is not assignable to declared return type `dict[str, Any]`
pydantic (https://github.com/pydantic/pydantic)
- ERROR pydantic/_internal/_mock_val_ser.py:141:44-67: Argument `(ta: TypeAdapter[Unknown]) -> PluggableSchemaValidator | SchemaValidator` is not assignable to parameter `attr_fn` with type `(TypeAdapter[Unknown]) -> PluggableSchemaValidator | None` in function `attempt_rebuild_fn` [bad-argument-type]
+ ERROR pydantic/_internal/_mock_val_ser.py:141:25-68: Argument `() -> PluggableSchemaValidator | SchemaValidator | None` is not assignable to parameter `attempt_rebuild` with type `(() -> PluggableSchemaValidator | None) | None` in function `MockValSer.__init__` [bad-argument-type]
- ERROR pydantic/_internal/_mock_val_ser.py:180:44-78: Argument `(c: type[BaseModel]) -> PluggableSchemaValidator | SchemaValidator` is not assignable to parameter `attr_fn` with type `(type[BaseModel]) -> PluggableSchemaValidator | None` in function `attempt_rebuild_fn` [bad-argument-type]
+ ERROR pydantic/_internal/_mock_val_ser.py:180:25-79: Argument `() -> PluggableSchemaValidator | SchemaValidator | None` is not assignable to parameter `attempt_rebuild` with type `(() -> PluggableSchemaValidator | None) | None` in function `MockValSer.__init__` [bad-argument-type]
- ERROR pydantic/_internal/_mock_val_ser.py:221:44-78: Argument `(c: type[PydanticDataclass]) -> PluggableSchemaValidator | SchemaValidator` is not assignable to parameter `attr_fn` with type `(type[PydanticDataclass]) -> PluggableSchemaValidator | None` in function `attempt_rebuild_fn` [bad-argument-type]
+ ERROR pydantic/_internal/_mock_val_ser.py:221:25-79: Argument `() -> PluggableSchemaValidator | SchemaValidator | None` is not assignable to parameter `attempt_rebuild` with type `(() -> PluggableSchemaValidator | None) | None` in function `MockValSer.__init__` [bad-argument-type]
- ::error file=pydantic/_internal/_mock_val_ser.py,line=141,col=44,endLine=141,endColumn=67,title=Pyrefly bad-argument-type::Argument `(ta: TypeAdapter[Unknown]) -> PluggableSchemaValidator | SchemaValidator` is not assignable to parameter `attr_fn` with type `(TypeAdapter[Unknown]) -> PluggableSchemaValidator | None` in function `attempt_rebuild_fn`
+ ::error file=pydantic/_internal/_mock_val_ser.py,line=141,col=25,endLine=141,endColumn=68,title=Pyrefly bad-argument-type::Argument `() -> PluggableSchemaValidator | SchemaValidator | None` is not assignable to parameter `attempt_rebuild` with type `(() -> PluggableSchemaValidator | None) | None` in function `MockValSer.__init__`
- ::error file=pydantic/_internal/_mock_val_ser.py,line=180,col=44,endLine=180,endColumn=78,title=Pyrefly bad-argument-type::Argument `(c: type[BaseModel]) -> PluggableSchemaValidator | SchemaValidator` is not assignable to parameter `attr_fn` with type `(type[BaseModel]) -> PluggableSchemaValidator | None` in function `attempt_rebuild_fn`
+ ::error file=pydantic/_internal/_mock_val_ser.py,line=180,col=25,endLine=180,endColumn=79,title=Pyrefly bad-argument-type::Argument `() -> PluggableSchemaValidator | SchemaValidator | None` is not assignable to parameter `attempt_rebuild` with type `(() -> PluggableSchemaValidator | None) | None` in function `MockValSer.__init__`
- ::error file=pydantic/_internal/_mock_val_ser.py,line=221,col=44,endLine=221,endColumn=78,title=Pyrefly bad-argument-type::Argument `(c: type[PydanticDataclass]) -> PluggableSchemaValidator | SchemaValidator` is not assignable to parameter `attr_fn` with type `(type[PydanticDataclass]) -> PluggableSchemaValidator | None` in function `attempt_rebuild_fn`
+ ::error file=pydantic/_internal/_mock_val_ser.py,line=221,col=25,endLine=221,endColumn=79,title=Pyrefly bad-argument-type::Argument `() -> PluggableSchemaValidator | SchemaValidator | None` is not assignable to parameter `attempt_rebuild` with type `(() -> PluggableSchemaValidator | None) | None` in function `MockValSer.__init__`
werkzeug (https://github.com/pallets/werkzeug)
+ ERROR src/werkzeug/local.py:526:24-41: Returned type `LocalProxy[Any] | T | Unknown` is not assignable to declared return type `T` [bad-return]
- ERROR src/werkzeug/local.py:526:33-40: Argument `LocalProxy[Any] | T | Unknown` is not assignable to parameter `o` with type `T` in function `_identity` [bad-argument-type]
+ ::error file=src/werkzeug/local.py,line=526,col=24,endLine=526,endColumn=41,title=Pyrefly bad-return::Returned type `LocalProxy[Any] | T | Unknown` is not assignable to declared return type `T`
- ::error file=src/werkzeug/local.py,line=526,col=33,endLine=526,endColumn=40,title=Pyrefly bad-argument-type::Argument `LocalProxy[Any] | T | Unknown` is not assignable to parameter `o` with type `T` in function `_identity`
PyGithub (https://github.com/PyGithub/PyGithub)
- ERROR github/Branch.py:219:45-53: Argument `_NotSetType | list[str]` is not assignable to parameter `v` with type `_NotSetType | bool` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/Branch.py:219:69-75: Argument `_NotSetType | list[str | tuple[str, int]]` is not assignable to parameter `v` with type `_NotSetType | bool` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/Branch.py:248:27-48: Argument `_NotSetType | bool` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/Branch.py:249:27-53: Argument `_NotSetType | bool` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/Branch.py:250:27-58: Argument `_NotSetType | int` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/Branch.py:254:27-53: Argument `_NotSetType | bool` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/Enterprise.py:130:51-61: Argument `Attribute[str]` is not assignable to parameter `v` with type `_NotSetType` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/GitCommit.py:144:51-59: Argument `Attribute[str]` is not assignable to parameter `v` with type `_NotSetType` in function `github.GithubObject.is_defined` [bad-argument-type]
- ERROR github/GitCommit.py:157:52-65: Argument `Attribute[str]` is not assignable to parameter `v` with type `_NotSetType` in function `github.GithubObject.is_defined` [bad-argument-type]
- ::error file=github/Branch.py,line=219,col=45,endLine=219,endColumn=53,title=Pyrefly bad-argument-type::Argument `_NotSetType | list[str]` is not assignable to parameter `v` with type `_NotSetType | bool` in function `github.GithubObject.is_defined`
- ::error file=github/Branch.py,line=219,col=69,endLine=219,endColumn=75,title=Pyrefly bad-argument-type::Argument `_NotSetType | list[str | tuple[str, int]]` is not assignable to parameter `v` with type `_NotSetType | bool` in function `github.GithubObject.is_defined`
- ::error file=github/Branch.py,line=248,col=27,endLine=248,endColumn=48,title=Pyrefly bad-argument-type::Argument `_NotSetType | bool` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined`
- ::error file=github/Branch.py,line=249,col=27,endLine=249,endColumn=53,title=Pyrefly bad-argument-type::Argument `_NotSetType | bool` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined`
- ::error file=github/Branch.py,line=250,col=27,endLine=250,endColumn=58,title=Pyrefly bad-argument-type::Argument `_NotSetType | int` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined`
- ::error file=github/Branch.py,line=254,col=27,endLine=254,endColumn=53,title=Pyrefly bad-argument-type::Argument `_NotSetType | bool` is not assignable to parameter `v` with type `_NotSetType | list[str]` in function `github.GithubObject.is_defined`
- ::error file=github/Enterprise.py,line=130,col=51,endLine=130,endColumn=61,title=Pyrefly bad-argument-type::Argument `Attribute[str]` is not assignable to parameter `v` with type `_NotSetType` in function `github.GithubObject.is_defined`
- ::error file=github/GitCommit.py,line=144,col=51,endLine=144,endColumn=59,title=Pyrefly bad-argument-type::Argument `Attribute[str]` is not assignable to parameter `v` with type `_NotSetType` in function `github.GithubObject.is_defined`
- ::error file=github/GitCommit.py,line=157,col=52,endLine=157,endColumn=65,title=Pyrefly bad-argument-type::Argument `Attribute[str]` is not assignable to parameter `v` with type `_NotSetType` in function `github.GithubObject.is_defined`
mypy (https://github.com/python/mypy)
- ERROR mypy/applytype.py:195:41-67: Argument `PolyTranslator` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
+ ERROR mypy/applytype.py:195:22-68: Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ERROR mypy/checkexpr.py:2319:51-76: Argument `ArgInferSecondPassQuery` is not assignable to parameter `visitor` with type `TypeVisitor[Literal[False]]` in function `mypy.types.Type.accept` [bad-argument-type]
- ERROR mypy/expandtype.py:242:66-70: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
+ ERROR mypy/expandtype.py:242:45-71: Argument `Type` is not assignable to parameter `upper_bound` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.TypeVarType.copy_modified` [bad-argument-type]
+ ERROR mypy/expandtype.py:459:30-53: Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
+ ERROR mypy/expandtype.py:460:33-96: Argument `Type | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ERROR mypy/expandtype.py:459:48-52: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
- ERROR mypy/expandtype.py:460:33-96: Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ERROR mypy/expandtype.py:460:53-57: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
- ERROR mypy/expandtype.py:461:30-87: Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
+ ERROR mypy/expandtype.py:461:30-87: Argument `Type | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ERROR mypy/expandtype.py:461:47-51: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
- ERROR mypy/expandtype.py:484:48-52: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
+ ERROR mypy/expandtype.py:484:30-53: Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
+ ERROR mypy/expandtype.py:498:22-45: Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
+ ERROR mypy/expandtype.py:499:25-88: Argument `Type | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ERROR mypy/expandtype.py:498:40-44: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
- ERROR mypy/expandtype.py:499:25-88: Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ERROR mypy/expandtype.py:499:45-49: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
- ERROR mypy/expandtype.py:500:22-79: Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
+ ERROR mypy/expandtype.py:500:22-79: Argument `Type | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ERROR mypy/expandtype.py:500:39-43: Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
- ERROR mypy/strconv.py:441:45-49: Argument `Self@StrConv` is not assignable to parameter `visitor` with type `ExpressionVisitor[object]` in function `mypy.nodes.Expression.accept` [bad-argument-type]
- ERROR mypy/type_visitor.py:259:40-44: Argument `Self@TypeTranslator` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept` [bad-argument-type]
+ ERROR mypy/type_visitor.py:259:22-45: Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified` [bad-argument-type]
- ::error file=mypy/applytype.py,line=195,col=41,endLine=195,endColumn=67,title=Pyrefly bad-argument-type::Argument `PolyTranslator` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept`
+ ::error file=mypy/applytype.py,line=195,col=22,endLine=195,endColumn=68,title=Pyrefly bad-argument-type::Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/checkexpr.py,line=2319,col=51,endLine=2319,endColumn=76,title=Pyrefly bad-argument-type::Argument `ArgInferSecondPassQuery` is not assignable to parameter `visitor` with type `TypeVisitor[Literal[False]]` in function `mypy.types.Type.accept`
- ::error file=mypy/expandtype.py,line=242,col=66,endLine=242,endColumn=70,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept`
+ ::error file=mypy/expandtype.py,line=242,col=45,endLine=242,endColumn=71,title=Pyrefly bad-argument-type::Argument `Type` is not assignable to parameter `upper_bound` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.TypeVarType.copy_modified`
- ::error file=mypy/expandtype.py,line=459,col=48,endLine=459,endColumn=52,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept`
+ ::error file=mypy/expandtype.py,line=459,col=30,endLine=459,endColumn=53,title=Pyrefly bad-argument-type::Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/expandtype.py,line=460,col=33,endLine=460,endColumn=96,title=Pyrefly bad-argument-type::Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
+ ::error file=mypy/expandtype.py,line=460,col=33,endLine=460,endColumn=96,title=Pyrefly bad-argument-type::Argument `Type | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/expandtype.py,line=460,col=53,endLine=460,endColumn=57,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept`
- ::error file=mypy/expandtype.py,line=461,col=30,endLine=461,endColumn=87,title=Pyrefly bad-argument-type::Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
+ ::error file=mypy/expandtype.py,line=461,col=30,endLine=461,endColumn=87,title=Pyrefly bad-argument-type::Argument `Type | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/expandtype.py,line=461,col=47,endLine=461,endColumn=51,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept`
- ::error file=mypy/expandtype.py,line=484,col=48,endLine=484,endColumn=52,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept`
+ ::error file=mypy/expandtype.py,line=484,col=30,endLine=484,endColumn=53,title=Pyrefly bad-argument-type::Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/expandtype.py,line=498,col=40,endLine=498,endColumn=44,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept`
+ ::error file=mypy/expandtype.py,line=498,col=22,endLine=498,endColumn=45,title=Pyrefly bad-argument-type::Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/expandtype.py,line=499,col=25,endLine=499,endColumn=88,title=Pyrefly bad-argument-type::Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
+ ::error file=mypy/expandtype.py,line=499,col=25,endLine=499,endColumn=88,title=Pyrefly bad-argument-type::Argument `Type | None` is not assignable to parameter `type_guard` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/expandtype.py,line=499,col=45,endLine=499,endColumn=49,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept`
- ::error file=mypy/expandtype.py,line=500,col=22,endLine=500,endColumn=79,title=Pyrefly bad-argument-type::Argument `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any] | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
+ ::error file=mypy/expandtype.py,line=500,col=22,endLine=500,endColumn=79,title=Pyrefly bad-argument-type::Argument `Type | None` is not assignable to parameter `type_is` with type `FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]` in function `mypy.types.CallableType.copy_modified`
- ::error file=mypy/expandtype.py,line=500,col=39,endLine=500,endColumn=43,title=Pyrefly bad-argument-type::Argument `Self@ExpandTypeVisitor` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type | None, Type | None] | FlexibleAlias[Type | None, Any]]` in function `mypy.types.Type.accept`
- ::error file=mypy/strconv.py,line=441,col=45,endLine=441,endColumn=49,title=Pyrefly bad-argument-type::Argument `Self@StrConv` is not assignable to parameter `visitor` with type `ExpressionVisitor[object]` in function `mypy.nodes.Expression.accept`
- ::error file=mypy/type_visitor.py,line=259,col=40,endLine=259,endColumn=44,title=Pyrefly bad-argument-type::Argument `Self@TypeTranslator` is not assignable to parameter `visitor` with type `TypeVisitor[FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]]` in function `mypy.types.Type.accept`
+ ::error file=mypy/type_visitor.py,line=259,col=22,endLine=259,endColumn=45,title=Pyrefly bad-argument-type::Argument `Type` is not assignable to parameter `ret_type` with type `FlexibleAlias[Type, Type] | FlexibleAlias[Type, Any]` in function `mypy.types.CallableType.copy_modified`
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/_internal/concurrency/services.py:333:60-74: Argument `BoundMethod[_QueueServiceBase[Unknown], (self: _QueueServiceBase[Unknown]) -> None]` is not assignable to parameter with type `() -> Awaitable[Awaitable[Unknown] | Unknown] | Awaitable[Unknown] | Unknown` in function `prefect._internal.concurrency.api.create_call` [bad-argument-type]
+ ERROR src/prefect/_internal/concurrency/services.py:333:48-75: Argument `Call[None]` is not assignable to parameter `__call` with type `(() -> Awaitable[Awaitable[Unknown] | Unknown] | Awaitable[Unknown] | Unknown) | Call[Awaitable[Unknown] | Unknown]` in function `prefect._internal.concurrency.api._base.call_soon_in_loop_thread` [bad-argument-type]
... (truncated 90 lines) ...``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Added selective hint fallback for generic function calls
Added
has_error_kind()method toErrorCollectorfor checking specific error typesPreserves type variable bound violations while fixing hint-induced argument errors
Problem
When calling generic functions with an outer type hint from an assignment context, the hint was incorrectly constraining type variable resolution:
The type checker was using the
strhint to solveT, then erroring thatNonedoesn't matchstr, instead of correctly reporting thatAny | Noneis not assignable tostr.Solution
When a generic function call with a hint produces errors:
BadSpecialization(type variable bound violations)This ensures:
Test plan
test_call_hint_does_not_override_argfor the reported issuetest_nested_call_preserves_boundstill passes