From 085fc3bf87eb748b19e7b0cc892c30d8ba00cc63 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 11 Sep 2015 16:43:31 +0300 Subject: [PATCH] Transform anonymous types even for public symbols This became necessary when we removed the requirement to specify types for public members, because otherwise everything fails not being able to locate the anonymous class from another module #KT-9072 Fixed EA-72801 --- .../kotlin/resolve/DescriptorResolver.java | 19 +++++----- .../SimpleValAnonymousObject.A.kt | 9 +++++ .../SimpleValAnonymousObject.B.kt | 6 ++++ .../tests/ObjectWithConstructor.txt | 2 +- .../annotations/annotationInheritance.txt | 2 +- .../kt462BackingFieldsResolve.txt | 2 +- .../ReturnFromFunctionInObject.txt | 2 +- .../tests/controlFlowAnalysis/kt1191.txt | 2 +- .../tests/controlFlowAnalysis/kt2960.txt | 2 +- .../tests/controlFlowAnalysis/kt3444.txt | 2 +- .../ambiguousObjectExpressionType.kt | 36 +++++++++---------- .../unambiguousObjectExpressionType.txt | 24 ++++++------- .../functionAndProperty/objectExpression.txt | 2 +- .../objectExpressionInConstructor.txt | 2 +- .../tests/extensions/GenericIterator.txt | 4 +-- .../tests/extensions/GenericIterator2.txt | 2 +- .../tests/inner/illegalModifier.txt | 2 +- .../tests/inner/innerErrorForClassObjects.txt | 2 +- .../tests/inner/innerErrorForObjects.txt | 2 +- .../diagnostics/tests/inner/kt6026.txt | 2 +- .../diagnostics/tests/objects/Objects.txt | 2 +- .../diagnostics/tests/objects/kt2240.txt | 2 +- .../constructorInObject.txt | 2 +- .../onNestedDeclarationsInsideNativeClass.txt | 2 +- ...NestedDeclarationsInsideNonNativeClass.txt | 2 +- .../onNestedDeclarationsInsideNativeClass.txt | 2 +- ...NestedDeclarationsInsideNonNativeClass.txt | 2 +- .../onNestedDeclarationsInsideNativeClass.txt | 2 +- ...NestedDeclarationsInsideNonNativeClass.txt | 2 +- ...mpileKotlinAgainstKotlinTestGenerated.java | 6 ++++ 30 files changed, 85 insertions(+), 65 deletions(-) create mode 100644 compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.A.kt create mode 100644 compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.B.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index b0c51029417..462168c21c7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -26,6 +26,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.builtins.KotlinBuiltIns; import org.jetbrains.kotlin.descriptors.*; +import org.jetbrains.kotlin.descriptors.annotations.AnnotationSplitter; import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget; import org.jetbrains.kotlin.descriptors.annotations.Annotations; import org.jetbrains.kotlin.descriptors.annotations.CompositeAnnotations; @@ -42,12 +43,14 @@ import org.jetbrains.kotlin.resolve.constants.ConstantValue; import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator; import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsPackage; import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil; -import org.jetbrains.kotlin.resolve.scopes.*; +import org.jetbrains.kotlin.resolve.scopes.JetScopeUtils; +import org.jetbrains.kotlin.resolve.scopes.LexicalScope; +import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope; +import org.jetbrains.kotlin.resolve.scopes.WritableScope; import org.jetbrains.kotlin.storage.StorageManager; import org.jetbrains.kotlin.types.*; import org.jetbrains.kotlin.types.checker.JetTypeChecker; import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices; -import org.jetbrains.kotlin.descriptors.annotations.AnnotationSplitter; import java.util.*; @@ -930,25 +933,21 @@ public class DescriptorResolver { @NotNull JetType type, @NotNull BindingTrace trace ) { - ClassifierDescriptor classifierDescriptor = type.getConstructor().getDeclarationDescriptor(); - if (classifierDescriptor == null || !DescriptorUtils.isAnonymousObject(classifierDescriptor)) { + ClassifierDescriptor classifier = type.getConstructor().getDeclarationDescriptor(); + if (classifier == null || !DescriptorUtils.isAnonymousObject(classifier) || DescriptorUtils.isLocal(descriptor)) { return type; } boolean definedInClass = DescriptorUtils.getParentOfType(descriptor, ClassDescriptor.class) != null; - boolean isLocal = DescriptorUtils.isLocal(descriptor); - Visibility visibility = descriptor.getVisibility(); - boolean transformNeeded = !isLocal && !visibility.getIsPublicAPI() - && !(definedInClass && Visibilities.isPrivate(visibility)); - if (transformNeeded) { + if (!definedInClass || !Visibilities.isPrivate(descriptor.getVisibility())) { if (type.getConstructor().getSupertypes().size() == 1) { - assert type.getArguments().isEmpty() : "Object expression couldn't have any type parameters!"; return type.getConstructor().getSupertypes().iterator().next(); } else { trace.report(AMBIGUOUS_ANONYMOUS_TYPE_INFERRED.on(declaration, type.getConstructor().getSupertypes())); } } + return type; } diff --git a/compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.A.kt b/compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.A.kt new file mode 100644 index 00000000000..02baf8dcdcb --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.A.kt @@ -0,0 +1,9 @@ +package pkg + +interface ClassA { + companion object { + val DEFAULT = object : ClassA { + override fun toString() = "OK" + } + } +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.B.kt b/compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.B.kt new file mode 100644 index 00000000000..b93bc202943 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.B.kt @@ -0,0 +1,6 @@ +import pkg.ClassA + +fun main(args: Array) { + val obj = ClassA.DEFAULT + obj.toString() +} diff --git a/compiler/testData/diagnostics/tests/ObjectWithConstructor.txt b/compiler/testData/diagnostics/tests/ObjectWithConstructor.txt index 398b28d1cc6..56bfde65380 100644 --- a/compiler/testData/diagnostics/tests/ObjectWithConstructor.txt +++ b/compiler/testData/diagnostics/tests/ObjectWithConstructor.txt @@ -1,6 +1,6 @@ package -public val x: x. +public val x: kotlin.Any public object A1 { private constructor A1() diff --git a/compiler/testData/diagnostics/tests/annotations/annotationInheritance.txt b/compiler/testData/diagnostics/tests/annotations/annotationInheritance.txt index 0f6cafb1413..354d29e311f 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationInheritance.txt +++ b/compiler/testData/diagnostics/tests/annotations/annotationInheritance.txt @@ -1,6 +1,6 @@ package -public val a: a. +public val a: T kotlin.annotation.annotation() public final class Ann : C { public constructor Ann() diff --git a/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.txt b/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.txt index 947a08af1cd..0cb6a2e37fb 100644 --- a/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.txt +++ b/compiler/testData/diagnostics/tests/backingField/kt462BackingFieldsResolve.txt @@ -5,7 +5,7 @@ package kt462 { public final class T { public constructor T() - public final val a: kt462.T.a. + public final val a: kotlin.Any public final var r: kotlin.Int public final var x: kotlin.Int public final val z: kotlin.Int diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturn/ReturnFromFunctionInObject.txt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturn/ReturnFromFunctionInObject.txt index 4144581f825..88e463ae4c6 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturn/ReturnFromFunctionInObject.txt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/definiteReturn/ReturnFromFunctionInObject.txt @@ -1,6 +1,6 @@ package -public val m: m. +public val m: X public interface X { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1191.txt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1191.txt index 41b5642a7a8..73eeaa6639e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1191.txt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1191.txt @@ -1,7 +1,7 @@ package package kt1191 { - public fun foo(/*0*/ unused: kotlin.Int): kt1191.foo. + public fun foo(/*0*/ unused: kotlin.Int): kotlin.Any public fun kt1191.FunctionalList.plus(/*0*/ element: T): kt1191.FunctionalList public interface FunctionalList { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.txt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.txt index 6eaca4a30a4..e211870384b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.txt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.txt @@ -3,7 +3,7 @@ package package b { public var f: () -> kotlin.Unit public val g: () -> kotlin.Int - public val o: b.o. + public val o: kotlin.Any public val p: b.P public fun doSmth(/*0*/ i: kotlin.Int): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt3444.txt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt3444.txt index eb9e8d91105..7e24afbff98 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt3444.txt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt3444.txt @@ -1,6 +1,6 @@ package -public val m: m. +public val m: X public fun box(): kotlin.Unit public interface X { diff --git a/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt b/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt index 57b839c4129..aad1486a8e7 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt @@ -16,13 +16,13 @@ class Foo { privateProperty.f2() } - protected val protectedProperty = object : MyClass(), MyTrait {} + protected val protectedProperty = object : MyClass(), MyTrait {} - val internalProperty = object : MyClass(), MyTrait {} + val internalProperty = object : MyClass(), MyTrait {} internal val internal2Property = object : MyClass(), MyTrait {} - public val publicProperty = object : MyClass(), MyTrait {} + public val publicProperty = object : MyClass(), MyTrait {} private fun privateFunction() = object : MyClass(), MyTrait {} @@ -32,13 +32,13 @@ class Foo { privateFunction().f2() } - protected fun protectedFunction() = object : MyClass(), MyTrait {} + protected fun protectedFunction() = object : MyClass(), MyTrait {} - fun internalFunction() = object : MyClass(), MyTrait {} + fun internalFunction() = object : MyClass(), MyTrait {} internal fun internal2Function() = object : MyClass(), MyTrait {} - public fun publicFunction() = object : MyClass(), MyTrait {} + public fun publicFunction() = object : MyClass(), MyTrait {} @@ -50,13 +50,13 @@ class Foo { privatePropertyInner.f2() } - protected val protectedProperty = object : MyClass(), MyTrait {} + protected val protectedProperty = object : MyClass(), MyTrait {} - val internalProperty = object : MyClass(), MyTrait {} + val internalProperty = object : MyClass(), MyTrait {} internal val internal2Property = object : MyClass(), MyTrait {} - public val publicProperty = object : MyClass(), MyTrait {} + public val publicProperty = object : MyClass(), MyTrait {} private fun privateFunctionInner() = object : MyClass(), MyTrait {} @@ -66,13 +66,13 @@ class Foo { privateFunctionInner().f2() } - protected fun protectedFunction() = object : MyClass(), MyTrait {} + protected fun protectedFunction() = object : MyClass(), MyTrait {} - fun internalFunction() = object : MyClass(), MyTrait {} + fun internalFunction() = object : MyClass(), MyTrait {} internal fun internal2Function() = object : MyClass(), MyTrait {} - public fun publicFunction() = object : MyClass(), MyTrait {} + public fun publicFunction() = object : MyClass(), MyTrait {} } @@ -90,21 +90,21 @@ class Foo { private val packagePrivateProperty = object : MyClass(), MyTrait {} -protected val packageProtectedProperty = object : MyClass(), MyTrait {} +protected val packageProtectedProperty = object : MyClass(), MyTrait {} -val packageInternalProperty = object : MyClass(), MyTrait {} +val packageInternalProperty = object : MyClass(), MyTrait {} internal val packageInternal2Property = object : MyClass(), MyTrait {} -public val packagePublicProperty = object : MyClass(), MyTrait {} +public val packagePublicProperty = object : MyClass(), MyTrait {} -protected fun packageProtectedFunction() = object : MyClass(), MyTrait {} +protected fun packageProtectedFunction() = object : MyClass(), MyTrait {} -fun packageInternalFunction() = object : MyClass(), MyTrait {} +fun packageInternalFunction() = object : MyClass(), MyTrait {} internal fun packageInternal2Function() = object : MyClass(), MyTrait {} -public fun packagePublicFunction() = object : MyClass(), MyTrait {} +public fun packagePublicFunction() = object : MyClass(), MyTrait {} fun fooPackage() { val packageLocalVar = object : MyClass(), MyTrait {} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/unambiguousObjectExpressionType.txt b/compiler/testData/diagnostics/tests/declarationChecks/unambiguousObjectExpressionType.txt index ef1e6debba9..423830089ed 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/unambiguousObjectExpressionType.txt +++ b/compiler/testData/diagnostics/tests/declarationChecks/unambiguousObjectExpressionType.txt @@ -2,15 +2,15 @@ package internal val packageInternalProperty: MyClass private val packagePrivateProperty: MyClass -protected val packageProtectedProperty: packageProtectedProperty. +protected val packageProtectedProperty: MyClass public val packagePublic2Property: MyClass -public val packagePublicProperty: packagePublicProperty. +public val packagePublicProperty: MyClass public fun fooPackage(): kotlin.Unit internal fun internalFunction(): MyClass private fun privateFunction(): MyClass -protected fun protectedFunction(): protectedFunction. +protected fun protectedFunction(): MyClass public fun public2Function(): MyClass -public fun publicFunction(): publicFunction. +public fun publicFunction(): MyClass public fun testFunctions(): kotlin.Unit public fun testProperties(): kotlin.Unit @@ -19,18 +19,18 @@ public final class Foo { internal final val internalProperty: MyClass private final val privateProperty: Foo.privateProperty. protected final val protected2Property: MyClass - protected final val protectedProperty: Foo.protectedProperty. + protected final val protectedProperty: MyClass public final val public2Property: MyClass - public final val publicProperty: Foo.publicProperty. + public final val publicProperty: MyClass public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun foo(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int internal final fun internalFunction(): MyClass private final fun privateFunction(): Foo.privateFunction. protected final fun protected2Function(): MyClass - protected final fun protectedFunction(): Foo.protectedFunction. + protected final fun protectedFunction(): MyClass public final fun public2Function(): MyClass - public final fun publicFunction(): Foo.publicFunction. + public final fun publicFunction(): MyClass public final fun testFunctions(): kotlin.Unit public final fun testProperties(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -40,17 +40,17 @@ public final class Foo { internal final val internalProperty: MyClass private final val privateProperty: Foo.FooInner.privateProperty. protected final val protected2Property: MyClass - protected final val protectedProperty: Foo.FooInner.protectedProperty. + protected final val protectedProperty: MyClass public final val public2Property: MyClass - public final val publicProperty: Foo.FooInner.publicProperty. + public final val publicProperty: MyClass public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int internal final fun internalFunction(): MyClass private final fun privateFunction(): Foo.FooInner.privateFunction. protected final fun protected2Function(): MyClass - protected final fun protectedFunction(): Foo.FooInner.protectedFunction. + protected final fun protectedFunction(): MyClass public final fun public2Function(): MyClass - public final fun publicFunction(): Foo.FooInner.publicFunction. + public final fun publicFunction(): MyClass public final fun testFunctions(): kotlin.Unit public final fun testProperties(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpression.txt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpression.txt index 8de79875da8..12d9abe4cea 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpression.txt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpression.txt @@ -1,3 +1,3 @@ package -public fun foo(): foo. +public fun foo(): kotlin.Any diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpressionInConstructor.txt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpressionInConstructor.txt index 8027355e16c..536a9c0714b 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpressionInConstructor.txt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/functionAndProperty/objectExpressionInConstructor.txt @@ -2,7 +2,7 @@ package public final class Outer { public constructor Outer() - public final val x: Outer.x. + public final val x: kotlin.Any 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 diff --git a/compiler/testData/diagnostics/tests/extensions/GenericIterator.txt b/compiler/testData/diagnostics/tests/extensions/GenericIterator.txt index a66e3a89d96..73946c5ed5e 100644 --- a/compiler/testData/diagnostics/tests/extensions/GenericIterator.txt +++ b/compiler/testData/diagnostics/tests/extensions/GenericIterator.txt @@ -1,8 +1,8 @@ package public fun main(/*0*/ args: kotlin.Array): kotlin.Unit -public fun T?.iterator(): iterator. -public fun java.util.Enumeration.iterator(): iterator. +public fun T?.iterator(): MyIterator +public fun java.util.Enumeration.iterator(): kotlin.Iterator public interface MyIterator { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/extensions/GenericIterator2.txt b/compiler/testData/diagnostics/tests/extensions/GenericIterator2.txt index 85e5d0fab55..44ffde9dd82 100644 --- a/compiler/testData/diagnostics/tests/extensions/GenericIterator2.txt +++ b/compiler/testData/diagnostics/tests/extensions/GenericIterator2.txt @@ -1,4 +1,4 @@ package public fun a(/*0*/ e: java.util.Enumeration): kotlin.Unit -public fun java.util.Enumeration.iterator(): iterator. +public fun java.util.Enumeration.iterator(): kotlin.Iterator diff --git a/compiler/testData/diagnostics/tests/inner/illegalModifier.txt b/compiler/testData/diagnostics/tests/inner/illegalModifier.txt index d5c5d8bce0b..f7383b87eef 100644 --- a/compiler/testData/diagnostics/tests/inner/illegalModifier.txt +++ b/compiler/testData/diagnostics/tests/inner/illegalModifier.txt @@ -1,6 +1,6 @@ package -public val R: R. +public val R: kotlin.Any public val prop: kotlin.Int = 42 public fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.txt b/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.txt index e0f91c06f47..f613a8fead2 100644 --- a/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.txt +++ b/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.txt @@ -17,7 +17,7 @@ public final class Test { public companion object Companion : Test.InnerClass { private constructor Companion() - public final val a: Test.Companion.a. + public final val a: Test.InnerClass 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 more(): Test.InnerClass diff --git a/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.txt b/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.txt index 4472c4dbb66..b9ef2e4e8b1 100644 --- a/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.txt +++ b/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.txt @@ -24,7 +24,7 @@ public final class Test { public object Some : Test.InnerClass { private constructor Some() - public final val a: Test.Some.a. + public final val a: Test.InnerClass 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 more(): Test.InnerClass diff --git a/compiler/testData/diagnostics/tests/inner/kt6026.txt b/compiler/testData/diagnostics/tests/inner/kt6026.txt index 8d98662b8a7..ea72c018c0b 100644 --- a/compiler/testData/diagnostics/tests/inner/kt6026.txt +++ b/compiler/testData/diagnostics/tests/inner/kt6026.txt @@ -1,3 +1,3 @@ package -public val oo: oo. +public val oo: kotlin.Any diff --git a/compiler/testData/diagnostics/tests/objects/Objects.txt b/compiler/testData/diagnostics/tests/objects/Objects.txt index c70c501e8cc..d76e1bd8ccd 100644 --- a/compiler/testData/diagnostics/tests/objects/Objects.txt +++ b/compiler/testData/diagnostics/tests/objects/Objects.txt @@ -2,7 +2,7 @@ package package toplevelObjectDeclarations { public val x: kotlin.Int - public val y: toplevelObjectDeclarations.y. + public val y: toplevelObjectDeclarations.Foo public val z: kotlin.Int public object A : toplevelObjectDeclarations.Foo { diff --git a/compiler/testData/diagnostics/tests/objects/kt2240.txt b/compiler/testData/diagnostics/tests/objects/kt2240.txt index d758bfa2109..0f32c768039 100644 --- a/compiler/testData/diagnostics/tests/objects/kt2240.txt +++ b/compiler/testData/diagnostics/tests/objects/kt2240.txt @@ -1,7 +1,7 @@ package package a { - public val o: a.o. + public val o: kotlin.Any public fun a.A.foo(/*0*/ f: T): kotlin.Unit public final class A { diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.txt b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.txt index 0c9336170ae..6c4053813eb 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.txt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.txt @@ -1,6 +1,6 @@ package -public val anonObject: anonObject. +public val anonObject: kotlin.Any public object A { private constructor A() diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.txt index d7502e55b07..5a7b17af070 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.txt @@ -8,7 +8,7 @@ kotlin.js.native() public final class A { public final class B { public constructor B() - public final val anonymous: A.B.anonymous. + public final val anonymous: kotlin.Any 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 diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.txt index 5c8196ed79f..4a5697ab775 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.txt @@ -8,7 +8,7 @@ public final class A { public final class B { public constructor B() - public final val anonymous: A.B.anonymous. + public final val anonymous: kotlin.Any 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 diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.txt index d2fd8a12c2b..5a00c5bdfde 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.txt @@ -8,7 +8,7 @@ kotlin.js.native() public final class A { public final class B { public constructor B() - public final val anonymous: A.B.anonymous. + public final val anonymous: kotlin.Any 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 diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.txt index 54807a3f0e2..34b572eaebc 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.txt @@ -8,7 +8,7 @@ public final class A { public final class B { public constructor B() - public final val anonymous: A.B.anonymous. + public final val anonymous: kotlin.Any 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 diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.txt index fc791c50203..911ff008c2b 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.txt @@ -8,7 +8,7 @@ kotlin.js.native() public final class A { public final class B { public constructor B() - public final val anonymous: A.B.anonymous. + public final val anonymous: kotlin.Any 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 diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.txt index 539ebcde2ab..4b5b07a4c1c 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.txt @@ -8,7 +8,7 @@ public final class A { public final class B { public constructor B() - public final val anonymous: A.B.anonymous. + public final val anonymous: kotlin.Any 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 diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java index e15f8f7b502..d66095fe00b 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java @@ -167,6 +167,12 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl doTest(fileName); } + @TestMetadata("SimpleValAnonymousObject.A.kt") + public void testSimpleValAnonymousObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.A.kt"); + doTest(fileName); + } + @TestMetadata("StarImportEnum.A.kt") public void testStarImportEnum() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/StarImportEnum.A.kt");