FIR: fix resolve of function type & its parameters in supertype position

This commit is contained in:
Mikhail Glukhikh
2018-03-23 20:21:59 +03:00
parent 6cfe935c2a
commit c31513837b
8 changed files with 40 additions and 3 deletions
@@ -144,6 +144,10 @@ open class FirTypeResolveTransformer : FirTransformer<Nothing?>() {
return resolvedType.compose()
}
override fun transformValueParameter(valueParameter: FirValueParameter, data: Nothing?): CompositeTransformResult<FirDeclaration> {
return valueParameter.also { it.transformChildren(this, data) }.compose()
}
override fun transformTypeProjectionWithVariance(
typeProjectionWithVariance: FirTypeProjectionWithVariance,
@@ -203,7 +207,7 @@ open class FirTypeResolveTransformer : FirTransformer<Nothing?>() {
if (symbol != null) walkSymbols(symbol)
if (type !is FirUserType) return myTransformer.transformType(type, data)
if (type !is FirUserType) return type.transform(myTransformer, data)
type.transformChildren(myTransformer, null)
@@ -4,7 +4,7 @@ FILE: derivedClass.kt
}
<T : Any> public? final class Derived() : Base<T> {
public? constructor(x: T)STUB
public? constructor(x: T): super(STUB)
}
<T : Any> public? final? function create(x: T): Derived<T> {
@@ -5,7 +5,7 @@ FILE: nestedClass.kt
}
public? final class Outer() {
public? final class Derived() : Base {
public? constructor(s: String)STUB
public? constructor(s: String): super(STUB)
}
+6
View File
@@ -0,0 +1,6 @@
interface KMutableProperty1<T> : KProperty1<T>
interface KProperty1<T> : (T) -> Int
+5
View File
@@ -0,0 +1,5 @@
FILE: ft.kt
<T> public? abstract interface KMutableProperty1() : R|KProperty1<T>| {
}
<T> public? abstract interface KProperty1() : R|(T) -> kotlin/Int| {
}
+8
View File
@@ -6,3 +6,11 @@ fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
fun <T> simpleWith(t: T, f: T.() -> Unit): Unit = t.f()
interface KMutableProperty1<T, R> : KProperty1<T, R>, KMutableProperty<R>
interface KProperty1<T, out R> : KProperty<R>, (T) -> R
interface KProperty<out R>
interface KMutableProperty<R>
+8
View File
@@ -7,3 +7,11 @@ FILE: functionTypes.kt
<T> public? final? function simpleWith(t: R|T|, f: R|T.() -> kotlin/Unit|): R|kotlin/Unit| {
STUB
}
<T, R> public? abstract interface KMutableProperty1() : R|KProperty1<T, R>|, R|KMutableProperty<R>| {
}
<T, out R> public? abstract interface KProperty1() : R|KProperty<R>|, R|(T) -> R| {
}
<out R> public? abstract interface KProperty() {
}
<R> public? abstract interface KMutableProperty() {
}
@@ -39,6 +39,12 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
runTest("compiler/testData/fir/resolve/F.kt");
}
@TestMetadata("ft.kt")
public void testFt() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/fir/resolve/ft.kt");
doTest(fileName);
}
@TestMetadata("functionTypes.kt")
public void testFunctionTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/fir/resolve/functionTypes.kt");