KT-560 - no type coertion for fields
This commit is contained in:
@@ -706,6 +706,7 @@ public abstract class StackValue {
|
|||||||
@Override
|
@Override
|
||||||
public void put(Type type, InstructionAdapter v) {
|
public void put(Type type, InstructionAdapter v) {
|
||||||
v.visitFieldInsn(isStatic ? Opcodes.GETSTATIC : Opcodes.GETFIELD, owner, name, this.type.getDescriptor());
|
v.visitFieldInsn(isStatic ? Opcodes.GETSTATIC : Opcodes.GETFIELD, owner, name, this.type.getDescriptor());
|
||||||
|
coerce(type, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -735,6 +736,7 @@ public abstract class StackValue {
|
|||||||
public void put(Type type, InstructionAdapter v) {
|
public void put(Type type, InstructionAdapter v) {
|
||||||
v.load(0, JetTypeMapper.TYPE_OBJECT);
|
v.load(0, JetTypeMapper.TYPE_OBJECT);
|
||||||
v.getfield(owner, name, this.type.getDescriptor());
|
v.getfield(owner, name, this.type.getDescriptor());
|
||||||
|
coerce(type, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
namespace while_bug_1
|
||||||
|
|
||||||
|
import java.io.*
|
||||||
|
|
||||||
|
open class AllEvenNum() {
|
||||||
|
|
||||||
|
class object {
|
||||||
|
open public fun main(args : Array<String?>?) : Unit {
|
||||||
|
var i : Int = 1
|
||||||
|
while ((i <= 100)) {
|
||||||
|
{
|
||||||
|
if (((i % 2) == 0))
|
||||||
|
{
|
||||||
|
System.out?.print((i.toString() + ","))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
(i++)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() : String {
|
||||||
|
AllEvenNum.main(Array<String?>(0))
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -21,4 +21,8 @@ public class ObjectGenTest extends CodegenTestCase {
|
|||||||
public void testKt535() throws Exception {
|
public void testKt535() throws Exception {
|
||||||
blackBoxFile("regressions/kt535.jet");
|
blackBoxFile("regressions/kt535.jet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKt560() throws Exception {
|
||||||
|
blackBoxFile("regressions/kt560.jet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user