-
Notifications
You must be signed in to change notification settings - Fork 65
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
Do not resolve unqualified symbols in current record without HasImplicitReceiver
#1984
Conversation
HasExplicitMemberAccess
traitHasExplicitMemberAccessOnly
trait
HasExplicitMemberAccessOnly
traitHasExplicitReceiverOnly
trait
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/scopes/Scope.kt
Outdated
Show resolved
Hide resolved
...nguage-python/src/test/kotlin/de/fraunhofer/aisec/cpg/frontends/python/SymbolResolverTest.kt
Show resolved
Hide resolved
5452d7a
to
3488de7
Compare
After some digging, I actually discovered that we already have the opposite trait |
HasExplicitReceiverOnly
traitHasImplicitReceiver
66cd738
to
706df94
Compare
HasImplicitReceiver
HasImplicitReceiver
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.
In general, I'm happy with this PR, once the additional case of fields declared directly inside a class are covered.
...nguage-python/src/test/kotlin/de/fraunhofer/aisec/cpg/frontends/python/SymbolResolverTest.kt
Show resolved
Hide resolved
...nguage-python/src/test/kotlin/de/fraunhofer/aisec/cpg/frontends/python/SymbolResolverTest.kt
Outdated
Show resolved
Hide resolved
...nguage-python/src/test/kotlin/de/fraunhofer/aisec/cpg/frontends/python/SymbolResolverTest.kt
Show resolved
Hide resolved
04ef9cf
to
5bdffd9
Compare
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.
LGTM :)
cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PythonAddDeclarationsPass.kt
Outdated
Show resolved
Hide resolved
cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PythonAddDeclarationsPass.kt
Outdated
Show resolved
Hide resolved
…sses/PythonAddDeclarationsPass.kt Co-authored-by: Maximilian Kaul <[email protected]>
9404be7
to
724bee6
Compare
…icitReceiver` (#1984) * Introduce `HasExplicitMemberAccess` trait Fixes #1983 * Added trait to GoLanguage as well to be safe * Added more documentation * Spotless * Addressed code review * Using existing trait * added more tests * Fixed the tests as good as they can be fixed in this PR * a -> globalA * Fixed another bug where field declarations were declared twice * Update cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PythonAddDeclarationsPass.kt Co-authored-by: Maximilian Kaul <[email protected]> * Better documentation --------- Co-authored-by: Maximilian Kaul <[email protected]>
We need to consider the trait
HasImplicitReceiver
(or the lack thereof) when resolving symbols in an unqualified lookup to not accidentally resolve fields/methods of a class without an receiver.Fixes #1983