Propagate input type position across incorporation properly
^KT-45719 Fixed
This commit is contained in:
+6
@@ -12191,6 +12191,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("onlyInputTypesWithMultilevelIncorporation.kt")
|
||||||
|
public void testOnlyInputTypesWithMultilevelIncorporation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/onlyInputTypesWithMultilevelIncorporation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("opposite.kt")
|
@TestMetadata("opposite.kt")
|
||||||
public void testOpposite() throws Exception {
|
public void testOpposite() throws Exception {
|
||||||
|
|||||||
+2
-1
@@ -219,7 +219,8 @@ class ConstraintIncorporator(
|
|||||||
|
|
||||||
val kind = if (isSubtype) ConstraintKind.LOWER else ConstraintKind.UPPER
|
val kind = if (isSubtype) ConstraintKind.LOWER else ConstraintKind.UPPER
|
||||||
|
|
||||||
val inputTypePosition = baseConstraint.position.from as? OnlyInputTypeConstraintPosition
|
val inputTypePosition =
|
||||||
|
baseConstraint.position.from as? OnlyInputTypeConstraintPosition ?: baseConstraint.inputTypePositionBeforeIncorporation
|
||||||
|
|
||||||
val isNewConstraintUsefulForNullability = isUsefulForNullabilityConstraint && newConstraint.isNullableNothing()
|
val isNewConstraintUsefulForNullability = isUsefulForNullabilityConstraint && newConstraint.isNullableNothing()
|
||||||
val isOtherConstraintUsefulForNullability = otherConstraint.isNullabilityConstraint && otherConstraint.type.isNullableNothing()
|
val isOtherConstraintUsefulForNullability = otherConstraint.isNullabilityConstraint && otherConstraint.type.isNullableNothing()
|
||||||
|
|||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||||
|
|
||||||
|
import kotlin.internal.OnlyInputTypes
|
||||||
|
|
||||||
|
fun <<!HIDDEN!>@OnlyInputTypes<!> T> assertEquals(expected: T, actual: T, message: String? = null) {}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertEquals(
|
||||||
|
mapOf(1 to "1", 2 to "2", 3 to "3"),
|
||||||
|
intArrayOf(1, 2, 3).associateWith { it.toString() }
|
||||||
|
)
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||||
|
|
||||||
|
import kotlin.internal.OnlyInputTypes
|
||||||
|
|
||||||
|
fun <@OnlyInputTypes T> assertEquals(expected: T, actual: T, message: String? = null) {}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
assertEquals(
|
||||||
|
mapOf(1 to "1", 2 to "2", 3 to "3"),
|
||||||
|
intArrayOf(1, 2, 3).associateWith { it.toString() }
|
||||||
|
)
|
||||||
|
}
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun </*0*/ @kotlin.internal.OnlyInputTypes T> assertEquals(/*0*/ expected: T, /*1*/ actual: T, /*2*/ message: kotlin.String? = ...): kotlin.Unit
|
||||||
|
public fun main(): kotlin.Unit
|
||||||
Generated
+6
@@ -12197,6 +12197,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/nullableUpperBound.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("onlyInputTypesWithMultilevelIncorporation.kt")
|
||||||
|
public void testOnlyInputTypesWithMultilevelIncorporation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/onlyInputTypesWithMultilevelIncorporation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("opposite.kt")
|
@TestMetadata("opposite.kt")
|
||||||
public void testOpposite() throws Exception {
|
public void testOpposite() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user