[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
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
class Param
|
||||
class C
|
||||
class R
|
||||
|
||||
context(C)
|
||||
fun R.f1(g: context(C) R.(Param) -> Unit) {
|
||||
g(this@C, this@R, Param())
|
||||
}
|
||||
|
||||
context(C)
|
||||
fun f2(g: context(C) (Param) -> Unit) {
|
||||
g(this@C, Param())
|
||||
}
|
||||
|
||||
context(C)
|
||||
fun R.f3(g: context(C) R.() -> Unit) {
|
||||
g(this@C, this@R)
|
||||
}
|
||||
|
||||
context(C)
|
||||
fun f4(g: context(C) () -> Unit) {
|
||||
g(this@C)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val lf1: context(C) R.(Param) -> Unit = { _ -> }
|
||||
val lf2: context(C) (Param) -> Unit = { _ -> }
|
||||
val lf3: context(C) R.() -> Unit = { }
|
||||
val lf4: context(C) () -> Unit = { }
|
||||
|
||||
with(C()) {
|
||||
with(R()) {
|
||||
f1(lf1)
|
||||
f2(lf2)
|
||||
f3(lf3)
|
||||
f4(lf4)
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
class Param
|
||||
class C
|
||||
class R
|
||||
|
||||
context(C)
|
||||
fun R.f1(g: context(C) R.(Param) -> Unit) {
|
||||
g(this@C, this@R, Param())
|
||||
}
|
||||
|
||||
context(C)
|
||||
fun f2(g: context(C) (Param) -> Unit) {
|
||||
g(this@C, Param())
|
||||
}
|
||||
|
||||
context(C)
|
||||
fun R.f3(g: context(C) R.() -> Unit) {
|
||||
g(this@C, this@R)
|
||||
}
|
||||
|
||||
context(C)
|
||||
fun f4(g: context(C) () -> Unit) {
|
||||
g(this@C)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val lf1: context(C) R.(Param) -> Unit = { _ -> }
|
||||
val lf2: context(C) (Param) -> Unit = { _ -> }
|
||||
val lf3: context(C) R.() -> Unit = { }
|
||||
val lf4: context(C) () -> Unit = { }
|
||||
|
||||
with(C()) {
|
||||
with(R()) {
|
||||
f1(lf1)
|
||||
f2(lf2)
|
||||
f3(lf3)
|
||||
f4(lf4)
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package
|
||||
|
||||
public fun f2(/*0*/ g: @kotlin.ContextFunctionTypeParams(count = 1) (Param) -> kotlin.Unit): kotlin.Unit
|
||||
public fun f4(/*0*/ g: @kotlin.ContextFunctionTypeParams(count = 1) () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
public fun R.f1(/*0*/ g: @kotlin.ContextFunctionTypeParams(count = 1) (R.(Param) -> kotlin.Unit)): kotlin.Unit
|
||||
public fun R.f3(/*0*/ g: @kotlin.ContextFunctionTypeParams(count = 1) (R.() -> kotlin.Unit)): kotlin.Unit
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
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 R {
|
||||
public constructor R()
|
||||
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