-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Analyzer throws exception if function optional argument is omitted and it's parametrized. #33864
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
Comments
I've just found even more simple example which fails similarly - in the following code testme1<X extends List<X>>() {}
testme2<X extends List<int>>() {}
main() {
testme1();
testme2();
} analyzer passes with |
I'm implementing the checks of type arguments against the bounds in CFE currently and seeing tests with type variables declared like in the examples shown above (for example, In the last example the missing compile-time argument provided by instantiate-to-bound is Just in case I'm interpreting the feature spec incorrectly, I'll cc @eernstg. |
Agreed, i2b makes it In particular, the given type argument is passed and may be used by code which was checked statically under the assumption that type parameter bounds are satisfied, so it would be unsound to allow any bound violations. So super-bounded types can come up here, but they can't be allowed. Just like they can't be allowed as actual type arguments in an instance creation. |
Analyzer still produces |
Dart2js now produces errors here, which I think agrees with @eernstg and @chloestefantsova 's assessment. Closing. |
Dart SDK Version: 2.0.0_dev.68.0
OS: Windows 10
The following sample code example declares a function with one optional parametrized argument and than calls it without parameters:
It passes with dart and it seems like a correct result - indeed, if we don't set optional input argument, it should not affect the execution.
However, dartanalyzer throws an error here:
I suppose analyzer should pass here too.
The text was updated successfully, but these errors were encountered: