FIR: Rework bare types support

^KT-48305 Fixed
This commit is contained in:
Denis.Zharkov
2021-08-26 18:13:55 +03:00
committed by TeamCityServer
parent 587146679d
commit 112af9b145
21 changed files with 253 additions and 93 deletions
@@ -21,7 +21,7 @@ FILE: bareTypes2.kt
when ((R|<local>/x| as? R|C|)?.{ $subj$.R|/A.field| }) {
($subj$ is R|kotlin/String|) -> {
when () {
==((R|<local>/x| as? R|B<C>|)?.{ $subj$.R|/A.cond| }, Boolean(true)) -> {
==((R|<local>/x| as? R|B<*>|)?.{ $subj$.R|/A.cond| }, Boolean(true)) -> {
R|<local>/x|.R|/C.foo|()
}
}
@@ -1,7 +1,7 @@
FILE: bareTypesWithFlexibleArguments.kt
public final fun <T> R|kotlin/collections/Collection<T>?|.concat(collection: R|kotlin/collections/Collection<T>|): R|kotlin/collections/Collection<T>?| {
when () {
(this@R|/concat| is R|kotlin/collections/LinkedHashSet<T>|) -> {
(this@R|/concat| is R|java/util/LinkedHashSet<T>|) -> {
this@R|/concat|.R|SubstitutionOverride<java/util/LinkedHashSet.addAll: R|kotlin/Boolean|>|(R|<local>/collection|)
^concat this@R|/concat|
}
@@ -17,7 +17,7 @@ FILE: capturedTypeInEquality.kt
}
public final fun foo(target: R|FirTarget<FirFunction<*>>|, property: R|FirProperty|): R|kotlin/Unit| {
lval functionTarget: R|FirFunction<*>| = R|<local>/target|.R|SubstitutionOverride</FirTarget.labeledElement: R|FirFunction<*>|>|
lval x: R|kotlin/Int?| = (R|<local>/functionTarget| as? R|FirFunction<CapturedType(*)>|)?.{ $subj$.R|kotlin/let|<R|FirFunction<*>|, R|kotlin/Int|>(<L> = let@fun <anonymous>(it: R|FirFunction<*>|): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
lval x: R|kotlin/Int?| = (R|<local>/functionTarget| as? R|FirFunction<*>|)?.{ $subj$.R|kotlin/let|<R|FirFunction<*>|, R|kotlin/Int|>(<L> = let@fun <anonymous>(it: R|FirFunction<*>|): R|kotlin/Int| <inline=Inline, kind=EXACTLY_ONCE> {
when () {
===(R|<local>/property|.R|/FirProperty.getter|, R|<local>/functionTarget|) -> {
^@let Int(1)
@@ -15,7 +15,7 @@ interface FirTarget<E : FirTargetElement> {
fun foo(target: FirTarget<FirFunction<*>>, property: FirProperty) {
val functionTarget = target.labeledElement
val x = (functionTarget as? FirFunction)?.let {
if (<!EQUALITY_NOT_APPLICABLE_WARNING!>property.getter === functionTarget<!>) {
if (property.getter === functionTarget) {
return@let 1
}
0
@@ -4350,6 +4350,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/cast/bare/RedundantNullable.kt");
}
@Test
@TestMetadata("SupertypeChain.kt")
public void testSupertypeChain() throws Exception {
runTest("compiler/testData/diagnostics/tests/cast/bare/SupertypeChain.kt");
}
@Test
@TestMetadata("ToErrorType.kt")
public void testToErrorType() throws Exception {
@@ -4350,6 +4350,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/cast/bare/RedundantNullable.kt");
}
@Test
@TestMetadata("SupertypeChain.kt")
public void testSupertypeChain() throws Exception {
runTest("compiler/testData/diagnostics/tests/cast/bare/SupertypeChain.kt");
}
@Test
@TestMetadata("ToErrorType.kt")
public void testToErrorType() throws Exception {