Fix exception on star import from typealias
#KT-30983 Fixed
This commit is contained in:
+5
@@ -22551,6 +22551,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/simpleTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOnTypeAlias.kt")
|
||||
public void testStarImportOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/starProjection.kt");
|
||||
|
||||
@@ -231,7 +231,7 @@ class QualifiedExpressionResolver {
|
||||
val packageOrClassDescriptor = resolveToPackageOrClass(
|
||||
path, moduleDescriptor, trace, packageFragmentForCheck,
|
||||
scopeForFirstPart = null, position = QualifierPosition.IMPORT
|
||||
) ?: return null
|
||||
).classDescriptorFromTypeAlias() ?: return null
|
||||
|
||||
if (packageOrClassDescriptor is ClassDescriptor && packageOrClassDescriptor.kind.isSingleton && lastPart.expression != null) {
|
||||
trace.report(
|
||||
@@ -249,6 +249,10 @@ class QualifiedExpressionResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private fun DeclarationDescriptor?.classDescriptorFromTypeAlias(): DeclarationDescriptor? {
|
||||
return if (this is TypeAliasDescriptor) classDescriptor else this
|
||||
}
|
||||
|
||||
private fun computePackageFragmentToCheck(
|
||||
containingFile: KtFile,
|
||||
packageFragmentForVisibilityCheck: PackageFragmentDescriptor?
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
// MODULE: common
|
||||
// FILE: common.kt
|
||||
|
||||
package test
|
||||
|
||||
expect enum class E
|
||||
|
||||
// MODULE: jvm1(common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
package test
|
||||
|
||||
actual typealias E = F
|
||||
|
||||
enum class F {
|
||||
OK;
|
||||
}
|
||||
|
||||
// MODULE: main(jvm1)
|
||||
// FILE: jvm2.kt
|
||||
|
||||
import test.E.*
|
||||
|
||||
fun box(): String {
|
||||
return OK.name
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_JAVAC
|
||||
|
||||
// FILE: test/jv/JavaSample.java
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// FILE: foo.kt
|
||||
|
||||
// FILE: foo.kt
|
||||
|
||||
package test
|
||||
|
||||
typealias ClassAlias = ClassSample
|
||||
typealias ObjectAlias = ObjectSample
|
||||
typealias EnumAlias = EnumSample
|
||||
|
||||
class ClassSample
|
||||
|
||||
object ObjectSample
|
||||
|
||||
enum class EnumSample {
|
||||
Entry;
|
||||
}
|
||||
|
||||
// FILE: bar.kt
|
||||
|
||||
import test.ClassAlias.*
|
||||
import test.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>ObjectAlias<!>.*
|
||||
import test.EnumAlias.*
|
||||
import test.EnumAlias
|
||||
|
||||
|
||||
fun bar() {
|
||||
Entry
|
||||
EnumAlias.Entry
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package
|
||||
|
||||
public fun bar(): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public final class ClassSample {
|
||||
public constructor ClassSample()
|
||||
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 enum class EnumSample : kotlin.Enum<test.EnumSample> {
|
||||
enum entry Entry
|
||||
|
||||
private constructor EnumSample()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: test.EnumSample): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<test.EnumSample!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): test.EnumSample
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<test.EnumSample>
|
||||
}
|
||||
|
||||
public object ObjectSample {
|
||||
private constructor ObjectSample()
|
||||
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 ClassAlias = test.ClassSample
|
||||
public typealias EnumAlias = test.EnumSample
|
||||
public typealias ObjectAlias = test.ObjectSample
|
||||
}
|
||||
@@ -22633,6 +22633,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/simpleTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOnTypeAlias.kt")
|
||||
public void testStarImportOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/starProjection.kt");
|
||||
|
||||
Generated
+5
@@ -22553,6 +22553,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/simpleTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOnTypeAlias.kt")
|
||||
public void testStarImportOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/starImportOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/starProjection.kt");
|
||||
|
||||
+5
@@ -16068,6 +16068,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectationJvm.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOfExpectEnumWithActualTypeAlias.kt")
|
||||
public void testStarImportOfExpectEnumWithActualTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/starImportOfExpectEnumWithActualTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+5
@@ -16068,6 +16068,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectationJvm.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOfExpectEnumWithActualTypeAlias.kt")
|
||||
public void testStarImportOfExpectEnumWithActualTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/starImportOfExpectEnumWithActualTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+5
@@ -16073,6 +16073,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectationJvm.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOfExpectEnumWithActualTypeAlias.kt")
|
||||
public void testStarImportOfExpectEnumWithActualTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/starImportOfExpectEnumWithActualTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+5
@@ -12293,6 +12293,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOfExpectEnumWithActualTypeAlias.kt")
|
||||
public void testStarImportOfExpectEnumWithActualTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/starImportOfExpectEnumWithActualTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+5
@@ -13448,6 +13448,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starImportOfExpectEnumWithActualTypeAlias.kt")
|
||||
public void testStarImportOfExpectEnumWithActualTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/starImportOfExpectEnumWithActualTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/multiplatform/defaultArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user