[AA] Fix sealed inheritors provider for binary libraries in Standalone tests

- Since binary libraries don't carry decompiled files anymore, the
  static declaration provider doesn't index binary libraries in the
  Standalone mode, where we don't use stub-based deserialization. This
  led `LLSealedInheritorsProviderFactoryForTests` to fail in Standalone
  mode for sealed classes from binary libraries, as this provider is now
  populated from the declaration provider's index (see the previous
  commit). Luckily, class-based deserialization sets
  `sealedInheritorsAttr`, so we can simply use this attribute.

^KT-65960
This commit is contained in:
Marco Pennekamp
2024-02-21 20:33:25 +01:00
committed by Space Team
parent e62038f5f3
commit c7ccfcc785
@@ -39,9 +39,9 @@ private class SealedClassInheritorsProviderForTests(
else -> ktModule
}
// the module might be absent in the map if it doesn't have any .kt-files whatsoever, in which case
// there's definitely no sealed inheritors
val inheritorsForModuleMap = inheritorsByModule[relevantModule] ?: return emptyList()
return inheritorsForModuleMap[firClass.classId] ?: firClass.sealedInheritorsAttr?.value ?: emptyList()
// If the module is absent in the map, it's either a binary library that wasn't stub-indexed (e.g. in Standalone mode) or the module
// doesn't have any `.kt` files, in which case there cannot be sealed inheritors. `sealedInheritorsAttr` covers the binary library
// case, as class-based deserialization sets this attribute.
return inheritorsByModule[relevantModule]?.get(firClass.classId) ?: firClass.sealedInheritorsAttr?.value ?: emptyList()
}
}