diff --git a/compiler/testData/diagnostics/tests/PackageInExpressionPosition.kt b/compiler/testData/diagnostics/tests/PackageInExpressionPosition.kt index 19bbc758b52..4de84a1a10e 100644 --- a/compiler/testData/diagnostics/tests/PackageInExpressionPosition.kt +++ b/compiler/testData/diagnostics/tests/PackageInExpressionPosition.kt @@ -3,24 +3,24 @@ package foo class X {} val s = java -val ss = System -val sss = X -val x = "${System}" +val ss = System +val sss = X +val x = "${System}" val xs = java.lang -val xss = java.lang.System -val xsss = foo.X +val xss = java.lang.System +val xsss = foo.X val xssss = foo -val f = { System } +val f = { System } fun main(args : Array) { java = null - System = null - System!! - java.lang.System = null - java.lang.System!! - System is Int + System = null + System!! + java.lang.System = null + java.lang.System!! + System is Int System() - (System) - foo@ System - null in System + (System) + foo@ System + null in System } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/PackageInExpressionPosition.txt b/compiler/testData/diagnostics/tests/PackageInExpressionPosition.txt index 4485e026e44..42cd87be5ec 100644 --- a/compiler/testData/diagnostics/tests/PackageInExpressionPosition.txt +++ b/compiler/testData/diagnostics/tests/PackageInExpressionPosition.txt @@ -1,14 +1,14 @@ package package foo { - public val f: () -> ??? + public val f: () -> java.lang.System public val s: [ERROR : Type for java] - public val ss: [ERROR : Type for System] - public val sss: [ERROR : Type for X] + public val ss: java.lang.System + public val sss: foo.X public val x: kotlin.String public val xs: [ERROR : Type for java.lang] - public val xss: [ERROR : Type for java.lang.System] - public val xsss: [ERROR : Type for foo.X] + public val xss: java.lang.System + public val xsss: foo.X public val xssss: [ERROR : Type for foo] public fun main(/*0*/ args: kotlin.Array): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/SafeCallOnFakePackage.kt b/compiler/testData/diagnostics/tests/SafeCallOnFakePackage.kt index ecd81a884b6..e050eab938d 100644 --- a/compiler/testData/diagnostics/tests/SafeCallOnFakePackage.kt +++ b/compiler/testData/diagnostics/tests/SafeCallOnFakePackage.kt @@ -10,7 +10,7 @@ val s: String = "test" // FILE: test.kt fun ff() { - val a = Test?.FOO - val b = foo?.s - System?.out.println(a + b) + val a = Test?.FOO + val b = foo?.s + System?.out.println(a + b) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt b/compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt index 95191baeb53..fa901d730f6 100644 --- a/compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt +++ b/compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt @@ -36,7 +36,7 @@ val a = A.x val c = B.x val d = b.x -val s = System // error +val s = System // error fun test() { System.out.println() java.lang.System.out.println() diff --git a/compiler/testData/diagnostics/tests/classObjects/ClassObjects.txt b/compiler/testData/diagnostics/tests/classObjects/ClassObjects.txt index a672bc12d37..0c499f84944 100644 --- a/compiler/testData/diagnostics/tests/classObjects/ClassObjects.txt +++ b/compiler/testData/diagnostics/tests/classObjects/ClassObjects.txt @@ -4,7 +4,7 @@ package Jet86 { public val a: kotlin.Int = 1 public val c: [ERROR : Type for B.x] public val d: [ERROR : Type for b.x] - public val s: [ERROR : Type for System] + public val s: java.lang.System public fun test(): kotlin.Unit public final class A { diff --git a/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughClassObject.kt b/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughClassObject.kt index f5a74364b7e..680e6fe56cf 100644 --- a/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughClassObject.kt +++ b/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughClassObject.kt @@ -28,7 +28,7 @@ object O { fun f() { A.c A.hashCode() - A().Nested + A().Nested A.Nested() A().Inner() A.Companion.Nested diff --git a/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt b/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt index 67f11564278..f8be2f7d2c9 100644 --- a/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt +++ b/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt @@ -42,7 +42,7 @@ fun f() { C.O C.O.InO C.A() - C.B() + C.B() C.E3.O_O C.E3.G() diff --git a/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt b/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt new file mode 100644 index 00000000000..fce3cdad0d5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt @@ -0,0 +1,20 @@ +class Another { + @Deprecated("Object") + companion object { + fun use() {} + const val USE = 42 + } +} + +fun first() { + Another.use() + Another.Companion.USE // TODO + Another.USE // TODO +} + +fun useCompanion() { + val d = Another + val x = Another.Companion + Another.Companion.use() + Another.use() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.txt b/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.txt new file mode 100644 index 00000000000..22f5d0b7da9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.txt @@ -0,0 +1,20 @@ +package + +public fun first(): kotlin.Unit +public fun useCompanion(): kotlin.Unit + +public final class Another { + public constructor Another() + 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 + + @kotlin.Deprecated(message = "Object") public companion object Companion { + private constructor Companion() + public const final val USE: kotlin.Int = 42 + 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 fun use(): kotlin.Unit + } +} diff --git a/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt b/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt index ed34c52ae70..108f1f56c9f 100644 --- a/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/objectUsage.kt @@ -3,25 +3,7 @@ object Obsolete { fun use() {} } -class Another { - @Deprecated("Object") - companion object { - fun use() {} - } -} - -fun first() { - Another.use() -} - fun useObject() { Obsolete.use() val x = Obsolete } - -fun useCompanion() { - val d = Another - val x = Another.Companion - Another.Companion.use() - Another.use() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/deprecated/objectUsage.txt b/compiler/testData/diagnostics/tests/deprecated/objectUsage.txt index b3686849fc4..2cd5a280289 100644 --- a/compiler/testData/diagnostics/tests/deprecated/objectUsage.txt +++ b/compiler/testData/diagnostics/tests/deprecated/objectUsage.txt @@ -1,24 +1,7 @@ package -public fun first(): kotlin.Unit -public fun useCompanion(): kotlin.Unit public fun useObject(): kotlin.Unit -public final class Another { - public constructor Another() - 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 - - @kotlin.Deprecated(message = "Object") public companion object Companion { - private constructor Companion() - 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 fun use(): kotlin.Unit - } -} - @kotlin.Deprecated(message = "Object") public object Obsolete { private constructor Obsolete() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/arrayExpression.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/arrayExpression.kt index c94d9ba916f..64480d663e8 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/arrayExpression.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/arrayExpression.kt @@ -3,5 +3,5 @@ package bar fun main(args : Array) { class Some - Some[] names = ["ads"] + Some[] names = ["ads"] } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inner/constructorAccess.kt b/compiler/testData/diagnostics/tests/inner/constructorAccess.kt index 91e8f63dcc7..f31a5f1e4d7 100644 --- a/compiler/testData/diagnostics/tests/inner/constructorAccess.kt +++ b/compiler/testData/diagnostics/tests/inner/constructorAccess.kt @@ -8,8 +8,8 @@ class Outer1 { inner class Inner - class C5 { val b = Inner() } - class C6(val b: Any = Inner()) + class C5 { val b = Inner() } + class C6(val b: Any = Inner()) inner class C7 { val b = Inner() } inner class C8(val b: Any = Inner()) } @@ -18,7 +18,7 @@ class Outer1 { class Outer2 { class Nested { fun foo() = Outer2() - fun bar() = Inner() + fun bar() = Inner() } inner class Inner { fun foo() = Outer2() diff --git a/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt b/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt index fc94449fdad..955710761ab 100644 --- a/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt +++ b/compiler/testData/diagnostics/tests/inner/innerErrorForClassObjects.kt @@ -10,7 +10,7 @@ class Test { } fun more(): InnerClass { - val b = InnerClass() + val b = InnerClass() val testVal = inClass foo() diff --git a/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt b/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt index fee2aff02d6..ad861aecc98 100644 --- a/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt +++ b/compiler/testData/diagnostics/tests/inner/innerErrorForObjects.kt @@ -10,7 +10,7 @@ class Test { } fun more(): InnerClass { - val b = InnerClass() + val b = InnerClass() val testVal = inClass foo() diff --git a/compiler/testData/diagnostics/tests/inner/nestedClassAccessedViaInstanceReference.kt b/compiler/testData/diagnostics/tests/inner/nestedClassAccessedViaInstanceReference.kt index 3c001b643b8..c233d9959f8 100644 --- a/compiler/testData/diagnostics/tests/inner/nestedClassAccessedViaInstanceReference.kt +++ b/compiler/testData/diagnostics/tests/inner/nestedClassAccessedViaInstanceReference.kt @@ -28,7 +28,7 @@ fun test(with: WithClassObject, without: WithoutClassObject, obj: Obj) { with.NestedWithClassObject with.NestedWithClassObject() with.NestedWithClassObject.foo() - with.NestedEnum.A + with.NestedEnum.A with.NestedObj with.NestedObj() with.NestedObj.foo() @@ -37,7 +37,7 @@ fun test(with: WithClassObject, without: WithoutClassObject, obj: Obj) { without.NestedWithClassObject without.NestedWithClassObject() without.NestedWithClassObject.foo() - without.NestedEnum.A + without.NestedEnum.A without.NestedObj without.NestedObj() without.NestedObj.foo() @@ -46,9 +46,8 @@ fun test(with: WithClassObject, without: WithoutClassObject, obj: Obj) { obj.NestedWithClassObject obj.NestedWithClassObject() obj.NestedWithClassObject.foo() - obj.NestedEnum.A + obj.NestedEnum.A obj.NestedObj obj.NestedObj() obj.NestedObj.foo() -} - +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inner/qualifiedExpression/constructNestedClass.kt b/compiler/testData/diagnostics/tests/inner/qualifiedExpression/constructNestedClass.kt index a776810281f..7b4b0e32373 100644 --- a/compiler/testData/diagnostics/tests/inner/qualifiedExpression/constructNestedClass.kt +++ b/compiler/testData/diagnostics/tests/inner/qualifiedExpression/constructNestedClass.kt @@ -11,7 +11,7 @@ class Outer { fun f1() = Outer() fun f2() = Outer.Nested() fun f3() = Outer.Nested.NestedNested() -fun f4() = Outer.Inner() -fun f5() = Outer.Inner.InnerInner() +fun f4() = Outer.Inner() +fun f5() = Outer.Inner.InnerInner() fun f6() = Outer().Inner() fun f7() = Outer().Inner().InnerInner() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inner/referenceToSelfInLocal.kt b/compiler/testData/diagnostics/tests/inner/referenceToSelfInLocal.kt index b0cb260fad8..a359b467051 100644 --- a/compiler/testData/diagnostics/tests/inner/referenceToSelfInLocal.kt +++ b/compiler/testData/diagnostics/tests/inner/referenceToSelfInLocal.kt @@ -27,4 +27,4 @@ val closure = { val x: MyClass = MyClass() } } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt2956.kt b/compiler/testData/diagnostics/tests/regressions/kt2956.kt index e128a6685de..d0b150002ee 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt2956.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt2956.kt @@ -1 +1 @@ -val a: String = Nothing \ No newline at end of file +val a: String = Nothing \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt4827.kt b/compiler/testData/diagnostics/tests/regressions/kt4827.kt index a1d5ec830d8..00982055f05 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt4827.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt4827.kt @@ -11,6 +11,6 @@ class C { } fun f() { - TestInterface() - C.I() + TestInterface() + C.I() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.kt b/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.kt new file mode 100644 index 00000000000..1dd8405d4a1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.kt @@ -0,0 +1,23 @@ +class A private constructor() + +class B { + private companion object +} + +class C(val x: Int) + +class D private constructor() { + companion object +} + +class E private constructor() { + companion object { + operator fun invoke(x: Int) = x + } +} + +val a = A +val b = B +val c = C +val d = D +val e = E(42) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.txt b/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.txt new file mode 100644 index 00000000000..e560bfa5f4c --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.txt @@ -0,0 +1,65 @@ +package + +public val a: A +public val b: B.Companion +public val c: C +public val d: D.Companion +public val e: kotlin.Int + +public final class A { + private constructor A() + 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 B { + public constructor B() + 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 + + private companion object Companion { + private constructor Companion() + 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 C { + public constructor C(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 D { + private 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 companion object Companion { + private constructor Companion() + 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 E { + private constructor E() + 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 companion object Companion { + private constructor Companion() + 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 operator fun invoke(/*0*/ x: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/resolve/localObject.kt b/compiler/testData/diagnostics/tests/resolve/localObject.kt new file mode 100644 index 00000000000..c649b686303 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/localObject.kt @@ -0,0 +1,4 @@ +fun foo(): Any { + object Bar + return Bar +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/localObject.txt b/compiler/testData/diagnostics/tests/resolve/localObject.txt new file mode 100644 index 00000000000..2f7e731adfb --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/localObject.txt @@ -0,0 +1,3 @@ +package + +public fun foo(): kotlin.Any diff --git a/compiler/testData/diagnostics/tests/resolve/wrongReceiver.kt b/compiler/testData/diagnostics/tests/resolve/wrongReceiver.kt index c311a1751aa..3207307bb62 100644 --- a/compiler/testData/diagnostics/tests/resolve/wrongReceiver.kt +++ b/compiler/testData/diagnostics/tests/resolve/wrongReceiver.kt @@ -8,7 +8,7 @@ val Int.foo: Int get() = 4 fun Int.extFun() = 4 fun String.test() { - some + some some.A() "".some diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt index 88a3a63a021..931029ea0a6 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt @@ -36,7 +36,7 @@ class E: A() { B().foo() // todo: some resolve hacks B().bar() - D() + D() C() } } @@ -58,7 +58,7 @@ class F: A() { companion object { init { B().fas() - D().f() + D().f() } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt index 312750c3a41..2eebc48b594 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt @@ -46,7 +46,7 @@ class Y: B() { init { B_() - B.B_() + B.B_() Y.B_() B_S() @@ -59,7 +59,7 @@ class Y: B() { val b_s: B_S = null!! init { - B_() + B_() B_S() } } @@ -83,7 +83,7 @@ class Z: C() { init { A_S() - B_() + B_() B_S() } } diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt index 86a3fc8d66a..643f3673ed2 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt @@ -36,7 +36,7 @@ public class F extends D { class X: D() { init { B_() - B.B_() + B.B_() C.B_() D.B_() X.B_() diff --git a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.kt b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.kt index 24b303294cc..2264609a5ae 100644 --- a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.kt +++ b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.kt @@ -11,7 +11,7 @@ sealed class Tree { fun maxIsClass(): Int = when(this) { Empty -> -1 - Leaf -> 0 + Leaf -> 0 is Node -> this.left.max() } @@ -20,4 +20,4 @@ sealed class Tree { is Node -> this.left.max() else -> -1 } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/javaPackageMembers.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaPackageMembers.kt new file mode 100644 index 00000000000..95ee62372b4 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaPackageMembers.kt @@ -0,0 +1,9 @@ +fun fn(): Nothing = throw java.lang.RuntimeException("oops") + +val x = throw java.lang.RuntimeException("oops") + +class SomeClass { + fun method() { + throw java.lang.AssertionError("!!!") + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/javaPackageMembers.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaPackageMembers.txt new file mode 100644 index 00000000000..cc523d91d9e --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaPackageMembers.txt @@ -0,0 +1,12 @@ +package + +public val x: kotlin.Nothing +public fun fn(): kotlin.Nothing + +public final class SomeClass { + public constructor SomeClass() + 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 method(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/javaStaticMembers.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaStaticMembers.kt new file mode 100644 index 00000000000..dcb6eba37cd --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaStaticMembers.kt @@ -0,0 +1,12 @@ +// FILE: Test.java +public class Test { + public static final String FOO = "test"; +} + +// FILE: test.kt +fun ff() { + val a = Test.FOO + val b = Test?.FOO + System.out.println(a + b) + System?.out.println(a + b) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/javaStaticMembers.txt b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaStaticMembers.txt new file mode 100644 index 00000000000..5d253e3310a --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/javaStaticMembers.txt @@ -0,0 +1,13 @@ +package + +public fun ff(): kotlin.Unit + +public open class Test { + public constructor Test() + 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 + + // Static members + public const final val FOO: kotlin.String = "test" +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 5c9c050efe9..de05ca5335d 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -4773,6 +4773,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("companionObjectUsage.kt") + public void testCompanionObjectUsage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deprecated/companionObjectUsage.kt"); + doTest(fileName); + } + @TestMetadata("componentUsage.kt") public void testComponentUsage() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deprecated/componentUsage.kt"); @@ -13068,6 +13074,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("constructorVsCompanion.kt") + public void testConstructorVsCompanion() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/constructorVsCompanion.kt"); + doTest(fileName); + } + @TestMetadata("CycleInTypeArgs.kt") public void testCycleInTypeArgs() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.kt"); @@ -13104,6 +13116,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("localObject.kt") + public void testLocalObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/localObject.kt"); + doTest(fileName); + } + @TestMetadata("objectLiteralAsArgument.kt") public void testObjectLiteralAsArgument() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/objectLiteralAsArgument.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 506980cb299..eb3fcf23118 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -964,6 +964,18 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/resolve"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("javaPackageMembers.kt") + public void testJavaPackageMembers() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/resolve/javaPackageMembers.kt"); + doTest(fileName); + } + + @TestMetadata("javaStaticMembers.kt") + public void testJavaStaticMembers() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/resolve/javaStaticMembers.kt"); + doTest(fileName); + } + @TestMetadata("kt4711.kt") public void testKt4711() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/resolve/kt4711.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java b/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java index e8585f96b75..40932644326 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java @@ -128,7 +128,7 @@ public class KotlinTypeCheckerTest extends KotlinLiteFixture { } public void testJumps() throws Exception { - assertType("throw java.lang.Exception()", builtIns.getNothingType()); + assertType("throw Exception()", builtIns.getNothingType()); assertType("continue", builtIns.getNothingType()); assertType("break", builtIns.getNothingType()); } diff --git a/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages1.results.txt b/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages1.results.txt index ba1c507c3d7..88078951fb2 100644 --- a/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages1.results.txt +++ b/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages1.results.txt @@ -1 +1 @@ -Value read (6: 12) return Bar +Value read (6: 12) return Bar \ No newline at end of file diff --git a/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages2.results.txt b/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages2.results.txt index 168f0885a02..478b5b223d9 100644 --- a/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages2.results.txt +++ b/idea/testData/findUsages/kotlin/findObjectUsages/kotlinLocalObjectUsages2.results.txt @@ -1 +1 @@ -Value read (7: 16) return Bar +Value read (7: 16) return Bar \ No newline at end of file diff --git a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.after.kt b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.after.kt index 60cf4e1079f..3714920386a 100644 --- a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.after.kt +++ b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.after.kt @@ -1,5 +1,6 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" // ERROR: Unresolved reference: SomeTest +// ERROR: Expression expected, but a package name found // ACTION: Edit intention settings // ACTION: Replace safe access expression with 'if' expression // ACTION: Disable 'Replace Safe Access Expression with 'if' Expression' diff --git a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt index e575b1dcfda..29a618e388b 100644 --- a/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt +++ b/idea/testData/quickfix/autoImports/noImportInSafeQualifiedExpressionNotFirst.before.Main.kt @@ -1,5 +1,6 @@ // "class org.jetbrains.kotlin.idea.quickfix.AutoImportFix" "false" // ERROR: Unresolved reference: SomeTest +// ERROR: Expression expected, but a package name found // ACTION: Create class 'SomeTest' // ACTION: Replace safe access expression with 'if' expression diff --git a/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt b/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt index 7eff2d31234..c880b13579e 100644 --- a/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt +++ b/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt @@ -1,5 +1,5 @@ // "Import" "true" -// ERROR: Please specify constructor invocation; classifier 'ArrayList' does not have a companion object +// ERROR: Function invocation 'ArrayList()' expected // KT-4000 diff --git a/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt.after b/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt.after index 34d5e839e1c..cae88b4a17b 100644 --- a/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt.after +++ b/idea/testData/quickfix/autoImports/unresolvedReferenceInCall.kt.after @@ -1,5 +1,5 @@ // "Import" "true" -// ERROR: Please specify constructor invocation; classifier 'ArrayList' does not have a companion object +// ERROR: Function invocation 'ArrayList()' expected // KT-4000 diff --git a/idea/testData/safeDelete/deleteObject/kotlinObject/localObject1.kt.after b/idea/testData/safeDelete/deleteObject/kotlinObject/localObject1.kt.after new file mode 100644 index 00000000000..5ed3db24457 --- /dev/null +++ b/idea/testData/safeDelete/deleteObject/kotlinObject/localObject1.kt.after @@ -0,0 +1,4 @@ +fun foo() { + + A +} \ No newline at end of file diff --git a/idea/testData/shortenRefs/InterfaceInExpression.kt b/idea/testData/shortenRefs/InterfaceInExpression.kt new file mode 100644 index 00000000000..7e804685e29 --- /dev/null +++ b/idea/testData/shortenRefs/InterfaceInExpression.kt @@ -0,0 +1,3 @@ +fun foo() { + java.util.List +} \ No newline at end of file diff --git a/idea/testData/shortenRefs/InterfaceInExpression.kt.after b/idea/testData/shortenRefs/InterfaceInExpression.kt.after new file mode 100644 index 00000000000..29755661383 --- /dev/null +++ b/idea/testData/shortenRefs/InterfaceInExpression.kt.after @@ -0,0 +1,5 @@ +import java.util.List + +fun foo() { + List +} diff --git a/idea/tests/org/jetbrains/kotlin/shortenRefs/ShortenRefsTestGenerated.java b/idea/tests/org/jetbrains/kotlin/shortenRefs/ShortenRefsTestGenerated.java index 921fd103a92..abb98d1c75b 100644 --- a/idea/tests/org/jetbrains/kotlin/shortenRefs/ShortenRefsTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/shortenRefs/ShortenRefsTestGenerated.java @@ -59,6 +59,12 @@ public class ShortenRefsTestGenerated extends AbstractShortenRefsTest { doTest(fileName); } + @TestMetadata("InterfaceInExpression.kt") + public void testInterfaceInExpression() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/shortenRefs/InterfaceInExpression.kt"); + doTest(fileName); + } + @TestMetadata("JavaStaticMethod.kt") public void testJavaStaticMethod() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/shortenRefs/JavaStaticMethod.kt"); diff --git a/jps-plugin/testData/incremental/withJava/javaUsedInKotlin/samConversions/methodAdded/build.log b/jps-plugin/testData/incremental/withJava/javaUsedInKotlin/samConversions/methodAdded/build.log index 351c19dafcc..33acb90e24b 100644 --- a/jps-plugin/testData/incremental/withJava/javaUsedInKotlin/samConversions/methodAdded/build.log +++ b/jps-plugin/testData/incremental/withJava/javaUsedInKotlin/samConversions/methodAdded/build.log @@ -17,7 +17,5 @@ src/usageWithFunctionExpression.kt src/usageWithFunctionLiteral.kt End of files COMPILATION FAILED -Expression 'SamInterface' cannot be invoked as a function. The function invoke() is not found -Please specify constructor invocation; classifier 'SamInterface' does not have a companion object -Expression 'SamInterface' cannot be invoked as a function. The function invoke() is not found -Please specify constructor invocation; classifier 'SamInterface' does not have a companion object \ No newline at end of file +Unresolved reference: SamInterface +Unresolved reference: SamInterface \ No newline at end of file