KT-32368 Rework Inline hints settings // migrate tests for lambdas

KotlinLambdasHintsProvider which in now responsible for lambda related
hints is not compatible with the existing LambdaReturnValueHintsTest.
Because of that tests were migrated to the new infrastructure.
This commit is contained in:
Andrei Klunnyi
2020-07-07 15:49:07 +02:00
parent 5fe1eaea17
commit b0dece756a
23 changed files with 288 additions and 438 deletions
@@ -0,0 +1,16 @@
// MODE: return
@Target(AnnotationTarget.EXPRESSION)
annotation class Some
fun test() {
run {
val files: Any? = null
@Some
12<# ^run #>
}
run {
val files: Any? = null
@Some 12<# ^run #>
}
}
@@ -0,0 +1,5 @@
// MODE: off
val x = run {
println("foo")
1
}
+7
View File
@@ -0,0 +1,7 @@
// MODE: return
fun foo() {
run {
val length: Int? = null
length ?: 0<# ^run #>
}
}
+8
View File
@@ -0,0 +1,8 @@
// MODE: return
val x = run {
if (true) {
1<# ^run #>
} else {
0<# ^run #>
}
}
+4
View File
@@ -0,0 +1,4 @@
// MODE: receivers_params
val x = listOf("").filter {<# it: String #>
it.startsWith("")
}
@@ -0,0 +1,2 @@
// MODE: receivers_params
val x = listOf("").filter { it.startsWith(<hint text="prefix:" />"") }
@@ -0,0 +1,4 @@
// MODE: receivers_params
val x = buildString { <hint text="this: StringBuilder" />
append("foo")
}
+5
View File
@@ -0,0 +1,5 @@
// MODE: return
val x = run foo@{
println("foo")
1<# ^foo #>
}
@@ -0,0 +1,13 @@
// MODE: return
fun test() {
run {
val files: Any? = null
run@
12<# ^run #>
}
run {
val files: Any? = null
run@12<# ^run #>
}
}
+12
View File
@@ -0,0 +1,12 @@
// MODE: return
val x = run hello@{
if (true) {
}
run { // Two hints here
when (true) {
true -> 1<# ^run #>
false -> 0<# ^run #>
}
}<# ^hello #>
}
@@ -0,0 +1,4 @@
// MODE: return
val x = run {
1
}
+5
View File
@@ -0,0 +1,5 @@
// MODE: return
val x = run {
println(1)
if (true) 1 else { 0 }<# ^run #>
}
@@ -0,0 +1,13 @@
// MODE: return
fun bar() {
var test = 0
run {
test
test++<# ^run #>
}
run {
test
++test<# ^run #>
}
}
+5
View File
@@ -0,0 +1,5 @@
// MODE: return
val x = run {
var s = "abc"
s.length<# ^run #>
}
@@ -0,0 +1,5 @@
// MODE: return
fun test() = run {
val a = 1
{ a }<# ^run #>
}
+5
View File
@@ -0,0 +1,5 @@
// MODE: return
val x = run {
println("foo")
1<# ^run #>
}
+7
View File
@@ -0,0 +1,7 @@
// MODE: return
val x = run {
when (true) {
true -> 1<# ^run #>
false -> 0<# ^run #>
}
}