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

Added nullptr checks for l/rtype #3138

Merged
merged 3 commits into from
Mar 18, 2022

Conversation

MichalKekely
Copy link
Contributor

No description provided.

@@ -1832,6 +1832,11 @@ const IR::Node* TypeInference::postorder(IR::Concat* expression) {
ltype = getTypeType(se->type);
if (auto se = rtype->to<IR::Type_SerEnum>())
rtype = getTypeType(se->type);
if (ltype == nullptr || rtype == nullptr) {
typeError("%1%: Could not find a type for enumeration",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really a typeError, it is either a BUG or it reflects a type error found elsewhere.
If you look at the implementation of getTypeType, it only may return 'nullptr' when some other earlier type error has occurred. So a message has already been printed. Thus here you can simply return, compilation will stop soon.

Copy link
Contributor Author

@MichalKekely MichalKekely Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, removed the unnecessary error (also did the same at line 2276)

@mihaibudiu
Copy link
Contributor

you have to run cpplint on your code.

@mihaibudiu mihaibudiu merged commit b9b84ee into main Mar 18, 2022
@mihaibudiu mihaibudiu deleted the mkekely/expression_type_nullptr_check branch March 18, 2022 17:42
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.

2 participants