KT-61728 [LL API] Add extra test for smartcast inside let
This commit is contained in:
committed by
Space Team
parent
a20dea1b0a
commit
370a6fb461
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fun foo(param: String?): String {
|
||||||
|
param?.let {
|
||||||
|
return <expr>param</expr>
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
Vendored
+40
@@ -0,0 +1,40 @@
|
|||||||
|
Tower Data Context:
|
||||||
|
Element 0
|
||||||
|
Scope: FirDefaultStarImportingScope
|
||||||
|
Element 1
|
||||||
|
Scope: FirDefaultSimpleImportingScope
|
||||||
|
Element 2
|
||||||
|
Scope: FirExplicitStarImportingScope
|
||||||
|
Element 3
|
||||||
|
Scope: FirDefaultSimpleImportingScope
|
||||||
|
Element 4
|
||||||
|
Scope: FirDefaultSimpleImportingScope
|
||||||
|
Element 5
|
||||||
|
Scope: FirPackageMemberScope
|
||||||
|
Element 6
|
||||||
|
Scope: FirExplicitSimpleImportingScope
|
||||||
|
Element 7
|
||||||
|
Scope: FirLocalScope
|
||||||
|
Properties:
|
||||||
|
FirValueParameterSymbol param: R|kotlin/String?|
|
||||||
|
Element 8
|
||||||
|
Scope: FirLocalScope
|
||||||
|
Element 9
|
||||||
|
Scope: FirLocalScope
|
||||||
|
Properties:
|
||||||
|
FirValueParameterSymbol it: R|kotlin/String|
|
||||||
|
Element 10
|
||||||
|
Scope: FirLocalScope
|
||||||
|
Smart Casts:
|
||||||
|
FirValueParameterSymbol param: R|kotlin/String?|
|
||||||
|
Types:
|
||||||
|
kotlin/Any
|
||||||
|
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] insideLetOnNullableReceiver.kt
|
||||||
|
public final [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] param: R|kotlin/String?|): R|kotlin/String| {
|
||||||
|
R|<local>/param|?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|kotlin/Nothing|>(<L> = [ResolvedTo(BODY_RESOLVE)] let@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] it: R|kotlin/String|): R|kotlin/Nothing| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||||
|
^foo R|<local>/param|
|
||||||
|
}
|
||||||
|
) }
|
||||||
|
^foo String()
|
||||||
|
}
|
||||||
+6
@@ -257,6 +257,12 @@ public class ContextCollectorSourceTestGenerated extends AbstractContextCollecto
|
|||||||
runTest("analysis/low-level-api-fir/testdata/contextCollector/smartCasts/extensionReceiver.kt");
|
runTest("analysis/low-level-api-fir/testdata/contextCollector/smartCasts/extensionReceiver.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("insideLetOnNullableReceiver.kt")
|
||||||
|
public void testInsideLetOnNullableReceiver() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testdata/contextCollector/smartCasts/insideLetOnNullableReceiver.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("insideLoop.kt")
|
@TestMetadata("insideLoop.kt")
|
||||||
public void testInsideLoop() throws Exception {
|
public void testInsideLoop() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user