Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Flag for error on implicit dynamic #363

Closed
munificent opened this issue Oct 13, 2015 · 5 comments
Closed

Flag for error on implicit dynamic #363

munificent opened this issue Oct 13, 2015 · 5 comments

Comments

@munificent
Copy link
Contributor

We've discussed this a few times, but I figured I should file a tracking issue (if there isn't one already). I would like to be able to run the analyzer in strong mode with an option to tell me if the type inference engine ever can't pick a static type and ends up picking dynamic instead.

For example, I would expect to get an error here:

someFunction(a) => a.mysteryProperty;

But not here:

someFunction(dynamic a) => a.mysteryProperty;
@jmesserly
Copy link
Contributor

Nice!

another variant, more for codegen, is "no dynamic invokes" ... this would allow us to omit some helper code. Possibly useful if you're trying to export a Dart library to JS and you want really small code size.

(of course, as far as code size is concerned, we have bigger fish to fry in the SDK libs)

@vsmenon
Copy link
Contributor

vsmenon commented Oct 14, 2015

Would you guys want an error here:

var list = [1, 2, 4];

?
In this case, the implicit dynamic is within the List type - List<dynamic> - that is both the inferred static type of list as well as its reified runtime type. I believe TypeScript's no-implicit-any complains.

@vsmenon
Copy link
Contributor

vsmenon commented Oct 14, 2015

I filed a related bug for no reified dynamics: #365
I suspect that would also eliminate dynamic invokes, but probably the hard way to get there.

@munificent
Copy link
Contributor Author

Yes, I'd want an error there too.

@jmesserly
Copy link
Contributor

this is moved to the SDK now dart-lang/sdk#24712, dart-lang/sdk#25573

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants