Removed hacks for code migration from ConstraintSystemImpl.
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt
index b493a4e..773ae34 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt
@@ -45,14 +45,14 @@
override val status = object : ConstraintSystemStatus {
// for debug ConstraintsUtil.getDebugMessageForStatus might be used
- override fun isSuccessful() = !hasContradiction() && !hasUnknownParameters()
+ override fun isSuccessful() = !hasContradiction() && !hasUnknownParameters() && satisfyInitialConstraints()
override fun hasContradiction() = hasParameterConstraintError() || hasConflictingConstraints()
- || hasCannotCaptureTypesError() || hasTypeInferenceIncorporationError()
- // hacks for library migration todo: remove its later
- || hasTypeParameterWithUnsatisfiedOnlyInputTypesError()
+ || hasCannotCaptureTypesError() || errors.any { it is TypeInferenceError }
/**
+ * All hacks were removed. This comment is left for information.
+ *
* Hacks above are needed for the following example:
*
* @kotlin.jvm.JvmName("containsAny")
diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/resolveWithLowPriorityAnnotation.kt b/compiler/testData/codegen/boxWithStdlib/annotations/resolveWithLowPriorityAnnotation.kt
index c6d8434..c54cd58 100644
--- a/compiler/testData/codegen/boxWithStdlib/annotations/resolveWithLowPriorityAnnotation.kt
+++ b/compiler/testData/codegen/boxWithStdlib/annotations/resolveWithLowPriorityAnnotation.kt
@@ -5,26 +5,13 @@
fun foo(a: Any) = 2
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
-fun <T> Iterable<T>.contains1(element: @kotlin.internal.NoInfer T): Boolean = false
-
-@kotlin.jvm.JvmName("containsAny")
-@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.LowPriorityInOverloadResolution
-fun <T> Iterable<T>.contains1(element: T): Boolean = true
+fun bar(a: String?) = 3
-fun main(args: Array<String>) {
- println(box())
-}
+fun bar(a: Any) = 4
+
fun box(): String {
- if (foo(1) != 2) return "fail"
- val l = listOf(1, 2)
- val i: Int? = 42
- val a: Any = ""
- return when {
- l.contains1(3) -> "fail0"
- !l.contains1(i) -> "fail1"
- !l.contains1(a) -> "fail2"
- !l.contains1("") -> "fail3"
- else -> "OK"
- }
+ if (foo(1) != 2) return "fail1"
+ if (bar(null) != 3) return "fail2"
+ return "OK"
}
\ No newline at end of file
diff --git a/compiler/testData/diagnostics/testsWithStdLib/cast/AsInsideIn.kt b/compiler/testData/diagnostics/testsWithStdLib/cast/AsInsideIn.kt
index adbb29c..980b487 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/cast/AsInsideIn.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/cast/AsInsideIn.kt
@@ -3,7 +3,7 @@
class B : A
fun foo1(list: List<A>, arg: B?): Boolean {
// Type mismatch
- return <!TYPE_MISMATCH!>arg<!> in list
+ return arg <!TYPE_INFERENCE_ONLY_INPUT_TYPES!>in<!> list // resolved to extension
}
fun foo2(list: List<A>, arg: B?): Boolean {
// FAKE: no cast needed
diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.kt
index 8e25d53..31775c3 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.kt
@@ -10,6 +10,6 @@
fun test() {
- val a: Int = listOf(1).contains1("")
+ val a: Boolean = listOf(1).<!TYPE_INFERENCE_INCORPORATION_ERROR!>contains1<!>(<!TYPE_MISMATCH!>""<!>)
val b: Boolean = listOf(1).contains1(1)
}
\ No newline at end of file
diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndLowPriority.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndLowPriority.kt
index 9219014..5ffb9e3 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndLowPriority.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndLowPriority.kt
@@ -17,9 +17,9 @@
public fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.get1(key: K): V? = null!!
fun test(map: Map<Int, String>) {
- val a: Int = listOf(1).contains1("")
+ val a: Int = listOf(1).<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>contains1("")<!>
val b: Boolean = listOf(1).contains1(1)
- val c: Int = map.get1("")
+ val c: String? = map.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>get1<!>("")
val d: String? = map.get1(1)
}
\ No newline at end of file