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

KotlinReferencesTypeHintsProvider which in now responsible for
type hints is not compatible with the existing
InlayTypeHintsTest. Because of that tests were migrated to the new
infrastructure.
This commit is contained in:
Andrei Klunnyi
2020-06-23 13:32:47 +02:00
parent 36f3431559
commit d1722e3975
35 changed files with 393 additions and 305 deletions
@@ -0,0 +1,7 @@
// MODE: function_return
val o = object : Iterable<Int> {
override fun iterator()<# : Iterator<Int> #> = object : Iterator<Int> {
override fun next()<# : Int #> = 1
override fun hasNext()<# : Boolean #> = true
}
}
@@ -0,0 +1,6 @@
// MODE: all
fun foo() {
val o = object {
val x: Int = 0
}
}
@@ -0,0 +1,2 @@
// MODE: all
val a = 1
@@ -0,0 +1,2 @@
// MODE: all
class Bar<T>; val a = Bar<String>()
@@ -0,0 +1,2 @@
// MODE: property
class Bar<T>(val t: T); val a<# : Bar<String> #> = Bar("")
@@ -0,0 +1,2 @@
// MODE: all
val a = Any()
@@ -0,0 +1,2 @@
// MODE: local_variable
fun foo() { val (i<# : Int #>, s<# : String #>) = 1 to "" }
@@ -0,0 +1,9 @@
// MODE: all
fun main(args: Array<String>) {
val (a: String, b: String, c: String) = x()
}
fun x() :Triple<String, String,String> {
return Triple("A", "B", "C")
}
+3
View File
@@ -0,0 +1,3 @@
// MODE: all
enum class E { ENTRY }
val test = E.ENTRY
@@ -0,0 +1,7 @@
// MODE: property
enum class E {
ENTRY;
companion object {}
}
val test<# : E# > = E.Companion
@@ -0,0 +1,8 @@
// MODE: property
enum class E { ENTRY;
companion object {
fun test(): E = ENTRY
}
}
val test<# : E# > = E.test()
@@ -0,0 +1,10 @@
// MODE: property
enum class E {
ENTRY;
companion object {
val test: E = ENTRY
}
}
val test<# : E# > = E.test
@@ -0,0 +1,4 @@
// MODE: all
package a
enum class E { ENTRY }
val test = a.E.ENTRY
+2
View File
@@ -0,0 +1,2 @@
// MODE: all
val x = arrayListOf<>()
@@ -0,0 +1,2 @@
// MODE: property
val x<# : ArrayList<Int> #> = arrayListOf(1)
@@ -0,0 +1,4 @@
// MODE: property
import E.ENTRY
enum class E { ENTRY }
val test<# : E# > = ENTRY
@@ -0,0 +1,2 @@
// MODE: local_variable
fun foo() { val a<# : List<String> #> = listOf("a") }
@@ -0,0 +1,2 @@
// MODE: local_variable
fun foo() { for (x<# : String #> in listOf("a")) { } }
@@ -0,0 +1,2 @@
// MODE: all
fun foo() { for (x: String in listOf("a")) { } }
@@ -0,0 +1,3 @@
// MODE: property
import kotlin.collections.Map.Entry
val entries<# : Set<Entry<Int, String>> #> = mapOf(1 to "1").entries
@@ -0,0 +1,2 @@
// MODE: property
val entries<# : Set<Map.Entry<Int, String>> #> = mapOf(1 to "1").entries
@@ -0,0 +1,7 @@
// MODE: parameter
fun <T> T.wrap(lambda: (T) -> T) {}
fun foo() {
12.wrap { elem<# : Int #> ->
elem
}
}
+2
View File
@@ -0,0 +1,2 @@
// MODE: property
val a<# : List<String> #> = listOf("a")
@@ -0,0 +1,22 @@
// MODE: local_variable
package p
class A {
class B {
class C {
class D
}
}
inner class E
enum class F { enumCase }
}
fun foo() {
val v1 = A.B.C.D()
val v2 = p.A.B.C.D()
val v3<# : A.E #> = A().E()
val v4 = p.A.F.enumCase
val v5 = A.F.enumCase
val v6 = p.A()
}
@@ -0,0 +1 @@
val x = Runnable { }
@@ -0,0 +1,8 @@
// MODE: property
class A {
companion object {
class InA
fun provideInA() = InA()
}
}
val inA<# : A.InA# > = A.provideInA()
@@ -0,0 +1,8 @@
// MODE: property
class A {
companion object N {
class InA
fun provideInA() = InA()
}
}
val inA<# : A.N.InA #> = A.provideInA()
@@ -0,0 +1,2 @@
// MODE: all
val a = -1; val b = +1
@@ -0,0 +1,6 @@
// MODE: local_variable
fun foo() {
val x =
// indent is the same: declaration & initialization
println("Foo")
}
@@ -0,0 +1,5 @@
// MODE: all
fun foo() {
val x<# : Unit #> =
println("Foo") // indent differs
}
@@ -0,0 +1,4 @@
// MODE: local_variable
fun foo() {
val x<# : Unit #> = println("Foo")
}