[SamWithReceiver] Fix test configuration and testdata

This commit is contained in:
Dmitriy Novozhilov
2022-11-24 11:09:17 +02:00
committed by Space Team
parent ebc879ed1e
commit 2610ad94e0
25 changed files with 273 additions and 22 deletions
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.test.runners.AbstractDiagnosticTest
import org.jetbrains.kotlin.test.runners.AbstractFirDiagnosticTest
import org.jetbrains.kotlin.test.runners.codegen.AbstractFirBlackBoxCodegenTest
import org.jetbrains.kotlin.test.runners.codegen.AbstractIrBlackBoxCodegenTest
import org.jetbrains.kotlin.test.runners.configurationForClassicAndFirTestsAlongside
import org.jetbrains.kotlin.test.services.EnvironmentConfigurator
import org.jetbrains.kotlin.test.services.TestServices
@@ -24,14 +25,19 @@ import org.jetbrains.kotlin.test.services.TestServices
abstract class AbstractSamWithReceiverTest : AbstractDiagnosticTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.configurePlugin()
with(builder) {
configurePlugin()
}
}
}
abstract class AbstractFirSamWithReceiverTest : AbstractFirDiagnosticTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.configurePlugin()
with(builder) {
configurePlugin()
configurationForClassicAndFirTestsAlongside()
}
}
}
@@ -1,6 +1,6 @@
// FIR_IDENTICAL
// FILE: SamConstructor.kt
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run();
@@ -0,0 +1,19 @@
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run(String a, String b);
}
// FILE: test.kt
annotation class SamWithReceiver
fun test() {
Sam <!ARGUMENT_TYPE_MISMATCH!>{ a, <!CANNOT_INFER_PARAMETER_TYPE!>b<!> ->
System.out.println(a)
}<!>
Sam { b ->
val a: String = this
System.out.println(a)
}
}
@@ -0,0 +1,17 @@
package
public fun test(): kotlin.Unit
@SamWithReceiver public interface Sam {
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 abstract fun run(/*0*/ a: kotlin.String!, /*1*/ b: kotlin.String!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class SamWithReceiver : kotlin.Annotation {
public constructor SamWithReceiver()
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
}
@@ -1,4 +1,4 @@
// FILE: SamConstructor.kt
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run(String a, String b);
@@ -8,7 +8,7 @@ public interface Sam {
annotation class SamWithReceiver
fun test() {
Sam <!ARGUMENT_TYPE_MISMATCH!>{ a, <!CANNOT_INFER_PARAMETER_TYPE!>b<!> ->
Sam <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>a, <!CANNOT_INFER_PARAMETER_TYPE!>b<!><!> ->
System.out.println(a)
}<!>
@@ -1,6 +1,6 @@
// FIR_IDENTICAL
// FILE: SamConstructor.kt
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run();
@@ -0,0 +1,20 @@
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run(String a);
}
// FILE: Exec.java
public class Exec {
void exec(Sam sam) {}
}
// FILE: test.kt
annotation class SamWithReceiver
fun test() {
val e = Exec()
e.exec <!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>a<!> -> System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a) }<!>
e.exec { System.out.println(this) }
}
@@ -0,0 +1,25 @@
package
public fun test(): kotlin.Unit
public open class Exec {
public constructor Exec()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public/*package*/ open fun exec(/*0*/ sam: Sam!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@SamWithReceiver public interface Sam {
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 abstract fun run(/*0*/ a: kotlin.String!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class SamWithReceiver : kotlin.Annotation {
public constructor SamWithReceiver()
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
}
@@ -1,4 +1,4 @@
// FILE: SamConstructor.kt
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run(String a);
@@ -15,6 +15,6 @@ annotation class SamWithReceiver
fun test() {
val e = Exec()
e.exec <!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>a<!> -> System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a) }<!>
e.exec <!TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE, EXPECTED_PARAMETERS_NUMBER_MISMATCH!>a<!> -> System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>) }<!>
e.exec { System.out.println(this) }
}
@@ -0,0 +1,17 @@
// FILE: Sam.java
public interface Sam {
void run(String a);
}
// FILE: Exec.java
public class Exec {
void exec(Sam sam) {}
}
// FILE: test.kt
fun test() {
val e = Exec()
e.exec { a -> System.out.println(a) }
e.exec { System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(<!NO_THIS!>this<!>) }
}
@@ -0,0 +1,18 @@
package
public fun test(): kotlin.Unit
public open class Exec {
public constructor Exec()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public/*package*/ open fun exec(/*0*/ sam: Sam!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Sam {
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 abstract fun run(/*0*/ a: kotlin.String!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,4 +1,4 @@
// FILE: SamConstructor.kt
// FILE: Sam.java
public interface Sam {
void run(String a);
}
@@ -13,5 +13,5 @@ fun test() {
val e = Exec()
e.exec { a -> System.out.println(a) }
e.exec { System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(<!NO_THIS!>this<!>) }
e.exec { System.out.println(<!NO_THIS!>this<!>) }
}
@@ -0,0 +1,21 @@
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
String run(String a, String b);
}
// FILE: test.kt
annotation class SamWithReceiver
fun test() {
Sam <!ARGUMENT_TYPE_MISMATCH!>{ a, <!CANNOT_INFER_PARAMETER_TYPE!>b<!> ->
System.out.println(a)
""
}<!>
Sam { b ->
val a: String = this
System.out.println(a)
""
}
}
@@ -0,0 +1,17 @@
package
public fun test(): kotlin.Unit
@SamWithReceiver public interface Sam {
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 abstract fun run(/*0*/ a: kotlin.String!, /*1*/ b: kotlin.String!): kotlin.String!
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class SamWithReceiver : kotlin.Annotation {
public constructor SamWithReceiver()
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
}
@@ -1,4 +1,4 @@
// FILE: SamConstructor.kt
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
String run(String a, String b);
@@ -8,7 +8,7 @@ public interface Sam {
annotation class SamWithReceiver
fun test() {
Sam <!ARGUMENT_TYPE_MISMATCH!>{ a, <!CANNOT_INFER_PARAMETER_TYPE!>b<!> ->
Sam <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>a, <!CANNOT_INFER_PARAMETER_TYPE!>b<!><!> ->
System.out.println(a)
""
}<!>
@@ -0,0 +1,18 @@
// FILE: Sam.java
public interface Sam {
String run(String a, String b);
}
// FILE: test.kt
fun test() {
Sam { a, b ->
System.out.println(a)
""
}
Sam <!ARGUMENT_TYPE_MISMATCH!>{ b ->
val a = this<!UNRESOLVED_LABEL!>@Sam<!>
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a)
""
}<!>
}
@@ -0,0 +1,10 @@
package
public fun test(): kotlin.Unit
public interface Sam {
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 abstract fun run(/*0*/ a: kotlin.String!, /*1*/ b: kotlin.String!): kotlin.String!
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,4 +1,4 @@
// FILE: SamConstructor.kt
// FILE: Sam.java
public interface Sam {
String run(String a, String b);
}
@@ -10,9 +10,9 @@ fun test() {
""
}
Sam <!ARGUMENT_TYPE_MISMATCH!>{ b ->
val a = this<!UNRESOLVED_LABEL!>@Sam<!>
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a)
Sam <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>b<!> ->
val a = <!NO_THIS!>this@Sam<!>
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>)
""
}<!>
}
@@ -0,0 +1,20 @@
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run(String a);
}
// FILE: test.kt
annotation class SamWithReceiver
fun test() {
Sam <!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>a<!> ->
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a)
}<!>
Sam {
val a: String = this
val a2: String = <!UNRESOLVED_REFERENCE!>it<!>
System.out.println(a)
}
}
@@ -0,0 +1,17 @@
package
public fun test(): kotlin.Unit
@SamWithReceiver public interface Sam {
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 abstract fun run(/*0*/ a: kotlin.String!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final annotation class SamWithReceiver : kotlin.Annotation {
public constructor SamWithReceiver()
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
}
@@ -1,4 +1,4 @@
// FILE: SamConstructor.kt
// FILE: Sam.java
@SamWithReceiver
public interface Sam {
void run(String a);
@@ -8,8 +8,8 @@ public interface Sam {
annotation class SamWithReceiver
fun test() {
Sam <!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>a<!> ->
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a)
Sam <!TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE, EXPECTED_PARAMETERS_NUMBER_MISMATCH!>a<!> ->
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>)
}<!>
Sam {
@@ -0,0 +1,16 @@
// FILE: Sam.java
public interface Sam {
void run(String a);
}
// FILE: test.kt
fun test() {
Sam { a ->
System.out.println(a)
}
Sam {
val a = <!NO_THIS!>this<!>
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a)
}
}
@@ -0,0 +1,10 @@
package
public fun test(): kotlin.Unit
public interface Sam {
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 abstract fun run(/*0*/ a: kotlin.String!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,4 +1,4 @@
// FILE: SamConstructor.kt
// FILE: Sam.java
public interface Sam {
void run(String a);
}
@@ -11,6 +11,6 @@ fun test() {
Sam {
val a = <!NO_THIS!>this<!>
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(a)
System.out.<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>)
}
}
@@ -8,7 +8,7 @@ import java.lang.annotation.RetentionPolicy;
public @interface SamWithReceiver1 {
}
// FILE: SamConstructor.kt
// FILE: Sam.java
@SamWithReceiver1
public interface Sam {
void run(String a, String b);