mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema]Construct type refinement hierarchy for other source files
Resolving signatures of declarations from files other than the primary source file causes first-pass type checking, including diagnostics for potential unavailability, to be performed on those declarations. Prior to this commit, the type refinement context hierarchy was only constructed for the primary file, so spurious errors were emitted when checking declarations in other files. With this commit, the availability checker builds the hierarchy for a source file the first time its hierarchy is queried. We will eventually want to build the hierarchy more lazily, but that will come later. Swift SVN r25746
This commit is contained in:
@@ -811,6 +811,8 @@ private:
|
||||
mutable Identifier PrivateDiscriminator;
|
||||
|
||||
/// The root TypeRefinementContext for this SourceFile.
|
||||
///
|
||||
/// This is set during type checking.
|
||||
TypeRefinementContext *TRC = nullptr;
|
||||
|
||||
/// If non-null, used to track name lookups that happen within this file.
|
||||
@@ -1006,9 +1008,14 @@ public:
|
||||
return isScriptMode() || hasMainClass();
|
||||
}
|
||||
|
||||
/// Get the root refinement context for the file.
|
||||
/// Get the root refinement context for the file. The root context may be
|
||||
/// null if the context hierarchy has not been built yet. Use
|
||||
/// TypeChecker::getOrBuildTypeRefinementContext() to get a built
|
||||
/// root of the hierarchy.
|
||||
TypeRefinementContext *getTypeRefinementContext();
|
||||
|
||||
/// Set the root refinement context for the file.
|
||||
void setTypeRefinementContext(TypeRefinementContext *TRC);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user