Commit a5fc7ea
committed
SIL: Use correct generic signature when computing yield types for witness thunks
Yield types are not represented in the AST FunctionType, so when we compute
the lowered type of a witness thunk for a 'modify' or 'read' coroutine, we
have to compute the yield type from scratch.
We do this by applying the witness substitutions computed by Sema to the
storage type, and then canonicalizing the resulting substituted type with
respect to the storage's own generic signature.
However, the right hand sides of the witness substitutions are written with
respect to the conformance context, which might be a subclass of the class
that the storage is originally defined in.
By not using the generic signature of this subclass, we could miss associated
types of generic parameters of the base class which were made concrete in the
subclass using a 'where' clause.
Instead, let's pass down the generic signature of the witness thunk, ensuring
we always compute the correct canonical type.
Fixes rdar://problem/77737914.1 parent d93e5a3 commit a5fc7ea
File tree
2 files changed
+34
-3
lines changed- lib/SIL/IR
- test/SILGen
2 files changed
+34
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1988 | 1988 | | |
1989 | 1989 | | |
1990 | 1990 | | |
| 1991 | + | |
1991 | 1992 | | |
1992 | 1993 | | |
1993 | 1994 | | |
| |||
2012 | 2013 | | |
2013 | 2014 | | |
2014 | 2015 | | |
| 2016 | + | |
2015 | 2017 | | |
2016 | 2018 | | |
2017 | 2019 | | |
2018 | 2020 | | |
2019 | | - | |
2020 | | - | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
2021 | 2024 | | |
2022 | 2025 | | |
2023 | 2026 | | |
| |||
2178 | 2181 | | |
2179 | 2182 | | |
2180 | 2183 | | |
2181 | | - | |
| 2184 | + | |
| 2185 | + | |
2182 | 2186 | | |
2183 | 2187 | | |
2184 | 2188 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments