-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Simplify ConstantEvaluator. #3232
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
Conversation
} | ||
)"; | ||
CHECK_ERROR(text, TypeError, "Identifier must be declared constant."); | ||
CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal or constant expression."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We lose a little precision here, but I think the previous error message was not particularly helpful, because you actually cannot declare a
constant.
I'd split this into:
|
} | ||
} | ||
)"; | ||
CHECK_ERROR(text, TypeError, "Constant identifier declaration must have a constant value."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message is also not too helpful, because you cannot assign a constant value to this variable.
_operation, | ||
Token::isCompareOp(_operation.getOperator()) ? | ||
make_shared<BoolType>() : | ||
left->binaryOperatorResult(_operation.getOperator(), right) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keep using commonType
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right
@axic I don't think I have time to work on splitting this... |
1ec1135
to
e39da3b
Compare
e39da3b
to
48c7ba7
Compare
I was increasingly uneasy with ConstantEvaluator setting the
type
property of the annotations. This should only be done by the TypeChecker, and not already in the reference resolution stage.