K2: add test to confirm KT-56409 now works properly
This commit is contained in:
committed by
Space Team
parent
104d5e420e
commit
be5a27dd6b
+6
@@ -6999,6 +6999,12 @@ public class DiagnosticCompilerTestFirTestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeVariablesInWrappedSamCall.kt")
|
||||
public void testTypeVariablesInWrappedSamCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypesEligibleForSimpleVisit.kt")
|
||||
public void testTypesEligibleForSimpleVisit() throws Exception {
|
||||
|
||||
+6
@@ -6999,6 +6999,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeVariablesInWrappedSamCall.kt")
|
||||
public void testTypeVariablesInWrappedSamCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypesEligibleForSimpleVisit.kt")
|
||||
public void testTypesEligibleForSimpleVisit() throws Exception {
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
FILE: TypeVariablesInWrappedSamCall.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval flag: R|kotlin/Boolean| = Boolean(true)
|
||||
R|/consumeTicker<CS errors: /consumeTicker>#|(R|/select|<R|Ticker?|>(when () {
|
||||
R|<local>/flag| -> {
|
||||
Null(null)
|
||||
}
|
||||
else -> {
|
||||
select@fun <anonymous>(num: <ERROR TYPE REF: Cannot infer type for parameter num>): R|kotlin/Unit| <inline=Unknown> {
|
||||
R|<local>/num|.<Ambiguity: dec, [kotlin/dec, kotlin/dec]>#()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
, Null(null)))
|
||||
}
|
||||
public final fun <T> select(a: R|T|, b: R|T|): R|T| {
|
||||
^select R|<local>/a|
|
||||
}
|
||||
public final fun consumeTicker(ticker: R|Ticker?|): R|kotlin/Unit| {
|
||||
}
|
||||
public abstract fun interface Ticker : R|kotlin/Any| {
|
||||
public abstract fun tick(num: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// ISSUE: KT-56409
|
||||
|
||||
fun main() {
|
||||
val flag = true
|
||||
consumeTicker(
|
||||
select(if (flag) null else <!ARGUMENT_TYPE_MISMATCH, ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>num<!> -> num.<!OVERLOAD_RESOLUTION_AMBIGUITY!>dec<!>() }<!>, null)
|
||||
)
|
||||
}
|
||||
|
||||
fun <T> select(a: T, b: T): T = a
|
||||
|
||||
fun consumeTicker(ticker: Ticker?) {}
|
||||
|
||||
fun interface Ticker {
|
||||
fun tick(num: Int)
|
||||
}
|
||||
+6
@@ -6999,6 +6999,12 @@ public class FirLightTreeDiagnosticsTestGenerated extends AbstractFirLightTreeDi
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeVariablesInWrappedSamCall.kt")
|
||||
public void testTypeVariablesInWrappedSamCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypesEligibleForSimpleVisit.kt")
|
||||
public void testTypesEligibleForSimpleVisit() throws Exception {
|
||||
|
||||
+6
@@ -6999,6 +6999,12 @@ public class FirPsiDiagnosticTestGenerated extends AbstractFirPsiDiagnosticTest
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeVariablesInWrappedSamCall.kt")
|
||||
public void testTypeVariablesInWrappedSamCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypesEligibleForSimpleVisit.kt")
|
||||
public void testTypesEligibleForSimpleVisit() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user