Syntax forms 'a<T>::foo', 'a?::foo' have special cases resolved for future releases.
'a<T>::foo' is reserved if 'a' is a simple name and can be resolved as an expression (this can be extended to 'a.b.c<T>::foo' case, although that is rather hard to implement using PSI). 'a?::foo' is reserved if 'a' can be resolved as an expression.
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
package test
|
||||
|
||||
object ClassMemberMarker
|
||||
|
||||
class a<T> {
|
||||
fun foo() = ClassMemberMarker
|
||||
}
|
||||
|
||||
class b<T1, T2> {
|
||||
fun foo() = ClassMemberMarker
|
||||
}
|
||||
|
||||
fun Int.foo() {}
|
||||
|
||||
class Test {
|
||||
val <T> List<T>.a: Int get() = size
|
||||
val <T> List<T>.b: Int? get() = size
|
||||
|
||||
fun <T> List<T>.testCallable1(): () -> Unit = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a<T><!>::foo
|
||||
fun <T> List<T>.testCallable2(): () -> Unit = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>b<!>?::<!UNSAFE_CALL!>foo<!>
|
||||
fun <T> List<T>.testCallable3(): () -> Unit = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>b<T, Any><!>::<!UNSAFE_CALL!>foo<!>
|
||||
fun <T> List<T>.testCallable4(): () -> Unit = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>b<T><!>?::<!UNSAFE_CALL!>foo<!>
|
||||
|
||||
fun <T> List<T>.testClassLiteral1() = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a<T><!>::class
|
||||
fun <T> List<T>.testClassLiteral2() = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>b<!>?::class
|
||||
fun <T> List<T>.testClassLiteral3() = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>b<T, Any><!>::class
|
||||
|
||||
fun <T> List<T>.testUnresolved1() = <!UNRESOLVED_REFERENCE!>unresolved<!><T>::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>
|
||||
fun <T> List<T>.testUnresolved2() = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a<<!UNRESOLVED_REFERENCE!>unresolved<!>><!>::foo
|
||||
fun <T> List<T>.testUnresolved3() = a<<!SYNTAX!><!>>::foo
|
||||
fun <T> List<T>.testUnresolved4() = <!UNRESOLVED_REFERENCE!>unresolved<!>?::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package
|
||||
|
||||
package test {
|
||||
public fun kotlin.Int.foo(): kotlin.Unit
|
||||
|
||||
public object ClassMemberMarker {
|
||||
private constructor ClassMemberMarker()
|
||||
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
|
||||
}
|
||||
|
||||
public final class Test {
|
||||
public constructor Test()
|
||||
public final val </*0*/ T> kotlin.collections.List<T>.a: kotlin.Int
|
||||
public final val </*0*/ T> kotlin.collections.List<T>.b: kotlin.Int?
|
||||
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
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testCallable1(): () -> kotlin.Unit
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testCallable2(): () -> kotlin.Unit
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testCallable3(): () -> kotlin.Unit
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testCallable4(): () -> kotlin.Unit
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testClassLiteral1(): kotlin.reflect.KClass<kotlin.Int>
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testClassLiteral2(): kotlin.reflect.KClass<kotlin.Int?>
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testClassLiteral3(): kotlin.reflect.KClass<kotlin.Int?>
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testUnresolved1(): [ERROR : Error function type]
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testUnresolved2(): kotlin.reflect.KFunction0<kotlin.Unit>
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testUnresolved3(): kotlin.reflect.KFunction0<kotlin.Unit>
|
||||
public final fun </*0*/ T> kotlin.collections.List<T>.testUnresolved4(): [ERROR : Error function type]
|
||||
}
|
||||
|
||||
public final class a</*0*/ T> {
|
||||
public constructor a</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): test.ClassMemberMarker
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class b</*0*/ T1, /*1*/ T2> {
|
||||
public constructor b</*0*/ T1, /*1*/ T2>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): test.ClassMemberMarker
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
package test
|
||||
|
||||
fun nullableFun(): Int? = null
|
||||
fun Int.foo() {}
|
||||
|
||||
val test1 = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>nullableFun()<!>?::<!UNSAFE_CALL!>foo<!>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package
|
||||
|
||||
package test {
|
||||
public val test1: kotlin.reflect.KFunction0<kotlin.Unit>
|
||||
public fun nullableFun(): kotlin.Int?
|
||||
public fun kotlin.Int.foo(): kotlin.Unit
|
||||
}
|
||||
Reference in New Issue
Block a user