diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExtensionFunctionTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExtensionFunctionTest.java index 4108553cf48..5a4ffb1f522 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExtensionFunctionTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExtensionFunctionTest.java @@ -66,4 +66,12 @@ public final class ExtensionFunctionTest extends SingleFileTranslationTest { public void testExtensionFunctionCalledFromExtensionFunction() throws Exception { fooBoxTest(); } + + public void testExtensionOnClassWithExplicitAndImplicitReceiver() throws Exception { + fooBoxTest(); + } + + public void TODO_FIXME_testExtensionPropertyOnClassWithExplicitAndImplicitReceiver() throws Exception { + fooBoxTest(); + } } diff --git a/js/js.translator/testFiles/extensionFunction/cases/extensionOnClassWithExplicitAndImplicitReceiver.kt b/js/js.translator/testFiles/extensionFunction/cases/extensionOnClassWithExplicitAndImplicitReceiver.kt new file mode 100644 index 00000000000..61fe31dfcfa --- /dev/null +++ b/js/js.translator/testFiles/extensionFunction/cases/extensionOnClassWithExplicitAndImplicitReceiver.kt @@ -0,0 +1,24 @@ +package foo + +class Foo { + + fun blah(): Int { + return 5 + } + +} + +public inline fun Foo.fooImp() : String { + return "impl" + blah() +} + +public inline fun Foo.fooExp() : String { + return "expl" + this.blah() +} + +fun box() : Boolean { + var a = Foo() + if (a.fooImp() != "impl5") return false + if (a.fooExp() != "expl5") return false + return true; +} \ No newline at end of file diff --git a/js/js.translator/testFiles/extensionFunction/cases/extensionPropertyOnClassWithExplicitAndImplicitReceiver.kt b/js/js.translator/testFiles/extensionFunction/cases/extensionPropertyOnClassWithExplicitAndImplicitReceiver.kt new file mode 100644 index 00000000000..7ac6a24099c --- /dev/null +++ b/js/js.translator/testFiles/extensionFunction/cases/extensionPropertyOnClassWithExplicitAndImplicitReceiver.kt @@ -0,0 +1,26 @@ +package foo + +class Foo { + + fun blah(): Int { + return 6 + } + +} + +val Foo.fooImp : String + get() { + return "implProp" + blah() + } + +val Foo.fooExp() : String + get() { + return "explProp" + this.blah() + } + +fun box() : Boolean { + var a = Foo() + if (a.fooImp != "implProp6") return false + if (a.fooExp != "explProp6") return false + return true; +} \ No newline at end of file