K2: Rework scopes for types with projection arguments for Out types
The only case when behavior is change is described at computeNonTrivialTypeArgumentForScopeSubstitutor The idea is to avoid depending on the presence of @UnsafeVariance and instead approximate captured types in covariant argument positions before building substitution scopes It's correct because for Captured(*) <: Supertype, Out<Captured(*)> <: Out<Supertype> and when we've got @UnsafeVariance value parameters at Out, it's ok to allow passing Supertype there. ^KT-57602 Fixed ^KT-54894 Fixed
This commit is contained in:
committed by
Space Team
parent
1cd040fd6a
commit
55a58e54fe
@@ -185,7 +185,7 @@ digraph complex_kt {
|
||||
color=blue
|
||||
55 [label="Enter block"];
|
||||
56 [label="Access variable this@R|/firstIsInstanceOrNull|"];
|
||||
57 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()" style="filled" fillcolor=yellow];
|
||||
57 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|()" style="filled" fillcolor=yellow];
|
||||
58 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>|"];
|
||||
subgraph cluster_19 {
|
||||
color=blue
|
||||
|
||||
@@ -24,7 +24,7 @@ FILE: complex.kt
|
||||
}
|
||||
public final inline fun <reified T : R|kotlin/Any|> R|kotlin/collections/List<*>|.firstIsInstanceOrNull(): R|T?| {
|
||||
{
|
||||
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>| = this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<CapturedType(*)>|>|()
|
||||
lval <iterator>: R|kotlin/collections/Iterator<kotlin/Any?>| = this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<kotlin/Any?>|>|()
|
||||
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.hasNext: R|kotlin/Boolean|>|()) {
|
||||
lval element: R|kotlin/Any?| = R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/Iterator.next: R|kotlin/Any?|>|()
|
||||
{
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ FILE: typeAliasWithTypeArguments.kt
|
||||
public final fun test_6(a: R|A|, out1: R|Out1<A>|, out2: R|Out1<in A>|, out3: R|Out1<out A>|): R|kotlin/Unit| {
|
||||
R|<local>/out1|.R|SubstitutionOverride</Out.value: R|A|>|().R|/A.foo|()
|
||||
R|<local>/out2|.<Unresolved name: value>#().<Unresolved name: foo>#()
|
||||
R|<local>/out3|.R|SubstitutionOverride</Out.value: R|CapturedType(out A)|>|().R|/A.foo|()
|
||||
R|<local>/out3|.R|SubstitutionOverride</Out.value: R|A|>|().R|/A.foo|()
|
||||
}
|
||||
public final fun test_7(a: R|A|, inv1: R|Invariant1<A>|, inv2: R|Invariant1<in A>|, inv3: R|Invariant1<out A>|): R|kotlin/Unit| {
|
||||
R|<local>/inv1|.R|SubstitutionOverride</Invariant.value: R|A|>|().R|/A.foo|()
|
||||
|
||||
Reference in New Issue
Block a user