Remove redundant calls of the conversion method: report for unsigned types
#KT-30263 Fixed
This commit is contained in:
committed by
Yan Zhulanow
parent
38b6b73745
commit
a2f55e8b7c
+6
-1
@@ -32,6 +32,7 @@ class RemoveRedundantCallsOfConversionMethodsIntention : SelfTargetingRangeInten
|
|||||||
KotlinBundle.lazyMessage("remove.redundant.calls.of.the.conversion.method")
|
KotlinBundle.lazyMessage("remove.redundant.calls.of.the.conversion.method")
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ExperimentalUnsignedTypes
|
||||||
private val targetClassMap: Map<String, String?> by lazy {
|
private val targetClassMap: Map<String, String?> by lazy {
|
||||||
mapOf(
|
mapOf(
|
||||||
"toString()" to String::class.qualifiedName,
|
"toString()" to String::class.qualifiedName,
|
||||||
@@ -41,7 +42,11 @@ class RemoveRedundantCallsOfConversionMethodsIntention : SelfTargetingRangeInten
|
|||||||
"toInt()" to Int::class.qualifiedName,
|
"toInt()" to Int::class.qualifiedName,
|
||||||
"toChar()" to Char::class.qualifiedName,
|
"toChar()" to Char::class.qualifiedName,
|
||||||
"toShort()" to Short::class.qualifiedName,
|
"toShort()" to Short::class.qualifiedName,
|
||||||
"toByte()" to Byte::class.qualifiedName
|
"toByte()" to Byte::class.qualifiedName,
|
||||||
|
"toULong()" to ULong::class.qualifiedName,
|
||||||
|
"toUInt()" to UInt::class.qualifiedName,
|
||||||
|
"toUShort()" to UShort::class.qualifiedName,
|
||||||
|
"toUByte()" to UByte::class.qualifiedName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: UByte) {
|
||||||
|
val foo = i.toUByte()<caret>
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: UByte) {
|
||||||
|
val foo = i
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: UInt) {
|
||||||
|
val foo = i.toUInt()<caret>
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: UInt) {
|
||||||
|
val foo = i
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: ULong) {
|
||||||
|
val foo = i.toULong()<caret>
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: ULong) {
|
||||||
|
val foo = i
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: UShort) {
|
||||||
|
val foo = i.toUShort()<caret>
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
fun test(i: UShort) {
|
||||||
|
val foo = i
|
||||||
|
}
|
||||||
@@ -14209,6 +14209,26 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/toOtherType.kt");
|
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/toOtherType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("uByte.kt")
|
||||||
|
public void testUByte() throws Exception {
|
||||||
|
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/uByte.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("uInt.kt")
|
||||||
|
public void testUInt() throws Exception {
|
||||||
|
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/uInt.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("uLong.kt")
|
||||||
|
public void testULong() throws Exception {
|
||||||
|
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/uLong.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("uShort.kt")
|
||||||
|
public void testUShort() throws Exception {
|
||||||
|
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/uShort.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("variable.kt")
|
@TestMetadata("variable.kt")
|
||||||
public void testVariable() throws Exception {
|
public void testVariable() throws Exception {
|
||||||
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/variable.kt");
|
runTest("idea/testData/intentions/removeRedundantCallsOfConversionMethods/variable.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user