[FIR] Add default upper bound to type parameter in fir deserializer
This commit is contained in:
+8
-1
@@ -31,7 +31,8 @@ class FirTypeParameterImpl(
|
||||
|
||||
/*
|
||||
* Note that each type parameter have to has at least one upper bound (Any? if there is no other bounds)
|
||||
* so if you create FirTypeParameterImpl you need to guarantee this contract
|
||||
* so after initializing FirTypeParameterImpl you should call [addDefaultBoundIfNecessary] to guarantee
|
||||
* this contract
|
||||
*/
|
||||
override val bounds: MutableList<FirTypeRef> = mutableListOf()
|
||||
|
||||
@@ -40,4 +41,10 @@ class FirTypeParameterImpl(
|
||||
|
||||
return super<FirAbstractNamedAnnotatedDeclaration>.transformChildren(transformer, data)
|
||||
}
|
||||
}
|
||||
|
||||
fun FirTypeParameterImpl.addDefaultBoundIfNecessary() {
|
||||
if (bounds.isEmpty()) {
|
||||
bounds += FirImplicitNullableAnyTypeRef(null)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user