K2: Fix false-positive error with captured types in builder inference
Error arises from the fact that type substitution operation isn't
consistent when applied to captured types.
E.g.:
```
substitution = { A => B }
substituteOrSelf(C<CapturedType(out A)_0>) -> C<CapturedType(out B)_1>
substituteOrSelf(C<CapturedType(out A)_0>) -> C<CapturedType(out B)_2>
C<CapturedType(out B)_1> <!:> C<CapturedType(out B)_2>
```
Relates to KT-53749
This commit is contained in:
committed by
Space Team
parent
d46075a9db
commit
c2ddbfc93b
Vendored
+2
-2
@@ -26,7 +26,7 @@ fun <K> captureIn(x: Inv<out K>): K = null as K
|
||||
fun <K> capture(x: Inv<K>): K = null as K
|
||||
|
||||
fun main() {
|
||||
<!NEW_INFERENCE_ERROR!>build {
|
||||
build {
|
||||
emit("")
|
||||
getInv()
|
||||
captureOut(getInv())
|
||||
@@ -35,7 +35,7 @@ fun main() {
|
||||
// K is fixed into CapturedType(out NotFixed: TypeVariable(R))
|
||||
capture(getOut())
|
||||
""
|
||||
}<!>
|
||||
}
|
||||
build {
|
||||
emit("")
|
||||
// K is fixed into CapturedType(in NotFixed: TypeVariable(R))
|
||||
|
||||
Reference in New Issue
Block a user