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

static/top-level const can hit use before define error #144

Closed
jmesserly opened this issue Apr 21, 2015 · 3 comments
Closed

static/top-level const can hit use before define error #144

jmesserly opened this issue Apr 21, 2015 · 3 comments

Comments

@jmesserly
Copy link
Contributor

Const can result in use-before-define errors as the code isn't sorted properly. library cycles make this worse, but the bug exists even with a single library, as the initializer expression isn't taken into account at all for class ordering. non-const final fields can hit this too, since we try to pretend they are const if possible.

Fortunately we already have means to codegen lazy fields, as that's how most statics work. So shouldn't be too bad, just need to track it.

Related issue on const canonicalization: #29

@jmesserly
Copy link
Contributor Author

At the moment I'm fixing the most egregious case regarding list initializers, by having them codegen a bit differently (avoid the List.from constructor)

@vsmenon
Copy link
Contributor

vsmenon commented Apr 21, 2015

Dup with #131?

@jmesserly
Copy link
Contributor Author

ah, fair, didn't see that one.

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

No branches or pull requests

2 participants