Add quickfix for changing primitive cast to primitive conversion method
Fixes #KT-15564
This commit is contained in:
committed by
Mikhail Glukhikh
parent
2b54f1ac72
commit
a0491d5258
@@ -0,0 +1,6 @@
|
||||
// "Replace cast with call to 'toInt()'" "false"
|
||||
// WARNING: Cast can never succeed
|
||||
|
||||
fun foo() {
|
||||
val a = true as<caret> Int
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Replace cast with call to 'toShort()'" "true"
|
||||
|
||||
fun foo(c: Char) {
|
||||
val a = c as<caret> Short
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Replace cast with call to 'toShort()'" "true"
|
||||
|
||||
fun foo(c: Char) {
|
||||
val a = c.toShort()<caret>
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Replace cast with call to 'toByte()'" "true"
|
||||
|
||||
fun foo() {
|
||||
val a = 1 as<caret> Byte
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Replace cast with call to 'toByte()'" "true"
|
||||
|
||||
fun foo() {
|
||||
val a = 1.toByte()<caret>
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Replace cast with call to 'toFloat()'" "true"
|
||||
|
||||
fun foo() {
|
||||
val a = 1L as<caret> Float
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Replace cast with call to 'toFloat()'" "true"
|
||||
|
||||
fun foo() {
|
||||
val a = 1L.toFloat()<caret>
|
||||
}
|
||||
Reference in New Issue
Block a user