Automatically cast error for intrinsic methods in array

#KT-2997 Fixed
This commit is contained in:
Natalia.Ukhorskaya
2012-11-06 16:18:18 +04:00
parent e9bf09d240
commit f139b637f3
7 changed files with 94 additions and 5 deletions
@@ -44,7 +44,7 @@ public class ArrayGet implements IntrinsicMethod {
StackValue receiver,
@NotNull GenerationState state
) {
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
receiver.put(receiver.type, v);
Type type = correctElementType(receiver.type);
codegen.gen(arguments.get(0), Type.INT_TYPE);
@@ -39,7 +39,7 @@ public class ArrayIndices implements IntrinsicMethod {
StackValue receiver,
@NotNull GenerationState state
) {
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
receiver.put(receiver.type, v);
v.arraylength();
v.invokestatic(AsmTypeConstants.JET_INT_RANGE_TYPE.getInternalName(), "count", "(I)Ljet/IntRange;");
return StackValue.onStack(AsmTypeConstants.JET_INT_RANGE_TYPE);
@@ -50,7 +50,7 @@ public class ArrayIterator implements IntrinsicMethod {
StackValue receiver,
@NotNull GenerationState state
) {
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
receiver.put(receiver.type, v);
JetCallExpression call = (JetCallExpression) element;
FunctionDescriptor funDescriptor = (FunctionDescriptor) codegen.getBindingContext()
.get(BindingContext.REFERENCE_TARGET, (JetSimpleNameExpression) call.getCalleeExpression());
@@ -44,7 +44,7 @@ public class ArraySet implements IntrinsicMethod {
StackValue receiver,
@NotNull GenerationState state
) {
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
receiver.put(receiver.type, v);
Type type = correctElementType(receiver.type);
codegen.gen(arguments.get(0), Type.INT_TYPE);
@@ -42,7 +42,7 @@ public class ArraySize implements IntrinsicMethod {
StackValue receiver,
@NotNull GenerationState state
) {
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
receiver.put(receiver.type, v);
v.arraylength();
return StackValue.onStack(Type.INT_TYPE);