-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Dart does not throw error if function argument parameter extends Null #33701
Comments
The error seems spurious. There is nothing inherently problematic with allowing If we have a rule preventing a type parameter from being a supertype of its bound, the phrasing needs to be fixed so it doesn't allow this any more than it disallows |
OK, but if Null is allowed, analyzer should not throw error too. |
We could simply accept the current wording including the error with an explicitly In order to ensure that this issue can stay focused on its original purpose, I've created a new issue #33709 addressing the language question. Marking this issue as blocked: Waiting for #33709. |
Removing blocked status: As of 4fd0404, the subtype circularity prevention rule in the language specification has be adjusted such that So we need to change the area back to analyzer—done. |
Analyzer no longer reports an error for this code (both with and without null-safety). |
Dart SDK Version: 2.0.0-dev.55.0
OS: Windows 10
Sample code below declares a [typedef] with parameter which extends [Null]. It causes a lot of compiler errors with dartanalyzer and passes without errors with dart.
This is similar to the issue #33699, however analyzer produces different errors in these two cases, so we would be better to have separate issues.
I believe both tools should behave in the same way.
Dartanalyzer sample output is:
Dart stdout and stderr are empty, no exceptions or warnings there.
The text was updated successfully, but these errors were encountered: