KT-877 - wrong codegen for unary plus
This commit is contained in:
@@ -21,7 +21,12 @@ public class UnaryPlus implements IntrinsicMethod {
|
|||||||
if(nullable) {
|
if(nullable) {
|
||||||
expectedType = JetTypeMapper.unboxType(expectedType);
|
expectedType = JetTypeMapper.unboxType(expectedType);
|
||||||
}
|
}
|
||||||
receiver.put(expectedType, v);
|
if(receiver != null && receiver != StackValue.none())
|
||||||
|
receiver.put(expectedType, v);
|
||||||
|
else {
|
||||||
|
assert arguments != null;
|
||||||
|
codegen.gen(arguments.get(0), expectedType);
|
||||||
|
}
|
||||||
return StackValue.onStack(expectedType);
|
return StackValue.onStack(expectedType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fun box() : String {
|
||||||
|
var a : Int = -1
|
||||||
|
if((+a) != -1) return "fail 1"
|
||||||
|
a = 1
|
||||||
|
if((+a) != 1) return "fail 2"
|
||||||
|
if((+-1) != -1) return "fail 3"
|
||||||
|
if((-+a) != -1) return "fail 4"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -351,4 +351,8 @@ public class PrimitiveTypesTest extends CodegenTestCase {
|
|||||||
public void testKt757 () {
|
public void testKt757 () {
|
||||||
blackBoxFile("regressions/kt757.jet");
|
blackBoxFile("regressions/kt757.jet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKt877 () {
|
||||||
|
blackBoxFile("regressions/kt877.jet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user