generate correct bytecode for constructors using infix call syntax

#KT-4589 Fixed
This commit is contained in:
Dmitry Jemerov
2015-03-04 19:18:08 +01:00
parent ed4c265564
commit 1188be9070
3 changed files with 25 additions and 0 deletions
@@ -2912,6 +2912,10 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
ResolvedCall<?> resolvedCall = getResolvedCallWithAssert(expression, bindingContext);
FunctionDescriptor descriptor = (FunctionDescriptor) resolvedCall.getResultingDescriptor();
if (descriptor instanceof ConstructorDescriptor) {
return generateConstructorCall(resolvedCall, expressionType(expression));
}
Callable callable = resolveToCallable(descriptor, false);
if (callable instanceof IntrinsicMethod) {
Type returnType = typeMapper.mapType(descriptor);
@@ -0,0 +1,15 @@
class Z() {
inner class Z2(val s: String) {
}
fun a(): String {
val s = Z() Z2 "OK"
return s.s
}
}
fun box(): String {
return Z().a()
}
@@ -4042,6 +4042,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("innerInfixCall.kt")
public void testInnerInfixCall() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/innerInfixCall.kt");
doTest(fileName);
}
@TestMetadata("innerLabeledThis.kt")
public void testInnerLabeledThis() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/innerLabeledThis.kt");