-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
--disallow-any-generics generates spurious messages #7077
Comments
In general it seems to me we should prohibit using types as contexts for errors in general (or make file name part of error context). |
I think that types are probably fine as error contexts in the semantic analyzer. |
Fixes #7077 The logic of the fix is quite straightforward: emit the error immediately when we fix an instance type, and not in a traversal after the main pass. Note that I fix this only for the new analyser, because the old one will be anyway deprecated soon. This causes a bit of code churn because we need to pass the flags to several functions, but the logic should not change much. I didn't add many new tests, since we have a bunch of existing tests. It would probably make sense to play with this, suggestions for more tests are very welcome.
Sorry, I have problem.
test.py:3: error: Missing type parameters for generic type I can't understand this error. |
I also have same problem with @happy2mylife . |
Is this problem not solved yet? @msullivan |
You probably need to put |
In certain cases,
--disallow-any-generics
will generate an error message in the file where a type alias is used with the line number at which the type alias is defined.For example
generates the error
main:6: error: Missing type parameters for generic type
.main:6
is not a line that appears.The error here is line 6 of
a.py
,B = A
, though that is not an error in this case becausedisallow-any-generics
is not specified for that file. It is triggered by line 3 of main, but reporting an error there would also be wrong because there is nothing wrong with line 3 of main, just with the definition ofB
. (And there is nothing that can be fixed at that call site, becauseB
is not generic!).I'm marking this as high priority because
disallow-any-generics
is a super important option that we I think we should make a default once it is fixed.The text was updated successfully, but these errors were encountered: