Checks for primitive types and arrays made static in KotlinBuiltIns
This commit is contained in:
@@ -851,7 +851,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
@Override
|
||||
protected void assignToLoopParameter() {
|
||||
Type arrayElParamType;
|
||||
if (KotlinBuiltIns.getInstance().isArray(loopRangeType)) {
|
||||
if (KotlinBuiltIns.isArray(loopRangeType)) {
|
||||
arrayElParamType = boxType(asmElementType);
|
||||
}
|
||||
else {
|
||||
@@ -3438,7 +3438,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
args.add(va.getArgumentExpression());
|
||||
}
|
||||
|
||||
boolean isArray = KotlinBuiltIns.getInstance().isArray(arrayType);
|
||||
boolean isArray = KotlinBuiltIns.isArray(arrayType);
|
||||
if (!isArray && args.size() != 1) {
|
||||
throw new CompilationException("primitive array constructor requires one argument", null, expression);
|
||||
}
|
||||
@@ -3492,7 +3492,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
public void newArrayInstruction(@NotNull JetType arrayType) {
|
||||
if (KotlinBuiltIns.getInstance().isArray(arrayType)) {
|
||||
if (KotlinBuiltIns.isArray(arrayType)) {
|
||||
JetType elementJetType = arrayType.getArguments().get(0).getType();
|
||||
putReifierMarkerIfTypeIsReifiedParameter(
|
||||
elementJetType,
|
||||
@@ -3519,7 +3519,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
operationDescriptor.getValueParameters().get(0).getType().equals(KotlinBuiltIns.getInstance().getIntType())) {
|
||||
assert type != null;
|
||||
Type elementType;
|
||||
if (KotlinBuiltIns.getInstance().isArray(type)) {
|
||||
if (KotlinBuiltIns.isArray(type)) {
|
||||
JetType jetElementType = type.getArguments().get(0).getType();
|
||||
elementType = boxType(asmType(jetElementType));
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ public class JetTypeMapper {
|
||||
return asmType;
|
||||
}
|
||||
|
||||
if (descriptor instanceof ClassDescriptor && KotlinBuiltIns.getInstance().isArray(jetType)) {
|
||||
if (descriptor instanceof ClassDescriptor && KotlinBuiltIns.isArray(jetType)) {
|
||||
if (jetType.getArguments().size() != 1) {
|
||||
throw new UnsupportedOperationException("arrays must have one type argument");
|
||||
}
|
||||
@@ -683,11 +683,11 @@ public class JetTypeMapper {
|
||||
*/
|
||||
private static boolean forceBoxedReturnType(@NotNull FunctionDescriptor descriptor) {
|
||||
//noinspection ConstantConditions
|
||||
if (!KotlinBuiltIns.getInstance().isPrimitiveType(descriptor.getReturnType())) return false;
|
||||
if (!KotlinBuiltIns.isPrimitiveType(descriptor.getReturnType())) return false;
|
||||
|
||||
for (FunctionDescriptor overridden : getAllOverriddenDescriptors(descriptor)) {
|
||||
//noinspection ConstantConditions
|
||||
if (!KotlinBuiltIns.getInstance().isPrimitiveType(overridden.getOriginal().getReturnType())) return true;
|
||||
if (!KotlinBuiltIns.isPrimitiveType(overridden.getOriginal().getReturnType())) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user