JS: extension lambdas translated same as local lambdas (KT-13312 fixed)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
fun test1(f: (Int) -> Int) = f(1)
|
||||
|
||||
fun test2(f: Int.() -> Int) = 2.f()
|
||||
|
||||
class A(val foo: Int.() -> Int)
|
||||
|
||||
fun box(): String {
|
||||
val a: (Int) -> Int = { it }
|
||||
val b: Int.() -> Int = { this }
|
||||
|
||||
if (test1(a) != 1) return "fail 1a"
|
||||
if (test1(b) != 1) return "fail 1b"
|
||||
if (test2(a) != 2) return "fail 2a"
|
||||
if (test2(b) != 2) return "fail 2b"
|
||||
|
||||
val x = A({ this })
|
||||
|
||||
if (x.foo(3) != 3) return "fail 3"
|
||||
if (with(x) { foo(4) } != 4) return "fail 4"
|
||||
if (with(x) { 5.foo() } != 5) return "fail 5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun test(cl: Int.() -> Int):Int = 11.cl()
|
||||
|
||||
class Foo {
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun box(): String {
|
||||
val f = fun (s: String): String = s
|
||||
val g = f as String.() -> String
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
class It(val id: String)
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun box(): String {
|
||||
operator fun Int?.inc() = (this ?: 0) + 1
|
||||
var counter: Int? = null
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
fun doStuff(fn: String.() -> String) = "ok".fn()
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// Enable when using lambdas as extension lambdas is supported (KT-13312)
|
||||
// IGNORE_BACKEND: JS
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// Enable when using lambdas as extension lambdas is supported (KT-13312)
|
||||
// IGNORE_BACKEND: JS
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// Enable when using lambdas as extension lambdas is supported (KT-13312)
|
||||
// IGNORE_BACKEND: JS
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
@kotlin.Metadata
|
||||
public final class A {
|
||||
private final @org.jetbrains.annotations.NotNull field foo: kotlin.jvm.functions.Function1
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void
|
||||
public final @org.jetbrains.annotations.NotNull method getFoo(): kotlin.jvm.functions.Function1
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Kt13312Kt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method test1(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): int
|
||||
public final static method test2(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): int
|
||||
}
|
||||
Reference in New Issue
Block a user