'Long' type is now stored for 'Long' literal #KT-12267 Fixed
This commit is contained in:
+2
-1
@@ -199,7 +199,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
compileTimeConstant != null ? ((TypedCompileTimeConstant) compileTimeConstant).getConstantValue() : null;
|
||||
boolean hasError = constantChecker.checkConstantExpressionType(constantValue, expression, context.expectedType);
|
||||
if (hasError) {
|
||||
return TypeInfoFactoryKt.createTypeInfo(getDefaultType(elementType), context);
|
||||
return TypeInfoFactoryKt.createTypeInfo(constantValue != null ? constantValue.getType() : getDefaultType(elementType),
|
||||
context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Int'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Short = <caret>100000
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Int'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Int = 100000
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Long'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Double = <caret>0L
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Long'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Long = 0L
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Long'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Int = <caret>0L
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Long'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Long = 0L
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Int'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Byte = <caret>1000
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Change 'x' type to 'Int'" "true"
|
||||
|
||||
fun foo() {
|
||||
val x: Int = 1000
|
||||
}
|
||||
@@ -7741,6 +7741,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("intToShortTypeMismatch.kt")
|
||||
public void testIntToShortTypeMismatch() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/intToShortTypeMismatch.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("letClassImplementAdditionalInterface.kt")
|
||||
public void testLetClassImplementAdditionalInterface() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/letClassImplementAdditionalInterface.kt");
|
||||
@@ -7819,6 +7825,18 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("longToDoubleTypeMismatch.kt")
|
||||
public void testLongToDoubleTypeMismatch() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/longToDoubleTypeMismatch.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("longToIntTypeMismatch.kt")
|
||||
public void testLongToIntTypeMismatch() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/longToIntTypeMismatch.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("makeReturnTypeNullable.kt")
|
||||
public void testMakeReturnTypeNullable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/makeReturnTypeNullable.kt");
|
||||
@@ -7861,6 +7879,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("shortToByteTypeMismatch.kt")
|
||||
public void testShortToByteTypeMismatch() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/shortToByteTypeMismatch.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tooManyArgumentsException.kt")
|
||||
public void testTooManyArgumentsException() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/tooManyArgumentsException.kt");
|
||||
|
||||
Reference in New Issue
Block a user