IrTypes: IrClass.superTypes can depend on type parameters

IrClass.superTypes can depend on type parameters of a class and thus
should be initialized after type parameters are in put in scope.
This commit is contained in:
Dmitry Petrov
2018-05-25 15:04:11 +03:00
parent 8ae17ecbcb
commit eb6f652763
3 changed files with 5 additions and 4 deletions
@@ -54,6 +54,8 @@ class ClassGenerator(
return context.symbolTable.declareClass(
startOffset, endOffset, IrDeclarationOrigin.DEFINED, classDescriptor
).buildWithScope { irClass ->
declarationGenerator.generateGlobalTypeParametersDeclarations(irClass, classDescriptor.declaredTypeParameters)
classDescriptor.typeConstructor.supertypes.mapTo(irClass.superTypes) {
it.toIrType()
}
@@ -65,8 +67,6 @@ class ClassGenerator(
classDescriptor.thisAsReceiverParameter.type.toIrType()
)
declarationGenerator.generateGlobalTypeParametersDeclarations(irClass, classDescriptor.declaredTypeParameters)
val irPrimaryConstructor = generatePrimaryConstructor(irClass, ktClassOrObject)
if (irPrimaryConstructor != null) {
generateDeclarationsForPrimaryConstructorParameters(irClass, irPrimaryConstructor, ktClassOrObject)