mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This patch adds the beginning of building the type refinement context tree for availability checking in Sema, guarded by by the -enable-experimental-availability-checking option. This tree parallels the AST but is much more sparse: we introduce a new TypeRefinementContext only when needed. Each context refines the range of potential OS versions that could be encountered at run time. For the moment, we only refine contexts for function bodies. I will add refinement contexts for #os(...) in a later commit. The AST is not directly connected to the TRC tree except at the SourceFile level; when type checking, we use source locations to look up the TRC corresponding to an AST element. For the moment, we emit a diagnostic when the programmer references a potentially unavailable declaration. We will later change this to treat the declaration as if it had optional type. Swift SVN r22145
53 KiB
53 KiB