[FIR] Resolve annotations as calls
This commit is contained in:
committed by
Mikhail Glukhikh
parent
bc1fa8ed7f
commit
721b9b4d8c
Vendored
+3
-3
@@ -12,12 +12,12 @@ public @interface A {
|
||||
|
||||
@A(*arrayOf("5", "6"), "7", y = 3) fun test3() {}
|
||||
|
||||
@A("1", "2", "3", x = String::class, y = 4) fun test4() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A("1", "2", "3", x = String::class, y = 4)<!> fun test4() {}
|
||||
|
||||
@A("4", y = 5) fun test5() {}
|
||||
|
||||
@A(*arrayOf("5", "6"), "7", x = Any::class, y = 6) fun test6() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(*arrayOf("5", "6"), "7", x = Any::class, y = 6)<!> fun test6() {}
|
||||
|
||||
@A(y = 7) fun test7() {}
|
||||
|
||||
@A("8", "9", "10") fun test8() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A("8", "9", "10")<!> fun test8() {}
|
||||
|
||||
+5
-5
@@ -15,16 +15,16 @@ public @interface A {
|
||||
|
||||
@A(*arrayOf("5", "6"), "7") fun test3() {}
|
||||
|
||||
@A("1", "2", "3", x = String::class) fun test4() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A("1", "2", "3", x = String::class)<!> fun test4() {}
|
||||
|
||||
@A("4", y = 2) fun test5() {}
|
||||
|
||||
@A(*arrayOf("5", "6"), "7", x = Any::class, y = 3) fun test6() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(*arrayOf("5", "6"), "7", x = Any::class, y = 3)<!> fun test6() {}
|
||||
|
||||
@A() fun test7() {}
|
||||
|
||||
@A fun test8() {}
|
||||
|
||||
@A(x = Any::class, *arrayOf("5", "6"), "7", y = 3) fun test9() {}
|
||||
@A(x = Any::class, value = ["5", "6"], "7", y = 3) fun test10() {}
|
||||
@A(x = Any::class, value = ["5", "6", "7"], y = 3) fun test11() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(x = Any::class, *arrayOf("5", "6"), "7", y = 3)<!> fun test9() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(x = Any::class, value = ["5", "6"], "7", y = 3)<!> fun test10() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(x = Any::class, value = ["5", "6", "7"], y = 3)<!> fun test11() {}
|
||||
|
||||
+1
-1
@@ -6,6 +6,6 @@ public @interface A {
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
@A(*arrayOf(1, "b"))
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(*arrayOf(1, "b"))<!>
|
||||
fun test() {
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
|
||||
annotation class B(vararg val args: String)
|
||||
|
||||
@B(*arrayOf(1, "b"))
|
||||
<!INAPPLICABLE_CANDIDATE!>@B(*arrayOf(1, "b"))<!>
|
||||
fun test() {
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,27 +1,27 @@
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE
|
||||
|
||||
// FILE: b.kt
|
||||
@file:JvmPackageName("")
|
||||
<!HIDDEN!>@file:JvmPackageName("")<!>
|
||||
package b
|
||||
fun b() {}
|
||||
|
||||
// FILE: c.kt
|
||||
@file:JvmPackageName("invalid-fq-name")
|
||||
<!HIDDEN!>@file:JvmPackageName("invalid-fq-name")<!>
|
||||
package c
|
||||
fun c() {}
|
||||
|
||||
// FILE: d.kt
|
||||
@file:JvmPackageName("d")
|
||||
<!HIDDEN!>@file:JvmPackageName("d")<!>
|
||||
package d
|
||||
class D
|
||||
fun d() {}
|
||||
|
||||
// FILE: e.kt
|
||||
@file:JvmPackageName(42)
|
||||
<!HIDDEN!>@file:JvmPackageName(42)<!>
|
||||
package e
|
||||
fun e() {}
|
||||
|
||||
// FILE: f.kt
|
||||
@file:JvmPackageName(f)
|
||||
<!HIDDEN!>@file:JvmPackageName(f)<!>
|
||||
package f
|
||||
const val name = "f"
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ class MyClass1
|
||||
@Ann1(arrayOf(Any::class))
|
||||
class MyClass1a
|
||||
|
||||
@Ann1(arrayOf(B1::class))
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann1(arrayOf(B1::class))<!>
|
||||
class MyClass2
|
||||
|
||||
annotation class Ann2(val arg: Array<KClass<in B1>>)
|
||||
@@ -25,5 +25,5 @@ class MyClass3
|
||||
@Ann2(arrayOf(B1::class))
|
||||
class MyClass4
|
||||
|
||||
@Ann2(arrayOf(B2::class))
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann2(arrayOf(B2::class))<!>
|
||||
class MyClass5
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ annotation class Ann1(val arg: Array<KClass<out A>>)
|
||||
@Ann1(arrayOf(A::class))
|
||||
class MyClass1
|
||||
|
||||
@Ann1(arrayOf(Any::class))
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann1(arrayOf(Any::class))<!>
|
||||
class MyClass1a
|
||||
|
||||
@Ann1(arrayOf(B1::class))
|
||||
@@ -19,11 +19,11 @@ class MyClass2
|
||||
|
||||
annotation class Ann2(val arg: Array<KClass<out B1>>)
|
||||
|
||||
@Ann2(arrayOf(A::class))
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann2(arrayOf(A::class))<!>
|
||||
class MyClass3
|
||||
|
||||
@Ann2(arrayOf(B1::class))
|
||||
class MyClass4
|
||||
|
||||
@Ann2(arrayOf(B2::class))
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann2(arrayOf(B2::class))<!>
|
||||
class MyClass5
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ class MyClass1
|
||||
@Ann1(Any::class)
|
||||
class MyClass1a
|
||||
|
||||
@Ann1(B1::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann1(B1::class)<!>
|
||||
class MyClass2
|
||||
|
||||
annotation class Ann2(val arg: KClass<in B1>)
|
||||
@@ -23,5 +23,5 @@ class MyClass3
|
||||
@Ann2(B1::class)
|
||||
class MyClass4
|
||||
|
||||
@Ann2(B2::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann2(B2::class)<!>
|
||||
class MyClass5
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ annotation class Ann1(val arg: KClass<out A>)
|
||||
@Ann1(A::class)
|
||||
class MyClass1
|
||||
|
||||
@Ann1(Any::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann1(Any::class)<!>
|
||||
class MyClass1a
|
||||
|
||||
@Ann1(B1::class)
|
||||
@@ -17,11 +17,11 @@ class MyClass2
|
||||
|
||||
annotation class Ann2(val arg: KClass<out B1>)
|
||||
|
||||
@Ann2(A::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann2(A::class)<!>
|
||||
class MyClass3
|
||||
|
||||
@Ann2(B1::class)
|
||||
class MyClass4
|
||||
|
||||
@Ann2(B2::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann2(B2::class)<!>
|
||||
class MyClass5
|
||||
|
||||
+3
-3
@@ -8,15 +8,15 @@ annotation class Ann1(val arg: KClass<A>)
|
||||
@Ann1(A::class)
|
||||
class MyClass1
|
||||
|
||||
@Ann1(Any::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann1(Any::class)<!>
|
||||
class MyClass1a
|
||||
|
||||
@Ann1(B::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann1(B::class)<!>
|
||||
class MyClass2
|
||||
|
||||
annotation class Ann2(val arg: KClass<B>)
|
||||
|
||||
@Ann2(A::class)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann2(A::class)<!>
|
||||
class MyClass3
|
||||
|
||||
@Ann2(B::class)
|
||||
|
||||
+2
-2
@@ -6,6 +6,6 @@ public @interface A {
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
@A(false,
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(false,
|
||||
1.0,
|
||||
false, 1, 2) fun foo1() {}
|
||||
false, 1, 2)<!> fun foo1() {}
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@ public @interface A {
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
@A(false,
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(false,
|
||||
1.0,
|
||||
false) fun foo1() {}
|
||||
false)<!> fun foo1() {}
|
||||
|
||||
@A(2.0, x = true, b = 2.0) fun foo2() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>@A(2.0, x = true, b = 2.0)<!> fun foo2() {}
|
||||
|
||||
+4
-4
@@ -10,19 +10,19 @@ fun newPublishedFun() {}
|
||||
annotation class Marker
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(Marker::class)
|
||||
<!HIDDEN!>@WasExperimental(Marker::class)<!>
|
||||
fun newFunExperimentalInThePast() {}
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(Marker::class)
|
||||
<!HIDDEN!>@WasExperimental(Marker::class)<!>
|
||||
val newValExperimentalInThePast = ""
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(Marker::class)
|
||||
<!HIDDEN!>@WasExperimental(Marker::class)<!>
|
||||
class NewClassExperimentalInThePast
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(Marker::class)
|
||||
<!HIDDEN!>@WasExperimental(Marker::class)<!>
|
||||
typealias TypeAliasToNewClass = NewClassExperimentalInThePast
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class Foo {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
<!HIDDEN!>@kotlin.internal.LowPriorityInOverloadResolution<!>
|
||||
val test: Bar = Bar()
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEBUG_INFO_CONSTANT -UNUSED_EXPRESSION
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes K, V, V1 : V?>
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> K, V, V1 : V?>
|
||||
Map<out K, @kotlin.internal.Exact V>.getOrDefault_Exact(key: K, defaultValue: V1): V1 = TODO()
|
||||
|
||||
fun test() {
|
||||
@@ -14,4 +14,4 @@ fun test() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>r2<!>
|
||||
|
||||
map.getOrDefault_Exact("y", "string")
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ interface Parent
|
||||
object ChildA : Parent
|
||||
object ChildB : Parent
|
||||
|
||||
fun <@kotlin.internal.OnlyInputTypes T> select(a: T, b: T) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> select(a: T, b: T) {}
|
||||
|
||||
fun test() {
|
||||
select(ChildA, ChildB) // should be error
|
||||
|
||||
Vendored
+4
-4
@@ -7,17 +7,17 @@ class CX : Base()
|
||||
class CY : Base()
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes T> foo(a: T, b: T) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> foo(a: T, b: T) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes T : Any> fooA(a: T, b: T) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T : Any> fooA(a: T, b: T) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes T : Base> fooB(a: T, b: T) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T : Base> fooB(a: T, b: T) {}
|
||||
|
||||
|
||||
fun usage(x: CX, y: CY) {
|
||||
foo(x, y) // expected err, got err
|
||||
fooA(x, y) // expected err, got ok
|
||||
fooB(x, y) // expected err, got ok
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
annotation class Anno
|
||||
|
||||
fun test(a: List<Class<Anno>>) {
|
||||
strictSelect(a, emptyList<Anno>().map { it.annotationClass.java })
|
||||
}
|
||||
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> S> strictSelect(arg1: S, arg2: S): S = TODO()
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@@ -10,4 +9,4 @@ 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()
|
||||
fun <@kotlin.internal.OnlyInputTypes S> strictSelect(arg1: S, arg2: S): S = TODO()
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
<!HIDDEN!>@kotlin.internal.LowPriorityInOverloadResolution<!>
|
||||
public fun <T> Iterable<T>.contains1(element: T): Int = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@@ -13,4 +13,4 @@ public fun <T> Iterable<T>.contains1(element: @kotlin.internal.NoInfer T): Boole
|
||||
fun test() {
|
||||
val a: Boolean = listOf(1).contains1("")
|
||||
val b: Boolean = listOf(1).contains1(1)
|
||||
}
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !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", "INVISIBLE_REFERENCE")
|
||||
fun <<!HIDDEN!>@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
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@@ -16,4 +15,4 @@ public class Test<K> extends TestBase<K> { }
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
interface IFace<K, out V>
|
||||
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> K, V> IFace<out K, V>.get(key: K): V? = TODO()
|
||||
fun <<!HIDDEN!>@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
+1
-1
@@ -3,7 +3,7 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
public fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
class In<in T>
|
||||
|
||||
|
||||
+5
-5
@@ -4,19 +4,19 @@
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
<!HIDDEN!>@kotlin.internal.LowPriorityInOverloadResolution<!>
|
||||
public fun <T> Iterable<T>.contains1(element: T): Int = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
public fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@JvmName("getAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
<!HIDDEN!>@kotlin.internal.LowPriorityInOverloadResolution<!>
|
||||
public fun <K, V> Map<K, V>.get1(key: Any?): Int = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.get1(key: K): V? = null!!
|
||||
public fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> K, V> Map<out K, V>.get1(key: K): V? = null!!
|
||||
|
||||
fun test(map: Map<Int, String>) {
|
||||
val a: Int = listOf(1).contains1("")
|
||||
@@ -24,4 +24,4 @@ fun test(map: Map<Int, String>) {
|
||||
|
||||
val c: String? = map.get1("")
|
||||
val d: String? = map.get1(1)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -5,13 +5,13 @@
|
||||
class Inv<T>
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes K> Inv<out K>.onlyOut(e: K) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> K> Inv<out K>.onlyOut(e: K) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes K : Number> Inv<out K>.onlyOutUB(e: K) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> K : Number> Inv<out K>.onlyOutUB(e: K) {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes K> Inv<in K>.onlyIn(e: K) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> K> Inv<in K>.onlyIn(e: K) {}
|
||||
|
||||
fun test(
|
||||
invStar: Inv<*>,
|
||||
@@ -71,4 +71,4 @@ class Test5 {
|
||||
}
|
||||
field = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+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", "INVISIBLE_REFERENCE")
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> assertEquals1(t1: T, t2: T) {}
|
||||
|
||||
fun test() {
|
||||
assertEquals1(null, Foo.foo())
|
||||
assertEquals1("", Foo.foo())
|
||||
}
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
//FILE:Foo.java
|
||||
@@ -17,4 +16,4 @@ fun <@kotlin.internal.OnlyInputTypes T> assertEquals1(t1: T, t2: T) {}
|
||||
fun test() {
|
||||
assertEquals1(null, Foo.foo())
|
||||
assertEquals1("", Foo.foo())
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
// Issue: KT-26698
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
public fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> Iterable<T>.contains1(element: T): Boolean = null!!
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.foo(element: T): T = null!!
|
||||
public fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> Iterable<T>.foo(element: T): T = null!!
|
||||
|
||||
class Inv<T>
|
||||
class Inv2<T, R>
|
||||
|
||||
+2
-2
@@ -16,8 +16,8 @@ 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 <<!HIDDEN!>@OnlyInputTypes<!> M> strictId(arg: M): M = arg
|
||||
fun <<!HIDDEN!>@OnlyInputTypes<!> S> strictSelect(arg1: S, arg2: S): S = arg1
|
||||
|
||||
fun testOK(first: First, bound: Bound, second: Second) {
|
||||
strictId(Inv(15))
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ fun <T> foo(i: Inv<in T>, o: Out<T>) {
|
||||
bar(i, o)
|
||||
}
|
||||
|
||||
fun <@kotlin.internal.OnlyInputTypes K> bar(r: Inv<out K>, o: Out<K>): K = TODO()
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> K> bar(r: Inv<out K>, o: Out<K>): K = TODO()
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes S> select(a1: S, a2: S): S = TODO()
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> S> select(a1: S, a2: S): S = TODO()
|
||||
|
||||
interface Common
|
||||
class First : Common
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes T> assertEquals1(t1: T, t2: T) {}
|
||||
fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> assertEquals1(t1: T, t2: T) {}
|
||||
|
||||
open class A
|
||||
class B: A()
|
||||
@@ -19,8 +19,8 @@ fun test1(a: A, b: B, c: C) {
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <@kotlin.internal.OnlyInputTypes T> expect1(expected: T, block: () -> T) {}
|
||||
public fun <<!HIDDEN!>@kotlin.internal.OnlyInputTypes<!> T> expect1(expected: T, block: () -> T) {}
|
||||
|
||||
fun test() {
|
||||
expect1(2) { byteArrayOf(1, 2, 3).indexOf(3) }
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -UNUSED_PARAMETER -NULLABLE_INLINE_PARAMETER
|
||||
|
||||
<!HIDDEN!>@kotlin.internal.InlineOnly<!>
|
||||
inline fun test() {
|
||||
|
||||
}
|
||||
|
||||
<!HIDDEN!>@kotlin.internal.InlineOnly<!>
|
||||
inline fun test3(noinline s : (Int) -> Int) {
|
||||
|
||||
}
|
||||
|
||||
<!HIDDEN!>@kotlin.internal.InlineOnly<!>
|
||||
inline fun test4(noinline s : Int.() -> Int) {
|
||||
|
||||
}
|
||||
|
||||
<!HIDDEN!>@kotlin.internal.InlineOnly<!>
|
||||
inline fun Function1<Int, Int>?.test5() {
|
||||
|
||||
}
|
||||
|
||||
<!HIDDEN!>@kotlin.internal.InlineOnly<!>
|
||||
inline fun Function1<Int, Int>?.test6() {
|
||||
|
||||
}
|
||||
|
||||
<!HIDDEN!>@kotlin.internal.InlineOnly<!>
|
||||
inline fun test2(s : ((Int) -> Int)?) {
|
||||
|
||||
}
|
||||
Vendored
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -UNUSED_PARAMETER -NULLABLE_INLINE_PARAMETER
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
@@ -29,4 +28,4 @@ inline fun Function1<Int, Int>?.test6() {
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun test2(s : ((Int) -> Int)?) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
inline fun <reified <!HIDDEN!>@kotlin.internal.PureReifiable<!> T> foo(x: T) {}
|
||||
|
||||
fun test() {
|
||||
foo<List<String>>(listOf(""))
|
||||
foo(listOf(""))
|
||||
|
||||
foo<Array<String>>(arrayOf(""))
|
||||
foo(arrayOf(""))
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
@JvmName()
|
||||
<!INAPPLICABLE_CANDIDATE!>@JvmName()<!>
|
||||
fun foo() {}
|
||||
|
||||
@JvmName(42)
|
||||
<!INAPPLICABLE_CANDIDATE!>@JvmName(42)<!>
|
||||
fun bar() {}
|
||||
|
||||
@JvmName("a", "b")
|
||||
<!INAPPLICABLE_CANDIDATE!>@JvmName("a", "b")<!>
|
||||
fun baz() {}
|
||||
|
||||
@@ -8,11 +8,11 @@ package b
|
||||
import a.A
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach(i: Int) = i
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach(s: String) {}
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ class A {
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach() = ""
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach(s: String) {}
|
||||
|
||||
fun test(a: A) {
|
||||
|
||||
@@ -8,12 +8,12 @@ class A {
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach(i: Int) = i
|
||||
|
||||
class B {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach() = this@B
|
||||
|
||||
fun test(a: A) {
|
||||
@@ -27,11 +27,11 @@ class B {
|
||||
|
||||
fun test2(a: A) {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach() = ""
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.HidesMembers
|
||||
<!HIDDEN!>@kotlin.internal.HidesMembers<!>
|
||||
fun A.forEach(i: Int) = ""
|
||||
|
||||
a.forEach() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
|
||||
@@ -41,4 +41,4 @@ fun test2(a: A) {
|
||||
forEach() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
|
||||
forEach(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user