[NI] Fix completion of error delegates with receiver with type parameters

This commit is contained in:
Dmitriy Novozhilov
2019-12-25 15:00:26 +03:00
parent e83941a98e
commit c8a1b876e8
3 changed files with 49 additions and 2 deletions
@@ -217,6 +217,13 @@ class KotlinConstraintSystemCompleter(
typeConstructor.takeIf { c.notFixedTypeVariables.containsKey(typeConstructor) }
}
/*
* Hack for completing error candidates in delegate resolve
*/
if (this is StubResolvedAtom && typeVariable in c.notFixedTypeVariables) {
to += typeVariable
}
if (analyzed) {
subResolvedAtoms?.forEach { it.process(to) }
}
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.model.NewTypeVariable
import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableForLambdaReturnType
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeConstructor
import org.jetbrains.kotlin.types.TypeSubstitutor
import org.jetbrains.kotlin.types.UnwrappedType
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
@@ -246,4 +247,12 @@ class PartialCallContainer(val result: PartialCallResolutionResult?) {
companion object {
val empty = PartialCallContainer(null)
}
}
/*
* Used only for delegated properties with one good candidate and one for bad
* e.g. in case `var x by lazy { "" }
*/
class StubResolvedAtom(val typeVariable: TypeConstructor) : ResolvedAtom() {
override val atom: ResolutionAtom? get() = null
}