Fix projection compilation against bootstrap compiler

This is needed after 5d95a1ac
This commit is contained in:
Mikhail Zarechenskiy
2019-04-25 15:08:27 +03:00
parent ac0a1d984f
commit f00c946ff7
11 changed files with 24 additions and 16 deletions
@@ -6,11 +6,15 @@
package org.jetbrains.kotlin.checkers.diagnostics
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiElement
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.checkers.diagnostics.factories.DebugInfoDiagnosticFactory1
import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1
import org.jetbrains.kotlin.diagnostics.rendering.AbstractDiagnosticWithParametersRenderer
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticWithParameters1Renderer
import org.jetbrains.kotlin.diagnostics.rendering.Renderers.TO_STRING
import java.util.regex.Pattern
@@ -136,7 +140,7 @@ class TextDiagnostic(
private fun asTextDiagnostic(actualDiagnostic: ActualDiagnostic): TextDiagnostic {
val diagnostic = actualDiagnostic.diagnostic
val renderer = when (diagnostic.factory) {
is DebugInfoDiagnosticFactory1 -> DiagnosticWithParameters1Renderer("{0}", TO_STRING)
is DebugInfoDiagnosticFactory1 -> DiagnosticWithParameters1Renderer("{0}", TO_STRING) as DiagnosticRenderer<Diagnostic>
else -> DefaultErrorMessages.getRendererForDiagnostic(diagnostic)
}
val diagnosticName = actualDiagnostic.name
@@ -205,7 +205,9 @@ class KotlinResolutionCallbacksImpl(
}
override fun bindStubResolvedCallForCandidate(candidate: ResolvedCallAtom) {
kotlinToResolvedCallTransformer.createStubResolvedCallAndWriteItToTrace(candidate, trace, emptyList(), substitutor = null)
kotlinToResolvedCallTransformer.createStubResolvedCallAndWriteItToTrace<CallableDescriptor>(
candidate, trace, emptyList(), substitutor = null
)
}
override fun createReceiverWithSmartCastInfo(resolvedAtom: ResolvedCallAtom): ReceiverValueWithSmartCastInfo? {
@@ -108,7 +108,7 @@ class KotlinToResolvedCallTransformer(
val resultSubstitutor = baseResolvedCall.constraintSystem.buildResultingSubstitutor()
if (context.inferenceSession.writeOnlyStubs()) {
val stub = createStubResolvedCallAndWriteItToTrace(
val stub = createStubResolvedCallAndWriteItToTrace<CallableDescriptor>(
candidate,
context.trace,
baseResolvedCall.diagnostics,
@@ -261,7 +261,7 @@ open class WrappedTypeParameterDescriptor(
override val supertypeLoopChecker = SupertypeLoopChecker.EMPTY
override fun getParameters() = emptyList()
override fun getParameters(): List<TypeParameterDescriptor> = emptyList()
override fun isFinal() = false
@@ -687,7 +687,7 @@ open class WrappedEnumEntryDescriptor(
TODO("not implemented")
}
override fun getDeclaredTypeParameters() = emptyList()
override fun getDeclaredTypeParameters(): List<TypeParameterDescriptor> = emptyList()
override fun getSealedSubclasses(): Collection<ClassDescriptor> {
TODO("not implemented")
@@ -773,7 +773,7 @@ open class WrappedPropertyDescriptor(
owner.setter?.descriptor as? PropertyAccessorDescriptor
).toMutableList()
override fun getTypeParameters() = emptyList()
override fun getTypeParameters(): List<TypeParameterDescriptor> = emptyList()
override fun getVisibility() = owner.visibility
@@ -877,7 +877,7 @@ open class WrappedFieldDescriptor(
override fun getAccessors(): MutableList<PropertyAccessorDescriptor> = mutableListOf()
override fun getTypeParameters() = emptyList()
override fun getTypeParameters(): List<TypeParameterDescriptor> = emptyList()
override fun getVisibility() = owner.visibility
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
import org.jetbrains.kotlin.name.Name
val jvmDefaultArgumentStubPhase = makeIrFilePhase(
val jvmDefaultArgumentStubPhase = makeIrFilePhase<CommonBackendContext>(
{ context -> DefaultArgumentStubGenerator(context, false) },
name = "DefaultArgumentsStubGenerator",
description = "Generate synthetic stubs for functions with default parameter values"
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.name.Name
object SYNTHESIZED_INIT_BLOCK: IrStatementOriginImpl("SYNTHESIZED_INIT_BLOCK")
fun makeInitializersPhase(origin: IrDeclarationOrigin, clinitNeeded: Boolean)= makeIrFilePhase(
fun makeInitializersPhase(origin: IrDeclarationOrigin, clinitNeeded: Boolean)= makeIrFilePhase<CommonBackendContext>(
{ context -> InitializersLowering(context, origin, clinitNeeded) },
name = "Initializers",
description = "Handle initializer statements",
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.backend.common.lower
import org.jetbrains.kotlin.backend.common.BackendContext
import org.jetbrains.kotlin.backend.common.CommonBackendContext
import org.jetbrains.kotlin.backend.common.DeclarationContainerLoweringPass
import org.jetbrains.kotlin.backend.common.descriptors.*
import org.jetbrains.kotlin.backend.common.ir.copyTo
@@ -34,7 +35,7 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.NameUtils
import java.util.*
val jvmLocalDeclarationsPhase = makeIrFilePhase(
val jvmLocalDeclarationsPhase = makeIrFilePhase<CommonBackendContext>(
{ context ->
LocalDeclarationsLowering(context, object : LocalNameProvider {
override fun localName(declaration: IrDeclarationWithName): String =
@@ -114,7 +114,7 @@ private class VarargTransformer(
// empty vararg => empty array literal
if (segments.isEmpty()) {
return emptyList().toArrayLiteral(primitiveExpressionType, primitiveElementType)
return emptyList<IrExpression>().toArrayLiteral(primitiveExpressionType, primitiveElementType)
}
// vararg with a single segment => no need to concatenate
@@ -173,7 +173,7 @@ private class VarargTransformer(
val argument = expression.getValueArgument(i)
val parameter = expression.symbol.owner.valueParameters[i]
if (argument == null && parameter.varargElementType != null) {
expression.putValueArgument(i, emptyList().toArrayLiteral(parameter.type, parameter.varargElementType!!))
expression.putValueArgument(i, emptyList<IrExpression>().toArrayLiteral(parameter.type, parameter.varargElementType!!))
}
}
@@ -44,7 +44,7 @@ private val expectDeclarationsRemovingPhase = makeIrFilePhase(
description = "Remove expect declaration from module fragment"
)
private val propertiesPhase = makeIrFilePhase(
private val propertiesPhase = makeIrFilePhase<CommonBackendContext>(
{ context ->
PropertiesLowering(context, JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS) { propertyName ->
JvmAbi.getSyntheticMethodNameForAnnotatedProperty(propertyName)
@@ -55,7 +55,7 @@ private val propertiesPhase = makeIrFilePhase(
stickyPostconditions = setOf((PropertiesLowering)::checkNoProperties)
)
val jvmPhases = namedIrFilePhase(
val jvmPhases = namedIrFilePhase<JvmBackendContext>(
name = "IrLowering",
description = "IR lowering",
lower = expectDeclarationsRemovingPhase then
@@ -58,7 +58,7 @@ import org.jetbrains.org.objectweb.asm.Type
//Hack implementation to support CR java types in lower
class CrIrType(val type: Type) : IrType {
override val annotations = emptyList()
override val annotations: List<IrCall> = emptyList()
override fun equals(other: Any?): Boolean =
other is CrIrType && type == other.type
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.common.push
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
import org.jetbrains.kotlin.ir.declarations.IrSymbolOwner
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl
@@ -27,7 +28,7 @@ internal val singletonReferencesPhase = makeIrFilePhase(
private class SingletonReferencesLowering(val context: JvmBackendContext) : ClassLoweringPass, IrElementTransformerVoid() {
private lateinit var containingClass: IrClass
private val constructingEnums = arrayListOf()
private val constructingEnums = arrayListOf<IrDeclarationParent>()
override fun lower(irClass: IrClass) {
containingClass = irClass