-
Notifications
You must be signed in to change notification settings - Fork 164
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
fixes semantic error for int (Issue #1926) #2476
fixes semantic error for int (Issue #1926) #2476
Conversation
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.
Yeah if we've decided to return an error till we decide on what action we want to take for the int
annotation, I think this should work !
@@ -876,7 +876,12 @@ class CommonVisitor : public AST::BaseVisitor<Struct> { | |||
} | |||
|
|||
if( !type && raise_error ) { | |||
throw SemanticError("Unsupported type annotation: " + var_annotation, loc); | |||
if (var_annotation == "int") { | |||
throw SemanticError(var_annotation + " type is not supported yet. " , loc); |
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.
Add a hint: "hint: use i8, i16, i32 or i64 for now". Lookup other place in the code how to add a hint.
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.
Please review the changes I have made.
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.
Excellent, thanks! Can you please also add a test for this error message?
Resolved Issue #1926 by refining the semantic error message for 'int'. Changes: |
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.
Excellent, thank you for this PR. I think the code looks great, very nice error message.
Issue Link: #1926
Changes:
Introduces a clear error message:
Context:
As discussed in this comment, this improvement enhances the usability of LPython.