[FIR] When call candidates resolve to errors, select the least bad ones
This fixes a scenario when INVISIBLE_REFERENCE is suppressed, but we
resolved to the wrong overload because when none of the candidates were
applicable, more or less the first one was chosen.
Because we call `fullyProcessCandidate` on the candidates, their
applicability can change which can lead to a situation where the
applicability of a ConeAmbiguityError is different to all its
candidates. The changes in coneDiagnosticToFirDiagnostic.kt account for
that, otherwise code like candidates.first { it.applicability ==
CandidateApplicability.UNSAFE_CALL } can throw NoSuchElementException.
#KT-57776 Fixed
This commit is contained in:
committed by
Space Team
parent
09ea0ef757
commit
592baee852
+3
-5
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.isSuccess
|
||||
import org.jetbrains.kotlin.types.EmptyIntersectionTypeKind
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
|
||||
private fun ConeDiagnostic.toKtDiagnostic(
|
||||
@@ -68,14 +68,12 @@ private fun ConeDiagnostic.toKtDiagnostic(
|
||||
is ConeAmbiguityError -> when {
|
||||
applicability.isSuccess -> FirErrors.OVERLOAD_RESOLUTION_AMBIGUITY.createOn(source, this.candidates.map { it.symbol })
|
||||
applicability == CandidateApplicability.UNSAFE_CALL -> {
|
||||
val candidate = candidates.first { it.applicability == CandidateApplicability.UNSAFE_CALL }
|
||||
val unsafeCall = candidate.diagnostics.firstIsInstance<UnsafeCall>()
|
||||
val (unsafeCall, candidate) = candidates.firstNotNullOf { it.diagnostics.firstIsInstanceOrNull<UnsafeCall>()?.to(it) }
|
||||
mapUnsafeCallError(candidate, unsafeCall, source, qualifiedAccessSource)
|
||||
}
|
||||
|
||||
applicability == CandidateApplicability.UNSTABLE_SMARTCAST -> {
|
||||
val unstableSmartcast =
|
||||
this.candidates.first { it.applicability == CandidateApplicability.UNSTABLE_SMARTCAST }.diagnostics.firstIsInstance<UnstableSmartCast>()
|
||||
val unstableSmartcast = this.candidates.firstNotNullOf { it.diagnostics.firstIsInstanceOrNull<UnstableSmartCast>() }
|
||||
FirErrors.SMARTCAST_IMPOSSIBLE.createOn(
|
||||
unstableSmartcast.argument.source,
|
||||
unstableSmartcast.targetType,
|
||||
|
||||
+16
@@ -50204,6 +50204,22 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -50204,6 +50204,22 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
@@ -165,30 +165,52 @@ class FirCallResolver(
|
||||
val result = towerResolver.runResolver(info, resolutionContext, collector)
|
||||
val bestCandidates = result.bestCandidates()
|
||||
|
||||
fun chooseMostSpecific(): Set<Candidate> {
|
||||
val onSuperReference = (explicitReceiver as? FirQualifiedAccessExpression)?.calleeReference is FirSuperReference
|
||||
return conflictResolver.chooseMaximallySpecificCandidates(
|
||||
bestCandidates, discriminateAbstracts = onSuperReference
|
||||
)
|
||||
}
|
||||
|
||||
var reducedCandidates = if (!result.currentApplicability.isSuccess) {
|
||||
val distinctApplicabilities = bestCandidates.mapTo(mutableSetOf()) { it.currentApplicability }
|
||||
//if all candidates have the same kind on inApplicability - try to choose the most specific one
|
||||
if (distinctApplicabilities.size == 1 && distinctApplicabilities.single() > CandidateApplicability.INAPPLICABLE) {
|
||||
chooseMostSpecific()
|
||||
} else {
|
||||
bestCandidates.toSet()
|
||||
}
|
||||
} else {
|
||||
chooseMostSpecific()
|
||||
}
|
||||
|
||||
var reducedCandidates = reduceCandidates(bestCandidates, explicitReceiver, resolutionContext, result.currentApplicability.isSuccess)
|
||||
reducedCandidates = overloadByLambdaReturnTypeResolver.reduceCandidates(qualifiedAccess, bestCandidates, reducedCandidates)
|
||||
|
||||
return ResolutionResult(info, result.currentApplicability, reducedCandidates)
|
||||
}
|
||||
|
||||
private fun reduceCandidates(
|
||||
candidates: List<Candidate>,
|
||||
explicitReceiver: FirExpression?,
|
||||
resolutionContext: ResolutionContext,
|
||||
isSuccess: Boolean,
|
||||
): Set<Candidate> {
|
||||
fun chooseMostSpecific(list: List<Candidate>): Set<Candidate> {
|
||||
val onSuperReference = (explicitReceiver as? FirQualifiedAccessExpression)?.calleeReference is FirSuperReference
|
||||
return conflictResolver.chooseMaximallySpecificCandidates(list, discriminateAbstracts = onSuperReference)
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
return chooseMostSpecific(candidates)
|
||||
}
|
||||
|
||||
val singleApplicability = candidates.mapTo(mutableSetOf()) { it.currentApplicability }.singleOrNull()
|
||||
|
||||
if (singleApplicability == null || singleApplicability <= CandidateApplicability.INAPPLICABLE) {
|
||||
return candidates.toSet()
|
||||
}
|
||||
|
||||
// If all candidates have the same kind on inapplicability - try to choose the most specific one
|
||||
if (candidates.size > 1) {
|
||||
// We have multiple candidates with the same inapplicability. We want to select the "least bad" candidates.
|
||||
|
||||
// First, fully process all of them and group them by their worst applicability.
|
||||
val groupedByDiagnosticCount = candidates.groupBy {
|
||||
components.resolutionStageRunner.fullyProcessCandidate(it, resolutionContext)
|
||||
it.diagnostics.minOf(ResolutionDiagnostic::applicability)
|
||||
}
|
||||
|
||||
// Then, select the group with the best worst applicability.
|
||||
groupedByDiagnosticCount.maxBy { it.key }.let {
|
||||
return chooseMostSpecific(it.value)
|
||||
}
|
||||
}
|
||||
|
||||
return chooseMostSpecific(candidates)
|
||||
}
|
||||
|
||||
fun resolveVariableAccessAndSelectCandidate(
|
||||
qualifiedAccess: FirQualifiedAccessExpression,
|
||||
isUsedAsReceiver: Boolean,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// MODULE: a
|
||||
// FILE: a.kt
|
||||
|
||||
internal fun foo(s: String) = "FAIL"
|
||||
internal fun foo(s: String, x: Any) = "OK"
|
||||
|
||||
// MODULE: b(a)
|
||||
// FILE: box.kt
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun box() = foo("", Any())
|
||||
+1
-1
@@ -6,7 +6,7 @@ class A {
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
a.<!NONE_APPLICABLE!>foo<!>(3)
|
||||
a.<!INVISIBLE_REFERENCE!>foo<!>(3)
|
||||
a.<!NONE_APPLICABLE!>foo<!>()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ open class A protected constructor(x: Int) {
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
<!NONE_APPLICABLE!>A<!>()
|
||||
<!INVISIBLE_REFERENCE!>A<!>()
|
||||
A(1.0)
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -9,11 +9,11 @@ open class MyClass private constructor(val x: Int) {
|
||||
|
||||
typealias MyAlias = MyClass
|
||||
|
||||
val test1 = <!NONE_APPLICABLE!>MyAlias<!>(1)
|
||||
val test1a = <!NONE_APPLICABLE!>MyClass<!>(1)
|
||||
val test1 = <!INVISIBLE_REFERENCE!>MyAlias<!>(1)
|
||||
val test1a = <!INVISIBLE_REFERENCE!>MyClass<!>(1)
|
||||
|
||||
val test2 = <!NONE_APPLICABLE!>MyAlias<!>("")
|
||||
val test2a = <!NONE_APPLICABLE!>MyClass<!>("")
|
||||
val test2 = <!INVISIBLE_REFERENCE!>MyAlias<!>("")
|
||||
val test2a = <!INVISIBLE_REFERENCE!>MyClass<!>("")
|
||||
|
||||
val test3 = MyAlias(1.0)
|
||||
val test3a = MyClass(1.0)
|
||||
|
||||
+16
@@ -47648,6 +47648,22 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -50204,6 +50204,22 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -50204,6 +50204,22 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+18
@@ -38647,6 +38647,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Suppressions extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Vendored
+12
-12
@@ -345,22 +345,22 @@ class case_14_class {
|
||||
if (!funWithReturnsTrueAndInvertCondition(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (funWithReturnsFalse(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (funWithReturnsNotNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) == null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (funWithReturnsNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) != null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,26 +414,26 @@ class case_17_class {
|
||||
if (contracts.case_17_1(value_1, value_2, o.prop_1, this.prop_1)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (contracts.case_17_2(value_1, value_2, o.prop_1, this.prop_1)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (contracts.case_17_3(value_1, value_2, o.prop_1, this.prop_1) == null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (contracts.case_17_4(value_1, value_2, o.prop_1, this.prop_1) != null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(this.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-5
@@ -37,7 +37,7 @@ class case_5_class {
|
||||
funWithReturns(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null)
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,22 +130,22 @@ class case_10_class {
|
||||
if (funWithReturnsTrue(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (!funWithReturnsFalse(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (funWithReturnsNotNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) != null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (funWithReturnsNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) == null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-5
@@ -105,7 +105,7 @@ class case_3_class {
|
||||
contracts.case_3(value_1, value_2, o.prop_1, this.prop_1)
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,22 +158,22 @@ class case_6_class {
|
||||
if (contracts.case_6_1(value_1, value_2, o.prop_1, this.prop_1)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (!contracts.case_6_2(value_1, value_2, o.prop_1, this.prop_1)) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (contracts.case_6_3(value_1, value_2, o.prop_1, this.prop_1) == null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
if (contracts.case_6_4(value_1, value_2, o.prop_1, this.prop_1) != null) {
|
||||
println(value_1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>dec<!>())
|
||||
println(value_2?.toByte())
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
println(o.prop_1<!UNSAFE_CALL!>.<!>plus(3))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -35530,6 +35530,22 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -35872,6 +35872,22 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -35872,6 +35872,22 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+16
@@ -35872,6 +35872,22 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+20
@@ -39966,6 +39966,26 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegenK2")
|
||||
@Tag("firCodegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@FirPipeline()
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+22
@@ -40948,6 +40948,28 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegenK2")
|
||||
@Tag("firCodegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@FirPipeline()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+19
@@ -39475,6 +39475,25 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegen")
|
||||
@Tag("k1Codegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+21
@@ -40457,6 +40457,27 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("codegen")
|
||||
@Tag("k1Codegen")
|
||||
@UseExtTestCaseGroupProvider()
|
||||
@UsePartialLinkage(mode = Mode.DISABLED)
|
||||
@Tag("no-partial-linkage-may-be-skipped")
|
||||
public class Suppressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Generated
+18
@@ -32032,6 +32032,24 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/suppressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Suppressions extends AbstractIrCodegenBoxWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuppressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/suppressions"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("suppressInvisible.kt")
|
||||
public void testSuppressInvisible() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/suspendConversion")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user