Removed hacks for code migration from ConstraintSystemImpl.
This commit is contained in:
+4
-4
@@ -45,14 +45,14 @@ internal class ConstraintSystemImpl(
|
||||
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")
|
||||
|
||||
+6
-19
@@ -4,27 +4,14 @@ fun foo(i: Int) = 1
|
||||
|
||||
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 bar(a: Any) = 4
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println(box())
|
||||
}
|
||||
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"
|
||||
}
|
||||
+1
-1
@@ -10,7 +10,7 @@ P := My<T>*
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ P := My<T>*
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ P := My<T?>*
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ P := My<T?>*
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ P <: My<My<Consumer<T>>>*, <: My<out My<out Consumer<Int>>>
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ P <: My<My<Producer<T>>>*, <: My<out My<out Producer<Int>>>
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ P := Two<T, P>*
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ P := My<T>*
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ P := My<T>*
|
||||
status:
|
||||
-hasCannotCaptureTypesError: false
|
||||
-hasConflictingConstraints: false
|
||||
-hasContradiction: true
|
||||
-hasContradiction: false
|
||||
-hasErrorInConstrainingTypes: false
|
||||
-hasParameterConstraintError: false
|
||||
-hasTypeInferenceIncorporationError: true
|
||||
|
||||
@@ -3,7 +3,7 @@ interface A
|
||||
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
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ public fun <T> Iterable<T>.contains1(element: @kotlin.internal.NoInfer T): Boole
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
+2
-2
@@ -17,9 +17,9 @@ public fun <K, V> Map<K, V>.get1(key: Any?): Int = null!!
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user