FIR: Fix forEach resolution within local class
This commit is contained in:
committed by
TeamCityServer
parent
056657525e
commit
cac69edff2
+6
@@ -36735,6 +36735,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/resolve"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forEachInLocalClass.kt")
|
||||
public void testForEachInLocalClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/forEachInLocalClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hidesMembers.kt")
|
||||
public void testHidesMembers() throws Exception {
|
||||
|
||||
+6
@@ -36799,6 +36799,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/resolve"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forEachInLocalClass.kt")
|
||||
public void testForEachInLocalClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/forEachInLocalClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hidesMembers.kt")
|
||||
public void testHidesMembers() throws Exception {
|
||||
|
||||
+6
@@ -36799,6 +36799,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/resolve"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forEachInLocalClass.kt")
|
||||
public void testForEachInLocalClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/forEachInLocalClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hidesMembers.kt")
|
||||
public void testHidesMembers() throws Exception {
|
||||
|
||||
+1
@@ -333,6 +333,7 @@ class BodyResolveContext(
|
||||
): BodyResolveContext =
|
||||
BodyResolveContext(returnTypeCalculator, dataFlowAnalyzerContext, targetedLocalClasses, outerLocalClassForNested).apply {
|
||||
file = this@BodyResolveContext.file
|
||||
fileImportsScope += this@BodyResolveContext.fileImportsScope
|
||||
towerDataContextForAnonymousFunctions.putAll(this@BodyResolveContext.towerDataContextForAnonymousFunctions)
|
||||
towerDataContextForCallableReferences.putAll(this@BodyResolveContext.towerDataContextForCallableReferences)
|
||||
containers = this@BodyResolveContext.containers
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// SKIP_TXT
|
||||
// FIR_IDENTICAL
|
||||
// FULL_JDK
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: A.java
|
||||
import java.util.List;
|
||||
public class A {
|
||||
public static List<String> foo() { return null; }
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun bar(): Int {
|
||||
return object {
|
||||
fun baz(): Int {
|
||||
val strings = A.foo()
|
||||
strings.forEach {
|
||||
if (it.length == 0) return 1
|
||||
}
|
||||
return 2
|
||||
}
|
||||
}.baz()
|
||||
}
|
||||
Generated
+6
@@ -36895,6 +36895,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/resolve"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forEachInLocalClass.kt")
|
||||
public void testForEachInLocalClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/forEachInLocalClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("hidesMembers.kt")
|
||||
public void testHidesMembers() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user