Adjust type approximation to broken code and missing dependencies
- Do not run approximation if arguments number is different - Add nullable Any? as supertype to MissingDependencyErrorClass The latter is needed because otherwise TypeArgument.isConsistent became false
This commit is contained in:
@@ -117,7 +117,7 @@ public fun approximateCapturedTypes(type: KotlinType): ApproximationBounds<Kotli
|
||||
else -> throw AssertionError("Only nontrivial projections should have been captured, not: $typeProjection")
|
||||
}
|
||||
}
|
||||
if (type.arguments.isEmpty()) {
|
||||
if (type.arguments.isEmpty() || type.arguments.size != typeConstructor.parameters.size) {
|
||||
return ApproximationBounds(type, type)
|
||||
}
|
||||
val lowerBoundArguments = ArrayList<TypeArgument>()
|
||||
|
||||
+5
-1
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScopeImpl
|
||||
import org.jetbrains.kotlin.types.ErrorUtils.createErrorType
|
||||
@@ -63,7 +64,10 @@ internal class PackageFragmentProviderForMissingDependencies(val moduleDescripto
|
||||
private class MissingDependencyErrorClassDescriptor(
|
||||
containing: DeclarationDescriptor,
|
||||
override val fullFqName: FqName
|
||||
) : MissingDependencyErrorClass, ClassDescriptorImpl(containing, fullFqName.shortName(), Modality.OPEN, ClassKind.CLASS, listOf(), SourceElement.NO_SOURCE) {
|
||||
) : MissingDependencyErrorClass, ClassDescriptorImpl(
|
||||
containing, fullFqName.shortName(), Modality.OPEN, ClassKind.CLASS, listOf(containing.builtIns.nullableAnyType),
|
||||
SourceElement.NO_SOURCE
|
||||
) {
|
||||
|
||||
private val scope = ScopeWithMissingDependencies(fullFqName, this)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user