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

Spurious Downcast info messages for const. #8

Closed
jacob314 opened this issue Dec 23, 2014 · 5 comments
Closed

Spurious Downcast info messages for const. #8

jacob314 opened this issue Dec 23, 2014 · 5 comments

Comments

@jacob314
Copy link
Contributor

I don't think this code should be generating a downcast. BAR should have static type String.

Repo:

class Foo {
  static const BAR = 'hi';
}

class Baz {
  String bla = Foo.BAR; // Info: DownCast
}

Note this seems to impact all const and final fields. Fixing this bug will fix a large number of the DownCasts.

@vsmenon
Copy link
Contributor

vsmenon commented Jan 13, 2015

Example should read Foo.BAR in the Baz class. BAR needs to be declared as a String to avoid the cast ... or we need inference.

@sigmundch
Copy link
Contributor

FYI - I went ahead and applied Vijay's change to the code snippet in Jacob's post.

I think we should definitely do inference of const expressions. Note that if you do: print(Foo.BAR.runtimeType) you'll always get String.

@jmesserly jmesserly self-assigned this Jan 16, 2015
@jmesserly
Copy link
Contributor

I'll take a look

@jmesserly jmesserly removed their assignment Mar 19, 2015
@jmesserly
Copy link
Contributor

@sigmundch is this working now?

@sigmundch
Copy link
Contributor

yes, this is now fixed. transitive inference between consts is still in the works though :)

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

No branches or pull requests

4 participants