[AA] Resolve isSubClassOf from the context of a use-site session again

`isSubClassOf` was changed in an earlier commit to use the session of
`subClass` instead, but that approach comes with multiple problems:

- We need to resolve classes from the use-site to take actualization of
  `expect` types into account.
- If `superClass` is a builtin and we resolve supertypes from
  `subClass`'s session, we may get multiple instances of symbols for the
  same builtin from different sessions (i.e. one from a stdlib session
  via the use-site session and another from the fallback builtins
  provider for binary libraries if `subClass` is from a binary library).

^KT-66013
This commit is contained in:
Marco Pennekamp
2024-03-13 20:34:51 +01:00
committed by Space Team
parent 53f2dfec41
commit 9d2298b326
3 changed files with 7 additions and 6 deletions
@@ -101,7 +101,7 @@ class KotlinStandaloneDirectInheritorsProvider(private val project: Project) : K
// `KotlinDirectInheritorsProvider`'s interface guarantees that `getDirectKotlinInheritors` is only called from lazy resolution to
// `SEALED_CLASS_INHERITORS` or later, so `isSubClassOf` resolving to `SUPER_TYPES` is legal.
return isSubClassOf(candidateFirClass, baseFirClass, allowIndirectSubtyping = false)
return isSubClassOf(candidateFirClass, baseFirClass, candidateFirClass.moduleData.session, allowIndirectSubtyping = false)
}
private fun KtClassOrObject.toFirSymbol(classId: ClassId, ktModule: KtModule): FirClassLikeSymbol<*>? {