Add some additional information to psi renderer

1) Trim unused spaces in annotations
2) Rewrote fq name rendering
3) Added annotations to for loop variable
4) Added type arguments render along to type parameters in functions
This commit is contained in:
Ivan Cilcic
2019-08-23 11:46:53 +03:00
committed by Mikhail Glukhikh
parent 8fb2383845
commit fe328f8c7a
36 changed files with 284 additions and 223 deletions
@@ -10,4 +10,4 @@ class B : TA() {
// constructor A.Nested()
// │
class NestedInB : Nested()
}
}
@@ -13,4 +13,4 @@ interface Test {
// │ │ │ class C<T, S> collections/List<*>
// │ │ │ │ │
val x: a.b.C<out CharSequence, *>.D<in List<*>, *>
}
}
@@ -5,7 +5,8 @@ open class Base<T>(val x: T)
// │ │
class Derived<T : Any>(x: T) : Base<T>(x)
// constructor Derived<T : Any>(T)
// │ create.x: T
//
// Derived<T>
// │ constructor Derived<T : Any>(T)
// create.x: T
// │ │ │
fun <T : Any> create(x: T): Derived<T> = Derived(x)
@@ -41,7 +41,7 @@ enum class Planet(val m: Double, internal val r: Double) {
}
};
// val (Planet/Companion).G: Double
// val (Planet.Companion).G: Double
// │ fun (Double).times(Double): Double
// │ │ val (Planet).m: Double
// │ │ │ fun (Double).div(Double): Double
@@ -59,4 +59,4 @@ enum class Planet(val m: Double, internal val r: Double) {
// │ │
const val G = 6.67e-11
}
}
}
@@ -7,20 +7,22 @@ object O2 : Some
enum class SomeEnum(val x: Some) {
// constructor SomeEnum(Some)
// │object O1: Some
// ││
// ││
FIRST(O1) {
// Boolean
//
// Boolean
// │ Boolean
// │ │
override fun check(y: Some): Boolean = true
},
// constructor SomeEnum(Some)
// │object O2: Some
// ││
// ││
SECOND(O2) {
// SomeEnum.SECOND.check.y: Some
// │ fun (Any).equals(Any?): Boolean
// │ │ object O2: Some
// │ │
// Boolean
// │ SomeEnum.SECOND.check.y: Some
// │ │ fun (Any).equals(Any?): Boolean
// │ │ object O2: Some
// │ │ │ │
override fun check(y: Some): Boolean = y == O2
};
@@ -8,6 +8,8 @@ expect val x: Int
actual class MyClass
// String
// │
actual fun foo() = "Hello"
// Int Int
@@ -1,5 +1,6 @@
// fun ((T) -> Unit).invoke(T): Unit
//
// Unit
// │ fun ((T) -> Unit).invoke(T): Unit
// │ │
fun <T> simpleRun(f: (T) -> Unit): Unit = f()
// collections/List<T>
@@ -8,8 +9,8 @@ fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
}
// simpleWith.t: T
// │ fun T.invoke(): Unit
// │ │
// Unit
// │ simpleWith.t: T
// │ │ fun T.invoke(): Unit
// │ │ │
fun <T> simpleWith(t: T, f: T.() -> Unit): Unit = t.f()
@@ -1,7 +1,9 @@
interface Any
// T?
// │
inline fun <reified T : Any> Any.safeAs(): T? = this as? T
abstract class Summator {
abstract fun <T> plus(first: T, second: T): T
}
}
@@ -1,7 +1,8 @@
// fun TODO(): Nothing
//
// Nothing
// │ fun TODO(): Nothing
// │ │
fun <T> genericFoo(): T = TODO()
// T fun <T> genericFoo(): T
// │ │
// T fun <T> genericFoo<T>(): T
// │ │
val <T> T.generic: T get() = genericFoo()
@@ -3,10 +3,10 @@ abstract class Base(val s: String)
class Outer {
// constructor Base(String)
// │ Outer.Derived.<init>.s: String
// │ │
// │ │
class Derived(s: String) : Base(s)
// constructor Base(String)
// │
// │
object Obj : Base("")
}
@@ -17,21 +17,23 @@ class SomeClass : SomeInterface {
// │ │ SomeClass.foo.x: Int
// │ │ │ fun (String).plus(Any?): String
// │ │ │ │ val (SomeClass).baz: Int
// │ │ │ │ │
// │ │ │ │ │
return y + x + baz
}
// Boolean
// │
// Boolean
// │
override var bar: Boolean
// Boolean
// │
// │
get() = true
// Boolean
// │
set(value) {}
// Double
// │
// Double
// │
lateinit var fau: Double
}
inline class InlineClass
inline class InlineClass
@@ -4,4 +4,4 @@ typealias C = B
// C /* = B */
// │
class D : C
class D : C
@@ -13,13 +13,13 @@ abstract class My<T : Some> {
// [ERROR : T]
// │ class My<T : Some>
// │ │
// │ │
abstract val y: My.T
// [ERROR : T]
// │ package test
// │ │ class My<T : Some>
// │ │ │
// │ │ │
abstract val z: test.My.T
// [ERROR : T]
@@ -10,11 +10,14 @@ typealias AnyList = List<*>
abstract class AbstractList<out T : Any> : List<T>
// constructor AbstractList<T : Any>()
// │
// │
class SomeList : AbstractList<Int>() {
// Int
//
// Int
// │ Int
// │ │
override fun get(index: Int): Int = 42
// SomeList
// │
override fun concat(other: List<Int>): List<Int> = this
}