Fix compiler warnings and some inspections

This commit is contained in:
Alexander Udalov
2020-11-02 09:53:21 +01:00
parent e5d5c20473
commit b3e79d36df
29 changed files with 62 additions and 118 deletions
@@ -323,17 +323,19 @@ fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
private val jvmAssertArgsRegex = "(es?a|ds?a|(enable|disable)(system)?assertions)(${'$'}|:)".toRegex()
fun configureDaemonJVMOptions(vararg additionalParams: String,
inheritMemoryLimits: Boolean,
inheritOtherJvmOptions: Boolean,
inheritAdditionalProperties: Boolean
fun configureDaemonJVMOptions(
vararg additionalParams: String,
inheritMemoryLimits: Boolean,
inheritOtherJvmOptions: Boolean,
inheritAdditionalProperties: Boolean
): DaemonJVMOptions =
configureDaemonJVMOptions(DaemonJVMOptions(),
additionalParams = additionalParams,
inheritMemoryLimits = inheritMemoryLimits,
inheritOtherJvmOptions = inheritOtherJvmOptions,
inheritAdditionalProperties = inheritAdditionalProperties)
configureDaemonJVMOptions(
DaemonJVMOptions(),
*additionalParams,
inheritMemoryLimits = inheritMemoryLimits,
inheritOtherJvmOptions = inheritOtherJvmOptions,
inheritAdditionalProperties = inheritAdditionalProperties,
)
fun configureDaemonOptions(opts: DaemonOptions): DaemonOptions {
System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)?.let {
@@ -841,7 +841,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
is ConeClassErrorType -> error { +type.diagnostic.reason }
is ConeClassLikeType -> return generate(type)
is ConeTypeParameterType -> resolved {
symbolRef(type.lookupTag.toSymbol()) {
symbolRef(type.lookupTag.symbol) {
simpleName(type.lookupTag.name)
}
}
@@ -345,7 +345,6 @@ fun Fir2IrComponents.createSafeCallConstruction(
receiverVariable: IrVariable,
receiverVariableSymbol: IrValueSymbol,
expressionOnNotNull: IrExpression,
isReceiverNullable: Boolean
): IrExpression {
val startOffset = expressionOnNotNull.startOffset
val endOffset = expressionOnNotNull.endOffset
@@ -343,14 +343,7 @@ class Fir2IrVisitor(
return conversionScope.withSafeCallSubject(receiverVariable) {
val afterNotNullCheck = safeCallExpression.regularQualifiedAccess.accept(this, data) as IrExpression
val isReceiverNullable = with(components.session.typeContext) {
safeCallExpression.receiver.typeRef.coneType.isNullableType()
}
components.createSafeCallConstruction(
receiverVariable, variableSymbol, afterNotNullCheck, isReceiverNullable
)
components.createSafeCallConstruction(receiverVariable, variableSymbol, afterNotNullCheck)
}
}
@@ -169,7 +169,7 @@ internal class OperatorExpressionGenerator(
unsafeIrCall.dispatchReceiver = IrGetValueImpl(startOffset, endOffset, receiverVariableSymbol)
components.createSafeCallConstruction(receiverVariable, receiverVariableSymbol, unsafeIrCall, isReceiverNullable = true)
components.createSafeCallConstruction(receiverVariable, receiverVariableSymbol, unsafeIrCall)
} else {
unsafeIrCall
}
@@ -71,7 +71,7 @@ class FirAnnotationTypeQualifierResolver(private val session: FirSession, privat
val annotationClassId = annotationCall.classId
return BUILT_IN_TYPE_QUALIFIER_DEFAULT_ANNOTATION_IDS[annotationClassId]?.let { qualifierForDefaultingAnnotation ->
val state = resolveJsr305ReportLevel(annotationCall).takeIf { it != ReportLevel.IGNORE } ?: return null
return qualifierForDefaultingAnnotation.copy(
qualifierForDefaultingAnnotation.copy(
nullabilityQualifier = qualifierForDefaultingAnnotation.nullabilityQualifier.copy(isForWarningOnly = state.isWarning)
)
}
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag
import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTagWithFixedSymbol
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
import org.jetbrains.kotlin.fir.symbols.impl.*
fun ConeClassifierLookupTag.toSymbol(useSiteSession: FirSession): FirClassifierSymbol<*>? =
@@ -33,8 +32,6 @@ fun ConeClassLikeLookupTag.toSymbol(useSiteSession: FirSession): FirClassLikeSym
}
}
fun ConeTypeParameterLookupTag.toSymbol(): FirTypeParameterSymbol = this.symbol as FirTypeParameterSymbol
@OptIn(LookupTagInternals::class)
fun ConeClassLikeLookupTagImpl.bindSymbolToLookupTag(session: FirSession, symbol: FirClassLikeSymbol<*>?) {
boundSymbol = OneElementWeakMap(session, symbol)
@@ -50,7 +50,7 @@ private fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: Scope
fir.scopeForClass(substitutorByMap(substitution), useSiteSession, scopeSession)
}
is ConeTypeParameterType -> {
val symbol = lookupTag.toSymbol()
val symbol = lookupTag.symbol
scopeSession.getOrBuild(symbol, TYPE_PARAMETER_SCOPE_KEY) {
val intersectionType = ConeTypeIntersector.intersectTypes(
useSiteSession.typeContext,
@@ -83,7 +83,7 @@ private fun mapTypeAliasArguments(
override fun substituteArgument(projection: ConeTypeProjection): ConeTypeProjection? {
val type = (projection as? ConeKotlinTypeProjection)?.type ?: return null
val symbol = (type as? ConeTypeParameterType)?.lookupTag?.toSymbol() ?: return super.substituteArgument(projection)
val symbol = (type as? ConeTypeParameterType)?.lookupTag?.symbol ?: return super.substituteArgument(projection)
val mappedProjection = typeAliasMap[symbol] ?: return super.substituteArgument(projection)
val mappedType = (mappedProjection as? ConeKotlinTypeProjection)?.type ?: return mappedProjection
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.fir.extensions.extensionService
import org.jetbrains.kotlin.fir.extensions.predicateBasedProvider
import org.jetbrains.kotlin.fir.extensions.supertypeGenerators
import org.jetbrains.kotlin.fir.resolve.*
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.LocalClassesNavigationInfo
import org.jetbrains.kotlin.fir.scopes.FirCompositeScope
import org.jetbrains.kotlin.fir.scopes.FirScope
@@ -228,7 +227,7 @@ private class FirSupertypeResolverVisitor(
// Local classes should be treated specially and supplied with localClassesNavigationInfo, normally
// But it seems to be too strict to add an assertion here
val navigationInfo = localClassesNavigationInfo ?: return persistentListOf()
if (localClassesNavigationInfo == null) return persistentListOf()
val parent = localClassesNavigationInfo.parentForClass[classLikeDeclaration]
@@ -20,7 +20,7 @@ fun AbstractFirBasedSymbol<*>.ensureResolved(
requiredPhase: FirResolvePhase,
// TODO: Currently, the parameter is unused but it's needed to guarantee that all call-sites are able to supply use-site session
// TODO: Decide which one session should be used and probably get rid of the parameter if use-site session is not needed
useSiteSession: FirSession,
@Suppress("UNUSED_PARAMETER") useSiteSession: FirSession,
) {
val fir = fir as FirDeclaration
val availablePhase = fir.resolvePhase
@@ -234,8 +234,6 @@ private class ReturnTypeCalculatorWithJump(
private fun computeReturnTypeRef(declaration: FirCallableMemberDeclaration<*>): FirResolvedTypeRef {
val symbol = declaration.symbol
val id = symbol.callableId
val provider = session.firProvider
val (designation, outerBodyResolveContext) = if (declaration in designationMapForLocalClasses) {
@@ -108,8 +108,7 @@ object FirFakeOverrideGenerator {
dispatchReceiverType = newDispatchReceiverType
attributes = baseFunction.attributes.copy()
typeParameters += configureAnnotationsTypeParametersAndSignature(
session, baseFunction, newParameterTypes,
newTypeParameters, newReceiverType, newReturnType, fakeOverrideSubstitution
baseFunction, newParameterTypes, newTypeParameters, newReceiverType, newReturnType, fakeOverrideSubstitution
).filterIsInstance<FirTypeParameter>()
}
}
@@ -135,7 +134,7 @@ object FirFakeOverrideGenerator {
symbol = fakeOverrideSymbol
typeParameters += configureAnnotationsTypeParametersAndSignature(
session, baseConstructor, newParameterTypes, newTypeParameters, newReceiverType = null, newReturnType, fakeOverrideSubstitution
baseConstructor, newParameterTypes, newTypeParameters, newReceiverType = null, newReturnType, fakeOverrideSubstitution
)
dispatchReceiverType = newDispatchReceiverType
@@ -147,7 +146,6 @@ object FirFakeOverrideGenerator {
}
private fun FirFunctionBuilder.configureAnnotationsTypeParametersAndSignature(
session: FirSession,
baseFunction: FirFunction<*>,
newParameterTypes: List<ConeKotlinType?>?,
newTypeParameters: List<FirTypeParameterRef>?,
@@ -158,7 +156,6 @@ object FirFakeOverrideGenerator {
return when {
baseFunction.typeParameters.isEmpty() -> {
configureAnnotationsAndSignature(
session,
baseFunction,
newParameterTypes,
newReceiverType,
@@ -183,7 +180,6 @@ object FirFakeOverrideGenerator {
else -> null to FakeOverrideSubstitution(substitutor, symbol)
}
configureAnnotationsAndSignature(
session,
baseFunction,
copiedParameterTypes,
copiedReceiverType,
@@ -194,7 +190,6 @@ object FirFakeOverrideGenerator {
}
else -> {
configureAnnotationsAndSignature(
session,
baseFunction,
newParameterTypes,
newReceiverType,
@@ -207,7 +202,6 @@ object FirFakeOverrideGenerator {
}
private fun FirFunctionBuilder.configureAnnotationsAndSignature(
session: FirSession,
baseFunction: FirFunction<*>,
newParameterTypes: List<ConeKotlinType?>?,
newReceiverType: ConeKotlinType?,
@@ -329,7 +329,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
}
val substitutor = substitutorByMap((0 until argumentsCount).map { index ->
(typeConstructor.getParameter(index) as ConeTypeParameterLookupTag).toSymbol() to (newArguments[index] as ConeKotlinType)
(typeConstructor.getParameter(index) as ConeTypeParameterLookupTag).symbol to (newArguments[index] as ConeKotlinType)
}.toMap())
for (index in 0 until argumentsCount) {
@@ -561,8 +561,8 @@ class ConeTypeCheckerContext(
}
}
override fun areEqualTypeConstructors(a: TypeConstructorMarker, b: TypeConstructorMarker): Boolean {
return a == b
override fun areEqualTypeConstructors(c1: TypeConstructorMarker, c2: TypeConstructorMarker): Boolean {
return c1 == c2
}
override fun prepareType(type: KotlinTypeMarker): KotlinTypeMarker {
@@ -239,9 +239,11 @@ private class DelegatingPackageFragmentProvider<M : ModuleInfo>(
) : PackageFragmentProviderOptimized {
private val syntheticFilePackages = moduleContent.syntheticFiles.map { it.packageFqName }.toSet()
@Suppress("OverridingDeprecatedMember")
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> {
if (certainlyDoesNotExist(fqName)) return emptyList()
@Suppress("DEPRECATION")
return resolverForProject.resolverForModuleDescriptor(module).packageFragmentProvider.getPackageFragments(fqName)
}
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.builtins.UnsignedTypes
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
import org.jetbrains.kotlin.builtins.isExtensionFunctionType
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.diagnostics.Errors.*
import org.jetbrains.kotlin.diagnostics.Errors.BadNamedArgumentsTarget.*
import org.jetbrains.kotlin.diagnostics.reportDiagnosticOnce
@@ -67,7 +66,7 @@ class DiagnosticReporterByTrackingStrategy(
AbstractSuperCall::class.java -> tracingStrategy.abstractSuperCall(trace)
NonApplicableCallForBuilderInferenceDiagnostic::class.java -> {
val reportOn = (diagnostic as NonApplicableCallForBuilderInferenceDiagnostic).kotlinCall
trace.reportDiagnosticOnce(Errors.NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE.on(reportOn.psiKotlinCall.psiCall.callElement))
trace.reportDiagnosticOnce(NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE.on(reportOn.psiKotlinCall.psiCall.callElement))
}
CandidateChosenUsingOverloadResolutionByLambdaAnnotation::class.java -> {
trace.report(CANDIDATE_CHOSEN_USING_OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION.on(psiKotlinCall.psiCall.callElement))
@@ -338,8 +337,8 @@ class DiagnosticReporterByTrackingStrategy(
override fun constraintError(error: ConstraintSystemError) {
when (error.javaClass) {
NewConstraintError::class.java -> {
val constraintError = error as NewConstraintError
val position = constraintError.position.from
error as NewConstraintError
val position = error.position.from
val argument =
when (position) {
is ArgumentConstraintPositionImpl -> position.argument
@@ -351,16 +350,16 @@ class DiagnosticReporterByTrackingStrategy(
argument?.let {
it.safeAs<LambdaKotlinCallArgument>()?.let lambda@{ lambda ->
val parameterTypes = lambda.parametersTypes?.toList() ?: return@lambda
val index = parameterTypes.indexOf(constraintError.upperKotlinType.unwrap())
val index = parameterTypes.indexOf(error.upperKotlinType.unwrap())
val lambdaExpression = lambda.psiExpression as? KtLambdaExpression ?: return@lambda
val parameter = lambdaExpression.valueParameters.getOrNull(index) ?: return@lambda
trace.report(Errors.EXPECTED_PARAMETER_TYPE_MISMATCH.on(parameter, constraintError.upperKotlinType))
trace.report(EXPECTED_PARAMETER_TYPE_MISMATCH.on(parameter, error.upperKotlinType))
return
}
val expression = it.psiExpression ?: return
val deparenthesized = KtPsiUtil.safeDeparenthesize(expression)
if (reportConstantTypeMismatch(constraintError, deparenthesized)) return
if (reportConstantTypeMismatch(error, deparenthesized)) return
val compileTimeConstant = trace[BindingContext.COMPILE_TIME_VALUE, deparenthesized] as? TypedCompileTimeConstant
if (compileTimeConstant != null) {
@@ -371,40 +370,22 @@ class DiagnosticReporterByTrackingStrategy(
return
}
}
trace.report(
Errors.TYPE_MISMATCH.on(
deparenthesized,
constraintError.upperKotlinType,
constraintError.lowerKotlinType
)
)
trace.report(TYPE_MISMATCH.on(deparenthesized, error.upperKotlinType, error.lowerKotlinType))
}
(position as? ExpectedTypeConstraintPositionImpl)?.let {
val call = it.topLevelCall.psiKotlinCall.psiCall.callElement.safeAs<KtExpression>()
val inferredType =
if (!constraintError.lowerKotlinType.isNullableNothing()) constraintError.lowerKotlinType
else constraintError.upperKotlinType.makeNullable()
if (!error.lowerKotlinType.isNullableNothing()) error.lowerKotlinType
else error.upperKotlinType.makeNullable()
if (call != null) {
trace.report(
Errors.TYPE_MISMATCH.on(
call,
constraintError.upperKotlinType,
inferredType
)
)
trace.report(TYPE_MISMATCH.on(call, error.upperKotlinType, inferredType))
}
}
(position as? ExplicitTypeParameterConstraintPositionImpl)?.let {
val typeArgumentReference = (it.typeArgument as SimpleTypeArgumentImpl).typeReference
trace.report(
UPPER_BOUND_VIOLATED.on(
typeArgumentReference,
constraintError.upperKotlinType,
constraintError.lowerKotlinType
)
)
trace.report(UPPER_BOUND_VIOLATED.on(typeArgumentReference, error.upperKotlinType, error.lowerKotlinType))
}
(position as? FixVariableConstraintPositionImpl)?.let {
@@ -417,36 +398,29 @@ class DiagnosticReporterByTrackingStrategy(
val call = it.resolvedAtom?.atom?.safeAs<PSIKotlinCall>()?.psiCall ?: call
val expression = call.calleeExpression ?: return
trace.reportDiagnosticOnce(
TYPE_MISMATCH.on(
expression,
constraintError.upperKotlinType,
constraintError.lowerKotlinType
)
)
trace.reportDiagnosticOnce(TYPE_MISMATCH.on(expression, error.upperKotlinType, error.lowerKotlinType))
}
}
CapturedTypeFromSubtyping::class.java -> {
val capturedError = error as CapturedTypeFromSubtyping
val position = capturedError.position
val argumentPosition =
position.safeAs<ArgumentConstraintPositionImpl>()
?: position.safeAs<IncorporationConstraintPosition>()?.from.safeAs<ArgumentConstraintPositionImpl>()
error as CapturedTypeFromSubtyping
val position = error.position
val argumentPosition: ArgumentConstraintPositionImpl? =
position.safeAs() ?: position.safeAs<IncorporationConstraintPosition>()?.from.safeAs()
argumentPosition?.let {
val expression = it.argument.psiExpression ?: return
trace.reportDiagnosticOnce(
NEW_INFERENCE_ERROR.on(
expression,
"Capture type from subtyping ${capturedError.constraintType} for variable ${capturedError.typeVariable}"
"Capture type from subtyping ${error.constraintType} for variable ${error.typeVariable}"
)
)
}
}
NotEnoughInformationForTypeParameterImpl::class.java -> {
val error = error as NotEnoughInformationForTypeParameterImpl
error as NotEnoughInformationForTypeParameterImpl
if (allDiagnostics.any {
when (it) {
is WrongCountOfTypeArguments -> true
@@ -661,10 +661,8 @@ sealed class NewAbstractResolvedCall<D : CallableDescriptor>() : ResolvedCall<D>
}
if (varargMappings != null && !needToUseCorrectExecutionOrderForVarargArguments) {
if (varargMappings != null) {
for ((parameter, argument) in varargMappings) {
result[parameter] = argument
}
for ((parameter, argument) in varargMappings) {
result[parameter] = argument
}
}
}
@@ -6,18 +6,14 @@
package org.jetbrains.kotlin.ir.backend.js.lower.calls
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
import org.jetbrains.kotlin.ir.expressions.IrDynamicOperator
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrDynamicOperatorExpressionImpl
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
import org.jetbrains.kotlin.name.FqName
// TODO use nativeX annotations on kotlin.js.Json instead
class JsonIntrinsics(context: JsIrBackendContext) : NativeGetterSetterTransformer(context) {
override fun transformFunctionAccess(call: IrFunctionAccessExpression, skip: Boolean): IrExpression {
override fun transformFunctionAccess(call: IrFunctionAccessExpression, doNotIntrinsify: Boolean): IrExpression {
return when (call.symbol.owner.fqNameWhenAvailable) {
FqName("kotlin.js.Json.get") -> call.transformToIndexedRead()
FqName("kotlin.js.Json.set") -> call.transformToIndexedWrite()
@@ -235,7 +235,7 @@ class JsIntrinsicTransformers(backendContext: JsIrBackendContext) {
val value = args[1]
jsAssignment(JsNameRef(Namer.SHARED_BOX_V, box), value)
}
add(intrinsics.jsUndefined) { call: IrCall, context: JsGenerationContext ->
add(intrinsics.jsUndefined) { _, _ ->
JsPrefixOperation(JsUnaryOperator.VOID, JsIntLiteral(1))
}
}
@@ -22,12 +22,10 @@ import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.util.DataClassMembersGenerator
import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET
import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
/**
* A generator that generates synthetic members of data class as well as part of inline class.
@@ -88,9 +86,6 @@ class DataClassMembersGenerator(
override fun generateComponentFunction(function: FunctionDescriptor, parameter: ValueParameterDescriptor) {
if (!irClass.isData) return
val ktParameter = DescriptorToSourceUtils.descriptorToDeclaration(parameter)
?: throw AssertionError("No definition for data class constructor parameter $parameter")
val backingField = irDataClassMembersGenerator.getBackingField(parameter, null) ?: return
irDataClassMembersGenerator.generateComponentFunction(function, backingField)
}
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
@@ -42,7 +41,7 @@ class PropertyGenerator(declarationGenerator: DeclarationGenerator) : Declaratio
generateSimpleProperty(ktProperty, propertyDescriptor)
}
fun generateDestructuringDeclarationEntryAsPropertyDeclaration(ktEntry: KtDestructuringDeclarationEntry, entryInitializer: IrExpression): IrProperty {
fun generateDestructuringDeclarationEntryAsPropertyDeclaration(ktEntry: KtDestructuringDeclarationEntry): IrProperty {
val propertyDescriptor = getPropertyDescriptor(ktEntry)
return context.symbolTable.declareProperty(
ktEntry.startOffsetSkippingComments, ktEntry.endOffset,
@@ -173,7 +173,7 @@ class ScriptGenerator(declarationGenerator: DeclarationGenerator) : DeclarationG
val irComponentProperty =
PropertyGenerator(declarationGenerator).generateDestructuringDeclarationEntryAsPropertyDeclaration(
ktEntry, irComponentCall
ktEntry
)
val irComponentBackingField = irComponentProperty.backingField!!
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.resolve.calls.inference.components
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemOperation
@@ -196,8 +195,8 @@ class ConstraintInjector(
return baseContext.substitutionSupertypePolicy(type)
}
override fun areEqualTypeConstructors(a: TypeConstructorMarker, b: TypeConstructorMarker): Boolean {
return baseContext.areEqualTypeConstructors(a, b)
override fun areEqualTypeConstructors(c1: TypeConstructorMarker, c2: TypeConstructorMarker): Boolean {
return baseContext.areEqualTypeConstructors(c1, c2)
}
override fun prepareType(type: KotlinTypeMarker): KotlinTypeMarker {
@@ -85,7 +85,7 @@ class AnnotationTypeQualifierResolver(storageManager: StorageManager, private va
return BUILT_IN_TYPE_QUALIFIER_DEFAULT_ANNOTATIONS[annotationDescriptor.fqName]?.let { qualifierForDefaultingAnnotation ->
val state = resolveDefaultAnnotationState(annotationDescriptor).takeIf { it != ReportLevel.IGNORE } ?: return null
return qualifierForDefaultingAnnotation.copy(
qualifierForDefaultingAnnotation.copy(
nullabilityQualifier = qualifierForDefaultingAnnotation.nullabilityQualifier.copy(isForWarningOnly = state.isWarning)
)
}
@@ -40,6 +40,7 @@ class JavaDescriptorResolver(
if (fqName == null) return null
@Suppress("DEPRECATION")
return packageFragmentProvider.getPackageFragments(fqName.parent()).firstOrNull()?.findClassifierByJavaClass(javaClass)
}
}
@@ -48,7 +48,6 @@ fun PackageFragmentProvider.collectPackageFragmentsOptimizedIfPossible(
) {
when (this) {
is PackageFragmentProviderOptimized -> collectPackageFragments(fqName, packageFragments)
else -> packageFragments.addAll(getPackageFragments(fqName))
else -> packageFragments.addAll(@Suppress("DEPRECATION") getPackageFragments(fqName))
}
}
@@ -47,10 +47,10 @@ open class ClassicTypeCheckerContext(
override val isStubTypeEqualsToAnything: Boolean
get() = stubTypeEqualsToAnything
override fun areEqualTypeConstructors(a: TypeConstructorMarker, b: TypeConstructorMarker): Boolean {
require(a is TypeConstructor, a::errorMessage)
require(b is TypeConstructor, b::errorMessage)
return areEqualTypeConstructors(a, b)
override fun areEqualTypeConstructors(c1: TypeConstructorMarker, c2: TypeConstructorMarker): Boolean {
require(c1 is TypeConstructor, c1::errorMessage)
require(c2 is TypeConstructor, c2::errorMessage)
return areEqualTypeConstructors(c1, c2)
}
open fun areEqualTypeConstructors(a: TypeConstructor, b: TypeConstructor): Boolean = when {
@@ -89,4 +89,4 @@ open class ClassicTypeCheckerContext(
private fun Any.errorMessage(): String {
return "ClassicTypeCheckerContext couldn't handle ${this::class} $this"
}
}
@@ -94,7 +94,7 @@ interface IrBuilderExtension {
irInvoke(
dispatchReceiver,
callee,
args = valueArguments.toTypedArray(),
*valueArguments.toTypedArray(),
typeHint = returnTypeHint
).also { call -> typeArguments.forEachIndexed(call::putTypeArgument) }
@@ -372,7 +372,6 @@ open class SerializerCodegenImpl(
for ((index, property) in serializableProperties.withIndex()) {
val propertyType = codegen.typeMapper.mapType(property.type)
if (!property.transient) {
val propertyAddressInBitMask = bitMaskOff(index)
// labelI:
visitLabel(labels[labelNum + 1])
callReadProperty(property, propertyType, index, inputVar, descVar, propVar)