KT-1508 jet.Number -> j.l.Number
This commit is contained in:
@@ -779,6 +779,7 @@ public class JetTypeMapper {
|
||||
knowTypes.put(standardLibrary.getNullablePrimitiveJetType(primitiveType), jvmPrimitiveType.getWrapper().getAsmType());
|
||||
}
|
||||
|
||||
knowTypes.put(standardLibrary.getNumberType(),JL_NUMBER_TYPE);
|
||||
knowTypes.put(standardLibrary.getStringType(),JL_STRING_TYPE);
|
||||
knowTypes.put(standardLibrary.getNullableStringType(),JL_STRING_TYPE);
|
||||
knowTypes.put(standardLibrary.getCharSequenceType(),JL_CHAR_SEQUENCE_TYPE);
|
||||
@@ -798,10 +799,6 @@ public class JetTypeMapper {
|
||||
|| className.getFqName().equals("java.lang.String") || className.getFqName().equals("java.lang.Object");
|
||||
}
|
||||
|
||||
public String isKnownTypeInfo(JetType jetType) {
|
||||
return knowTypeNames.get(jetType);
|
||||
}
|
||||
|
||||
public boolean isGenericsArray(JetType type) {
|
||||
DeclarationDescriptor declarationDescriptor = type.getConstructor().getDeclarationDescriptor();
|
||||
if(declarationDescriptor instanceof TypeParameterDescriptor)
|
||||
|
||||
@@ -96,6 +96,7 @@ public class JetStandardLibrary {
|
||||
private ClassDescriptor volatileClass;
|
||||
private ClassDescriptor throwableClass;
|
||||
|
||||
private JetType numberType;
|
||||
private JetType stringType;
|
||||
private JetType volatileType;
|
||||
private JetType nullableStringType;
|
||||
@@ -161,6 +162,7 @@ public class JetStandardLibrary {
|
||||
private void initStdClasses() {
|
||||
if(libraryScope == null) {
|
||||
this.libraryScope = JetStandardClasses.STANDARD_CLASSES_NAMESPACE.getMemberScope();
|
||||
|
||||
this.numberClass = (ClassDescriptor) libraryScope.getClassifier("Number");
|
||||
this.stringClass = (ClassDescriptor) libraryScope.getClassifier("String");
|
||||
this.charSequenceClass = (ClassDescriptor) libraryScope.getClassifier("CharSequence");
|
||||
@@ -172,6 +174,7 @@ public class JetStandardLibrary {
|
||||
this.comparableClass = (ClassDescriptor) libraryScope.getClassifier("Comparable");
|
||||
this.typeInfoFunction = libraryScope.getFunctions("typeinfo");
|
||||
|
||||
this.numberType = new JetTypeImpl(getNumber());
|
||||
this.stringType = new JetTypeImpl(getString());
|
||||
this.charSequenceType = new JetTypeImpl(getCharSequence());
|
||||
this.nullableCharSequenceType = TypeUtils.makeNullable(charSequenceType);
|
||||
@@ -513,4 +516,8 @@ public class JetStandardLibrary {
|
||||
public JetType getTuple0Type() {
|
||||
return tuple0Type;
|
||||
}
|
||||
|
||||
public JetType getNumberType() {
|
||||
return numberType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test( n : Number ) = n.toInt().toLong() + n.toLong()
|
||||
|
||||
fun box() : String {
|
||||
val n : Number = 10
|
||||
return if(test(n) == 20.toLong()) "OK" else "fail"
|
||||
}
|
||||
@@ -419,4 +419,8 @@ public class PrimitiveTypesTest extends CodegenTestCase {
|
||||
public void testKt1093 () {
|
||||
blackBoxFile("regressions/kt1093.kt");
|
||||
}
|
||||
|
||||
public void testKt1508 () {
|
||||
blackBoxFile("regressions/kt1508.kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user