[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public interface J {
|
||||
@NotNull
|
||||
String foo(@Nullable String x);
|
||||
}
|
||||
|
||||
// FILE: J2.java
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface J2 extends J {
|
||||
String foo(String x);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
<!INAPPLICABLE_CANDIDATE!>J<!> { s: String -> s} // should be prohibited, because SAM value parameter has nullable type
|
||||
J { "" + it.<!INAPPLICABLE_CANDIDATE!>length<!> }
|
||||
J { null }
|
||||
J { it?.length?.toString() }
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>J2<!> { s: String -> s}
|
||||
J2 { "" + it.<!INAPPLICABLE_CANDIDATE!>length<!> }
|
||||
J2 { null }
|
||||
J2 { it?.length?.toString() }
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// FILE: BehaviorSubject.java
|
||||
public class BehaviorSubject<T> extends Observable<T> {
|
||||
}
|
||||
|
||||
// FILE: Observable.java
|
||||
|
||||
public class Observable<T> {
|
||||
public static <T> Observable<T> create(Observable.OnSubscribe<T> f) {
|
||||
return null;
|
||||
}
|
||||
public interface OnSubscribe<T> {
|
||||
void call(T t);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
fun main() {
|
||||
BehaviorSubject.create<String>(null)
|
||||
BehaviorSubject.create<Int> { }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// FILE: Statics.java
|
||||
|
||||
public class Statics {
|
||||
public static void foo(Runnable r) {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class A : Statics() {
|
||||
fun test() {
|
||||
foo {}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
// FILE: foo/A.java
|
||||
package foo;
|
||||
|
||||
public class A {
|
||||
static void f(B b) {
|
||||
b.g();
|
||||
}
|
||||
|
||||
public interface B {
|
||||
void g();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: bar/sample.kt
|
||||
|
||||
package bar
|
||||
|
||||
fun main() {
|
||||
foo.A.<!INAPPLICABLE_CANDIDATE!>f<!> {}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// FILE: MyFuture.java
|
||||
|
||||
public interface MyFuture<V> {
|
||||
MyFuture<V> addListener(MyListener<? extends MyFuture<? super V>> listener);
|
||||
}
|
||||
|
||||
// FILE: MyListener.java
|
||||
|
||||
public interface MyListener<F extends MyFuture<?>> {
|
||||
void operationComplete(F future) throws Exception;
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
typealias Handler = (cause: Throwable?) -> Unit
|
||||
|
||||
fun <T> MyFuture<T>.setup() {
|
||||
addListener(ListenerImpl<T, MyFuture<T>>())
|
||||
addListener { }
|
||||
}
|
||||
|
||||
class ListenerImpl<T, F : MyFuture<T>> : MyListener<F>, Handler {
|
||||
override fun operationComplete(future: F) {
|
||||
}
|
||||
|
||||
override fun invoke(cause: Throwable?) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// FILE: FormFieldValidatorPresenterTest.java
|
||||
public class FormFieldValidatorPresenterTest<V extends String> {
|
||||
|
||||
public void setValidationListenerTest(ValidationListenerTest validationListener) {
|
||||
}
|
||||
|
||||
public interface ValidationListenerTest {
|
||||
void onValidityChanged(boolean valid);
|
||||
}
|
||||
}
|
||||
// FILE: main.kt
|
||||
fun <P : FormFieldValidatorPresenterTest<String>> setValidationListener(
|
||||
presenter: P,
|
||||
validationListener: (Boolean) -> Unit
|
||||
) {
|
||||
presenter.setValidationListenerTest(validationListener) // Error: Type mismatch: inferred type is (Boolean) -> Unit but FormFieldValidatorPresenterTest.ValidationListenerTest! was expected
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: a/Statics.java
|
||||
|
||||
package a;
|
||||
|
||||
public class Statics {
|
||||
public static void foo(Runnable r) {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
package b
|
||||
|
||||
import a.Statics.*
|
||||
|
||||
fun test() {
|
||||
foo {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FILE: a/Statics.java
|
||||
|
||||
package a;
|
||||
|
||||
public class Statics {
|
||||
public static void foo(Runnable r) {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
package b;
|
||||
|
||||
import a.Statics.foo
|
||||
|
||||
fun test() {
|
||||
foo {}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
|
||||
// FILE: A.java
|
||||
public class A<K, V> {
|
||||
public void foo(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: BiFunction.java
|
||||
public interface BiFunction<T, U, R> {
|
||||
R apply(T t, U u);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
val a = A<Int, String>()
|
||||
a.foo(2, BiFunction { k, v -> null })
|
||||
a.foo(2) { k, v -> null } // See KT-12144
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// FILE: ALambda.java
|
||||
|
||||
public interface ALambda {
|
||||
ALambda curried();
|
||||
|
||||
ALambda tupled();
|
||||
}
|
||||
|
||||
// FILE: ACheckedFunction0.java
|
||||
|
||||
public interface ACheckedFunction0 extends ALambda {
|
||||
|
||||
Integer apply();
|
||||
|
||||
default ALambda curried() { return null; }
|
||||
default ALambda tupled() { return null; }
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test() {
|
||||
ACheckedFunction0 { 2 } // error: Interface ACheckedFunction0 does not have constructors
|
||||
}
|
||||
Reference in New Issue
Block a user