swift
b6381d45 - Sema: Ban forward references of captured values from 'defer' body

Commit
4 years ago
Sema: Ban forward references of captured values from 'defer' body While 'defer' is implemented as a local function, it doesn't behave as one. In particular, since SILGen runs it after destroying all local bindings that appear after the 'defer' definition, the body of a 'defer' cannot forward reference captured bindings the way that local functions can. Note that I had to remove a SILGen test case for an older, related issue. The new diagnostic in Sema catches these cases earlier. Fixes rdar://problem/75088379.
Author
Committer
Parents
Loading