[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// FILE: A.java
|
||||
|
||||
public class A<E> {
|
||||
public <T extends E> A(E x, java.util.List<T> y) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun test(x: List<Int>, y: List<String>) {
|
||||
A("", x) checkType { <!UNRESOLVED_REFERENCE!>_<!><A<Any?>>() }
|
||||
A("", y) checkType { <!UNRESOLVED_REFERENCE!>_<!><A<String?>>() }
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>A<!><CharSequence, String>("", x)
|
||||
A<CharSequence, String>("", y)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// FILE: Outer.java
|
||||
|
||||
public class Outer<T> {
|
||||
public class Inner<E> {
|
||||
public <F extends E, G extends T> Inner(E x, java.util.List<F> y, G z) {}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test(x: List<Int>, y: List<String>) {
|
||||
Outer<Int>().Inner("", y, 1) checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<Int>.Inner<String>>() }
|
||||
Outer<Int>().<!INAPPLICABLE_CANDIDATE!>Inner<!><CharSequence, String, Int>("", y, 1) <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Outer<Int>.Inner<CharSequence>>() }
|
||||
|
||||
Outer<Int>().Inner("", x, 1) checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<Int>.Inner<Any>>() }
|
||||
Outer<Int>().<!INAPPLICABLE_CANDIDATE!>Inner<!><CharSequence, String, Int>("", x, 1)
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FILE: A.java
|
||||
|
||||
public class A {
|
||||
public <T> A(T x, java.util.List<T> y) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun test(x: List<Int>, y: List<String>) {
|
||||
A("", x) // inferred as Any!
|
||||
A("", y)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>A<!><String>("", x)
|
||||
|
||||
A<Any>("", x)
|
||||
A<String>("", y)
|
||||
A<CharSequence>("", y)
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FILE: A.java
|
||||
|
||||
public class A {
|
||||
public <T> A(T x, Inv<T> y) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class Inv<T>
|
||||
|
||||
fun test(x: Inv<Int>, y: Inv<String>) {
|
||||
<!INAPPLICABLE_CANDIDATE!>A<!>("", x)
|
||||
A("", y)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>A<!><String>("", x)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>A<!><Any>("", x)
|
||||
A<String>("", y)
|
||||
<!INAPPLICABLE_CANDIDATE!>A<!><CharSequence>("", y)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FILE: C.java
|
||||
|
||||
// See KT-10410
|
||||
public class C {
|
||||
public <T extends T> C(T t) {
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo() = <!INAPPLICABLE_CANDIDATE!>C<!>()
|
||||
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// FILE: R.java
|
||||
public class R<T extends R<T>> {
|
||||
public <F extends R<F>> R(F x) {
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: RImpl.java
|
||||
public class RImpl extends R<RImpl> {
|
||||
public RImpl() {
|
||||
<RImpl>super(null);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test() {
|
||||
val x: R<RImpl> = R(RImpl())
|
||||
R<RImpl, RImpl>(RImpl())
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
// FILE: A.java
|
||||
|
||||
public class A<E> {
|
||||
public <T extends E> A(E x, java.util.List<T> y) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class B1(x: List<String>) : A<CharSequence>("", x)
|
||||
class B2(x: List<Int>) : <!INAPPLICABLE_CANDIDATE!>A<CharSequence><!>("", x)
|
||||
|
||||
class C : A<CharSequence> {
|
||||
constructor(x: List<String>) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
constructor(x: List<Int>, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
// FILE: A.java
|
||||
|
||||
public class A<E> {
|
||||
public <T extends E, Q> A(E x, java.util.List<E> y) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
// TODO: It's effectively impossible to perform super call to such constructor
|
||||
// if there is not enough information to infer corresponding arguments
|
||||
// May be we could add some special syntax for such arguments
|
||||
class B1(x: List<String>) : A<CharSequence>("", x)
|
||||
class B2(x: List<Int>) : <!INAPPLICABLE_CANDIDATE!>A<CharSequence><!>("", x)
|
||||
|
||||
class C : A<CharSequence> {
|
||||
constructor(x: List<String>) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
constructor(x: List<Int>, y: Int) : <!INAPPLICABLE_CANDIDATE!>super<!>("", x)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VALUE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
// FILE: A.java
|
||||
|
||||
public class A<E> {
|
||||
public <T> A(T x, java.util.List<T> y) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun test(x: List<Int>, y: List<String>) {
|
||||
var z: A<Double> = A("", x) // E inferred from expected type
|
||||
z = A("", y)
|
||||
|
||||
z = <!INAPPLICABLE_CANDIDATE!>A<!><Double, String>("", x)
|
||||
|
||||
z = A<Double, Any>("", x)
|
||||
z = A<Double, String>("", y)
|
||||
z = A<Double, CharSequence>("", y)
|
||||
}
|
||||
Reference in New Issue
Block a user