[Tests] Update test data with error suppression warnings
#KT-61129 Fixed
This commit is contained in:
committed by
Space Team
parent
969c716c76
commit
5b9c35de2e
+26
@@ -0,0 +1,26 @@
|
||||
class Foo {
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
val test: Bar = Bar()
|
||||
}
|
||||
|
||||
fun Foo.test() {}
|
||||
class Bar
|
||||
class Scope {
|
||||
operator fun Bar.invoke(f: () -> Unit) {}
|
||||
}
|
||||
|
||||
fun Scope.bar(e: Foo) {
|
||||
e.test {}
|
||||
}
|
||||
|
||||
class Baz
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
constructor(val x: Foo)
|
||||
|
||||
fun Baz(x: Foo): Baz {
|
||||
throw NotImplementedError()
|
||||
}
|
||||
|
||||
fun testBaz(e: Foo) = Baz(e)
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
class Foo {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
|
||||
compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.fir.kt
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
//!DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <T, U: T> List<@kotlin.internal.Exact T>.firstTyped(): U = throw Exception()
|
||||
|
||||
fun test1(l: List<Number>) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEBUG_INFO_CONSTANT -UNUSED_EXPRESSION
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes K, V, V1 : V?>
|
||||
Map<out K, @kotlin.internal.Exact V>.getOrDefault_Exact(key: K, defaultValue: V1): V1 = TODO()
|
||||
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <R> Iterable<*>.filterIsInstance1(): List<@kotlin.internal.NoInfer R> = throw Exception()
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <R> List<*>.filterIsInstance2(): @kotlin.internal.NoInfer List<R> = throw Exception()
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.filterIsInstance1<Int>().map { it * 2 }
|
||||
list.filterIsInstance2<Int>().filter { it > 10 }
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <R> foo(t: R): List<@kotlin.internal.NoInfer R> = throw Exception("$t")
|
||||
|
||||
fun test() {
|
||||
foo(1).map { it * 2 }
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <R> List<R>.foo(): @kotlin.internal.NoInfer R = throw Exception()
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <R> bar(r: R, f: Function1<@kotlin.internal.NoInfer R, Unit>): Nothing = throw Exception()
|
||||
|
||||
fun test1() {
|
||||
listOf("").foo().length
|
||||
bar(1) { x -> x + 1 }
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
open class Base()
|
||||
class CX : Base()
|
||||
class CY : Base()
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes T> foo(a: T, b: T) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes T : Any> fooA(a: T, b: T) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes T : Base> fooB(a: T, b: T) {}
|
||||
|
||||
|
||||
fun usage(x: CX, y: CY) {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>foo<!>(x, y) // expected err, got err
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>fooA<!>(x, y) // expected err, got ok
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>fooB<!>(x, y) // expected err, got ok
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
open class Base()
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
|
||||
annotation class Anno
|
||||
|
||||
fun test(a: List<Class<Anno>>) {
|
||||
strictSelect(a, emptyList<Anno>().map { it.annotationClass.java })
|
||||
}
|
||||
|
||||
fun <@kotlin.internal.OnlyInputTypes S> strictSelect(arg1: S, arg2: S): S = TODO()
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// DIAGNOSTICS: -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
// FILE: a.kt
|
||||
package a
|
||||
|
||||
val bar get() = ""
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
val baz get() = ""
|
||||
|
||||
// FILE: b.kt
|
||||
package b
|
||||
|
||||
object bar
|
||||
object baz {
|
||||
val qux = 1
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
import a.*
|
||||
import b.*
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
class Foo {
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
val bar = 1
|
||||
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
val baz = 1
|
||||
}
|
||||
|
||||
fun Foo.test() {
|
||||
bar.length
|
||||
baz.qux
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// DIAGNOSTICS: -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
// FILE: a.kt
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
public fun <T> Iterable<T>.contains1(element: T): Int = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
public fun <T> Iterable<T>.contains1(element: @kotlin.internal.NoInfer T): Boolean = null!!
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -1,12 +1,12 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <T> test1(t1: T, t2: @kotlin.internal.NoInfer T): T = t1
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <T> @kotlin.internal.NoInfer T.test2(t1: T): T = t1
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <T> test3(t1: @kotlin.internal.NoInfer T): T = t1
|
||||
|
||||
fun usage() {
|
||||
@@ -15,7 +15,7 @@ fun usage() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>test3<!>("")
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <T> List<T>.contains1(e: @kotlin.internal.NoInfer T): Boolean = true
|
||||
|
||||
fun test(i: Int?, a: Any, l: List<Int>) {
|
||||
@@ -24,7 +24,7 @@ fun test(i: Int?, a: Any, l: List<Int>) {
|
||||
l.contains1(i)
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <T> assertEquals1(e1: T, e2: @kotlin.internal.NoInfer T): Boolean = true
|
||||
|
||||
fun test(s: String) {
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: TestBase.java
|
||||
|
||||
public class TestBase<T> { }
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
public class Test<K> extends TestBase<K> { }
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes K> TestBase<out K>.foo(key: K) = null
|
||||
fun foo(result: Test<*>) {
|
||||
result.foo("sd") // Type inference failed (NI), OK in OI
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: TestBase.java
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
|
||||
interface IFace<K, out V>
|
||||
|
||||
fun <@kotlin.internal.OnlyInputTypes K, V> IFace<out K, V>.get(key: K): V? = TODO()
|
||||
fun <@kotlin.internal.OnlyInputTypes I> id(arg: I): I = arg
|
||||
|
||||
interface InvBase<B>
|
||||
class DerivedInv : InvBase<DerivedInv>
|
||||
class InvRecursive<E : InvBase<E>>
|
||||
|
||||
fun test1(argument: InvRecursive<*>, receiver: IFace<InvRecursive<DerivedInv>, Any>) {
|
||||
receiver.get(argument)
|
||||
}
|
||||
|
||||
fun test2(arg: InvRecursive<out DerivedInv>) {
|
||||
id(arg)
|
||||
}
|
||||
|
||||
fun test3(arg: InvRecursive<in DerivedInv>) {
|
||||
id(arg)
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
class In<in T>
|
||||
|
||||
class Out<out T>
|
||||
|
||||
class Inv<T>
|
||||
|
||||
fun test_1(list: List<In<Number>>, x: In<Number>, y: In<Int>, z: In<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_2(list: List<In<Int>>, x: In<Int>, y: In<Number>, z: In<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_3(list: List<Out<Number>>, x: Out<Number>, y: Out<Int>, z: Out<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_4(list: List<Out<Int>>, x: Out<Int>, y: Out<Number>, z: Out<Any>) {
|
||||
list.contains1(x)
|
||||
list.contains1(y)
|
||||
list.contains1(z)
|
||||
}
|
||||
|
||||
fun test_5(list: List<Inv<Number>>, x: Inv<Number>, y: Inv<Int>, z: Inv<Any>) {
|
||||
list.contains1(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(z)
|
||||
}
|
||||
|
||||
fun test_6(list: List<Inv<Int>>, x: Inv<Int>, y: Inv<Number>, z: Inv<Any>) {
|
||||
list.contains1(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(z)
|
||||
}
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// FULL_JDK
|
||||
import java.lang.reflect.Field
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes T> assertEquals(expected: T, actual: T): T = actual
|
||||
|
||||
fun test(field: Field) {
|
||||
|
||||
+4
-4
@@ -1,19 +1,19 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
public fun <T> Iterable<T>.contains1(element: T): Int = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
@JvmName("getAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
public fun <K, V> Map<K, V>.get1(key: Any?): Int = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
public fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.get1(key: K): V? = null!!
|
||||
|
||||
fun test(map: Map<Int, String>) {
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@
|
||||
|
||||
class Inv<T>
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes K> Inv<out K>.onlyOut(e: K) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes K : Number> Inv<out K>.onlyOutUB(e: K) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes K> Inv<in K>.onlyIn(e: K) {}
|
||||
|
||||
fun test(
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
//FILE:Foo.java
|
||||
|
||||
public class Foo {
|
||||
public static String foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//FILE:Bar.kt
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes T> assertEquals1(t1: T, t2: T) {}
|
||||
|
||||
fun test() {
|
||||
assertEquals1(null, Foo.foo())
|
||||
assertEquals1("", Foo.foo())
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
//FILE:Foo.java
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
// Issue: KT-26698
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.foo(element: T): T = null!!
|
||||
|
||||
class Inv<T>
|
||||
class Inv2<T, R>
|
||||
|
||||
class In<in T>
|
||||
class Out<out T>
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
fun test_0(x: Inv2<in Number, out Number>, list: List<Inv2<Any, Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>foo<!>(x)
|
||||
}
|
||||
|
||||
// ------------------------- Inv -------------------------
|
||||
|
||||
fun test_1(x: Inv<Number>, list: List<Inv<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_2(x: Inv<Number>, list: List<Inv<Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_3(x: Inv<Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_4(x: Inv<in Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_5(x: Inv<in Number>, list: List<Inv<Number>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_6(x: Inv<in Number>, list: List<Inv<Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_7(x: Inv<out Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_8(x: Inv<out Number>, list: List<Inv<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_9(x: Inv<out Number>, list: List<Inv<Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
// ------------------------- In -------------------------
|
||||
|
||||
fun test_11(x: In<Number>, list: List<In<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_12(x: In<Number>, list: List<In<Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_13(x: In<Number>, list: List<In<Any>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
// ------------------------- Out -------------------------
|
||||
|
||||
fun test_21(x: Out<Number>, list: List<Out<Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_22(x: Out<Number>, list: List<Out<Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_23(x: Out<Number>, list: List<Out<Any>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
fun test_31(x: Inv<Number>, list: List<Inv<in Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_32(x: Inv<Number>, list: List<Inv<in Int>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_33(x: Inv<Number>, list: List<Inv<in Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_34(x: Inv<Number>, list: List<Inv<out Number>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
|
||||
fun test_35(x: Inv<Number>, list: List<Inv<out Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_36(x: Inv<Number>, list: List<Inv<out Any>>) {
|
||||
list.contains1(x)
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
// Issue: KT-26698
|
||||
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
|
||||
import kotlin.internal.OnlyInputTypes
|
||||
|
||||
interface Bound
|
||||
class First : Bound
|
||||
class Second : Bound
|
||||
class Inv<I >(val v: I)
|
||||
class InvB<I : Bound>(val v: I)
|
||||
class In<in C>(v: C)
|
||||
class InB<in C : Bound>(v: C)
|
||||
class Out<out O>(val v: O)
|
||||
class OutB<out O : Bound>(val v: O)
|
||||
|
||||
fun <@OnlyInputTypes M> strictId(arg: M): M = arg
|
||||
fun <@OnlyInputTypes S> strictSelect(arg1: S, arg2: S): S = arg1
|
||||
|
||||
fun testOK(first: First, bound: Bound, second: Second) {
|
||||
strictId(Inv(15))
|
||||
strictId(Inv("foo"))
|
||||
strictId(Inv(first))
|
||||
strictId(InvB(first))
|
||||
strictId(In(first))
|
||||
strictId(InB(first))
|
||||
strictId(Out(first))
|
||||
strictId(OutB(first))
|
||||
strictId(Inv(Inv(Inv(first))))
|
||||
|
||||
strictSelect(Inv(first), Inv(first))
|
||||
strictSelect(InvB(first), InvB(first))
|
||||
|
||||
strictSelect(Out(first), Out(bound))
|
||||
strictSelect(OutB(first), OutB(bound))
|
||||
strictSelect(In(first), In(bound))
|
||||
strictSelect(InB(first), InB(bound))
|
||||
|
||||
val out: Out<Bound> = strictSelect(Out(first), Out(second))
|
||||
val outb: OutB<Bound> = strictSelect(OutB(first), OutB(second))
|
||||
strictSelect<Out<Bound>>(Out(first), Out(second))
|
||||
strictSelect<OutB<Bound>>(OutB(first), OutB(second))
|
||||
}
|
||||
|
||||
fun testFail(first: First, bound: Bound, second: Second) {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(InvB(first), InvB(bound))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(Inv(first), Inv(bound))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(Out(first), Out(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(In(first), In(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(InB(first), InB(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(Out(Inv(first)), Out(Inv(second)))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(In(Inv(first)), In(Inv(second)))
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@file:Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
|
||||
class Inv<T>
|
||||
class Out<out T>
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// !LANGUAGE: -StrictOnlyInputTypesChecks
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes S> select(a1: S, a2: S): S = TODO()
|
||||
|
||||
interface Common
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
private object TopLevelTypeVariable {
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>, "HIDDEN")
|
||||
fun <T> foo(): @kotlin.internal.NoInfer T = TODO()
|
||||
|
||||
fun <K> bar(k: K) {}
|
||||
|
||||
fun test() {
|
||||
bar(foo<Int>())
|
||||
}
|
||||
}
|
||||
|
||||
private object NestedTypeVariable {
|
||||
class Inv<T>
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>, "HIDDEN")
|
||||
fun <T> foo(): Inv<@kotlin.internal.NoInfer T> = TODO()
|
||||
|
||||
fun <K> bar(p: Inv<K>) {}
|
||||
|
||||
fun test() {
|
||||
bar(foo<String>())
|
||||
}
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
private object TopLevelTypeVariable {
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
fun <@kotlin.internal.OnlyInputTypes T> assertEquals1(t1: T, t2: T) {}
|
||||
|
||||
open class A
|
||||
class B: A()
|
||||
class C: A()
|
||||
class D
|
||||
|
||||
fun test1(a: A, b: B, c: C) {
|
||||
assertEquals1(a, b)
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>assertEquals1<!>(b, c)
|
||||
|
||||
assertEquals1(3, 3)
|
||||
assertEquals1(1 or 2, 2 or 1)
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> expect1(expected: T, block: () -> T) {}
|
||||
|
||||
fun test() {
|
||||
expect1(2) { byteArrayOf(1, 2, 3).indexOf(3) }
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
Reference in New Issue
Block a user