Add test on kotlin.native.Throws ambiguity
KT-35468
This commit is contained in:
committed by
Ilya Gorbunov
parent
c6ae423816
commit
0f9718bf0d
@@ -0,0 +1,179 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: throws.kt
|
||||
package kotlin
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
public annotation class Throws(vararg val ThrowableClasses: KClass<out Throwable>)
|
||||
|
||||
// FILE: native.kt
|
||||
package kotlin.native
|
||||
|
||||
@Deprecated("")
|
||||
public typealias Throws = kotlin.Throws
|
||||
|
||||
// FILE: main1.kt
|
||||
package abc1
|
||||
|
||||
@Throws(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: Throws) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main2.kt
|
||||
package abc2
|
||||
|
||||
import kotlin.native.<!DEPRECATION!>Throws<!>
|
||||
|
||||
@<!DEPRECATION!>Throws<!>(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: <!DEPRECATION!>Throws<!>) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main3.kt
|
||||
package abc3
|
||||
|
||||
import kotlin.Throws
|
||||
|
||||
@Throws(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: Throws) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main4.kt
|
||||
package abc4
|
||||
|
||||
import kotlin.<!CONFLICTING_IMPORT!>Throws<!>
|
||||
import kotlin.native.<!CONFLICTING_IMPORT, DEPRECATION!>Throws<!>
|
||||
|
||||
@Throws(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: Throws) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main5.kt
|
||||
package abc5
|
||||
|
||||
import kotlin.native.*
|
||||
|
||||
@<!DEPRECATION!>Throws<!>(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: <!DEPRECATION!>Throws<!>) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main6.kt
|
||||
package abc6
|
||||
|
||||
import kotlin.*
|
||||
|
||||
@Throws(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: Throws) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main7.kt
|
||||
package abc7
|
||||
|
||||
import kotlin.*
|
||||
import kotlin.native.*
|
||||
|
||||
@Throws(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: Throws) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main8.kt
|
||||
package abc8
|
||||
|
||||
import kotlin.*
|
||||
import kotlin.native.<!DEPRECATION!>Throws<!>
|
||||
|
||||
@<!DEPRECATION!>Throws<!>(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: <!DEPRECATION!>Throws<!>) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
|
||||
// FILE: main9.kt
|
||||
package abc9
|
||||
|
||||
import kotlin.native.*
|
||||
import kotlin.Throws
|
||||
|
||||
@Throws(Throwable::class)
|
||||
fun foo1() {}
|
||||
|
||||
@kotlin.Throws(Throwable::class)
|
||||
fun foo2() {}
|
||||
|
||||
@<!DEPRECATION!>kotlin.native.Throws<!>(Throwable::class)
|
||||
fun foo3() {}
|
||||
|
||||
fun foo5(x: Throws) {}
|
||||
fun foo6(x: kotlin.Throws) {}
|
||||
fun foo7(x: kotlin.native.<!DEPRECATION!>Throws<!>) {}
|
||||
@@ -0,0 +1,97 @@
|
||||
package
|
||||
|
||||
package abc1 {
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc2 {
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc3 {
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc4 {
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc5 {
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc6 {
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc7 {
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc8 {
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package abc9 {
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo1(): kotlin.Unit
|
||||
@kotlin.Throws(ThrowableClasses = {kotlin.Throwable::class}) public fun foo2(): kotlin.Unit
|
||||
@kotlin.native.Throws /* = kotlin.Throws */(ThrowableClasses = {kotlin.Throwable::class}) public fun foo3(): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Throws): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.native.Throws /* = kotlin.Throws */): kotlin.Unit
|
||||
}
|
||||
|
||||
package kotlin {
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR}) @kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) public final annotation class Throws : kotlin.Annotation {
|
||||
public constructor Throws(/*0*/ vararg ThrowableClasses: kotlin.reflect.KClass<out kotlin.Throwable> /*kotlin.Array<out kotlin.reflect.KClass<out kotlin.Throwable>>*/)
|
||||
public final val ThrowableClasses: kotlin.Array<out kotlin.reflect.KClass<out kotlin.Throwable>>
|
||||
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
|
||||
}
|
||||
|
||||
package kotlin.native {
|
||||
@kotlin.Deprecated(message = "") public typealias Throws = kotlin.Throws
|
||||
}
|
||||
}
|
||||
+5
@@ -43,6 +43,11 @@ public class DiagnosticsNativeTestGenerated extends AbstractDiagnosticsNativeTes
|
||||
runTest("compiler/testData/diagnostics/nativeTests/throws.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("throwsClash.kt")
|
||||
public void testThrowsClash() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelSingleton.kt")
|
||||
public void testTopLevelSingleton() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt");
|
||||
|
||||
Reference in New Issue
Block a user