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

fix: check if external symbol before checking from same scope. #2434

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

arteevraina
Copy link
Collaborator

@arteevraina arteevraina commented Nov 28, 2023

@arteevraina arteevraina marked this pull request as draft November 28, 2023 06:25
@arteevraina arteevraina marked this pull request as ready for review November 28, 2023 07:14
@certik
Copy link
Contributor

certik commented Nov 28, 2023

I thought the ExternalSymbol should still be part of the current symbol table. I will need to investigate this.

Also let's add a test that now works.

Comment on lines +1097 to +1100
// If the symbol is an ExternalSymbol, then omit the check.
if (ASR::is_a<ASR::ExternalSymbol_t>(*symbol)) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this change is not correct --- I think the ASR is incorrect if the ExternalSymbol is not present in the current scope. So there is a bug in the way we construct the ASR that we need to fix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The symbol is there in the current_symtab imported as ExternalSymbol. But, x.m_derived_type points to actual definition of the class which is inside another module, that is why symtab_in_scope fails. I think ASR is correct as the External Symbol is there in the current scope.

Copy link
Contributor

Choose a reason for hiding this comment

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

The proper fix is described at lfortran/lfortran#2957.

@certik certik marked this pull request as draft December 1, 2023 16:59
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