Deprecate ExtensionFunctionType on a non-function types
Related to KT-43527
This commit is contained in:
@@ -6,7 +6,7 @@ fun foo(a: (String) -> Unit) {
|
||||
|
||||
interface A : (String) -> Unit {}
|
||||
|
||||
fun foo(a: @ExtensionFunctionType A) {
|
||||
fun foo(a: <!WRONG_EXTENSION_FUNCTION_TYPE_WARNING!>@ExtensionFunctionType<!> A) {
|
||||
// @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
|
||||
// Only kotlin.Function{n} type annotated with @Extension should
|
||||
"".a()
|
||||
|
||||
@@ -6,7 +6,7 @@ fun foo(a: (String) -> Unit) {
|
||||
|
||||
interface A : (String) -> Unit {}
|
||||
|
||||
fun foo(a: @ExtensionFunctionType A) {
|
||||
fun foo(a: <!WRONG_EXTENSION_FUNCTION_TYPE_WARNING!>@ExtensionFunctionType<!> A) {
|
||||
// @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
|
||||
// Only kotlin.Function{n} type annotated with @Extension should
|
||||
"".<!UNRESOLVED_REFERENCE!>a<!>()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +ForbidExtensionFunctionTypeOnNonFunctionTypes
|
||||
// This test checks that annotations on extension function types are preserved. See the corresponding .txt file
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
@@ -17,4 +18,6 @@ interface Some {
|
||||
}
|
||||
|
||||
fun f7(x: <!WRONG_EXTENSION_FUNCTION_TYPE!>@ExtensionFunctionType<!> Function0<Int>)
|
||||
|
||||
fun f8(x: <!WRONG_EXTENSION_FUNCTION_TYPE!>@ExtensionFunctionType<!> Int)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +ForbidExtensionFunctionTypeOnNonFunctionTypes
|
||||
// This test checks that annotations on extension function types are preserved. See the corresponding .txt file
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
@@ -17,4 +18,6 @@ interface Some {
|
||||
}
|
||||
|
||||
fun f7(x: <!WRONG_EXTENSION_FUNCTION_TYPE!>@ExtensionFunctionType<!> Function0<Int>)
|
||||
|
||||
fun f8(x: <!WRONG_EXTENSION_FUNCTION_TYPE!>@ExtensionFunctionType<!> Int)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ public interface Some {
|
||||
public abstract fun f5(): kotlin.Int.(???) -> kotlin.Int
|
||||
public open fun f6(/*0*/ x: kotlin.Int.(???) -> kotlin.Int): kotlin.Unit
|
||||
public abstract fun f7(/*0*/ x: kotlin.Int.(???) -> kotlin.Int): kotlin.Unit
|
||||
public abstract fun f8(/*0*/ x: @kotlin.ExtensionFunctionType kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: -ForbidExtensionFunctionTypeOnNonFunctionTypes
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Ann1
|
||||
|
||||
@@ -9,8 +10,7 @@ typealias Alias1 = @Ann1 String
|
||||
typealias Alias2 = @Ann2 Alias1
|
||||
fun test1(a: Alias2) = a
|
||||
|
||||
// NB @ExtensionFunctionType on non-functional type is not an error
|
||||
typealias Alias3 = @ExtensionFunctionType Alias1
|
||||
typealias Alias3 = <!WRONG_EXTENSION_FUNCTION_TYPE_WARNING!>@ExtensionFunctionType<!> Alias1
|
||||
fun test2(a: Alias3) = a
|
||||
|
||||
typealias LA1 = List<@Ann2 Alias1>
|
||||
|
||||
Reference in New Issue
Block a user