FIR: resolve bounds of function type arguments
This commit is contained in:
+1
-2
@@ -31,10 +31,9 @@ abstract class FirAbstractCallableMember(
|
||||
) : FirAbstractMemberDeclaration(session, psi, name, visibility, modality, platformStatus), FirCallableMember {
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirElement {
|
||||
annotations.transformInplace(transformer, data)
|
||||
receiverType = receiverType?.transformSingle(transformer, data)
|
||||
returnType = returnType.transformSingle(transformer, data)
|
||||
|
||||
return this
|
||||
return super<FirAbstractMemberDeclaration>.transformChildren(transformer, data)
|
||||
}
|
||||
}
|
||||
+11
@@ -8,10 +8,14 @@ package org.jetbrains.kotlin.fir.declarations.impl
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberPlatformStatus
|
||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
||||
import org.jetbrains.kotlin.fir.transformInplace
|
||||
import org.jetbrains.kotlin.fir.transformSingle
|
||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
abstract class FirAbstractMemberDeclaration(
|
||||
@@ -23,4 +27,11 @@ abstract class FirAbstractMemberDeclaration(
|
||||
override val platformStatus: FirMemberPlatformStatus
|
||||
) : FirAbstractNamedAnnotatedDeclaration(session, psi, name), FirMemberDeclaration {
|
||||
final override val typeParameters = mutableListOf<FirTypeParameter>()
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirElement {
|
||||
annotations.transformInplace(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
@@ -47,11 +47,9 @@ open class FirClassImpl(
|
||||
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirClass {
|
||||
annotations.transformInplace(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
superTypes.transformInplace(transformer, data)
|
||||
declarations.transformInplace(transformer, data)
|
||||
|
||||
return this
|
||||
return super<FirAbstractMemberDeclaration>.transformChildren(transformer, data) as FirClass
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
open class Base<T>(val x: T)
|
||||
|
||||
class Derived<T : Any>(x: T) : Base<T>(x)
|
||||
|
||||
fun <T : Any> create(x: T): Derived<T> = Derived(x)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
FILE: derivedClass.kt
|
||||
<T> public? open class Base {
|
||||
public? constructor(x: R|T|)
|
||||
|
||||
}
|
||||
<T : R|kotlin/Any|> public? final class Derived : R|Base<T>| {
|
||||
public? constructor(x: R|T|): super(STUB)
|
||||
|
||||
}
|
||||
<T : R|kotlin/Any|> public? final? function create(x: R|T|): R|Derived<T>| {
|
||||
STUB
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: genericFunctions.kt
|
||||
public? abstract interface Any {
|
||||
}
|
||||
<reified T : Any> public? final? inline function safeAs R|Any|.(): R|T| {
|
||||
<reified T : R|Any|> public? final? inline function safeAs R|Any|.(): R|T| {
|
||||
STUB
|
||||
}
|
||||
public? abstract class Summator {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
abstract class Base(val s: String)
|
||||
|
||||
class Outer {
|
||||
class Derived(s: String) : Base(s)
|
||||
|
||||
object Obj : Base("")
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
FILE: nestedClass.kt
|
||||
public? abstract class Base {
|
||||
public? constructor(s: R|kotlin/String|)
|
||||
|
||||
}
|
||||
public? final class Outer {
|
||||
public? final class Derived : R|Base| {
|
||||
public? constructor(s: R|kotlin/String|): super(STUB)
|
||||
|
||||
}
|
||||
|
||||
public? final object Obj : R|Base| {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,12 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/fir/resolve"), Pattern.compile("^([^.]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("derivedClass.kt")
|
||||
public void testDerivedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/fir/resolve/derivedClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("compiler/testData/fir/resolve/enum.kt");
|
||||
@@ -54,6 +60,12 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
|
||||
runTest("compiler/testData/fir/resolve/genericFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClass.kt")
|
||||
public void testNestedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/fir/resolve/nestedClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NestedOfAliasedType.kt")
|
||||
public void testNestedOfAliasedType() throws Exception {
|
||||
runTest("compiler/testData/fir/resolve/NestedOfAliasedType.kt");
|
||||
|
||||
Reference in New Issue
Block a user