-
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
Passing type-parameterized function to ArgumentError.checkNotNull broken in 2.8.1 #41871
Comments
@lrhn might this have to do with signature change from dart 2.7.1 which has: static void checkNotNull(Object argument, [String name]); to dart 2.8.1 which has: static T checkNotNull<@Since("2.8") T>(T argument, [String name]); |
It is because of that change, yes. I did not anticipate that change being breaking. Just goes to prove that no change is too small to break someone! Dart prohibits a generic function type from being a type argument. We should just stop having that restriction, or at least stop inferring generic types as arguments (just inferring The workaround would be to pass an explicit type argument (just |
For work around, one can also do: if (wrap == null) {
throw ArgumentError.notNull();
} That works fine :) But for existing code fixing this would be nice, at it's a static error for any code using |
Closing in favor of dart-lang/language#496 |
This is supported as of Dart 2.14. |
I might be using more type-parameters than is useful :)
But I ran into this curious case, and wonder if it's a known regression.
On dart
2.7.0
it works, but on2.8.1
I get (before it starts running):The text was updated successfully, but these errors were encountered: