Skip to content
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

Cannot evaluate constant referred by several module aliases #226

Open
blitz-1306 opened this issue Oct 6, 2023 · 0 comments
Open

Cannot evaluate constant referred by several module aliases #226

blitz-1306 opened this issue Oct 6, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@blitz-1306
Copy link
Contributor

blitz-1306 commented Oct 6, 2023

Environment

Any

Scenario

  1. Have a file A.sol, that declares file-level constant uint constant X = 100;.
  2. Have a file B.sol, that imports A.sol and aliases it as A.
  3. Have a file C.sol, that:
    • imports B.sol and aliases it as B.
    • declares file-level constant uint constant Y = 50 + B.A.X;
  4. Run constant evaluator on Y

Expected behavior

Expected Y to resolve to 150

Current behavior

Get two crashes:

Description

See #225 (comment)

Suggested solution

  1. Probably reintroduce ModuleType (that is not in package distribution and used for tests only).
  2. Fix InferType.
  3. Fix evalConstantExpr() to handle tree of MemberAcceeses, that refers to a variable via multiple aliases.
@blitz-1306 blitz-1306 added the bug Something isn't working label Oct 6, 2023
@blitz-1306 blitz-1306 changed the title Cannot evaluate constant with that referred by several module aliases Cannot evaluate constant referred by several module aliases Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant