Support '.toType()' and literal fixes related to unsigned type mismatch

#KT-26836 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-12-26 15:05:31 +03:00
parent 73b6148407
commit 8420fceb8c
14 changed files with 102 additions and 19 deletions
+1
View File
@@ -3,6 +3,7 @@
// ERROR: Conversion of signed constants to unsigned ones is prohibited
// ACTION: Change parameter 'u' type of function 'takeUInt' to 'Int'
// ACTION: Convert property initializer to getter
// ACTION: Change to '1u'
// ACTION: Do not show hints for current method
// ACTION: Add 'u =' to argument
@@ -0,0 +1,7 @@
// "Convert expression to 'Int'" "true"
// WITH_RUNTIME
fun foo(param: Int) {}
fun test(expr: UInt) {
foo(<caret>expr)
}
@@ -0,0 +1,7 @@
// "Convert expression to 'Int'" "true"
// WITH_RUNTIME
fun foo(param: Int) {}
fun test(expr: UInt) {
foo(expr.toInt())
}
@@ -0,0 +1,7 @@
// "Convert expression to 'UInt'" "true"
// WITH_RUNTIME
fun foo(param: UInt) {}
fun test(expr: Int) {
foo(<caret>expr)
}
@@ -0,0 +1,7 @@
// "Convert expression to 'UInt'" "true"
// WITH_RUNTIME
fun foo(param: UInt) {}
fun test(expr: Int) {
foo(expr.toUInt())
}
@@ -0,0 +1,7 @@
// "Change to '1u'" "true"
// WITH_RUNTIME
fun foo(param: UInt) {}
fun test() {
foo(<caret>1)
}
@@ -0,0 +1,7 @@
// "Change to '1u'" "true"
// WITH_RUNTIME
fun foo(param: UInt) {}
fun test() {
foo(1u)
}
@@ -0,0 +1,7 @@
// "Change to '1'" "true"
// WITH_RUNTIME
fun foo(param: Int) {}
fun test() {
foo(<caret>1u)
}
@@ -0,0 +1,7 @@
// "Change to '1'" "true"
// WITH_RUNTIME
fun foo(param: Int) {}
fun test() {
foo(1)
}