Fix SamWithReceiver tests for scripts, add tests...

that use new script definition and ability to load
annotations from script definition
This commit is contained in:
Ilya Chernikov
2020-06-02 12:43:25 +02:00
parent 8fb41e4562
commit 74c697af92
6 changed files with 121 additions and 7 deletions
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE,-UNUSED_ANONYMOUS_PARAMETER
// FILE: SamWithReceiver1.java
import java.lang.annotation.Retention;
@@ -11,15 +11,19 @@ public @interface SamWithReceiver1 {
// FILE: Sam.java
@SamWithReceiver1
public interface Sam {
void run(String a);
void run(String a, String b);
}
// FILE: Exec.java
public class Exec {
void exec(Sam sam) {}
void exec(Sam sam) { sam.run("a", "b") }
}
// FILE: test.kts
val e = Exec()
e.exec { System.out.println(this) }
e.exec <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>a, <!CANNOT_INFER_PARAMETER_TYPE!>b<!><!> -> System.out.println(a) }<!>
e.exec { b ->
val a: String = this
System.out.println(a)
}
@@ -11,7 +11,7 @@ public open class Exec {
@SamWithReceiver1 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 abstract fun run(/*0*/ a: kotlin.String!, /*1*/ b: kotlin.String!): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}