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

Distinguish between scope does not exist and name not found as scope #1895

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

peckto
Copy link
Collaborator

@peckto peckto commented Dec 12, 2024

Currently, the extractScope function does not make any difference whether the scope does not exist or the name was not found in the scope. This leads to problems in the type resolution.

The following code wars previously not parsed correctly:

/*
namespace ABC {
struct A {
    A();
    void foo();
};
}
*/

struct A : ABC::A {
    A() {
        foo();
    }
};

A data class ScopeExtraction is introduced for better readability.
For now, only the function lookupSymbolByName handles both cases explicitly.
The question is, do we also need to consider both cases in the other instances?

@peckto peckto marked this pull request as draft December 12, 2024 12:27
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 8 lines in your changes missing coverage. Please review.

Project coverage is 76.51%. Comparing base (9898155) to head (41f7708).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ain/kotlin/de/fraunhofer/aisec/cpg/ScopeManager.kt 85.71% 2 Missing and 1 partial ⚠️
...n/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt 75.00% 2 Missing and 1 partial ⚠️
...raunhofer/aisec/cpg/passes/inference/PassHelper.kt 77.77% 0 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
...raunhofer/aisec/cpg/passes/inference/PassHelper.kt 81.10% <77.77%> (+0.61%) ⬆️
...ain/kotlin/de/fraunhofer/aisec/cpg/ScopeManager.kt 81.64% <85.71%> (-0.05%) ⬇️
...n/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt 87.96% <75.00%> (-0.41%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peckto peckto marked this pull request as ready for review December 12, 2024 16:55
Copy link
Member

@oxisto oxisto left a comment

Choose a reason for hiding this comment

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

Very nice! I added some small other cases where we want to handle this explicitly. Please have a quick check if this is ok, otherwise we can merge this.

@oxisto oxisto changed the title Distinguish between scope does not exist and name not found in scope Distinguish between scope does not exist and name not found as scope Dec 12, 2024
@peckto
Copy link
Collaborator Author

peckto commented Dec 13, 2024

Thanks for your addition! Looks good to me.

@oxisto oxisto merged commit 01f5873 into main Dec 13, 2024
4 checks passed
@oxisto oxisto deleted the fix-extractScope branch December 13, 2024 12:28
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