Skip to content

flag to disable implicit dynamic in generic type annotations #26784

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

Closed
jmesserly opened this issue Jun 28, 2016 · 4 comments
Closed

flag to disable implicit dynamic in generic type annotations #26784

jmesserly opened this issue Jun 28, 2016 · 4 comments
Labels
legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@jmesserly
Copy link

no-implicit-dynamic still allows things like:

class C<T> { T t; C(this.t); }
void main() {
  C c = new C(42);
  c.t.oops();
}

If we require that to be written as C<dynamic> it makes the dynamic dispatch a bit more obvious. I think what we'd want to do here is interpret C as C<Object>, that way the simple syntax can still be used, but it becomes safer statically if someone is using this flag.

Context #25573 (comment)

@jmesserly jmesserly added legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request analyzer-strong-mode type-enhancement A request for a change that isn't a bug labels Jun 28, 2016
@jmesserly
Copy link
Author

CC @leafpetersen @munificent -- I left this one lower priority as I'm not sure if we have a current need for it.

@leafpetersen
Copy link
Member

Agreed, probably lower priority in my mind.

@jmesserly jmesserly added P2 A bug or feature request we're likely to work on and removed P3 A lower priority bug or feature request labels Jul 19, 2016
@jmesserly
Copy link
Author

@zoechi just hit this as well, so I bumped the priority

@jmesserly jmesserly added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels Aug 9, 2016
@srawlins
Copy link
Member

no-implicit-dynamic now produces an error on the code in the description:

$ cat 26784.dart 
class C<T> { T t; C(this.t); }
void main() {
  C c = new C(42);
  c.t.oops();
}
$ dartanalyzer --no-implicit-dynamic 26784.dart 
Analyzing 26784.dart...
  error • Missing type arguments for generic type 'C<dynamic>' at 26784.dart:3:13 • strong_mode_implicit_dynamic_type
1 error found.
$ dartanalyzer --version
dartanalyzer version 2.0.0-dev.63.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants