-
Notifications
You must be signed in to change notification settings - Fork 238
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
[rs2bril] Duplicate variable names with different types compiled incorrectly. #341
Comments
What bril code would you expect this to generate?
We could generate this, but: ❯ bril2json < dupe.bril | brilck
new type int for x conflicts with old type float (This might be a limitation of the type checking of brilck/brilirs to be fair) |
I wasn't sure if it's a limitation of type checking or an intended restriction. |
Hmm, it could work, but note that fresh names are tricky because I will now need to construct a control flow graph to understand what to re-write later uses of x to. Maybe one can show in most/all well-typed rust programs that one x dominates the other? Somewhat unrelated but a fun example of bril typing that is probably not well supported(except by brili)
|
Could we do the renaming over the rust ast? Alternatively a lightweight solution for now that would be a lot better is to throw an error |
Hmm, I've punted and taken your solution of just throwing an error. Hopefully this isn't too limiting in terms of what rust programs are not accepted. There are probably better solutions. |
I'm perfectly happy with that solution, thanks for putting so much effort into improving it! |
Rust files that re-use a name with a different type cause the rs2bril compiler to generate ill-typed bril.
Example:
The text was updated successfully, but these errors were encountered: