Disallow bare ParamSpec in type aliases#18174
Merged
hauntsaninja merged 1 commit intopython:masterfrom Nov 20, 2024
Merged
Conversation
Collaborator
Author
|
Conformance results diff for this PR ( diff --git a/conformance/results/mypy/generics_paramspec_basic.toml b/conformance/results/mypy/generics_paramspec_basic.toml
index 53fd4f5..a22eb7b 100644
--- a/conformance/results/mypy/generics_paramspec_basic.toml
+++ b/conformance/results/mypy/generics_paramspec_basic.toml
@@ -4,6 +4,8 @@ Does not reject ParamSpec when used "bare" in type alias definition.
"""
output = """
generics_paramspec_basic.py:10: error: String argument 1 "NotIt" to ParamSpec(...) does not match variable name "WrongName" [misc]
+generics_paramspec_basic.py:15: error: Invalid location for ParamSpec "P" [valid-type]
+generics_paramspec_basic.py:15: note: You can use ParamSpec as the first argument to Callable, e.g., "Callable[P, int]"
generics_paramspec_basic.py:23: error: Invalid location for ParamSpec "P" [valid-type]
generics_paramspec_basic.py:23: note: You can use ParamSpec as the first argument to Callable, e.g., "Callable[P, int]"
generics_paramspec_basic.py:27: error: Invalid location for Concatenate [valid-type]
@@ -15,7 +17,6 @@ generics_paramspec_basic.py:35: note: You can use ParamSpec as the first argumen
generics_paramspec_basic.py:39: error: Invalid location for ParamSpec "P" [valid-type]
generics_paramspec_basic.py:39: note: You can use ParamSpec as the first argument to Callable, e.g., "Callable[P, int]"
"""
-conformance_automated = "Fail"
+conformance_automated = "Pass"
errors_diff = """
-Line 15: Expected 1 errors
"""
diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml
index 699a899..61bb190 100644
--- a/conformance/results/mypy/version.toml
+++ b/conformance/results/mypy/version.toml
@@ -1,2 +1,2 @@
-version = "mypy 1.14.0+dev.21587f01045246a9ecb54a054a5ba03e20cbbd19"
-test_duration = 4.5
+version = "mypy 1.14.0+dev.bf422add81d770eb4896b84afe800da48dbb21f1"
+test_duration = 5.0 |
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
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.
Emit errors for both of the following aliases:
This is done by swapping a top-level call to
type.accept(analyzer)withanalyzer.anal_type(type), the latter of which simply calls the former and then performs some checks.