Type translation, initial import

This commit is contained in:
Dmitry Petrov
2018-04-16 13:15:16 +03:00
parent d1fe32a486
commit d3a1d93460
7 changed files with 205 additions and 42 deletions
@@ -26,17 +26,16 @@ class IrTypeImpl(
annotations: List<IrCall>
) : this(classifier, hasQuestionMark, arguments, annotations, Variance.INVARIANT)
constructor(
other: IrType,
variance: Variance
) : this(other.classifier, other.hasQuestionMark, other.arguments, other.annotations, variance)
override val type: IrType get() = this
}
fun makeTypeProjection(type: IrType, variance: Variance): IrTypeProjection =
if (type !is IrTypeImpl || type.variance != variance)
IrTypeImpl(
type.classifier,
type.hasQuestionMark,
type.arguments,
type.annotations,
variance
)
if (type is IrTypeImpl && type.variance == variance)
type
else
type
IrTypeImpl(type, variance)