generate correct bytecode for constructors using infix call syntax
#KT-4589 Fixed
This commit is contained in:
@@ -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()
|
||||
}
|
||||
+6
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user