Test for calling functions in initializers.
Adapted from https://github.com/develar/kotlin/commit/a9e0a42fb1347fa8e21c86b5a073ef8a7c873da0.
This commit is contained in:
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.k2js.test.semantics;
|
package org.jetbrains.k2js.test.semantics;
|
||||||
|
|
||||||
import org.jetbrains.k2js.translate.context.Namer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Pavel Talanov
|
* @author Pavel Talanov
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +58,7 @@ public class FunctionTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testEnclosingThis() throws Exception {
|
public void testEnclosingThis() throws Exception {
|
||||||
runFunctionOutputTest("enclosingThis.kt", Namer.getRootNamespaceName(), "box", "OK");
|
runFunctionOutputTest("enclosingThis.kt", "foo", "box", "OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -109,4 +107,8 @@ public class FunctionTest extends AbstractExpressionTest {
|
|||||||
public void testFunctionInsideFunction() throws Exception {
|
public void testFunctionInsideFunction() throws Exception {
|
||||||
fooBoxTest();
|
fooBoxTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testCallFunInInit() throws Exception {
|
||||||
|
fooBoxTest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
class A()
|
||||||
|
|
||||||
|
private val doInit = {
|
||||||
|
A()
|
||||||
|
}()
|
||||||
|
|
||||||
|
fun box(): Boolean = doInit is A
|
||||||
Reference in New Issue
Block a user