Fix: Constrained TypeVar resolves to constraint instead of subtype (#2370)#2383
Open
jackulau wants to merge 12 commits intofacebook:mainfrom
Open
Fix: Constrained TypeVar resolves to constraint instead of subtype (#2370)#2383jackulau wants to merge 12 commits intofacebook:mainfrom
jackulau wants to merge 12 commits intofacebook:mainfrom
Conversation
|
Diff from mypy_primer, showing the effect of this PR on open source code: scrapy (https://github.com/scrapy/scrapy)
- ERROR tests/test_proxy_connect.py:96:37-82: Cannot set item in `_Environ[str]` [unsupported-operation]
- ::error file=tests/test_proxy_connect.py,line=96,col=37,endLine=96,endColumn=82,title=Pyrefly unsupported-operation::Cannot set item in `_Environ[str]`%0A Argument `Literal[b'']` is not assignable to parameter `value` with type `str` in function `os._Environ.__setitem__`
kopf (https://github.com/nolar/kopf)
- ERROR kopf/_cogs/structs/references.py:87:51-59: Argument `str` is not assignable to parameter `pat` with type `NamespaceName` in function `fnmatch.fnmatch` [bad-argument-type]
- ERROR kopf/_cogs/structs/references.py:90:61-77: Argument `str` is not assignable to parameter `pat` with type `NamespaceName` in function `fnmatch.fnmatch` [bad-argument-type]
- ERROR kopf/_cogs/structs/references.py:92:73-77: Argument `str` is not assignable to parameter `pat` with type `NamespaceName` in function `fnmatch.fnmatch` [bad-argument-type]
- ::error file=kopf/_cogs/structs/references.py,line=87,col=51,endLine=87,endColumn=59,title=Pyrefly bad-argument-type::Argument `str` is not assignable to parameter `pat` with type `NamespaceName` in function `fnmatch.fnmatch`
- ::error file=kopf/_cogs/structs/references.py,line=90,col=61,endLine=90,endColumn=77,title=Pyrefly bad-argument-type::Argument `str` is not assignable to parameter `pat` with type `NamespaceName` in function `fnmatch.fnmatch`
- ::error file=kopf/_cogs/structs/references.py,line=92,col=73,endLine=92,endColumn=77,title=Pyrefly bad-argument-type::Argument `str` is not assignable to parameter `pat` with type `NamespaceName` in function `fnmatch.fnmatch`
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/cli/deploy/_core.py:91:33-81: No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[str, Any], _Environ[str], remove_notset=Literal[False]) [no-matching-overload]
+ ERROR src/prefect/cli/deploy/_core.py:91:33-81: No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[Any, Any], _Environ[str], remove_notset=Literal[False]) [no-matching-overload]
- ERROR src/prefect/cli/deploy/_core.py:370:34-44: Argument `list[dict[str, Any]] | list[Unknown] | type[NotSet] | Unknown` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]]` in function `prefect.cli.deploy._storage._PullStepStorage.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/deploy/_core.py:370:34-44: Argument `list[Any] | type[NotSet]` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]]` in function `prefect.cli.deploy._storage._PullStepStorage.__init__` [bad-argument-type]
- ERROR src/prefect/cli/deploy/_core.py:430:28-46: Argument `list[dict[str, Any]] | list[Unknown] | type[NotSet] | Unknown | None` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]] | None` in function `prefect.deployments.base._save_deployment_to_prefect_file` [bad-argument-type]
+ ERROR src/prefect/cli/deploy/_core.py:430:28-46: Argument `list[Any] | type[NotSet] | None` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]] | None` in function `prefect.deployments.base._save_deployment_to_prefect_file` [bad-argument-type]
- ERROR src/prefect/deployments/steps/core.py:138:26-46: No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[str, Any] | dict[Unknown, Unknown], _Environ[str]) [no-matching-overload]
+ ERROR src/prefect/deployments/steps/core.py:138:26-46: No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[Any, Any], _Environ[str]) [no-matching-overload]
- ::error file=src/prefect/cli/deploy/_core.py,line=91,col=33,endLine=91,endColumn=81,title=Pyrefly no-matching-overload::No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[str, Any], _Environ[str], remove_notset=Literal[False])%0A Possible overloads:%0A (template: T, values: dict[str, Any], remove_notset: Literal[True] = True, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T%0A (template: T, values: dict[str, Any], remove_notset: Literal[False] = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet] [closest match]%0A (template: T, values: dict[str, Any], remove_notset: bool = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet]
+ ::error file=src/prefect/cli/deploy/_core.py,line=91,col=33,endLine=91,endColumn=81,title=Pyrefly no-matching-overload::No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[Any, Any], _Environ[str], remove_notset=Literal[False])%0A Possible overloads:%0A (template: T, values: dict[str, Any], remove_notset: Literal[True] = True, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T%0A (template: T, values: dict[str, Any], remove_notset: Literal[False] = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet] [closest match]%0A (template: T, values: dict[str, Any], remove_notset: bool = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet]
- ::error file=src/prefect/cli/deploy/_core.py,line=370,col=34,endLine=370,endColumn=44,title=Pyrefly bad-argument-type::Argument `list[dict[str, Any]] | list[Unknown] | type[NotSet] | Unknown` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]]` in function `prefect.cli.deploy._storage._PullStepStorage.__init__`
+ ::error file=src/prefect/cli/deploy/_core.py,line=370,col=34,endLine=370,endColumn=44,title=Pyrefly bad-argument-type::Argument `list[Any] | type[NotSet]` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]]` in function `prefect.cli.deploy._storage._PullStepStorage.__init__`
- ::error file=src/prefect/cli/deploy/_core.py,line=430,col=28,endLine=430,endColumn=46,title=Pyrefly bad-argument-type::Argument `list[dict[str, Any]] | list[Unknown] | type[NotSet] | Unknown | None` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]] | None` in function `prefect.deployments.base._save_deployment_to_prefect_file`
+ ::error file=src/prefect/cli/deploy/_core.py,line=430,col=28,endLine=430,endColumn=46,title=Pyrefly bad-argument-type::Argument `list[Any] | type[NotSet] | None` is not assignable to parameter `pull_steps` with type `list[dict[str, Any]] | None` in function `prefect.deployments.base._save_deployment_to_prefect_file`
- ::error file=src/prefect/deployments/steps/core.py,line=138,col=26,endLine=138,endColumn=46,title=Pyrefly no-matching-overload::No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[str, Any] | dict[Unknown, Unknown], _Environ[str])%0A Possible overloads:%0A (template: T, values: dict[str, Any], remove_notset: Literal[True] = True, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T [closest match]%0A (template: T, values: dict[str, Any], remove_notset: Literal[False] = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet]%0A (template: T, values: dict[str, Any], remove_notset: bool = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet]
+ ::error file=src/prefect/deployments/steps/core.py,line=138,col=26,endLine=138,endColumn=46,title=Pyrefly no-matching-overload::No matching overload found for function `prefect.utilities.templating.apply_values` called with arguments: (dict[Any, Any], _Environ[str])%0A Possible overloads:%0A (template: T, values: dict[str, Any], remove_notset: Literal[True] = True, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T [closest match]%0A (template: T, values: dict[str, Any], remove_notset: Literal[False] = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet]%0A (template: T, values: dict[str, Any], remove_notset: bool = False, warn_on_notset: bool = False, skip_prefixes: list[str] | None = None) -> T | type[NotSet]
pwndbg (https://github.com/pwndbg/pwndbg)
+ ERROR pwndbg/commands/got_tracking.py:159:24-33: No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown | None) [no-matching-overload]
+ ::error file=pwndbg/commands/got_tracking.py,line=159,col=24,endLine=159,endColumn=33,title=Pyrefly no-matching-overload::No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown | None)%0A Possible overloads:%0A (string: str, pos: int = 0, endpos: int = ...) -> Match[str] | None [closest match]%0A (string: Buffer, pos: int = 0, endpos: int = ...) -> Match[bytes] | None%0A (string: str, pos: int = 0, endpos: int = ...) -> Match[str] | None [closest match]
materialize (https://github.com/MaterializeInc/materialize)
+ ERROR misc/python/materialize/feature_benchmark/report.py:39:25-41: `float` is not assignable to attribute `mean` with type `T | None` [bad-assignment]
+ ::error file=misc/python/materialize/feature_benchmark/report.py,line=39,col=25,endLine=39,endColumn=41,title=Pyrefly bad-assignment::`float` is not assignable to attribute `mean` with type `T | None`
tornado (https://github.com/tornadoweb/tornado)
- ERROR tornado/options.py:657:50-64: No matching overload found for function `re.Pattern.match` called with arguments: (str, @_) [no-matching-overload]
- ::error file=tornado/options.py,line=657,col=50,endLine=657,endColumn=64,title=Pyrefly no-matching-overload::No matching overload found for function `re.Pattern.match` called with arguments: (str, @_)%0A Possible overloads:%0A (string: str, pos: int = 0, endpos: int = ...) -> Match[str] | None [closest match]%0A (string: Buffer, pos: int = 0, endpos: int = ...) -> Match[bytes] | None%0A (string: LiteralString, pos: int = 0, endpos: int = ...) -> Match[LiteralString] | None
streamlit (https://github.com/streamlit/streamlit)
+ ERROR lib/tests/streamlit/typing/slider_types.py:207:16-60: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:208:16-79: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:209:16-211:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:212:16-221:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:223:16-231:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:232:16-241:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:243:16-245:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:246:16-87: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:247:16-252:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:253:16-262:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:263:16-268:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:269:16-87: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:270:16-273:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:274:16-282:6: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:284:16-291:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:292:16-301:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:302:16-310:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:333:16-336:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:337:16-340:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:341:16-344:6: assert_type(tuple[date, date], tuple[datetime, datetime]) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:365:16-87: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:368:16-86: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:369:16-85: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:370:16-85: assert_type(date, datetime) failed [assert-type]
+ ERROR lib/tests/streamlit/typing/slider_types.py:371:16-84: assert_type(date, datetime) failed [assert-type]
- ERROR lib/tests/streamlit/web/server/server_test.py:203:17-51: Argument `Literal[b'']` is not assignable to parameter `url` with type `HTTPRequest | str` in function `tornado.websocket.websocket_connect` [bad-argument-type]
- ERROR lib/tests/streamlit/web/server/server_test.py:219:17-51: Argument `Literal[b'']` is not assignable to parameter `url` with type `HTTPRequest | str` in function `tornado.websocket.websocket_connect` [bad-argument-type]
- ERROR lib/tests/streamlit/web/server/server_test_case.py:89:13-47: Argument `Literal[b'']` is not assignable to parameter `url` with type `HTTPRequest | str` in function `tornado.websocket.websocket_connect` [bad-argument-type]
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=207,col=16,endLine=207,endColumn=60,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=208,col=16,endLine=208,endColumn=79,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=209,col=16,endLine=211,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=212,col=16,endLine=221,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=223,col=16,endLine=231,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=232,col=16,endLine=241,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=243,col=16,endLine=245,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=246,col=16,endLine=246,endColumn=87,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=247,col=16,endLine=252,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=253,col=16,endLine=262,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=263,col=16,endLine=268,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=269,col=16,endLine=269,endColumn=87,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=270,col=16,endLine=273,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=274,col=16,endLine=282,endColumn=6,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=284,col=16,endLine=291,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=292,col=16,endLine=301,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=302,col=16,endLine=310,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=333,col=16,endLine=336,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=337,col=16,endLine=340,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=341,col=16,endLine=344,endColumn=6,title=Pyrefly assert-type::assert_type(tuple[date, date], tuple[datetime, datetime]) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=365,col=16,endLine=365,endColumn=87,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=368,col=16,endLine=368,endColumn=86,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=369,col=16,endLine=369,endColumn=85,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=370,col=16,endLine=370,endColumn=85,title=Pyrefly assert-type::assert_type(date, datetime) failed
+ ::error file=lib/tests/streamlit/typing/slider_types.py,line=371,col=16,endLine=371,endColumn=84,title=Pyrefly assert-type::assert_type(date, datetime) failed
- ::error file=lib/tests/streamlit/web/server/server_test.py,line=203,col=17,endLine=203,endColumn=51,title=Pyrefly bad-argument-type::Argument `Literal[b'']` is not assignable to parameter `url` with type `HTTPRequest | str` in function `tornado.websocket.websocket_connect`
- ::error file=lib/tests/streamlit/web/server/server_test.py,line=219,col=17,endLine=219,endColumn=51,title=Pyrefly bad-argument-type::Argument `Literal[b'']` is not assignable to parameter `url` with type `HTTPRequest | str` in function `tornado.websocket.websocket_connect`
- ::error file=lib/tests/streamlit/web/server/server_test_case.py,line=89,col=13,endLine=89,endColumn=47,title=Pyrefly bad-argument-type::Argument `Literal[b'']` is not assignable to parameter `url` with type `HTTPRequest | str` in function `tornado.websocket.websocket_connect`
xarray (https://github.com/pydata/xarray)
- ERROR xarray/core/indexing.py:1516:28-71: Argument `ndarray[tuple[int | Any, ...], dtype[Any]]` is not assignable to parameter `object` with type `ndarray[tuple[int], dtype[Any]]` in function `list.append` [bad-argument-type]
+ ERROR xarray/core/indexing.py:1516:28-71: Argument `ndarray[tuple[int, ...], dtype[Any]]` is not assignable to parameter `object` with type `ndarray[tuple[int], dtype[Any]]` in function `list.append` [bad-argument-type]
- ::error file=xarray/core/indexing.py,line=1516,col=28,endLine=1516,endColumn=71,title=Pyrefly bad-argument-type::Argument `ndarray[tuple[int | Any, ...], dtype[Any]]` is not assignable to parameter `object` with type `ndarray[tuple[int], dtype[Any]]` in function `list.append`
+ ::error file=xarray/core/indexing.py,line=1516,col=28,endLine=1516,endColumn=71,title=Pyrefly bad-argument-type::Argument `ndarray[tuple[int, ...], dtype[Any]]` is not assignable to parameter `object` with type `ndarray[tuple[int], dtype[Any]]` in function `list.append`
hydpy (https://github.com/hydpy-dev/hydpy)
- ERROR hydpy/core/devicetools.py:2575:36-46: Argument `Literal['-', '--', '-.', ':', 'dashdot', 'dashed', 'dotted', 'solid'] | tuple[LineStyle, LineStyle] | None` is not assignable to parameter `x` with type `Literal['-'] | tuple[Literal['-'] | None, Literal['-'] | None] | None` in function `_make_tuple` [bad-argument-type]
- ERROR hydpy/core/devicetools.py:2758:36-46: Argument `Literal['-', '--', '-.', ':', 'dashdot', 'dashed', 'dotted', 'solid'] | tuple[LineStyle, LineStyle] | None` is not assignable to parameter `x` with type `Literal['-'] | tuple[Literal['-'] | None, Literal['-'] | None] | None` in function `_make_tuple` [bad-argument-type]
- ERROR hydpy/core/parametertools.py:3418:55-64: Cannot index into `bool` [bad-index]
- ERROR hydpy/core/parametertools.py:3418:55-64: Cannot index into `int` [bad-index]
- ERROR hydpy/core/parametertools.py:3423:38-63: No matching overload found for function `zip.__new__` called with arguments: (type[zip[_T_co]], tuple[str, ...], bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]) [no-matching-overload]
+ ERROR hydpy/core/parametertools.py:3423:38-63: No matching overload found for function `zip.__new__` called with arguments: (type[zip[_T_co]], tuple[str, ...], float | ndarray[tuple[Any, ...], dtype[float64]]) [no-matching-overload]
- ERROR hydpy/core/parametertools.py:3901:45-59: Cannot index into `bool` [bad-index]
- ERROR hydpy/core/parametertools.py:3901:45-59: Cannot index into `int` [bad-index]
- ::error file=hydpy/core/devicetools.py,line=2575,col=36,endLine=2575,endColumn=46,title=Pyrefly bad-argument-type::Argument `Literal['-', '--', '-.', ':', 'dashdot', 'dashed', 'dotted', 'solid'] | tuple[LineStyle, LineStyle] | None` is not assignable to parameter `x` with type `Literal['-'] | tuple[Literal['-'] | None, Literal['-'] | None] | None` in function `_make_tuple`
- ::error file=hydpy/core/devicetools.py,line=2758,col=36,endLine=2758,endColumn=46,title=Pyrefly bad-argument-type::Argument `Literal['-', '--', '-.', ':', 'dashdot', 'dashed', 'dotted', 'solid'] | tuple[LineStyle, LineStyle] | None` is not assignable to parameter `x` with type `Literal['-'] | tuple[Literal['-'] | None, Literal['-'] | None] | None` in function `_make_tuple`
- ::error file=hydpy/core/parametertools.py,line=3418,col=55,endLine=3418,endColumn=64,title=Pyrefly bad-index::Cannot index into `bool`%0A Object of class `bool` has no attribute `__getitem__`
- ::error file=hydpy/core/parametertools.py,line=3418,col=55,endLine=3418,endColumn=64,title=Pyrefly bad-index::Cannot index into `int`%0A Object of class `int` has no attribute `__getitem__`
- ::error file=hydpy/core/parametertools.py,line=3423,col=38,endLine=3423,endColumn=63,title=Pyrefly no-matching-overload::No matching overload found for function `zip.__new__` called with arguments: (type[zip[_T_co]], tuple[str, ...], bool | float | int | ndarray[tuple[Any, ...], dtype[Any]])%0A Possible overloads:%0A (cls: type[zip[_T_co]], *, strict: bool = False) -> zip[Any]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], /, *, strict: bool = False) -> zip[tuple[_T1]]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], /, *, strict: bool = False) -> zip[tuple[_T1, _T2]] [closest match]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /, *, strict: bool = False) -> zip[tuple[_T1, _T2, _T3]]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], /, *, strict: bool = False) -> zip[tuple[_T1, _T2, _T3, _T4]]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5], /, *, strict: bool = False) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]%0A (cls: type[zip[_T_co]], iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any], iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any], /, *iterables: Iterable[Any], *, strict: bool = False) -> zip[tuple[Any, ...]]
+ ::error file=hydpy/core/parametertools.py,line=3423,col=38,endLine=3423,endColumn=63,title=Pyrefly no-matching-overload::No matching overload found for function `zip.__new__` called with arguments: (type[zip[_T_co]], tuple[str, ...], float | ndarray[tuple[Any, ...], dtype[float64]])%0A Possible overloads:%0A (cls: type[zip[_T_co]], *, strict: bool = False) -> zip[Any]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], /, *, strict: bool = False) -> zip[tuple[_T1]]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], /, *, strict: bool = False) -> zip[tuple[_T1, _T2]] [closest match]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /, *, strict: bool = False) -> zip[tuple[_T1, _T2, _T3]]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], /, *, strict: bool = False) -> zip[tuple[_T1, _T2, _T3, _T4]]%0A (cls: type[zip[_T_co]], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5], /, *, strict: bool = False) -> zip[tuple[_T1, _T2, _T3, _T4, _T5]]%0A (cls: type[zip[_T_co]], iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any], iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any], /, *iterables: Iterable[Any], *, strict: bool = False) -> zip[tuple[Any, ...]]
- ::error file=hydpy/core/parametertools.py,line=3901,col=45,endLine=3901,endColumn=59,title=Pyrefly bad-index::Cannot index into `bool`%0A Object of class `bool` has no attribute `__getitem__`
- ::error file=hydpy/core/parametertools.py,line=3901,col=45,endLine=3901,endColumn=59,title=Pyrefly bad-index::Cannot index into `int`%0A Object of class `int` has no attribute `__getitem__`
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ERROR ddtrace/internal/runtime/container.py:108:43-56: No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown) [no-matching-overload]
- ERROR ddtrace/internal/runtime/container.py:115:37-50: No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown) [no-matching-overload]
- ERROR ddtrace/vendor/dogstatsd/container.py:49:56-69: No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown) [no-matching-overload]
- ::error file=ddtrace/internal/runtime/container.py,line=108,col=43,endLine=108,endColumn=56,title=Pyrefly no-matching-overload::No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown)%0A Possible overloads:%0A (string: str, pos: int = 0, endpos: int = ...) -> Match[str] | None [closest match]%0A (string: Buffer, pos: int = 0, endpos: int = ...) -> Match[bytes] | None%0A (string: LiteralString, pos: int = 0, endpos: int = ...) -> Match[LiteralString] | None
- ::error file=ddtrace/internal/runtime/container.py,line=115,col=37,endLine=115,endColumn=50,title=Pyrefly no-matching-overload::No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown)%0A Possible overloads:%0A (string: str, pos: int = 0, endpos: int = ...) -> Match[str] | None [closest match]%0A (string: Buffer, pos: int = 0, endpos: int = ...) -> Match[bytes] | None%0A (string: LiteralString, pos: int = 0, endpos: int = ...) -> Match[LiteralString] | None
- ::error file=ddtrace/vendor/dogstatsd/container.py,line=49,col=56,endLine=49,endColumn=69,title=Pyrefly no-matching-overload::No matching overload found for function `re.Pattern.match` called with arguments: (str | Unknown)%0A Possible overloads:%0A (string: str, pos: int = 0, endpos: int = ...) -> Match[str] | None [closest match]%0A (string: Buffer, pos: int = 0, endpos: int = ...) -> Match[bytes] | None%0A (string: LiteralString, pos: int = 0, endpos: int = ...) -> Match[LiteralString] | None
pip (https://github.com/pypa/pip)
- ERROR src/pip/_internal/network/auth.py:336:16-54: Returned type `Literal[b'']` is not assignable to declared return type `str | None` [bad-return]
- ::error file=src/pip/_internal/network/auth.py,line=336,col=16,endLine=336,endColumn=54,title=Pyrefly bad-return::Returned type `Literal[b'']` is not assignable to declared return type `str | None`
altair (https://github.com/vega/altair)
- WARN altair/utils/schemapi.py:1133:24-84: Redundant cast: `Self@SchemaBase` is the same type as `Self@SchemaBase` [redundant-cast]
- ::warning file=altair/utils/schemapi.py,line=1133,col=24,endLine=1133,endColumn=84,title=Pyrefly redundant-cast::Redundant cast: `Self@SchemaBase` is the same type as `Self@SchemaBase`
cloud-init (https://github.com/canonical/cloud-init)
- ERROR cloudinit/sources/DataSourceCloudCIX.py:90:16-34: Returned type `Literal[b''] | Unknown | None` is not assignable to declared return type `str | None` [bad-return]
- ERROR cloudinit/sources/DataSourceLXD.py:356:53-63: Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_get_json_response` [bad-argument-type]
- ERROR cloudinit/sources/DataSourceLXD.py:364:26-42: Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_do_request` [bad-argument-type]
- ERROR cloudinit/sources/DataSourceLXD.py:406:30-38: Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_do_request` [bad-argument-type]
- ERROR cloudinit/sources/DataSourceLXD.py:412:55-58: Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_get_json_response` [bad-argument-type]
- ERROR cloudinit/sources/helpers/ec2.py:119:39-42: Argument `Literal['/']` is not assignable to parameter `suffix` with type `Buffer | tuple[Buffer, ...]` in function `bytes.endswith` [bad-argument-type]
- ERROR cloudinit/sources/helpers/ec2.py:120:17-33: `+=` is not supported between `Literal[b'']` and `Literal['/']` [unsupported-operation]
- ERROR cloudinit/sources/helpers/openstack.py:518:9-19: Class member `MetadataReader._path_join` overrides parent class `BaseReader` in an inconsistent manner [bad-override]
- ERROR cloudinit/url_helper.py:513:26-40: `str | Unknown` is not assignable to TypedDict key `method` with type `Literal[b''] | bool` [bad-typed-dict-key]
- ERROR cloudinit/url_helper.py:516:35-42: `tuple[Unknown, ...]` is not assignable to TypedDict key `timeout` with type `Literal[b''] | bool` [bad-typed-dict-key]
- ERROR cloudinit/url_helper.py:518:35-57: `float` is not assignable to TypedDict key `timeout` with type `Literal[b''] | bool` [bad-typed-dict-key]
- ERROR cloudinit/url_helper.py:548:31-38: `dict[Unknown, Unknown] | Unknown` is not assignable to TypedDict key `headers` with type `Literal[b''] | bool` [bad-typed-dict-key]
- ERROR cloudinit/url_helper.py:554:65-70: Object of class `bool` has no attribute `get`
+ ERROR cloudinit/url_helper.py:554:65-70: Object of class `bool` has no attribute `get` [missing-attribute]
- Object of class `bytes` has no attribute `get` [missing-attribute]
- ERROR cloudinit/url_helper.py:558:25-50: Cannot set item in `Literal[b'']` [unsupported-operation]
- ERROR cloudinit/url_helper.py:590:35-38: Argument `Literal[b'']` is not assignable to parameter `url` with type `str | None` in function `UrlError.__init__` [bad-argument-type]
- ERROR cloudinit/url_helper.py:596:21-24: Argument `Literal[b'']` is not assignable to parameter `url` with type `str | None` in function `UrlError.__init__` [bad-argument-type]
- ERROR cloudinit/url_helper.py:600:41-44: Argument `Literal[b'']` is not assignable to parameter `url` with type `str | None` in function `UrlError.__init__` [bad-argument-type]
- ERROR tests/unittests/sources/test_cloudcix.py:309:17-30: Argument `Literal[b''] | Unknown` is not assignable to parameter `base_url` with type `str` in function `cloudinit.sources.DataSourceCloudCIX.read_metadata` [bad-argument-type]
- ERROR tests/unittests/sources/test_cloudcix.py:333:17-30: Argument `Literal[b''] | Unknown` is not assignable to parameter `base_url` with type `str` in function `cloudinit.sources.DataSourceCloudCIX.read_metadata` [bad-argument-type]
- ::error file=cloudinit/sources/DataSourceCloudCIX.py,line=90,col=16,endLine=90,endColumn=34,title=Pyrefly bad-return::Returned type `Literal[b''] | Unknown | None` is not assignable to declared return type `str | None`
- ::error file=cloudinit/sources/DataSourceLXD.py,line=356,col=53,endLine=356,endColumn=63,title=Pyrefly bad-argument-type::Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_get_json_response`
- ::error file=cloudinit/sources/DataSourceLXD.py,line=364,col=26,endLine=364,endColumn=42,title=Pyrefly bad-argument-type::Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_do_request`
- ::error file=cloudinit/sources/DataSourceLXD.py,line=406,col=30,endLine=406,endColumn=38,title=Pyrefly bad-argument-type::Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_do_request`
- ::error file=cloudinit/sources/DataSourceLXD.py,line=412,col=55,endLine=412,endColumn=58,title=Pyrefly bad-argument-type::Argument `Literal[b''] | Unknown` is not assignable to parameter `url` with type `str` in function `_get_json_response`
- ::error file=cloudinit/sources/helpers/ec2.py,line=119,col=39,endLine=119,endColumn=42,title=Pyrefly bad-argument-type::Argument `Literal['/']` is not assignable to parameter `suffix` with type `Buffer | tuple[Buffer, ...]` in function `bytes.endswith`
- ::error file=cloudinit/sources/helpers/ec2.py,line=120,col=17,endLine=120,endColumn=33,title=Pyrefly unsupported-operation::`+=` is not supported between `Literal[b'']` and `Literal['/']`%0A Argument `Literal['/']` is not assignable to parameter `value` with type `Buffer` in function `bytes.__add__`%0A Protocol `Buffer` requires attribute `__buffer__`
- ::error file=cloudinit/sources/helpers/openstack.py,line=518,col=9,endLine=518,endColumn=19,title=Pyrefly bad-override::Class member `MetadataReader._path_join` overrides parent class `BaseReader` in an inconsistent manner%0A `MetadataReader._path_join` has type `(self: MetadataReader, base: Unknown, *add_ons: Unknown) -> Literal[b''] | Unknown`, which is not assignable to `(self: MetadataReader, base: Unknown, *add_ons: Unknown) -> None`, the type of `BaseReader._path_join`
- ::error file=cloudinit/url_helper.py,line=513,col=26,endLine=513,endColumn=40,title=Pyrefly bad-typed-dict-key::`str | Unknown` is not assignable to TypedDict key `method` with type `Literal[b''] | bool`
- ::error file=cloudinit/url_helper.py,line=516,col=35,endLine=516,endColumn=42,title=Pyrefly bad-typed-dict-key::`tuple[Unknown, ...]` is not assignable to TypedDict key `timeout` with type `Literal[b''] | bool`
- ::error file=cloudinit/url_helper.py,line=518,col=35,endLine=518,endColumn=57,title=Pyrefly bad-typed-dict-key::`float` is not assignable to TypedDict key `timeout` with type `Literal[b''] | bool`
- ::error file=cloudinit/url_helper.py,line=548,col=31,endLine=548,endColumn=38,title=Pyrefly bad-typed-dict-key::`dict[Unknown, Unknown] | Unknown` is not assignable to TypedDict key `headers` with type `Literal[b''] | bool`
- ::error file=cloudinit/url_helper.py,line=554,col=65,endLine=554,endColumn=70,title=Pyrefly missing-attribute::Object of class `bool` has no attribute `get`%0AObject of class `bytes` has no attribute `get`
+ ::error file=cloudinit/url_helper.py,line=554,col=65,endLine=554,endColumn=70,title=Pyrefly missing-attribute::Object of class `bool` has no attribute `get`
- ::error file=cloudinit/url_helper.py,line=558,col=25,endLine=558,endColumn=50,title=Pyrefly unsupported-operation::Cannot set item in `Literal[b'']`%0A Object of class `bytes` has no attribute `__setitem__`%0A Did you mean `__getitem__`?
- ::error file=cloudinit/url_helper.py,line=590,col=35,endLine=590,endColumn=38,title=Pyrefly bad-argument-type::Argument `Literal[b'']` is not assignable to parameter `url` with type `str | None` in function `UrlError.__init__`
- ::error file=cloudinit/url_helper.py,line=596,col=21,endLine=596,endColumn=24,title=Pyrefly bad-argument-type::Argument `Literal[b'']` is not assignable to parameter `url` with type `str | None` in function `UrlError.__init__`
- ::error file=cloudinit/url_helper.py,line=600,col=41,endLine=600,endColumn=44,title=Pyrefly bad-argument-type::Argument `Literal[b'']` is not assignable to parameter `url` with type `str | None` in function `UrlError.__init__`
- ::error file=tests/unittests/sources/test_cloudcix.py,line=309,col=17,endLine=309,endColumn=30,title=Pyrefly bad-argument-type::Argument `Literal[b''] | Unknown` is not assignable to parameter `base_url` with type `str` in function `cloudinit.sources.DataSourceCloudCIX.read_metadata`
- ::error file=tests/unittests/sources/test_cloudcix.py,line=333,col=17,endLine=333,endColumn=30,title=Pyrefly bad-argument-type::Argument `Literal[b''] | Unknown` is not assignable to parameter `base_url` with type `str` in function `cloudinit.sources.DataSourceCloudCIX.read_metadata`
|
migeed-z
reviewed
Feb 11, 2026
conformance/third_party/results.json
Outdated
| "fail": 25, | ||
| "pass_rate": 0.82, | ||
| "differences": 93, | ||
| "pass": 111, |
Contributor
There was a problem hiding this comment.
Why is this diff causing a conformance regression here?
migeed-z
requested changes
Feb 11, 2026
Contributor
migeed-z
left a comment
There was a problem hiding this comment.
Thank you for the PR!
I noticed some other conformance regressions. Sending back to ask about why we have a regression in other conformance tests as a result. Also, I wonder if those open source mypy primer changes are expected?
Contributor
Author
|
I am looking into it! I just merged the upstream. |
Contributor
When a constrained TypeVar (e.g. `AnyStr = TypeVar("AnyStr", str, bytes)`)
was solved with a subtype of a constraint (e.g. `MyStr(str)`), the solver
set the TypeVar to the subtype (`MyStr`) instead of the matching constraint
(`str`).
The fix adds constraint promotion in the solver's subset checker: when
pinning a constrained TypeVar, find the first constraint the argument type
is a subtype of and use that constraint as the answer.
Closes facebook#2370
Contributor
|
hi! as a reminder, please mark this as "ready for review" if you're ready for us to take another look. looks like there are some merge conflicts too unfortunately |
Contributor
|
Just doublechecking, is this still active? I can close if not. |
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
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
AnyStr = TypeVar("AnyStr", str, bytes)) was solved with a subtype of a constraint (e.g.MyStr(str)), pyrefly resolved toMyStrinstead ofstrFixes #2370
Test plan
test_constrained_typevar_subtype_resolves_to_constrainttestMyStr(str)→ resolves tostrMyBytes(bytes)→ resolves tobytesstr,bytes) still work