[FIR] Support captured type arguments of anonymous objects in resolve
This commit is contained in:
@@ -78,8 +78,8 @@ fun FirRegularClass.defaultType(): ConeClassLikeTypeImpl {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun FirAnonymousObject.defaultType(): ConeClassLikeTypeImpl {
|
fun FirAnonymousObject.defaultType(): ConeClassLikeType {
|
||||||
return ConeClassLikeTypeImpl(
|
return this.typeRef.coneTypeSafe() ?: ConeClassLikeTypeImpl(
|
||||||
symbol.toLookupTag(),
|
symbol.toLookupTag(),
|
||||||
emptyArray(),
|
emptyArray(),
|
||||||
isNullable = false
|
isNullable = false
|
||||||
|
|||||||
+5
-3
@@ -369,9 +369,11 @@ class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransformer)
|
|||||||
}
|
}
|
||||||
dataFlowAnalyzer.enterClass()
|
dataFlowAnalyzer.enterClass()
|
||||||
val type = anonymousObject.defaultType()
|
val type = anonymousObject.defaultType()
|
||||||
anonymousObject.resultType = buildResolvedTypeRef {
|
if (anonymousObject.typeRef !is FirResolvedTypeRef) {
|
||||||
source = anonymousObject.source
|
anonymousObject.resultType = buildResolvedTypeRef {
|
||||||
this.type = type
|
source = anonymousObject.source
|
||||||
|
this.type = type
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var result = withLabelAndReceiverType(null, anonymousObject, type) {
|
var result = withLabelAndReceiverType(null, anonymousObject, type) {
|
||||||
transformDeclarationContent(anonymousObject, data).single as FirAnonymousObject
|
transformDeclarationContent(anonymousObject, data).single as FirAnonymousObject
|
||||||
|
|||||||
@@ -200,11 +200,11 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
|||||||
//require(this is ConeSymbol)
|
//require(this is ConeSymbol)
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is FirTypeParameterSymbol,
|
is FirTypeParameterSymbol,
|
||||||
is FirAnonymousObjectSymbol,
|
|
||||||
is ConeCapturedTypeConstructor,
|
is ConeCapturedTypeConstructor,
|
||||||
is ErrorTypeConstructor,
|
is ErrorTypeConstructor,
|
||||||
is ConeTypeVariableTypeConstructor,
|
is ConeTypeVariableTypeConstructor,
|
||||||
is ConeIntersectionType -> 0
|
is ConeIntersectionType -> 0
|
||||||
|
is FirAnonymousObjectSymbol -> fir.typeParameters.size
|
||||||
is FirRegularClassSymbol -> fir.typeParameters.size
|
is FirRegularClassSymbol -> fir.typeParameters.size
|
||||||
is FirTypeAliasSymbol -> fir.typeParameters.size
|
is FirTypeAliasSymbol -> fir.typeParameters.size
|
||||||
is ConeIntegerLiteralType -> 0
|
is ConeIntegerLiteralType -> 0
|
||||||
@@ -216,6 +216,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
|||||||
//require(this is ConeSymbol)
|
//require(this is ConeSymbol)
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is FirTypeParameterSymbol -> error("?!:11")
|
is FirTypeParameterSymbol -> error("?!:11")
|
||||||
|
is FirAnonymousObjectSymbol -> fir.typeParameters[index].symbol
|
||||||
is FirRegularClassSymbol -> fir.typeParameters[index].symbol
|
is FirRegularClassSymbol -> fir.typeParameters[index].symbol
|
||||||
is FirTypeAliasSymbol -> fir.typeParameters[index].symbol
|
is FirTypeAliasSymbol -> fir.typeParameters[index].symbol
|
||||||
else -> error("?!:12")
|
else -> error("?!:12")
|
||||||
|
|||||||
Reference in New Issue
Block a user