Force resolve annotations in annotation checker
#KT-46173 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
83bae89ed8
commit
7fb2bf00c5
@@ -1,3 +1,9 @@
|
||||
compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt:4:32: error: too many arguments for public constructor Anno() defined in Anno
|
||||
class UnresolvedArgument(@Anno(BLA) val s: Int)
|
||||
^
|
||||
compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt:4:32: error: unresolved reference: BLA
|
||||
class UnresolvedArgument(@Anno(BLA) val s: Int)
|
||||
^
|
||||
compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt:6:25: error: no value passed for parameter 'message'
|
||||
class WithoutArguments(@Deprecated val s: Int)
|
||||
^
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions
|
||||
// !DIAGNOSTICS: -USELESS_CAST
|
||||
// ISSUE: KT-46173
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Ann(val s: String)
|
||||
|
||||
fun some(): Int {
|
||||
return 1 as @Ann(<!ARGUMENT_TYPE_MISMATCH, ARGUMENT_TYPE_MISMATCH!>6<!>) Int // should error but doesn't
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions
|
||||
// !DIAGNOSTICS: -USELESS_CAST
|
||||
// ISSUE: KT-46173
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Ann(val s: String)
|
||||
|
||||
fun some(): Int {
|
||||
return 1 as @Ann(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>6<!>) Int // should error but doesn't
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun some(): kotlin.Int
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation {
|
||||
public constructor Ann(/*0*/ s: kotlin.String)
|
||||
public final val s: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+2
-2
@@ -5,8 +5,8 @@ interface A
|
||||
interface B : A
|
||||
interface C : A
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> select(x: K, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = x
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> select(x: K, y: K): @kotlin.internal.Exact K = x
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ interface A
|
||||
interface B : A
|
||||
interface C : A
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> select(x: K, y: K): @kotlin.internal.Exact K = x
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public fun </*0*/ K> select(/*0*/ x: K, /*1*/ y: K): K
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN"}) public fun </*0*/ K> select(/*0*/ x: K, /*1*/ y: K): K
|
||||
public fun test(/*0*/ b: B, /*1*/ c: C): kotlin.Unit
|
||||
|
||||
public interface A {
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ interface A
|
||||
interface B : A
|
||||
interface C : A
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> select(x: K, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = x
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> select(x: K, y: K): @kotlin.internal.Exact K = x
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ interface A
|
||||
interface B : A
|
||||
interface C : A
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> select(x: K, y: K): @kotlin.internal.Exact K = x
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public fun </*0*/ K> select(/*0*/ x: K, /*1*/ y: K): K
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN"}) public fun </*0*/ K> select(/*0*/ x: K, /*1*/ y: K): K
|
||||
public fun test(/*0*/ b: B, /*1*/ c: C): kotlin.Unit
|
||||
|
||||
public interface A {
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ interface ISample
|
||||
|
||||
fun <K> elvisSimple(x: K?, y: K): K = y
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> elvisExact(x: K?, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = y
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
|
||||
|
||||
fun <T : Number> materialize(): T? = TODO()
|
||||
|
||||
|
||||
compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation.kt
Vendored
+1
-1
@@ -5,7 +5,7 @@ interface ISample
|
||||
|
||||
fun <K> elvisSimple(x: K?, y: K): K = y
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
|
||||
|
||||
fun <T : Number> materialize(): T? = TODO()
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public fun </*0*/ K> elvisExact(/*0*/ x: K?, /*1*/ y: K): K
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN"}) public fun </*0*/ K> elvisExact(/*0*/ x: K?, /*1*/ y: K): K
|
||||
public fun </*0*/ K> elvisSimple(/*0*/ x: K?, /*1*/ y: K): K
|
||||
public fun </*0*/ T : kotlin.Number> materialize(): T?
|
||||
public fun test(/*0*/ nullableSample: ISample, /*1*/ any: kotlin.Any): kotlin.Unit
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ interface ISample
|
||||
|
||||
fun <K> elvisSimple(x: K?, y: K): K = y
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> elvisExact(x: K?, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = y
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
|
||||
|
||||
fun <T : Number> materialize(): T? = null
|
||||
fun <T> Any?.materialize(): T = null as T
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ interface ISample
|
||||
|
||||
fun <K> elvisSimple(x: K?, y: K): K = y
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
|
||||
|
||||
fun <T : Number> materialize(): T? = null
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public fun </*0*/ K> elvisExact(/*0*/ x: K?, /*1*/ y: K): K
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN"}) public fun </*0*/ K> elvisExact(/*0*/ x: K?, /*1*/ y: K): K
|
||||
public fun </*0*/ K> elvisSimple(/*0*/ x: K?, /*1*/ y: K): K
|
||||
public fun </*0*/ T : kotlin.Number> materialize(): T?
|
||||
public fun test(/*0*/ nullableSample: ISample, /*1*/ any: kotlin.Any): kotlin.Unit
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
// FILE: Foo.java
|
||||
|
||||
public class Foo {
|
||||
public static <K, V> void create(java.util.Map<? extends K, ? extends V> m) { return null; }
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun test(properties: Map<String, String>, nullableProperties: Map<String, String>?) {
|
||||
val f1 = Foo.create(select1(properties, myEmptyMap()))
|
||||
val f2 = Foo.create(nullableProperties ?: myEmptyMap())
|
||||
}
|
||||
|
||||
fun <T, R> myEmptyMap(): Map<T, R> = TODO()
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <S> select1(x: S, y: S): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> S = y
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
@@ -16,5 +17,5 @@ fun test(properties: Map<String, String>, nullableProperties: Map<String, String
|
||||
|
||||
fun <T, R> myEmptyMap(): Map<T, R> = TODO()
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN")
|
||||
fun <S> select1(x: S, y: S): @kotlin.internal.Exact S = y
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T, /*1*/ R> myEmptyMap(): kotlin.collections.Map<T, R>
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public fun </*0*/ S> select1(/*0*/ x: S, /*1*/ y: S): S
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "HIDDEN"}) public fun </*0*/ S> select1(/*0*/ x: S, /*1*/ y: S): S
|
||||
public fun test(/*0*/ properties: kotlin.collections.Map<kotlin.String, kotlin.String>, /*1*/ nullableProperties: kotlin.collections.Map<kotlin.String, kotlin.String>?): kotlin.Unit
|
||||
|
||||
public open class Foo {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: implicitNothingInDelegate.kt
|
||||
@R|kotlin/Suppress|(vararg(String(INVISIBLE_REFERENCE))) public final operator fun <V, V1 : R|V|> R|kotlin/collections/Map<in kotlin/String, @Exact V>|.getValue(thisRef: R|kotlin/Any?|, property: R|kotlin/reflect/KProperty<*>|): R|V1| {
|
||||
@R|kotlin/Suppress|(vararg(String(INVISIBLE_REFERENCE), String(INVISIBLE_MEMBER))) public final operator fun <V, V1 : R|V|> R|kotlin/collections/Map<in kotlin/String, @Exact V>|.getValue(thisRef: R|kotlin/Any?|, property: R|kotlin/reflect/KProperty<*>|): R|V1| {
|
||||
^getValue Null(null)!!
|
||||
}
|
||||
public final val m2: R|kotlin/collections/Map<kotlin/String, *>| = R|kotlin/collections/mapOf|<R|kotlin/String|, R|kotlin/String|>(String(baz).R|kotlin/to|<R|kotlin/String|, R|kotlin/String|>(String(bat)))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
public operator fun <V, V1 : V> Map<in String, @kotlin.internal.Exact V>.getValue(thisRef: Any?, property: KProperty<*>): V1 = null!!
|
||||
|
||||
val m2: Map<String, *> = mapOf("baz" to "bat")
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@ package
|
||||
public val bar: kotlin.String
|
||||
public val m2: kotlin.collections.Map<kotlin.String, *>
|
||||
public fun foo(): kotlin.Unit
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public operator fun </*0*/ V, /*1*/ V1 : V> kotlin.collections.Map<in kotlin.String, V>.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): V1
|
||||
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE", "INVISIBLE_MEMBER"}) public operator fun </*0*/ V, /*1*/ V1 : V> kotlin.collections.Map<in kotlin.String, V>.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): V1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user