Commit e9ff8ad
committed
Sema: Allow closure parameter lists to reference opaque parameter declarations
A function declaration cannot have an opaque parameter type appearing in
consuming position:
func f(_: (some P) -> ()) {}
However, we should skip this check for a closure, because if the
closure's parameter list references an opaque parameter declaration,
it means something else: namely, the inferred type of the closure
refers to an opaque parameter from an outer scope. That's allowed.
This unnecessary prohibition has been there ever since the check was
added, but only for multi-statement closures, so nobody seemed to
notice.
When #76473 made it so we always
call TypeChecker::checkParameterList(), this exposed the problem in a
single-expression closure in an existing project.
Fixes rdar://139237671.1 parent 8f66bf1 commit e9ff8ad
File tree
2 files changed
+47
-30
lines changed- lib/Sema
- test/type
2 files changed
+47
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4287 | 4287 | | |
4288 | 4288 | | |
4289 | 4289 | | |
4290 | | - | |
4291 | | - | |
4292 | | - | |
4293 | | - | |
4294 | | - | |
4295 | | - | |
4296 | | - | |
4297 | | - | |
4298 | | - | |
4299 | | - | |
4300 | | - | |
4301 | | - | |
4302 | | - | |
4303 | | - | |
4304 | | - | |
4305 | | - | |
4306 | | - | |
4307 | | - | |
4308 | | - | |
4309 | | - | |
4310 | | - | |
4311 | | - | |
| 4290 | + | |
| 4291 | + | |
| 4292 | + | |
| 4293 | + | |
| 4294 | + | |
| 4295 | + | |
| 4296 | + | |
| 4297 | + | |
| 4298 | + | |
| 4299 | + | |
| 4300 | + | |
| 4301 | + | |
| 4302 | + | |
| 4303 | + | |
| 4304 | + | |
| 4305 | + | |
| 4306 | + | |
| 4307 | + | |
| 4308 | + | |
| 4309 | + | |
| 4310 | + | |
| 4311 | + | |
| 4312 | + | |
| 4313 | + | |
| 4314 | + | |
| 4315 | + | |
| 4316 | + | |
4312 | 4317 | | |
4313 | | - | |
4314 | | - | |
| 4318 | + | |
4315 | 4319 | | |
4316 | 4320 | | |
4317 | 4321 | | |
4318 | | - | |
4319 | | - | |
4320 | | - | |
4321 | | - | |
| 4322 | + | |
| 4323 | + | |
4322 | 4324 | | |
4323 | 4325 | | |
4324 | 4326 | | |
4325 | 4327 | | |
4326 | 4328 | | |
4327 | | - | |
4328 | 4329 | | |
| 4330 | + | |
4329 | 4331 | | |
4330 | 4332 | | |
4331 | | - | |
| 4333 | + | |
4332 | 4334 | | |
4333 | 4335 | | |
4334 | 4336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
0 commit comments