[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: 2.kt
|
||||
package b
|
||||
|
||||
import a.A
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach(i: Int) = i
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach(s: String) {}
|
||||
|
||||
|
||||
// FILE: 1.kt
|
||||
package a
|
||||
|
||||
import b.*
|
||||
|
||||
class A {
|
||||
fun forEach() = this
|
||||
fun forEach(i: Int) = this
|
||||
fun forEach(i: String) = this
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach() = ""
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach(s: String) {}
|
||||
|
||||
fun test(a: A) {
|
||||
a.forEach() checkType { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
|
||||
a.forEach(1) checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
|
||||
|
||||
a.forEach("")
|
||||
|
||||
with(a) {
|
||||
forEach() checkType { _<String>() }
|
||||
|
||||
forEach(1) checkType { _<Int>() }
|
||||
|
||||
forEach("")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
class A {
|
||||
fun forEach() = this
|
||||
fun forEach(i: Int) = this
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach(i: Int) = i
|
||||
|
||||
class B {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach() = this@B
|
||||
|
||||
fun test(a: A) {
|
||||
a.forEach() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><A>() } // todo
|
||||
|
||||
with(a) {
|
||||
forEach() checkType { _<A>() } // todo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(a: A) {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach() = ""
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
fun A.forEach(i: Int) = ""
|
||||
|
||||
a.forEach() checkType { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
a.forEach(1)
|
||||
|
||||
with(a) {
|
||||
forEach() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
|
||||
forEach(1)
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun fn(): Nothing = throw java.lang.<!UNRESOLVED_REFERENCE!>RuntimeException<!>("oops")
|
||||
|
||||
val x: Nothing = throw java.lang.<!UNRESOLVED_REFERENCE!>RuntimeException<!>("oops")
|
||||
|
||||
class SomeClass {
|
||||
fun method() {
|
||||
throw java.lang.<!UNRESOLVED_REFERENCE!>AssertionError<!>("!!!")
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FILE: Test.java
|
||||
public class Test {
|
||||
public static final String FOO = "test";
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun ff() {
|
||||
val a = Test.FOO
|
||||
val b = Test?.FOO
|
||||
System.out.println(a + b)
|
||||
System?.out.println(a + b)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
val stringReversed = String::reversed
|
||||
@@ -0,0 +1,10 @@
|
||||
fun <T1> List<T1>?.foo() {}
|
||||
|
||||
@JvmName("foo1")
|
||||
fun <T2> List<T2>.foo() {}
|
||||
|
||||
|
||||
fun <T1> bar(x: List<T1>) = x
|
||||
|
||||
@JvmName("bar1")
|
||||
fun <T2> bar(x: List<T2>?) = x
|
||||
@@ -0,0 +1,21 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
//KT-4711 Error type with no error reported from type inference
|
||||
|
||||
fun main() {
|
||||
val n = 100
|
||||
val delta = 1.0 / n
|
||||
val startTimeNanos = System.nanoTime()
|
||||
|
||||
// the problem sits on the next line:
|
||||
val pi = 4.0.toDouble() * delta * (1..n).reduce(
|
||||
{t, i ->
|
||||
val x = (i - 0.5) * delta
|
||||
t + 1.0 / (1.0 + x * x)
|
||||
|
||||
})
|
||||
// !!! pi has error type here
|
||||
|
||||
val elapseTime = (System.nanoTime() - startTimeNanos) / 1e9
|
||||
|
||||
println("pi_sequential_reduce $pi $n $elapseTime")
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
|
||||
// FILE: StaticOverrides.java
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
|
||||
public class StaticOverrides {
|
||||
public static class A {
|
||||
public static int foo(Runnable x) { return 0; }
|
||||
public static boolean foo(Function0<Unit> x) { return true; }
|
||||
}
|
||||
|
||||
public static class B {
|
||||
public static String foo(Runnable x) { return ""; }
|
||||
}
|
||||
|
||||
public static class C extends A {
|
||||
public static String foo(Runnable x) { return ""; }
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun test() {
|
||||
StaticOverrides.A.<!AMBIGUITY!>foo<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Boolean>() }
|
||||
StaticOverrides.B.foo {} checkType { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
StaticOverrides.C.<!AMBIGUITY!>foo<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Boolean>() }
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// FILE: s/SamConstructor.java
|
||||
package s;
|
||||
|
||||
public class SamConstructor {
|
||||
public SamConstructor(Runnable r) {
|
||||
}
|
||||
|
||||
public static void foo(Runnable r) {}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
package a
|
||||
|
||||
fun SamConstructor(a: () -> Unit) {}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
package b
|
||||
|
||||
import s.SamConstructor
|
||||
import a.*
|
||||
|
||||
fun test() {
|
||||
val a: s.SamConstructor = SamConstructor { }
|
||||
|
||||
val b: s.SamConstructor = SamConstructor(null)
|
||||
|
||||
SamConstructor.foo(null)
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
// FILE: Foo.java
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
class Foo {
|
||||
interface FObject<T> {
|
||||
void invoke(T i);
|
||||
}
|
||||
|
||||
public String foo(FObject<Integer> f) { return ""; }
|
||||
public int foo(Function1<Integer, Unit> f) { return 1; }
|
||||
|
||||
public String bar(FObject<Object> f) { return ""; }
|
||||
public int bar(Function1<Integer, Unit> f) { return 1; }
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
fun test() {
|
||||
Foo().<!AMBIGUITY!>foo<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
|
||||
Foo().<!AMBIGUITY!>bar<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// !LANGUAGE: -RefinedSamAdaptersPriority
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
// FILE: Foo.java
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
class Foo {
|
||||
interface FObject<T> {
|
||||
void invoke(T i);
|
||||
}
|
||||
|
||||
public String foo(FObject<Integer> f) { return ""; }
|
||||
public int foo(Function1<Integer, Unit> f) { return 1; }
|
||||
|
||||
public String bar(FObject<Object> f) { return ""; }
|
||||
public int bar(Function1<Integer, Unit> f) { return 1; }
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
fun test() {
|
||||
Foo().<!AMBIGUITY!>foo<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
|
||||
Foo().<!AMBIGUITY!>bar<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
|
||||
// FILE: Foo.java
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class Foo {
|
||||
interface FObject {
|
||||
void invoke(Object i);
|
||||
}
|
||||
|
||||
public String test(FObject f) { return ""; }
|
||||
public int test(Function1<Integer, Unit> f) { return 1; }
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
fun bar() {
|
||||
Foo().<!AMBIGUITY!>test<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: -RefinedSamAdaptersPriority
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
// FILE: Foo.java
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class Foo {
|
||||
interface FObject {
|
||||
void invoke(Object i);
|
||||
}
|
||||
|
||||
public String test(FObject f) { return ""; }
|
||||
public int test(Function1<Integer, Unit> f) { return 1; }
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
fun bar() {
|
||||
Foo().<!AMBIGUITY!>test<!> {} <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
|
||||
}
|
||||
Reference in New Issue
Block a user