Commit Graph

3 Commits

Author SHA1 Message Date
Slava Pestov
998e62005a Sema: Don't diagnose availability errors twice in non-single-expression closures 2019-04-02 20:37:01 -04:00
Jordan Rose
722cb836f5 Extend transitive availability checking to initial value expressions
Because initial value expressions aren't actually considered /within/
the VarDecl or PatternBindingDecl they're initializing, the existing
logic to search for availability attributes wasn't kicking in, leading
to errors when a conditionally-unavailable value was used in an
initial value expression for a conditionally-unavailable binding. Fix
this by walking the enclosing type or extension to find the appropriate
PatternBindingDecl.

https://bugs.swift.org/browse/SR-9867
2019-02-08 11:39:32 -08:00
Timothy J. Wood
cffd2c33e4 Only skip unavailability diagnostics if the platforms match.
Add TypeChecker::isInsideCompatibleUnavailableDeclaration().
Pass in the call site's AvailableAttr and compare its platform to those
in the enclosing lexical scopes.

Added some basic tests.
2017-10-21 09:35:31 -07:00