From f7321b497b1de994142c4e5656f1980e2c404b36 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 17 Jan 2020 15:21:24 +0100 Subject: [PATCH 1/4] Set KotlinCompilerVersion.IS_PRE_RELEASE = true Since master is now 1.4-M1, and 1.4 is a pre-release version. --- .../src/org/jetbrains/kotlin/config/KotlinCompilerVersion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/util.runtime/src/org/jetbrains/kotlin/config/KotlinCompilerVersion.java b/core/util.runtime/src/org/jetbrains/kotlin/config/KotlinCompilerVersion.java index bb1ee0e6b0b..7b26d9e3bbe 100644 --- a/core/util.runtime/src/org/jetbrains/kotlin/config/KotlinCompilerVersion.java +++ b/core/util.runtime/src/org/jetbrains/kotlin/config/KotlinCompilerVersion.java @@ -27,7 +27,7 @@ public class KotlinCompilerVersion { // Binaries produced by this compiler with that language version (or any future language version) are going to be marked // as "pre-release" and will not be loaded by release versions of the compiler. // Change this value before and after every major release - private static final boolean IS_PRE_RELEASE = false; + private static final boolean IS_PRE_RELEASE = true; public static final String TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release"; From 90b250d2410f6b1f84b5269e40cf3976230438dd Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 24 Jan 2020 14:40:32 +0300 Subject: [PATCH 2/4] PSI2IR: Fix bound inner class constructor callable reference generation --- .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 + .../ReflectionReferencesGenerator.kt | 4 +- .../boundInnerGenericConstructor.fir.txt | 91 +++++++++++++++++ .../boundInnerGenericConstructor.kt | 13 +++ .../boundInnerGenericConstructor.txt | 98 +++++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + 6 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.fir.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 23161689b13..68c0a3a5482 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1349,6 +1349,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("boundInnerGenericConstructor.kt") + public void testBoundInnerGenericConstructor() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt"); + } + @TestMetadata("constructorWithAdaptedArguments.kt") public void testConstructorWithAdaptedArguments() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt"); diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt index 33179c5f6b1..199912b9558 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt @@ -218,8 +218,8 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St context.callToSubstitutedDescriptorMap[irAdapteeCallInner] = resolvedDescriptor - val irDispatchReceiver = dispatchReceiverValue?.load() - val irExtensionReceiver = extensionReceiverValue?.load() + val irDispatchReceiver = dispatchReceiverValue?.loadIfExists() + val irExtensionReceiver = extensionReceiverValue?.loadIfExists() if (irDispatchReceiver != null) { if (irDispatchReceiver.isSafeToUseWithoutCopying()) { diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.fir.txt new file mode 100644 index 00000000000..2ecab187eaa --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.fir.txt @@ -0,0 +1,91 @@ +FILE fqName:test fileName:/boundInnerGenericConstructor.kt + CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test.Foo + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> () returnType:test.Foo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test.Foo.Inner + TYPE_PARAMETER name:P index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (a:T of test.Foo, b:P of test.Foo.Inner) returnType:test.Foo.Inner

[primary] + VALUE_PARAMETER name:a index:0 type:T of test.Foo + VALUE_PARAMETER name:b index:1 type:P of test.Foo.Inner + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]' + PROPERTY name:a visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:a type:T of test.Foo visibility:private [final] + EXPRESSION_BODY + GET_VAR 'a: T of test.Foo declared in test.Foo.Inner.' type=T of test.Foo origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Foo.Inner) returnType:T of test.Foo + correspondingProperty: PROPERTY name:a visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:test.Foo.Inner + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of test.Foo declared in test.Foo.Inner' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:T of test.Foo visibility:private [final]' type=T of test.Foo origin=null + receiver: GET_VAR ': test.Foo.Inner declared in test.Foo.Inner.' type=test.Foo.Inner origin=null + PROPERTY name:b visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:b type:P of test.Foo.Inner visibility:private [final] + EXPRESSION_BODY + GET_VAR 'b: P of test.Foo.Inner declared in test.Foo.Inner.' type=P of test.Foo.Inner origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Foo.Inner) returnType:P of test.Foo.Inner + correspondingProperty: PROPERTY name:b visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:test.Foo.Inner + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): P of test.Foo.Inner declared in test.Foo.Inner' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:b type:P of test.Foo.Inner visibility:private [final]' type=P of test.Foo.Inner origin=null + receiver: GET_VAR ': test.Foo.Inner declared in test.Foo.Inner.' type=test.Foo.Inner origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:foo visibility:public modality:FINAL (a:A of test.foo, b:B of test.foo, x:kotlin.Function2>) returnType:test.Foo.Inner [inline] + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:a index:0 type:A of test.foo + VALUE_PARAMETER name:b index:1 type:B of test.foo + VALUE_PARAMETER name:x index:2 type:kotlin.Function2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (a: A of test.foo, b: B of test.foo, x: kotlin.Function2>): test.Foo.Inner [inline] declared in test' + CALL 'public abstract fun invoke (p1: A of test.foo, p2: B of test.foo): test.Foo.Inner [operator] declared in kotlin.Function2' type=test.Foo.Inner origin=null + $this: GET_VAR 'x: kotlin.Function2> declared in test.foo' type=kotlin.Function2> origin=null + p1: GET_VAR 'a: A of test.foo declared in test.foo' type=A of test.foo origin=null + p2: GET_VAR 'b: B of test.foo declared in test.foo' type=B of test.foo origin=null + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:z type:test.Foo [val] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in test.Foo' type=test.Foo origin=null + : kotlin.String + VAR name:foo type:IrErrorType [val] + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + CONST String type=kotlin.String value="O" + CONST String type=kotlin.String value="K" + FUNCTION_REFERENCE 'public constructor (a: T of test.Foo, b: P of test.Foo.Inner) [primary] declared in test.Foo.Inner' type=kotlin.reflect.KFunction2> origin=null reflectionTarget= + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in test' + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin' type=kotlin.String origin=null + $receiver: ERROR_CALL 'Unresolved reference: #' type=IrErrorType + other: ERROR_CALL 'Unresolved reference: #' type=IrErrorType diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt new file mode 100644 index 00000000000..74d6002459a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt @@ -0,0 +1,13 @@ +package test + +class Foo { + inner class Inner

(val a: T, val b: P) +} + +inline fun foo(a: A, b: B, x: (A, B) -> Foo.Inner): Foo.Inner = x(a, b) + +fun box(): String { + val z = Foo() + val foo = foo("O", "K", z::Inner) + return foo.a + foo.b +} diff --git a/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.txt b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.txt new file mode 100644 index 00000000000..dde638e9a37 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.txt @@ -0,0 +1,98 @@ +FILE fqName:test fileName:/boundInnerGenericConstructor.kt + CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test.Foo + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> () returnType:test.Foo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test.Foo.Inner

+ TYPE_PARAMETER name:P index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> ($this:test.Foo, a:T of test.Foo, b:P of test.Foo.Inner) returnType:test.Foo.Inner

[primary] + $outer: VALUE_PARAMETER name: type:test.Foo + VALUE_PARAMETER name:a index:0 type:T of test.Foo + VALUE_PARAMETER name:b index:1 type:P of test.Foo.Inner + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]' + PROPERTY name:a visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:a type:T of test.Foo visibility:private [final] + EXPRESSION_BODY + GET_VAR 'a: T of test.Foo declared in test.Foo.Inner.' type=T of test.Foo origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Foo.Inner

) returnType:T of test.Foo + correspondingProperty: PROPERTY name:a visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:test.Foo.Inner

+ BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of test.Foo declared in test.Foo.Inner' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:a type:T of test.Foo visibility:private [final]' type=T of test.Foo origin=null + receiver: GET_VAR ': test.Foo.Inner

declared in test.Foo.Inner.' type=test.Foo.Inner

origin=null + PROPERTY name:b visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:b type:P of test.Foo.Inner visibility:private [final] + EXPRESSION_BODY + GET_VAR 'b: P of test.Foo.Inner declared in test.Foo.Inner.' type=P of test.Foo.Inner origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Foo.Inner

) returnType:P of test.Foo.Inner + correspondingProperty: PROPERTY name:b visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:test.Foo.Inner

+ BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): P of test.Foo.Inner declared in test.Foo.Inner' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:b type:P of test.Foo.Inner visibility:private [final]' type=P of test.Foo.Inner origin=null + receiver: GET_VAR ': test.Foo.Inner

declared in test.Foo.Inner.' type=test.Foo.Inner

origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:foo visibility:public modality:FINAL (a:A of test.foo, b:B of test.foo, x:kotlin.Function2>) returnType:test.Foo.Inner [inline] + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] + TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:a index:0 type:A of test.foo + VALUE_PARAMETER name:b index:1 type:B of test.foo + VALUE_PARAMETER name:x index:2 type:kotlin.Function2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (a: A of test.foo, b: B of test.foo, x: kotlin.Function2>): test.Foo.Inner [inline] declared in test' + CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=test.Foo.Inner origin=INVOKE + $this: GET_VAR 'x: kotlin.Function2> declared in test.foo' type=kotlin.Function2> origin=VARIABLE_AS_FUNCTION + p1: GET_VAR 'a: A of test.foo declared in test.foo' type=A of test.foo origin=null + p2: GET_VAR 'b: B of test.foo declared in test.foo' type=B of test.foo origin=null + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:z type:test.Foo [val] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in test.Foo' type=test.Foo origin=null + : kotlin.String + VAR name:foo type:test.Foo.Inner [val] + CALL 'public final fun foo (a: A of test.foo, b: B of test.foo, x: kotlin.Function2>): test.Foo.Inner [inline] declared in test' type=test.Foo.Inner origin=null + : kotlin.String + : kotlin.String + a: CONST String type=kotlin.String value="O" + b: CONST String type=kotlin.String value="K" + x: FUNCTION_REFERENCE 'public constructor (a: T of test.Foo, b: P of test.Foo.Inner) [primary] declared in test.Foo.Inner' type=kotlin.reflect.KFunction2<@[ParameterName(name = 'a')] kotlin.String, @[ParameterName(name = 'b')] kotlin.String, test.Foo.Inner> origin=null reflectionTarget= +

: kotlin.String + $this: GET_VAR 'val z: test.Foo [val] declared in test.box' type=test.Foo origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in test' + CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS + $this: CALL 'public final fun (): T of test.Foo declared in test.Foo.Inner' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR 'val foo: test.Foo.Inner [val] declared in test.box' type=test.Foo.Inner origin=null + other: CALL 'public final fun (): P of test.Foo.Inner declared in test.Foo.Inner' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR 'val foo: test.Foo.Inner [val] declared in test.box' type=test.Foo.Inner origin=null diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index ee6e2a05b5e..be418b520f7 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1348,6 +1348,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("boundInnerGenericConstructor.kt") + public void testBoundInnerGenericConstructor() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/boundInnerGenericConstructor.kt"); + } + @TestMetadata("constructorWithAdaptedArguments.kt") public void testConstructorWithAdaptedArguments() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt"); From 5c6e71001393dc42611e03d7a133b00eb86e794a Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Fri, 24 Jan 2020 16:40:44 +0300 Subject: [PATCH 3/4] Revert "Workaround an inliner problem upon which the compiler code itself stumbled ^KT-35856 Fixed" This reverts commit 59175912 --- ...irOldFrontendDiagnosticsTestGenerated.java | 5 ----- .../kotlin/asJava/classes/ultraLightUtils.kt | 6 +++--- .../kotlinAnnotationOnJavaInterface.fir.kt | 12 ----------- .../kotlinAnnotationOnJavaInterface.kt | 12 ----------- .../kotlinAnnotationOnJavaInterface.txt | 21 ------------------- .../checkers/DiagnosticsTestGenerated.java | 5 ----- .../DiagnosticsUsingJavacTestGenerated.java | 5 ----- 7 files changed, 3 insertions(+), 63 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt delete mode 100644 compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.txt diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index c602b88b0df..ff323aca818 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -970,11 +970,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/annotations/javaUnrepeatable.kt"); } - @TestMetadata("kotlinAnnotationOnJavaInterface.kt") - public void testKotlinAnnotationOnJavaInterface() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt"); - } - @TestMetadata("kt1860-negative.kt") public void testKt1860_negative() throws Exception { runTest("compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt"); diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt index b1d5353ef53..3253b70738c 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt @@ -418,8 +418,8 @@ inline fun runReadAction(crossinline runnable: () -> T): T { return ApplicationManager.getApplication().runReadAction(Computable { runnable() }) } -fun KtClassOrObject.safeIsLocal(): Boolean = runReadAction { this.isLocal } +inline fun KtClassOrObject.safeIsLocal(): Boolean = runReadAction { this.isLocal } -fun KtFile.safeIsScript() = runReadAction { this.isScript() } +inline fun KtFile.safeIsScript() = runReadAction { this.isScript() } -fun KtFile.safeScript() = runReadAction { this.script } \ No newline at end of file +inline fun KtFile.safeScript() = runReadAction { this.script } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.fir.kt b/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.fir.kt deleted file mode 100644 index 0e0be7ef09d..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Issue: KT-35856 - -// FILE: Bar.java -@Anno -public interface Bar {} - -// FILE: Foo.kt -@Target(AnnotationTarget.FILE, AnnotationTarget.CLASS) -@Retention(AnnotationRetention.BINARY) -annotation class Anno - -class Foo : Bar diff --git a/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt b/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt deleted file mode 100644 index 0e0be7ef09d..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Issue: KT-35856 - -// FILE: Bar.java -@Anno -public interface Bar {} - -// FILE: Foo.kt -@Target(AnnotationTarget.FILE, AnnotationTarget.CLASS) -@Retention(AnnotationRetention.BINARY) -annotation class Anno - -class Foo : Bar diff --git a/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.txt b/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.txt deleted file mode 100644 index 2751e4c13ef..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.txt +++ /dev/null @@ -1,21 +0,0 @@ -package - -@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FILE, AnnotationTarget.CLASS}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class Anno : kotlin.Annotation { - public constructor Anno() - 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 -} - -@Anno public interface Bar { - 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 Foo : Bar { - public constructor Foo() - 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/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 80597fd899b..e185e423abb 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -977,11 +977,6 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/annotations/javaUnrepeatable.kt"); } - @TestMetadata("kotlinAnnotationOnJavaInterface.kt") - public void testKotlinAnnotationOnJavaInterface() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt"); - } - @TestMetadata("kt1860-negative.kt") public void testKt1860_negative() throws Exception { runTest("compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index a4ebee489ea..f24d86f3444 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -972,11 +972,6 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/annotations/javaUnrepeatable.kt"); } - @TestMetadata("kotlinAnnotationOnJavaInterface.kt") - public void testKotlinAnnotationOnJavaInterface() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt"); - } - @TestMetadata("kt1860-negative.kt") public void testKt1860_negative() throws Exception { runTest("compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt"); From b647d2c645b67b7c39efbe460d0618cc709d12eb Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Fri, 24 Jan 2020 12:47:05 +0300 Subject: [PATCH 4/4] Prolong deprecation cycle for several restrictions until 1.5 ProhibitInvisibleAbstractMethodsInSuperclasses & ProhibitNonReifiedArraysAsReifiedTypeArguments were implemented in 1.3.70, so actually they should be enabled only in 1.5 --- .../jetbrains/kotlin/config/LanguageVersionSettings.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 441a097c309..50bb64aa949 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -112,8 +112,6 @@ enum class LanguageFeature( ProperComputationOrderOfTailrecDefaultParameters(KOTLIN_1_4), AllowNullableArrayArgsInMain(KOTLIN_1_4), TrailingCommas(KOTLIN_1_4), - ProhibitInvisibleAbstractMethodsInSuperclasses(KOTLIN_1_4, kind = BUG_FIX), - ProhibitNonReifiedArraysAsReifiedTypeArguments(KOTLIN_1_4, kind = BUG_FIX), ProhibitProtectedCallFromInline(KOTLIN_1_4, kind = BUG_FIX), ProperFinally(KOTLIN_1_4, kind = BUG_FIX), AllowAssigningArrayElementsToVarargsInNamedFormForFunctions(KOTLIN_1_4), @@ -128,13 +126,13 @@ enum class LanguageFeature( FunctionalInterfaceConversion(KOTLIN_1_4, kind = UNSTABLE_FEATURE), ProhibitSpreadOnSignaturePolymorphicCall(KOTLIN_1_5, kind = BUG_FIX), + ProhibitInvisibleAbstractMethodsInSuperclasses(KOTLIN_1_5, kind = BUG_FIX), + ProhibitNonReifiedArraysAsReifiedTypeArguments(KOTLIN_1_5, kind = BUG_FIX), + ProhibitVarargAsArrayAfterSamArgument(KOTLIN_1_5, kind = BUG_FIX), // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), - // TODO: set `sinceVersion` to KOTLIN_1_5 - ProhibitVarargAsArrayAfterSamArgument(sinceVersion = null, kind = BUG_FIX), - // Experimental features Coroutines(