You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Environment
Any
Scenario
A.sol
, that declares file-level constantuint constant X = 100;
.B.sol
, that importsA.sol
and aliases it asA
.C.sol
, that:B.sol
and aliases it asB
.uint constant Y = 50 + B.A.X;
Y
Expected behavior
Expected
Y
to resolve to150
Current behavior
Get two crashes:
InferType
would crash here:solc-typed-ast/src/types/infer.ts
Lines 1299 to 1305 in f467859
evalConstantExpr()
would crash as it cannot proceed evaluation without a type:solc-typed-ast/src/types/eval_const.ts
Lines 403 to 407 in f467859
Description
See #225 (comment)
Suggested solution
ModuleType
(that is not in package distribution and used for tests only).InferType
.evalConstantExpr()
to handle tree ofMemberAccees
es, that refers to a variable via multiple aliases.The text was updated successfully, but these errors were encountered: