[PSI, FE] Support functional types
This commit is contained in:
committed by
TeamCityServer
parent
e53cee77a3
commit
e3f987459c
+10
@@ -0,0 +1,10 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
class Button
|
||||
class ClickEvent
|
||||
|
||||
typealias ClickHandler = context(Button) (ClickEvent) -> Unit
|
||||
|
||||
fun handleClick(clickHandler: ClickHandler) {
|
||||
clickHandler(Button(), ClickEvent())
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun handleClick(/*0*/ clickHandler: ClickHandler /* = @kotlin.ContextFunctionTypeParams(count = 1) (ClickEvent) -> kotlin.Unit */): kotlin.Unit
|
||||
|
||||
public final class Button {
|
||||
public constructor Button()
|
||||
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 ClickEvent {
|
||||
public constructor ClickEvent()
|
||||
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 typealias ClickHandler = @kotlin.ContextFunctionTypeParams(count = 1) (ClickEvent) -> kotlin.Unit
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
|
||||
class Context
|
||||
class Receiver
|
||||
class Param
|
||||
|
||||
fun foo(context: Context, receiver: Receiver, p: Param) {}
|
||||
|
||||
context(Context)
|
||||
fun bar(receiver: Receiver, p: Param) {}
|
||||
|
||||
context(Context)
|
||||
fun Receiver.baz(p: Param) {}
|
||||
|
||||
fun main() {
|
||||
var g: context(Context) Receiver.(Param) -> Unit
|
||||
g = ::<!UNRESOLVED_REFERENCE!>foo<!> // OK
|
||||
g = ::bar // OK
|
||||
g = Receiver::baz // OK
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
|
||||
class Context
|
||||
class Receiver
|
||||
class Param
|
||||
|
||||
fun foo(context: Context, receiver: Receiver, p: Param) {}
|
||||
|
||||
context(Context)
|
||||
fun bar(receiver: Receiver, p: Param) {}
|
||||
|
||||
context(Context)
|
||||
fun Receiver.baz(p: Param) {}
|
||||
|
||||
fun main() {
|
||||
var g: context(Context) Receiver.(Param) -> Unit
|
||||
g = ::foo // OK
|
||||
g = ::bar // OK
|
||||
g = Receiver::baz // OK
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ receiver: Receiver, /*1*/ p: Param): kotlin.Unit
|
||||
public fun foo(/*0*/ context: Context, /*1*/ receiver: Receiver, /*2*/ p: Param): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
public fun Receiver.baz(/*0*/ p: Param): kotlin.Unit
|
||||
|
||||
public final class Context {
|
||||
public constructor Context()
|
||||
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 Param {
|
||||
public constructor Param()
|
||||
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 Receiver {
|
||||
public constructor Receiver()
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user