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

fixes semantic error for int (Issue #1926) #2476

Merged
merged 3 commits into from
Feb 7, 2024

Conversation

NishantBansal2003
Copy link
Contributor

Issue Link: #1926

Changes:
Introduces a clear error message:

Semantic Error: 'int' type is not supported yet.

Context:
As discussed in this comment, this improvement enhances the usability of LPython.

Copy link
Collaborator

@anutosh491 anutosh491 left a 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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@certik certik left a 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?

@NishantBansal2003
Copy link
Contributor Author

Resolved Issue #1926 by refining the semantic error message for 'int'.

Changes:
Improve 'int' semantic error message with a hint." Additionally, added a reference test.

Copy link
Contributor

@certik certik left a 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.

@certik certik merged commit 6285062 into lcompilers:main Feb 7, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants