diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index 52eb92e5705..d62fc438cbb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -710,18 +710,25 @@ public class DescriptorResolver { else { typeAliasDescriptor.initialize( typeParameterDescriptors, - storageManager.createLazyValue(new Function0() { - @Override - public SimpleType invoke() { - return typeResolver.resolveAbbreviatedType(scopeWithTypeParameters, typeReference, trace); - } - }), - storageManager.createLazyValue(new Function0() { - @Override - public SimpleType invoke() { - return typeResolver.resolveExpandedTypeForTypeAlias(typeAliasDescriptor); - } - })); + storageManager.createRecursionTolerantLazyValue( + new Function0() { + @Override + public SimpleType invoke() { + return typeResolver.resolveAbbreviatedType(scopeWithTypeParameters, typeReference, trace); + } + }, + ErrorUtils.createErrorType("Recursive type alias expansion for " + typeAliasDescriptor.getName().asString()) + ), + storageManager.createRecursionTolerantLazyValue( + new Function0() { + @Override + public SimpleType invoke() { + return typeResolver.resolveExpandedTypeForTypeAlias(typeAliasDescriptor); + } + }, + ErrorUtils.createErrorType("Recursive type alias expansion for " + typeAliasDescriptor.getName().asString()) + ) + ); } trace.record(TYPE_ALIAS, typeAlias, typeAliasDescriptor); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpansion.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpansion.kt index 28cb6022b51..6c8799fad98 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpansion.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeAliasExpansion.kt @@ -48,7 +48,7 @@ class TypeAliasExpansion private constructor( typeAliasDescriptor: TypeAliasDescriptor, arguments: List ): TypeAliasExpansion { - val typeParameters = typeAliasDescriptor.typeConstructor.parameters.map { it.original as TypeParameterDescriptor } + val typeParameters = typeAliasDescriptor.typeConstructor.parameters.map { it.original } val mappedArguments = typeParameters.zip(arguments).toMap() return TypeAliasExpansion(parent, typeAliasDescriptor, arguments, mappedArguments) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeAliasDescriptor.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeAliasDescriptor.kt index f4716156ab0..538db9ac813 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeAliasDescriptor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyTypeAliasDescriptor.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.impl.AbstractTypeAliasDescriptor import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.storage.NotNullLazyValue +import org.jetbrains.kotlin.storage.NullableLazyValue import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.types.SimpleType import org.jetbrains.kotlin.types.TypeSubstitutor @@ -42,9 +43,11 @@ class LazyTypeAliasDescriptor( private lateinit var underlyingTypeImpl: NotNullLazyValue private lateinit var expandedTypeImpl: NotNullLazyValue private lateinit var defaultTypeImpl: NotNullLazyValue + private lateinit var classDescriptorImpl: NullableLazyValue override val underlyingType: SimpleType get() = underlyingTypeImpl() override val expandedType: SimpleType get() = expandedTypeImpl() + override val classDescriptor: ClassDescriptor? get() = classDescriptorImpl() override fun getDefaultType(): SimpleType = defaultTypeImpl() fun initialize( @@ -56,10 +59,21 @@ class LazyTypeAliasDescriptor( this.underlyingTypeImpl = lazyUnderlyingType this.expandedTypeImpl = lazyExpandedType this.defaultTypeImpl = storageManager.createLazyValue { computeDefaultType() } + this.classDescriptorImpl = storageManager.createRecursionTolerantNullableLazyValue({ computeClassDescriptor() }, null) + } + + private fun computeClassDescriptor(): ClassDescriptor? { + if (underlyingType.isError) return null + val underlyingTypeDescriptor = underlyingType.constructor.declarationDescriptor + return when (underlyingTypeDescriptor) { + is ClassDescriptor -> underlyingTypeDescriptor + is TypeAliasDescriptor -> underlyingTypeDescriptor.classDescriptor + else -> null + } } private val lazyTypeConstructorParameters = - storageManager.createLazyValue { this.computeConstructorTypeParameters() } + storageManager.createRecursionTolerantLazyValue({ this.computeConstructorTypeParameters() }, emptyList()) fun initialize( declaredTypeParameters: List, diff --git a/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.txt b/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.txt index de6e804b5c0..7f0d07cf85e 100644 --- a/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.txt +++ b/compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.txt @@ -21,10 +21,10 @@ public final class Outer { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public typealias LTI /*captured type parameters: /*0*/ TI, /*1*/ TN*/ = kotlin.collections.List public typealias LTN /*captured type parameters: /*0*/ TI, /*1*/ TN*/ = kotlin.collections.List - public typealias LTO /*captured type parameters: /*0*/ TI, /*1*/ TN*/ = kotlin.collections.List<[ERROR : TO]> + public typealias LTO = kotlin.collections.List<[ERROR : TO]> } public typealias LTN /*captured type parameters: /*0*/ TN*/ = kotlin.collections.List - public typealias LTO /*captured type parameters: /*0*/ TN*/ = kotlin.collections.List<[ERROR : TO]> + public typealias LTO = kotlin.collections.List<[ERROR : TO]> } public typealias LTO /*captured type parameters: /*0*/ TO*/ = kotlin.collections.List } diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.kt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.kt new file mode 100644 index 00000000000..a47821a691c --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.kt @@ -0,0 +1,32 @@ +class Outer { + class Nested + class GenericNested + inner class Inner + inner class GenericInner + + typealias NestedAlias = Nested + typealias GenericNestedAlias = GenericNested + typealias InnerAlias = Inner + typealias GenericInnerAlias = GenericInner + + fun test1(x: NestedAlias) = x + fun test2(x: GenericNestedAlias) = x + fun test3(x: GenericNestedAlias) = x + fun test4(x: InnerAlias) = x + fun test5(x: GenericInnerAlias) = x + fun test6(x: GenericInnerAlias) = x +} +fun test1(x: Outer.NestedAlias) = x +fun test2(x: Outer.NestedAlias) = x +fun test3(x: Outer.NestedAlias) = x +fun test4(x: Outer.GenericNestedAlias) = x +fun test5(x: Outer.GenericNestedAlias) = x +fun test6(x: Outer.GenericNestedAlias) = x +fun test7(x: Outer.GenericNestedAlias) = x +fun test8(x: Outer.GenericNestedAlias) = x +fun test9(x: Outer.InnerAlias) = x +fun test10(x: Outer.InnerAlias) = x +fun test11(x: Outer.InnerAlias) = x +fun test12(x: Outer.GenericInnerAlias) = x +fun test13(x: Outer.GenericInnerAlias) = x +fun test14(x: Outer.GenericInnerAlias) = x diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.txt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.txt new file mode 100644 index 00000000000..c7245958edc --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.txt @@ -0,0 +1,61 @@ +package + +public fun test1(/*0*/ x: [ERROR : NestedAlias]): [ERROR : NestedAlias] +public fun test10(/*0*/ x: Outer.InnerAlias /* = Outer.Inner */): Outer.InnerAlias /* = Outer.Inner */ +public fun test11(/*0*/ x: Outer.InnerAlias /* = Outer.Inner */): Outer.InnerAlias /* = Outer.Inner */ +public fun test12(/*0*/ x: [ERROR : GenericInnerAlias]): [ERROR : GenericInnerAlias] +public fun test13(/*0*/ x: Outer.GenericInnerAlias /* = Outer.GenericInner */): Outer.GenericInnerAlias /* = Outer.GenericInner */ +public fun test14(/*0*/ x: Outer.GenericInnerAlias /* = Outer.GenericInner */): Outer.GenericInnerAlias /* = Outer.GenericInner */ +public fun test2(/*0*/ x: [ERROR : NestedAlias]): [ERROR : NestedAlias] +public fun test3(/*0*/ x: Outer.NestedAlias /* = Outer.Nested */): Outer.NestedAlias /* = Outer.Nested */ +public fun test4(/*0*/ x: [ERROR : GenericNestedAlias]): [ERROR : GenericNestedAlias] +public fun test5(/*0*/ x: [ERROR : GenericNestedAlias]): [ERROR : GenericNestedAlias] +public fun test6(/*0*/ x: [ERROR : GenericNestedAlias]): [ERROR : GenericNestedAlias] +public fun test7(/*0*/ x: Outer.GenericNestedAlias /* = Outer.GenericNested */): Outer.GenericNestedAlias /* = Outer.GenericNested */ +public fun test8(/*0*/ x: Outer.GenericNestedAlias /* = Outer.GenericNested */): Outer.GenericNestedAlias /* = Outer.GenericNested */ +public fun test9(/*0*/ x: [ERROR : InnerAlias]): [ERROR : InnerAlias] + +public final class Outer { + public constructor Outer() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test1(/*0*/ x: Outer.NestedAlias /* = Outer.Nested */): Outer.NestedAlias /* = Outer.Nested */ + public final fun test2(/*0*/ x: Outer.GenericNestedAlias /* = Outer.GenericNested */): Outer.GenericNestedAlias /* = Outer.GenericNested */ + public final fun test3(/*0*/ x: Outer.GenericNestedAlias /* = Outer.GenericNested */): Outer.GenericNestedAlias /* = Outer.GenericNested */ + public final fun test4(/*0*/ x: Outer.InnerAlias /* = Outer.Inner */): Outer.InnerAlias /* = Outer.Inner */ + public final fun test5(/*0*/ x: Outer.GenericInnerAlias /* = Outer.GenericInner */): Outer.GenericInnerAlias /* = Outer.GenericInner */ + public final fun test6(/*0*/ x: Outer.GenericInnerAlias /* = Outer.GenericInner */): Outer.GenericInnerAlias /* = Outer.GenericInner */ + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final inner class GenericInner /*captured type parameters: /*1*/ T*/ { + public constructor GenericInner() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class GenericNested { + public constructor GenericNested() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final inner class Inner /*captured type parameters: /*0*/ T*/ { + public constructor Inner() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class Nested { + public constructor Nested() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + public typealias GenericInnerAlias /*captured type parameters: /*1*/ T*/ = Outer.GenericInner + public typealias GenericNestedAlias = Outer.GenericNested + public typealias InnerAlias /*captured type parameters: /*0*/ T*/ = Outer.Inner + public typealias NestedAlias = Outer.Nested +} diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt new file mode 100644 index 00000000000..e51653d15ef --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt @@ -0,0 +1,22 @@ +class C { + inner class D + + typealias DA = D + typealias SDA = C.D + typealias TSDA = C.D + typealias TC = C + typealias SSDA = C<*>.D + typealias SSC = C<*> +} + +fun test1(x: C.DA) = x +fun test2(x: C.SDA) = x +fun test3(x: C.TSDA) = x +fun test4(x: C.TC) = x + +fun test5(x: C<*>.DA) = x +fun test6(x: C<*>.TSDA) = x +fun test7(x: C<*>.TC) = x + +fun test8(x: C.SSDA) = x +fun test9(x: C.SSC) = x \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.txt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.txt new file mode 100644 index 00000000000..5d7d94a83b5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.txt @@ -0,0 +1,31 @@ +package + +public fun test1(/*0*/ x: C.DA /* = C.D */): C.DA /* = C.D */ +public fun test2(/*0*/ x: C.SDA /* = C.D */): C.SDA /* = C.D */ +public fun test3(/*0*/ x: C.TSDA /* = C.D */): C.TSDA /* = C.D */ +public fun test4(/*0*/ x: C.TC /* = C */): C.TC /* = C */ +public fun test5(/*0*/ x: C<*>.DA /* = C<*>.D */): C<*>.DA /* = C<*>.D */ +public fun test6(/*0*/ x: C<*>.TSDA /* = C<*>.D */): C<*>.TSDA /* = C<*>.D */ +public fun test7(/*0*/ x: C<*>.TC /* = C<*> */): C<*>.TC /* = C<*> */ +public fun test8(/*0*/ x: C.SSDA /* = C<*>.D */): C.SSDA /* = C<*>.D */ +public fun test9(/*0*/ x: C.SSC /* = C<*> */): C.SSC /* = C<*> */ + +public final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final inner class D /*captured type parameters: /*0*/ T*/ { + public constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + public typealias DA /*captured type parameters: /*0*/ T*/ = C.D + public typealias SDA = C.D + public typealias SSC = C<*> + public typealias SSDA = C<*>.D + public typealias TC /*captured type parameters: /*0*/ T*/ = C + public typealias TSDA /*captured type parameters: /*0*/ T*/ = C.D +} diff --git a/compiler/testData/diagnostics/tests/typealias/kt14518.kt b/compiler/testData/diagnostics/tests/typealias/kt14518.kt new file mode 100644 index 00000000000..df4b929eaa7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/kt14518.kt @@ -0,0 +1,8 @@ +class OuterClass { + class NestedClass + typealias NestedType = NestedClass +} + +typealias ON1 = OuterClass.NestedClass +typealias ON2 = OuterClass.NestedType +typealias ON3 = OuterClass.NestedType \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/typealias/kt14518.txt b/compiler/testData/diagnostics/tests/typealias/kt14518.txt new file mode 100644 index 00000000000..d3fa98db44c --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/kt14518.txt @@ -0,0 +1,19 @@ +package + +public final class OuterClass { + public constructor OuterClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class NestedClass { + public constructor NestedClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + public typealias NestedType = OuterClass.NestedClass +} +public typealias ON1 = [ERROR : NestedClass] +public typealias ON2 = [ERROR : NestedType] +public typealias ON3 = OuterClass.NestedType diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasAsSuperQualifier.txt b/compiler/testData/diagnostics/tests/typealias/typeAliasAsSuperQualifier.txt index fe224e521fd..f87cefb1876 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasAsSuperQualifier.txt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasAsSuperQualifier.txt @@ -32,7 +32,7 @@ public final class TestSuperForGenericBase : GB /* = GenericBase public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public typealias MyBase /*captured type parameters: /*0*/ T*/ = GB - public typealias MyBaseInt /*captured type parameters: /*0*/ T*/ = GB + public typealias MyBaseInt = GB } public final class Unrelated { diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 86b6c3f5e0b..dd1a0465973 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -20926,6 +20926,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("innerTypeAliasAsType.kt") + public void testInnerTypeAliasAsType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.kt"); + doTest(fileName); + } + + @TestMetadata("innerTypeAliasAsType2.kt") + public void testInnerTypeAliasAsType2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt"); + doTest(fileName); + } + @TestMetadata("isAsWithTypeAlias.kt") public void testIsAsWithTypeAlias() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/isAsWithTypeAlias.kt"); @@ -20950,6 +20962,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("kt14518.kt") + public void testKt14518() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/kt14518.kt"); + doTest(fileName); + } + @TestMetadata("kt14641.kt") public void testKt14641() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/kt14641.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractTypeAliasDescriptor.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractTypeAliasDescriptor.kt index 2077cab9937..cdf855d8a99 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractTypeAliasDescriptor.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/AbstractTypeAliasDescriptor.kt @@ -47,14 +47,20 @@ abstract class AbstractTypeAliasDescriptor( visitor.visitTypeAliasDescriptor(this, data) override fun isInner(): Boolean = - containingDeclaration !is PackageFragmentDescriptor + // NB: it's ok to use underlyingType here, since referenced inner type aliases also capture type parameters. + // Using expandedType looks "proper", but in fact will cause a recursion in expandedType resolution, + // which will silently produce wrong result. + TypeUtils.contains(underlyingType) { + !it.isError && run { + val constructorDescriptor = it.constructor.declarationDescriptor + constructorDescriptor is TypeParameterDescriptor && + constructorDescriptor.containingDeclaration != this@AbstractTypeAliasDescriptor + } + } override fun getDeclaredTypeParameters(): List = declaredTypeParametersImpl - override val classDescriptor: ClassDescriptor? - get() = if (expandedType.isError) null else expandedType.constructor.declarationDescriptor as? ClassDescriptor - override fun getModality() = Modality.FINAL override fun getVisibility() = visibilityImpl diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt index 8025a05c5b4..27a633626ed 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt @@ -133,6 +133,8 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo get() = builtIns.nullableAnyType override fun getDefaultType(): SimpleType = builtIns.nullableAnyType + override val classDescriptor: ClassDescriptor? + get() = expandedType.constructor.declarationDescriptor as? ClassDescriptor override fun substitute(substitutor: TypeSubstitutor) = this diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt index 28284b9cc25..99aa970ff7b 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberDescriptor.kt @@ -169,6 +169,9 @@ class DeserializedTypeAliasDescriptor( defaultTypeImpl = computeDefaultType() } + override val classDescriptor: ClassDescriptor? + get() = if (expandedType.isError) null else expandedType.constructor.declarationDescriptor as? ClassDescriptor + override fun getDefaultType(): SimpleType = defaultTypeImpl diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 957bc6b4f67..87413d17bf8 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -7366,12 +7366,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } - @TestMetadata("kt13557.kt") - public void testKt13557() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/local/kt13557.kt"); - doTest(fileName); - } - @TestMetadata("localVal.kt") public void testLocalVal() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/local/localVal.kt");