[FIR] Disallow operators not on functions
Introduce `NOT_FUNCTION_AS_OPERATOR` and use it instead of `PROPERTY_AS_OPERATOR` ^KT-65881 Fixed Merge-request: KT-MR-14547
This commit is contained in:
committed by
Space Team
parent
df9d59851d
commit
2d4f4b9bb5
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// ISSUE: KT-59715
|
||||
|
||||
class FunctionComponent {
|
||||
val component1: () -> String = { "hello" }
|
||||
}
|
||||
|
||||
class I {
|
||||
operator fun invoke(): String = "hello"
|
||||
}
|
||||
|
||||
class InvokeComponent {
|
||||
val component1: I = I()
|
||||
}
|
||||
|
||||
fun test_1(c: FunctionComponent) {
|
||||
val (<!NOT_FUNCTION_AS_OPERATOR!>x<!>) = FunctionComponent()
|
||||
val (<!NOT_FUNCTION_AS_OPERATOR!>y<!>) = c
|
||||
}
|
||||
|
||||
fun test_2(c: InvokeComponent) {
|
||||
val (<!NOT_FUNCTION_AS_OPERATOR!>x<!>) = FunctionComponent()
|
||||
val (<!NOT_FUNCTION_AS_OPERATOR!>y<!>) = c
|
||||
}
|
||||
Reference in New Issue
Block a user