Add simple tests for using nested namespace.
This commit is contained in:
@@ -40,5 +40,9 @@ public class MultiNamespaceTest extends MultipleFilesTranslationTest {
|
|||||||
checkFooBoxIsTrue("namespaceVariableVisibleFromOtherNamespace");
|
checkFooBoxIsTrue("namespaceVariableVisibleFromOtherNamespace");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testNestedNamespaceFunctionCalledFromOtherNamespace() throws Exception {
|
||||||
|
checkFooBoxIsTrue("nestedNamespaceFunctionCalledFromOtherNamespace");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,4 +34,7 @@ public final class NamespaceTest extends SingleFileTranslationTest {
|
|||||||
runFunctionOutputTest("deeplyNestedNamespace.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", "box", true);
|
runFunctionOutputTest("deeplyNestedNamespace.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", "box", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testDeeplyNestedNamespaceFunctionCalled() throws Exception {
|
||||||
|
runFunctionOutputTest("deeplyNestedNamespaceFunctionCalled.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", "box", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -70,7 +70,10 @@ public final class QualifiedExpressionTranslator {
|
|||||||
if (selector instanceof JetCallExpression) {
|
if (selector instanceof JetCallExpression) {
|
||||||
return CallExpressionTranslator.translate((JetCallExpression)selector, receiver, callType, context);
|
return CallExpressionTranslator.translate((JetCallExpression)selector, receiver, callType, context);
|
||||||
}
|
}
|
||||||
throw new AssertionError("Unexpected qualified expression");
|
if (selector instanceof JetSimpleNameExpression) {
|
||||||
|
return ReferenceTranslator.translateSimpleName((JetSimpleNameExpression)selector, context);
|
||||||
|
}
|
||||||
|
throw new AssertionError("Unexpected qualified expression: " + selector.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: if has duplications
|
//TODO: if has duplications
|
||||||
|
|||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package a.foo
|
||||||
|
|
||||||
|
fun box() = b.bar.f()
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
package b.bar
|
||||||
|
fun f() = true
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package foo1.foo2.foo3.foo5.foo6.foo7.foo8
|
||||||
|
|
||||||
|
fun box() = f()
|
||||||
|
fun f() = true
|
||||||
Reference in New Issue
Block a user