[FE] Fix: do not report ambiguous label if label map is empty
This commit is contained in:
committed by
teamcity
parent
8905586cbb
commit
ea33da3a8d
+6
@@ -10654,6 +10654,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelFromFunctionName.kt")
|
||||||
|
public void testLabelFromFunctionName() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelFromFunctionName.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labelsFromClassNameForbidden.kt")
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
public void testLabelsFromClassNameForbidden() throws Exception {
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
|||||||
+6
@@ -10654,6 +10654,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelFromFunctionName.kt")
|
||||||
|
public void testLabelFromFunctionName() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelFromFunctionName.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labelsFromClassNameForbidden.kt")
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
public void testLabelsFromClassNameForbidden() throws Exception {
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
|||||||
+6
@@ -10654,6 +10654,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelFromFunctionName.kt")
|
||||||
|
public void testLabelFromFunctionName() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelFromFunctionName.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labelsFromClassNameForbidden.kt")
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
public void testLabelsFromClassNameForbidden() throws Exception {
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ object LabelResolver {
|
|||||||
]
|
]
|
||||||
val thisReceivers = labelNameToReceiverMap?.get(labelName.identifier)
|
val thisReceivers = labelNameToReceiverMap?.get(labelName.identifier)
|
||||||
val thisReceiver = when {
|
val thisReceiver = when {
|
||||||
thisReceivers == null -> declarationDescriptor.extensionReceiverParameter
|
thisReceivers.isNullOrEmpty() -> declarationDescriptor.extensionReceiverParameter
|
||||||
thisReceivers.size == 1 -> thisReceivers.single()
|
thisReceivers.size == 1 -> thisReceivers.single()
|
||||||
else -> {
|
else -> {
|
||||||
BindingContextUtils.reportAmbiguousLabel(context.trace, targetLabel, declarationsByLabel)
|
BindingContextUtils.reportAmbiguousLabel(context.trace, targetLabel, declarationsByLabel)
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
fun testLabels(source: Collection<String>) {
|
||||||
|
val r = buildList {
|
||||||
|
source.mapTo(this@buildList) { it.length }
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun testLabels(/*0*/ source: kotlin.collections.Collection<kotlin.String>): kotlin.Unit
|
||||||
Generated
+6
@@ -10660,6 +10660,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelFromFunctionName.kt")
|
||||||
|
public void testLabelFromFunctionName() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelFromFunctionName.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labelsFromClassNameForbidden.kt")
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
public void testLabelsFromClassNameForbidden() throws Exception {
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user