Psi2ir: do not load abbreviated types with not found classifier
This is not an ideal fix of the problem since the fact that
AbbreviatedType's classifier should be a TypeAliasDescriptor is a
reasonable assumption that might fail somewhere else, later in the
pipeline.
Previous attempts to fix this issue that were unsuccessful:
1) Do not load abbreviations for such types in deserialization at all.
Unfortunately, it broke quite a few things like reflection and
decompiler, where types frequently refer to symbols not reachable
from the point where they're requested, yet we have the FQ name of
the typealias, which is enough to render the abbreviation properly in
both these use cases.
2) Load classifiers for unresolved abbreviations as
MockTypeAliasDescriptor instead of MockClassDescriptor in
NotFoundClasses. Technically this was a revert of
e19c1b5364. But this failed because we
don't have enough information about such typealias to correctly set
its `expandedType`/`underlyingType` (just using nullable Any as
before that commit is not good enough). We only know its underlying
class (from one usage of such typealias), and even supporting that
would involve a major refactoring of TypeDeserializer which is
painful.
#KT-45308 Fixed
This commit is contained in:
+4
-2
@@ -1,5 +1,7 @@
|
||||
// KT-45308 Psi2ir: "AssertionError: TypeAliasDescriptor expected" caused by using typealias from one module as a type in another module without a transitive dependency
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// This test checks that unresolved typealias in an abbreviated type does not crash the compiler or result in a compilation error.
|
||||
// Apparently, there's some demand for this behavior, see KT-45308.
|
||||
|
||||
// FIR reports RETURN_TYPE_MISMATCH: Return type mismatch: expected kotlin/String, actual a/A
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// MODULE: a
|
||||
|
||||
Reference in New Issue
Block a user