[FIR2IR] Copy type parameters for trivial fake overrides
This commit is contained in:
+5
@@ -1711,6 +1711,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
public void testDeprecated() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/deprecated.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FirBuilder.kt")
|
||||
public void testFirBuilder() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/FirBuilder.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/ir/irText/lambdas")
|
||||
|
||||
+84
-68
@@ -217,7 +217,7 @@ class FirClassSubstitutionScope(
|
||||
|
||||
private fun createSubstitutedData(member: FirCallableMemberDeclaration<*>): SubstitutedData {
|
||||
val (newTypeParameters, substitutor) = createNewTypeParametersAndSubstitutor(
|
||||
member as FirTypeParameterRefsOwner
|
||||
member as FirTypeParameterRefsOwner, substitutor
|
||||
)
|
||||
|
||||
val receiverType = member.receiverTypeRef?.coneType
|
||||
@@ -228,58 +228,6 @@ class FirClassSubstitutionScope(
|
||||
return SubstitutedData(newTypeParameters, newReceiverType, newReturnType, substitutor)
|
||||
}
|
||||
|
||||
// Returns a list of type parameters, and a substitutor that should be used for all other types
|
||||
private fun createNewTypeParametersAndSubstitutor(
|
||||
member: FirTypeParameterRefsOwner
|
||||
): Pair<List<FirTypeParameterRef>, ConeSubstitutor> {
|
||||
if (member.typeParameters.isEmpty()) return Pair(member.typeParameters, substitutor)
|
||||
val newTypeParameters = member.typeParameters.map { typeParameter ->
|
||||
if (typeParameter !is FirTypeParameter) return@map null
|
||||
FirTypeParameterBuilder().apply {
|
||||
source = typeParameter.source
|
||||
session = typeParameter.session
|
||||
origin = FirDeclarationOrigin.FakeOverride
|
||||
name = typeParameter.name
|
||||
symbol = FirTypeParameterSymbol()
|
||||
variance = typeParameter.variance
|
||||
isReified = typeParameter.isReified
|
||||
annotations += typeParameter.annotations
|
||||
}
|
||||
}
|
||||
|
||||
val substitutionMapForNewParameters = member.typeParameters.zip(newTypeParameters).mapNotNull { (original, new) ->
|
||||
if (new != null)
|
||||
Pair(original.symbol, ConeTypeParameterTypeImpl(new.symbol.toLookupTag(), isNullable = false))
|
||||
else null
|
||||
}.toMap()
|
||||
|
||||
val additionalSubstitutor = substitutorByMap(substitutionMapForNewParameters)
|
||||
|
||||
for ((newTypeParameter, oldTypeParameter) in newTypeParameters.zip(member.typeParameters)) {
|
||||
if (newTypeParameter == null) continue
|
||||
val original = oldTypeParameter as FirTypeParameter
|
||||
for (boundTypeRef in original.bounds) {
|
||||
val typeForBound = boundTypeRef.coneType
|
||||
val substitutedBound = typeForBound.substitute()
|
||||
newTypeParameter.bounds +=
|
||||
buildResolvedTypeRef {
|
||||
source = boundTypeRef.source
|
||||
type = additionalSubstitutor.substituteOrSelf(substitutedBound ?: typeForBound)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Uncomment when problem from org.jetbrains.kotlin.fir.Fir2IrTextTestGenerated.Declarations.Parameters.testDelegatedMembers is gone
|
||||
// The problem is that Fir2Ir thinks that type parameters in fake override are the same as for original
|
||||
// While common Ir contracts expect them to be different
|
||||
// if (!wereChangesInTypeParameters) return Pair(member.typeParameters, substitutor)
|
||||
|
||||
return Pair(
|
||||
newTypeParameters.mapIndexed { index, builder -> builder?.build() ?: member.typeParameters[index] },
|
||||
ChainedSubstitutor(substitutor, additionalSubstitutor)
|
||||
)
|
||||
}
|
||||
|
||||
private fun createFakeOverrideField(original: FirFieldSymbol): FirFieldSymbol {
|
||||
if (substitutor == ConeSubstitutor.Empty) return original
|
||||
val member = original.fir
|
||||
@@ -336,6 +284,34 @@ class FirClassSubstitutionScope(
|
||||
}
|
||||
}
|
||||
|
||||
private fun FirFunctionBuilder.configureAnnotationsAndAllParameters(
|
||||
session: FirSession,
|
||||
baseFunction: FirFunction<*>,
|
||||
newParameterTypes: List<ConeKotlinType?>?,
|
||||
newTypeParameters: List<FirTypeParameterRef>?
|
||||
): List<FirTypeParameterRef> {
|
||||
return when {
|
||||
baseFunction.typeParameters.isEmpty() -> {
|
||||
configureAnnotationsAndParameters(session, baseFunction, newParameterTypes)
|
||||
emptyList()
|
||||
}
|
||||
newTypeParameters == null -> {
|
||||
val (copiedTypeParameters, substitutor) = createNewTypeParametersAndSubstitutor(
|
||||
baseFunction, ConeSubstitutor.Empty
|
||||
)
|
||||
val copiedParameterTypes = baseFunction.valueParameters.map {
|
||||
substitutor.substituteOrNull(it.returnTypeRef.coneType)
|
||||
}
|
||||
configureAnnotationsAndParameters(session, baseFunction, copiedParameterTypes)
|
||||
copiedTypeParameters
|
||||
}
|
||||
else -> {
|
||||
configureAnnotationsAndParameters(session, baseFunction, newParameterTypes)
|
||||
newTypeParameters
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun FirDeclarationStatus.withExpect(isExpect: Boolean): FirDeclarationStatus {
|
||||
return if (this.isExpect == isExpect) {
|
||||
this
|
||||
@@ -368,15 +344,10 @@ class FirClassSubstitutionScope(
|
||||
status = baseFunction.status.withExpect(isExpect)
|
||||
symbol = fakeOverrideSymbol
|
||||
resolvePhase = baseFunction.resolvePhase
|
||||
configureAnnotationsAndParameters(session, baseFunction, newParameterTypes)
|
||||
|
||||
// TODO: Fix the hack for org.jetbrains.kotlin.fir.backend.Fir2IrVisitor.addFakeOverrides
|
||||
// We might have added baseFunction.typeParameters in case new ones are null
|
||||
// But it fails at org.jetbrains.kotlin.ir.AbstractIrTextTestCase.IrVerifier.elementsAreUniqueChecker
|
||||
// because it shares the same declarations of type parameters between two different two functions
|
||||
if (newTypeParameters != null) {
|
||||
typeParameters += newTypeParameters
|
||||
}
|
||||
typeParameters += configureAnnotationsAndAllParameters(
|
||||
session, baseFunction, newParameterTypes, newTypeParameters
|
||||
).filterIsInstance<FirTypeParameter>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,16 +471,61 @@ class FirClassSubstitutionScope(
|
||||
status = baseConstructor.status.withExpect(isExpect)
|
||||
symbol = fakeOverrideSymbol
|
||||
resolvePhase = baseConstructor.resolvePhase
|
||||
configureAnnotationsAndParameters(session, baseConstructor, newParameterTypes)
|
||||
|
||||
// TODO: Fix the hack for org.jetbrains.kotlin.fir.backend.Fir2IrVisitor.addFakeOverrides
|
||||
// We might have added baseFunction.typeParameters in case new ones are null
|
||||
// But it fails at org.jetbrains.kotlin.ir.AbstractIrTextTestCase.IrVerifier.elementsAreUniqueChecker
|
||||
// because it shares the same declarations of type parameters between two different two functions
|
||||
if (newTypeParameters != null) {
|
||||
typeParameters += newTypeParameters
|
||||
typeParameters += configureAnnotationsAndAllParameters(session, baseConstructor, newParameterTypes, newTypeParameters)
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a list of type parameters, and a substitutor that should be used for all other types
|
||||
private fun createNewTypeParametersAndSubstitutor(
|
||||
member: FirTypeParameterRefsOwner, substitutor: ConeSubstitutor
|
||||
): Pair<List<FirTypeParameterRef>, ConeSubstitutor> {
|
||||
if (member.typeParameters.isEmpty()) return Pair(member.typeParameters, substitutor)
|
||||
val newTypeParameters = member.typeParameters.map { typeParameter ->
|
||||
if (typeParameter !is FirTypeParameter) return@map null
|
||||
FirTypeParameterBuilder().apply {
|
||||
source = typeParameter.source
|
||||
session = typeParameter.session
|
||||
origin = FirDeclarationOrigin.FakeOverride
|
||||
name = typeParameter.name
|
||||
symbol = FirTypeParameterSymbol()
|
||||
variance = typeParameter.variance
|
||||
isReified = typeParameter.isReified
|
||||
annotations += typeParameter.annotations
|
||||
}
|
||||
}
|
||||
|
||||
val substitutionMapForNewParameters = member.typeParameters.zip(newTypeParameters).mapNotNull { (original, new) ->
|
||||
if (new != null)
|
||||
Pair(original.symbol, ConeTypeParameterTypeImpl(new.symbol.toLookupTag(), isNullable = false))
|
||||
else null
|
||||
}.toMap()
|
||||
|
||||
val additionalSubstitutor = substitutorByMap(substitutionMapForNewParameters)
|
||||
|
||||
for ((newTypeParameter, oldTypeParameter) in newTypeParameters.zip(member.typeParameters)) {
|
||||
if (newTypeParameter == null) continue
|
||||
val original = oldTypeParameter as FirTypeParameter
|
||||
for (boundTypeRef in original.bounds) {
|
||||
val typeForBound = boundTypeRef.coneType
|
||||
val substitutedBound = substitutor.substituteOrNull(typeForBound)
|
||||
newTypeParameter.bounds +=
|
||||
buildResolvedTypeRef {
|
||||
source = boundTypeRef.source
|
||||
type = additionalSubstitutor.substituteOrSelf(substitutedBound ?: typeForBound)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Uncomment when problem from org.jetbrains.kotlin.fir.Fir2IrTextTestGenerated.Declarations.Parameters.testDelegatedMembers is gone
|
||||
// The problem is that Fir2Ir thinks that type parameters in fake override are the same as for original
|
||||
// While common Ir contracts expect them to be different
|
||||
// if (!wereChangesInTypeParameters) return Pair(member.typeParameters, substitutor)
|
||||
|
||||
return Pair(
|
||||
newTypeParameters.mapIndexed { index, builder -> builder?.build() ?: member.typeParameters[index] },
|
||||
ChainedSubstitutor(substitutor, additionalSubstitutor)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: a.kt
|
||||
interface I {
|
||||
|
||||
+3
-2
@@ -69,11 +69,12 @@ FILE fqName:<root> fileName:/typeParameterBoundedBySubclass.kt
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Base2'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived2 modality:FINAL visibility:public superTypes:[<root>.Base2]'
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:FINAL <> ($this:<root>.Base2, x:T of <root>.Base2.foo) returnType:kotlin.Unit [fake_override]
|
||||
FUN FAKE_OVERRIDE name:foo visibility:public modality:FINAL <T> ($this:<root>.Base2, x:T of <root>.Derived2.foo) returnType:kotlin.Unit [fake_override]
|
||||
overridden:
|
||||
public final fun foo <T> (x: T of <root>.Base2.foo): kotlin.Unit declared in <root>.Base2
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.Derived2]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base2
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.Base2.foo
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.Derived2.foo
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
FILE fqName:<root> fileName:/BaseFirBuilder.kt
|
||||
CLASS CLASS name:BaseFirBuilder modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BaseFirBuilder modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:withCapturedTypeParameters visibility:public modality:FINAL <T> ($this:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>, block:kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>) returnType:T of <root>.BaseFirBuilder.withCapturedTypeParameters [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun withCapturedTypeParameters <T> (block: kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>): T of <root>.BaseFirBuilder.withCapturedTypeParameters [inline] declared in <root>.BaseFirBuilder'
|
||||
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of <root>.BaseFirBuilder.withCapturedTypeParameters origin=INVOKE
|
||||
$this: GET_VAR 'block: kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters> declared in <root>.BaseFirBuilder.withCapturedTypeParameters' type=kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters> origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -0,0 +1,29 @@
|
||||
FILE fqName:<root> fileName:/BaseFirBuilder.kt
|
||||
CLASS CLASS name:BaseFirBuilder modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BaseFirBuilder modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:withCapturedTypeParameters visibility:public modality:FINAL <T> ($this:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>, block:kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>) returnType:T of <root>.BaseFirBuilder.withCapturedTypeParameters [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun withCapturedTypeParameters <T> (block: kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>): T of <root>.BaseFirBuilder.withCapturedTypeParameters [inline] declared in <root>.BaseFirBuilder'
|
||||
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of <root>.BaseFirBuilder.withCapturedTypeParameters origin=INVOKE
|
||||
$this: GET_VAR 'block: kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters> declared in <root>.BaseFirBuilder.withCapturedTypeParameters' type=kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters> origin=VARIABLE_AS_FUNCTION
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -0,0 +1,52 @@
|
||||
FILE fqName:<root> fileName:/FirBuilder.kt
|
||||
CLASS CLASS name:BaseConverter modality:OPEN visibility:public superTypes:[<root>.BaseFirBuilder<kotlin.Any>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.BaseConverter
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.BaseConverter [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.BaseFirBuilder'
|
||||
<T>: kotlin.Any
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BaseConverter modality:OPEN visibility:public superTypes:[<root>.BaseFirBuilder<kotlin.Any>]'
|
||||
FUN FAKE_OVERRIDE name:withCapturedTypeParameters visibility:public modality:FINAL <T> ($this:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>, block:kotlin.Function0<T of <root>.BaseConverter.withCapturedTypeParameters>) returnType:T of <root>.BaseConverter.withCapturedTypeParameters [inline,fake_override]
|
||||
overridden:
|
||||
public final fun withCapturedTypeParameters <T> (block: kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>): T of <root>.BaseFirBuilder.withCapturedTypeParameters [inline] declared in <root>.BaseFirBuilder
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.BaseFirBuilder<T of <root>.BaseFirBuilder>
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function0<T of <root>.BaseConverter.withCapturedTypeParameters>
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:DeclarationsConverter modality:FINAL visibility:public superTypes:[<root>.BaseConverter]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.DeclarationsConverter
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.DeclarationsConverter [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.BaseConverter'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DeclarationsConverter modality:FINAL visibility:public superTypes:[<root>.BaseConverter]'
|
||||
FUN FAKE_OVERRIDE name:withCapturedTypeParameters visibility:public modality:FINAL <T> ($this:<root>.BaseConverter, block:kotlin.Function0<T of <root>.DeclarationsConverter.withCapturedTypeParameters>) returnType:T of <root>.BaseConverter.withCapturedTypeParameters [inline,fake_override]
|
||||
overridden:
|
||||
public final fun withCapturedTypeParameters <T> (block: kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>): T of <root>.BaseFirBuilder.withCapturedTypeParameters [inline] declared in <root>.BaseFirBuilder
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.BaseConverter
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function0<T of <root>.DeclarationsConverter.withCapturedTypeParameters>
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1
|
||||
// FILE: BaseFirBuilder.kt
|
||||
|
||||
abstract class BaseFirBuilder<T> {
|
||||
inline fun <T> withCapturedTypeParameters(block: () -> T): T {
|
||||
return block()
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: m2(m1)
|
||||
// FILE: FirBuilder.kt
|
||||
|
||||
open class BaseConverter : BaseFirBuilder<Any>()
|
||||
|
||||
class DeclarationsConverter : BaseConverter()
|
||||
@@ -0,0 +1,52 @@
|
||||
FILE fqName:<root> fileName:/FirBuilder.kt
|
||||
CLASS CLASS name:BaseConverter modality:OPEN visibility:public superTypes:[<root>.BaseFirBuilder<kotlin.Any>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.BaseConverter
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.BaseConverter [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.BaseFirBuilder'
|
||||
<T>: kotlin.Any
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BaseConverter modality:OPEN visibility:public superTypes:[<root>.BaseFirBuilder<kotlin.Any>]'
|
||||
FUN FAKE_OVERRIDE name:withCapturedTypeParameters visibility:public modality:FINAL <T> ($this:<root>.BaseFirBuilder<kotlin.Any>, block:kotlin.Function0<T of <root>.BaseConverter.withCapturedTypeParameters>) returnType:T of <root>.BaseConverter.withCapturedTypeParameters [inline,fake_override]
|
||||
overridden:
|
||||
public final fun withCapturedTypeParameters <T> (block: kotlin.Function0<T of <root>.BaseFirBuilder.withCapturedTypeParameters>): T of <root>.BaseFirBuilder.withCapturedTypeParameters [inline] declared in <root>.BaseFirBuilder
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.BaseFirBuilder<kotlin.Any>
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function0<T of <root>.BaseConverter.withCapturedTypeParameters>
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.BaseFirBuilder
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.BaseFirBuilder
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.BaseFirBuilder
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:DeclarationsConverter modality:FINAL visibility:public superTypes:[<root>.BaseConverter]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.DeclarationsConverter
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.DeclarationsConverter [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.BaseConverter'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DeclarationsConverter modality:FINAL visibility:public superTypes:[<root>.BaseConverter]'
|
||||
FUN FAKE_OVERRIDE name:withCapturedTypeParameters visibility:public modality:FINAL <T> ($this:<root>.BaseFirBuilder<kotlin.Any>, block:kotlin.Function0<T of <root>.DeclarationsConverter.withCapturedTypeParameters>) returnType:T of <root>.DeclarationsConverter.withCapturedTypeParameters [inline,fake_override]
|
||||
overridden:
|
||||
public final fun withCapturedTypeParameters <T> (block: kotlin.Function0<T of <root>.BaseConverter.withCapturedTypeParameters>): T of <root>.BaseConverter.withCapturedTypeParameters [inline,fake_override] declared in <root>.BaseConverter
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.BaseFirBuilder<kotlin.Any>
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function0<T of <root>.DeclarationsConverter.withCapturedTypeParameters>
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.BaseConverter
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.BaseConverter
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.BaseConverter
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -1710,6 +1710,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
||||
public void testDeprecated() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/deprecated.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FirBuilder.kt")
|
||||
public void testFirBuilder() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/FirBuilder.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/ir/irText/lambdas")
|
||||
|
||||
Reference in New Issue
Block a user