FIR: make rendering of type parameters similar to original Kotlin

This commit is contained in:
Mikhail Glukhikh
2019-04-09 15:32:59 +03:00
parent 0c334163ab
commit 568e831651
178 changed files with 278 additions and 269 deletions
@@ -1,10 +1,10 @@
FILE: complexTypes.kt
<T, out S> public? final? class C : kotlin/Any {
public? final? class C<T, out S> : kotlin/Any {
public? constructor<T, out S>(): R|a/b/C<T, S>| {
super<kotlin/Any>()
}
<R, in P> public? final? inner class D : kotlin/Any {
public? final? inner class D<R, in P> : kotlin/Any {
public? constructor<R, in P>(): R|a/b/C.D<R, P>| {
super<kotlin/Any>()
}
@@ -1,5 +1,5 @@
FILE: derivedClass.kt
<T> public? open class Base : kotlin/Any {
public? open class Base<T> : kotlin/Any {
public? constructor<T>(x: T): R|Base<T>| {
super<kotlin/Any>()
}
@@ -8,12 +8,12 @@ FILE: derivedClass.kt
public? get(): T
}
<T : Any> public? final? class Derived : Base<T> {
public? final? class Derived<T : Any> : Base<T> {
public? constructor<T : Any>(x: T): R|Derived<T>| {
super<Base<T>>(x#)
}
}
<T : Any> public? final? fun create(x: T): Derived<T> {
public? final? fun <T : Any> create(x: T): Derived<T> {
^create Derived#(x#)
}
@@ -1,9 +1,9 @@
FILE: functionTypes.kt
<T> public? final? fun simpleRun(f: ( (T) -> Unit )): Unit {
public? final? fun <T> simpleRun(f: ( (T) -> Unit )): Unit {
^simpleRun f#()
}
<T, R> public? final? fun List<T>.simpleMap(f: ( (T) -> R )): R {
public? final? fun <T, R> List<T>.simpleMap(f: ( (T) -> R )): R {
}
<T> public? final? fun simpleWith(t: T, f: ( T.() -> Unit )): Unit {
public? final? fun <T> simpleWith(t: T, f: ( T.() -> Unit )): Unit {
^simpleWith t#.f#()
}
@@ -1,7 +1,7 @@
FILE: genericFunctions.kt
public? final? interface Any : kotlin/Any {
}
<reified T : Any> public? final? inline fun Any.safeAs(): T? {
public? final? inline fun <reified T : Any> Any.safeAs(): T? {
^safeAs (this# as? T)
}
public? abstract class Summator : kotlin/Any {
@@ -9,6 +9,6 @@ FILE: genericFunctions.kt
super<kotlin/Any>()
}
<T> public? abstract fun plus(first: T, second: T): T
public? abstract fun <T> plus(first: T, second: T): T
}
@@ -0,0 +1,3 @@
fun <T> genericFoo(): T = TODO()
val <T> T.generic: T get() = genericFoo()
@@ -0,0 +1,8 @@
FILE: genericProperty.kt
public? final? fun <T> genericFoo(): T {
^genericFoo TODO#()
}
public? final? val <T> T.generic: T
public? get(): T {
^ genericFoo#()
}
@@ -5,9 +5,9 @@ FILE: typeAliasWithGeneric.kt
}
}
<S, T : A> public? final? interface B : kotlin/Any {
public? final? interface B<S, T : A> : kotlin/Any {
}
<T> public? final typealias C = B<T, A>
public? final typealias C<T> = B<T, A>
public? final? class D : C<A> {
public? constructor(): R|D| {
super<kotlin/Any>()
@@ -1,7 +1,7 @@
FILE: typeParameterVsNested.kt
public? final? interface Some : kotlin/Any {
}
<T : Some> public? abstract class My : kotlin/Any {
public? abstract class My<T : Some> : kotlin/Any {
public? constructor<T : Some>(): R|test/My<T>| {
super<kotlin/Any>()
}
@@ -1,5 +1,5 @@
FILE: typeParameters.kt
<out T : Any> public? final? interface List : kotlin/Any {
public? final? interface List<out T : Any> : kotlin/Any {
public? final? operator fun get(index: Int): T
public? final? infix fun concat(other: List<T>): List<T>
@@ -7,7 +7,7 @@ FILE: typeParameters.kt
}
public? final typealias StringList = List<out String>
public? final typealias AnyList = List<*>
<out T : Any> public? abstract class AbstractList : List<T> {
public? abstract class AbstractList<out T : Any> : List<T> {
public? constructor<out T : Any>(): R|AbstractList<T>| {
super<kotlin/Any>()
}
@@ -3,7 +3,7 @@ FILE: where.kt
}
public? final? interface B : kotlin/Any {
}
<T : A, B> public? final? class C : kotlin/Any {
public? final? class C<T : A, B> : kotlin/Any {
public? constructor<T : A, B>(): R|C<T>| {
super<kotlin/Any>()
}
@@ -1,5 +1,5 @@
FILE: genericCalls.kt
<T> public? final? fun nullableValue(): T? {
public? final? fun <T> nullableValue(): T? {
^nullableValue Null(null)
}
public? final? fun test(): kotlin/Unit {
@@ -81,6 +81,11 @@ public class RawFirBuilderTestCaseGenerated extends AbstractRawFirBuilderTestCas
runTest("compiler/fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
}
@TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception {
runTest("compiler/fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt");