[aa-klib-reader] Only resolve symbols from the associated library/sourceFile

Previously the addresses were resolved by only respecting
CallableId or ClassId. This however, could lead to
resolving symbols that were not defined in the klib which
initially provided the declaration address.

E.g. this commit adds a test in `GetSymbolsTest`, where
```
// A.kt
private fun foo() = 42

// B.kt
private fun foo() = 42
```

In this case the two source files (A.kt and B.kt) defined
two distinct addresses for `foo`. However: Resolving
any of those two addresses would resolve both functions (A&B), which
is not expected.

^KT-66271 Fixed
This commit is contained in:
Sebastian Sellmair
2024-03-05 15:10:35 +01:00
committed by Space Team
parent 6b98602afc
commit 426d71b088
8 changed files with 144 additions and 9 deletions
@@ -7,4 +7,13 @@
package org.jetbrains.sample.filePrivateSymbolsClash
private fun foo() = 42
annotation class A
/**
* Defined in A.kt, clashes with B.kt
*/
@A
private fun foo() = 42
@A
private val fooProperty get() = 42
@@ -7,4 +7,13 @@
package org.jetbrains.sample.filePrivateSymbolsClash
private fun foo() = 42
annotation class B
/**
* Defined in B.kt, clashes with A.kt
*/
@B
private fun foo() = 42
@B
private val fooProperty get() = 42