[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
interface A {
|
||||
fun <T, E> foo(): E
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun <Q, W> foo(): Q
|
||||
}
|
||||
|
||||
fun test(c: Any) {
|
||||
if (c is B && c is A) {
|
||||
c.<!AMBIGUITY!>foo<!><String, Int>()
|
||||
}
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
fun foo(): CharSequence
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(): String?
|
||||
}
|
||||
|
||||
fun test(c: Any) {
|
||||
if (c is B && c is A) {
|
||||
c.<!AMBIGUITY!>foo<!>()
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// FILE: A.java
|
||||
public interface A {
|
||||
String foo();
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface B {
|
||||
fun foo(): String?
|
||||
}
|
||||
|
||||
interface C {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
fun foo(x: Any?) {
|
||||
if (x is A && x is B) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
|
||||
}
|
||||
|
||||
if (x is B && x is A) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
|
||||
}
|
||||
|
||||
if (x is A && x is C) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
|
||||
}
|
||||
|
||||
if (x is C && x is A) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
|
||||
}
|
||||
|
||||
if (x is A && x is B && x is C) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
|
||||
}
|
||||
|
||||
if (x is B && x is A && x is C) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
|
||||
}
|
||||
|
||||
if (x is B && x is C && x is A) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
open class A {
|
||||
open var value: Int = 4
|
||||
protected set
|
||||
}
|
||||
|
||||
class MutableA : A() {
|
||||
override var value: Int = 4
|
||||
public set
|
||||
}
|
||||
|
||||
fun test(myA: A) {
|
||||
if (myA is MutableA) {
|
||||
myA.value = 5
|
||||
}
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
abstract class A {
|
||||
abstract protected fun foo(): String
|
||||
abstract protected val bar: String
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(): String
|
||||
val bar: String
|
||||
}
|
||||
|
||||
fun test(x: A) {
|
||||
if (x is B) {
|
||||
x.foo()
|
||||
x.bar
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Common {
|
||||
fun foo(): CharSequence?
|
||||
}
|
||||
|
||||
interface A : Common {
|
||||
override fun foo(): CharSequence
|
||||
}
|
||||
|
||||
interface B : Common {
|
||||
override fun foo(): String
|
||||
}
|
||||
|
||||
fun test(c: Common) {
|
||||
if (c is B && c is A) {
|
||||
c.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
}
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
fun foo(): CharSequence?
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
fun test(c: Any) {
|
||||
if (c is B && c is A) {
|
||||
c.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
val foo: Any?
|
||||
}
|
||||
|
||||
interface C: A {
|
||||
override val foo: String?
|
||||
}
|
||||
interface B: A {
|
||||
override var foo: String
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
if (a is B && a is C) {
|
||||
a.<!AMBIGUITY!>foo<!> = ""
|
||||
a.<!AMBIGUITY!>foo<!> = null
|
||||
|
||||
a.<!AMBIGUITY!>foo<!>.<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
val foo: Any?
|
||||
}
|
||||
|
||||
interface C: A {
|
||||
override val foo: String
|
||||
}
|
||||
interface B: A {
|
||||
override var foo: String?
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
if (a is B && a is C) {
|
||||
a.<!AMBIGUITY!>foo<!> = ""
|
||||
a.<!AMBIGUITY!>foo<!> = null
|
||||
a.<!AMBIGUITY!>foo<!>
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
fun foo(): CharSequence?
|
||||
}
|
||||
|
||||
interface B : A {
|
||||
override fun foo(): String
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
if (a is B) {
|
||||
a.foo()
|
||||
a.foo().checkType { _<String>() }
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
interface A {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
interface C: A
|
||||
interface B: A
|
||||
|
||||
fun test(c: C) {
|
||||
if (c is B) {
|
||||
c.foo() // OVERLOAD_RESOLUTION_AMBIGUITY: B.foo() and C.foo()
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
fun foo(): CharSequence?
|
||||
fun baz(x: Any) {}
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(): String
|
||||
fun baz(x: Int): String =""
|
||||
fun baz(x: Int, y: Int) {}
|
||||
|
||||
fun foobar(): CharSequence?
|
||||
}
|
||||
|
||||
interface C {
|
||||
fun foo(): String
|
||||
fun baz(x: Int): String =""
|
||||
fun baz(x: Int, y: Int) {}
|
||||
|
||||
fun foobar(): String
|
||||
}
|
||||
|
||||
var x: A = null!!
|
||||
|
||||
fun test() {
|
||||
x.foo().checkType { _<CharSequence?>() }
|
||||
|
||||
if (x is B && x is C) {
|
||||
x.<!AMBIGUITY!>foo<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><CharSequence?>() }
|
||||
x.baz("")
|
||||
x.<!AMBIGUITY!>baz<!>(1).<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Unit>() }
|
||||
x.<!AMBIGUITY!>baz<!>(1, 2)
|
||||
|
||||
x.<!AMBIGUITY!>foobar<!>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
}
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
fun <T, E> foo(): E
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun <Q, W> foo(): W
|
||||
}
|
||||
|
||||
fun test(c: Any) {
|
||||
if (c is B && c is A) {
|
||||
c.<!AMBIGUITY!>foo<!><String, Int>().<!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
fun <T, E> foo(): E
|
||||
}
|
||||
|
||||
interface B : A {
|
||||
override fun <Q, W> foo(): W
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
if (a is B) {
|
||||
a.foo<String, Int>().checkType { _<Int>() }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user