Skip to content

Fixed a regression in overload matching that resulted in false positi… #6163

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

Merged
merged 1 commit into from
Oct 14, 2023

Conversation

erictraut
Copy link
Collaborator

…ve errors in hydra-zen. This change involves removing a heuristic from overload matching that attempted to eliminate a false positive error for x: list[str] = "a,b".split(","). This addresses #6160.

…ve errors in hydra-zen. This change involves removing a heuristic from overload matching that attempted to eliminate a false positive error for `x: list[str] = "a,b".split(",")`. This addresses #6160.
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

discord.py (https://github.com/Rapptz/discord.py)
-   /tmp/mypy_primer/projects/discord.py/discord/audit_logs.py:394:47 - warning: Unnecessary "# type: ignore" comment
-   /tmp/mypy_primer/projects/discord.py/discord/audit_logs.py:400:47 - warning: Unnecessary "# type: ignore" comment
-   /tmp/mypy_primer/projects/discord.py/discord/ui/select.py:336:49 - warning: Unnecessary "# type: ignore" comment
- 48 errors, 14 warnings, 0 informations 
+ 48 errors, 11 warnings, 0 informations 

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_frame.py:1464:22 - error: Expression of type "DataFrame" cannot be assigned to declared type "Series[Unknown]"
+     "DataFrame" is incompatible with "Series[Unknown]" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_frame.py:1521:39 - error: Argument of type "Timestamp" cannot be assigned to parameter "__iterable" of type "Iterable[_T@list]" in function "__init__"
+     "Timestamp" is incompatible with protocol "Iterable[_T@list]"
+       "__iter__" is not present (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:35:21 - error: Expression of type "Timestamp" cannot be assigned to declared type "Series[Unknown]"
+     "Timestamp" is incompatible with "Series[Unknown]" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:37:21 - error: Expression of type "Timestamp" cannot be assigned to declared type "Series[Unknown]"
+     "Timestamp" is incompatible with "Series[Unknown]" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:38:21 - error: Expression of type "Timestamp" cannot be assigned to declared type "Series[Unknown]"
+     "Timestamp" is incompatible with "Series[Unknown]" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:41:28 - error: Expression of type "Timestamp" cannot be assigned to declared type "DatetimeIndex"
+     "Timestamp" is incompatible with "DatetimeIndex" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:44:28 - error: Expression of type "Timestamp" cannot be assigned to declared type "DatetimeIndex"
+     "Timestamp" is incompatible with "DatetimeIndex" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:45:28 - error: Expression of type "Timestamp" cannot be assigned to declared type "DatetimeIndex"
+     "Timestamp" is incompatible with "DatetimeIndex" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:46:28 - error: Expression of type "Timestamp" cannot be assigned to declared type "DatetimeIndex"
+     "Timestamp" is incompatible with "DatetimeIndex" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_pandas.py:47:21 - error: Expression of type "Timestamp" cannot be assigned to declared type "Series[Unknown]"
+     "Timestamp" is incompatible with "Series[Unknown]" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_series.py:87:28 - error: Expression of type "Timestamp" cannot be assigned to declared type "DatetimeIndex"
+     "Timestamp" is incompatible with "DatetimeIndex" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_series.py:1237:25 - error: Expression of type "TimestampSeries" cannot be assigned to declared type "Series[str]"
+     "TimestampSeries" is incompatible with "Series[str]"
+       Type parameter "S1@Series" is invariant, but "Timestamp" is not the same as "str" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/pandas-stubs/tests/test_timefuncs.py:74:26 - error: Expression of type "Timedelta" cannot be assigned to declared type "Timestamp"
+     "Timedelta" is incompatible with "Timestamp" (reportGeneralTypeIssues)
- 1428 errors, 0 warnings, 0 informations 
+ 1441 errors, 0 warnings, 0 informations 

@erictraut
Copy link
Collaborator Author

erictraut commented Oct 14, 2023

@Dr-Irv, FYI, this bug fix may have an impact on pandas-stubs. I'm not able to repro the above results from mypy_primer when I run pyright on pandas-stubs locally, so I'm guessing that the above issues are all caused by not having the full dependencies installed in the mypy_primer script. I'm going to therefore assume that the above is just noise and not indicative of a real issue. Just wanted to give you a heads up in case you want to independently confirm.

@erictraut erictraut merged commit 554ff22 into main Oct 14, 2023
@erictraut erictraut deleted the issue6160 branch October 14, 2023 19:44
@erictraut erictraut restored the issue6160 branch October 15, 2023 19:49
@erictraut erictraut deleted the issue6160 branch October 15, 2023 19:52
@Dr-Irv
Copy link

Dr-Irv commented Oct 24, 2023

@Dr-Irv, FYI, this bug fix may have an impact on pandas-stubs. I'm not able to repro the above results from mypy_primer when I run pyright on pandas-stubs locally, so I'm guessing that the above issues are all caused by not having the full dependencies installed in the mypy_primer script. I'm going to therefore assume that the above is just noise and not indicative of a real issue. Just wanted to give you a heads up in case you want to independently confirm.

@erictraut is this released yet so we can test?

@erictraut
Copy link
Collaborator Author

This change was included in pyright 1.1.332, which was released last week Tuesday. It was also in last week's prerelease version of Pylance. It will be in this week's production Pylance release (normally published every Wed).

@Dr-Irv
Copy link

Dr-Irv commented Oct 24, 2023

This change was included in pyright 1.1.332, which was released last week Tuesday. It was also in last week's prerelease version of Pylance. It will be in this week's production Pylance release (normally published every Wed).

OK, it looks like this is just noise, because in pandas-dev/pandas-stubs#802 our CI tests are passing with 1.1.332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants