FIR / FE 1.0: fix exception for lambda with unresolved name
#KT-46515 Fixed
This commit is contained in:
+6
@@ -12395,6 +12395,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt40396.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46515.kt")
|
||||
public void testKt46515() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt46515.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6175.kt")
|
||||
public void testKt6175() throws Exception {
|
||||
|
||||
+6
@@ -12395,6 +12395,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt40396.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46515.kt")
|
||||
public void testKt46515() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt46515.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6175.kt")
|
||||
public void testKt6175() throws Exception {
|
||||
|
||||
@@ -185,9 +185,12 @@ class FirTowerDataContextsForClassParts(
|
||||
modeMap[mode] = value
|
||||
}
|
||||
|
||||
fun setAnonymousFunctionContext(symbol: FirAnonymousFunctionSymbol) {
|
||||
mode = SPECIAL
|
||||
modeMap[SPECIAL] = towerDataContextForAnonymousFunctions.getValue(symbol)
|
||||
fun setAnonymousFunctionContextIfAny(symbol: FirAnonymousFunctionSymbol) {
|
||||
val context = towerDataContextForAnonymousFunctions[symbol]
|
||||
if (context != null) {
|
||||
mode = SPECIAL
|
||||
modeMap[SPECIAL] = context
|
||||
}
|
||||
}
|
||||
|
||||
fun setCallableReferenceContextIfAny(access: FirCallableReferenceAccess) {
|
||||
|
||||
+1
-1
@@ -296,7 +296,7 @@ class BodyResolveContext(
|
||||
@OptIn(PrivateForInline::class)
|
||||
inline fun <T> withAnonymousFunctionTowerDataContext(symbol: FirAnonymousFunctionSymbol, f: () -> T): T {
|
||||
return withTowerModeCleanup {
|
||||
towerDataContextsForClassParts.setAnonymousFunctionContext(symbol)
|
||||
towerDataContextsForClassParts.setAnonymousFunctionContextIfAny(symbol)
|
||||
f()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -261,8 +261,8 @@ class ResolvedAtomCompleter(
|
||||
}
|
||||
}
|
||||
|
||||
val substitutedValueParameterTypes = descriptor.valueParameters.mapIndexed { i, valueParameter ->
|
||||
valueParameterTypes[i].substituteAndApproximate(substitutor).also {
|
||||
val substitutedValueParameterTypes = descriptor.valueParameters.mapIndexedNotNull { i, valueParameter ->
|
||||
valueParameterTypes.getOrNull(i)?.substituteAndApproximate(substitutor)?.also {
|
||||
if (valueParameter is ValueParameterDescriptorImpl && valueParameter.type.shouldBeUpdated()) {
|
||||
valueParameter.setOutType(it.approximatedType)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun bar() {
|
||||
listOf(1, 2, 3).<!NONE_APPLICABLE!>maxOf<!> { <!UNRESOLVED_REFERENCE!>foo<!> }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun bar(): kotlin.Unit
|
||||
Generated
+6
@@ -12401,6 +12401,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt40396.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46515.kt")
|
||||
public void testKt46515() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt46515.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt6175.kt")
|
||||
public void testKt6175() throws Exception {
|
||||
|
||||
+5
@@ -10791,6 +10791,11 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt40396.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt46515.kt")
|
||||
public void testKt46515() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt46515.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6175.kt")
|
||||
public void testKt6175() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt6175.kt");
|
||||
|
||||
Reference in New Issue
Block a user