Skip to content

Implicit dynamic complains about Object-typed generics #27625

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
nex3 opened this issue Oct 19, 2016 · 3 comments
Closed

Implicit dynamic complains about Object-typed generics #27625

nex3 opened this issue Oct 19, 2016 · 3 comments
Assignees
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@nex3
Copy link
Member

nex3 commented Oct 19, 2016

If I have the following Dart code:

class Foo {
  final List<Object> values;

  Foo(Iterable<Object> values)
      : values = new List.unmodifiable(values);
}

and I run dartanalyzer --strong --no-implicit-dynamic on it, I get:

[error] Missing type arguments for generic type 'List<dynamic>'. Either add an explicit type like 'dynamic', or enable implicit-dynamic in your Analyzer options.

I'd expect the analyzer to infer List<Object>. If I change <Object> to <String>, inference works as expected.

@nex3 nex3 added legacy-area-analyzer Use area-devexp instead. analyzer-strong-mode type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Oct 19, 2016
@jmesserly
Copy link

oh shoot. I'll need to check if my current CL makes this better. Yeah, we're not recording type constraints in some cases.

@jmesserly jmesserly added the P2 A bug or feature request we're likely to work on label Oct 19, 2016
@jmesserly
Copy link

(when the constraint is trivial, like top type)

@jmesserly
Copy link

related: #27586

@jmesserly jmesserly added this to the 1.23 milestone Mar 6, 2017
@leafpetersen leafpetersen removed this from the 1.23 milestone Mar 9, 2017
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. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants