[Sema] Decouple ConstraintSystem and TypeChecker headers

This commit is contained in:
Pavel Yaskevich
2020-10-06 13:18:39 -07:00
parent 68d72780f1
commit f94be56468
7 changed files with 32 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
//===----------------------------------------------------------------------===//
#include "ConstraintGraph.h"
#include "ConstraintSystem.h"
#include "TypeChecker.h"
#include "llvm/ADT/SetVector.h"
#include <tuple>

View File

@@ -17,6 +17,8 @@
//===----------------------------------------------------------------------===//
#include "ConstraintSystem.h"
#include "TypeChecker.h"
using namespace swift;
using namespace swift::constraints;

View File

@@ -19,6 +19,7 @@
#include "Constraint.h"
#include "ConstraintSystem.h"
#include "OverloadChoice.h"
#include "TypeChecker.h"
#include "swift/AST/ASTContext.h"
#include "swift/AST/ASTNode.h"
#include "swift/AST/Decl.h"

View File

@@ -16,6 +16,7 @@
#include "ConstraintGraph.h"
#include "ConstraintSystem.h"
#include "TypeCheckType.h"
#include "TypeChecker.h"
#include "swift/AST/ASTVisitor.h"
#include "swift/AST/ASTWalker.h"
#include "swift/AST/Expr.h"

View File

@@ -15,6 +15,7 @@
//
//===----------------------------------------------------------------------===//
#include "ConstraintSystem.h"
#include "TypeChecker.h"
#include "swift/AST/GenericSignature.h"
#include "swift/AST/ParameterList.h"
#include "swift/AST/ProtocolConformance.h"

View File

@@ -18,6 +18,7 @@
#include "ConstraintSystem.h"
#include "SolutionResult.h"
#include "TypeCheckType.h"
#include "TypeChecker.h"
#include "swift/AST/ParameterList.h"
#include "swift/AST/TypeWalker.h"
#include "llvm/ADT/STLExtras.h"

View File

@@ -24,16 +24,20 @@
#include "ConstraintGraphScope.h"
#include "ConstraintLocator.h"
#include "OverloadChoice.h"
#include "TypeChecker.h"
#include "SolutionResult.h"
#include "swift/AST/ASTContext.h"
#include "swift/AST/ASTNode.h"
#include "swift/AST/ASTVisitor.h"
#include "swift/AST/ASTWalker.h"
#include "swift/AST/AnyFunctionRef.h"
#include "swift/AST/DiagnosticsSema.h"
#include "swift/AST/NameLookup.h"
#include "swift/AST/PropertyWrappers.h"
#include "swift/AST/Types.h"
#include "swift/Basic/Debug.h"
#include "swift/Basic/LLVM.h"
#include "swift/Basic/OptionSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetOperations.h"
@@ -49,15 +53,32 @@
namespace swift {
class Expr;
class FuncDecl;
class BraseStmt;
enum class TypeCheckExprFlags;
namespace constraints {
class ConstraintGraph;
class ConstraintGraphNode;
class ConstraintSystem;
class SolutionApplicationTarget;
} // end namespace constraints
// Forward declare some TypeChecker related functions
// so they could be made friends of ConstraintSystem.
namespace TypeChecker {
Optional<BraceStmt *> applyFunctionBuilderBodyTransform(FuncDecl *func,
Type builderType);
Optional<constraints::SolutionApplicationTarget>
typeCheckExpression(constraints::SolutionApplicationTarget &target,
OptionSet<TypeCheckExprFlags> options);
} // end namespace TypeChecker
} // end namespace swift
/// Allocate memory within the given constraint system.
@@ -2730,9 +2751,10 @@ private:
friend Optional<BraceStmt *>
swift::TypeChecker::applyFunctionBuilderBodyTransform(FuncDecl *func,
Type builderType);
friend Optional<SolutionApplicationTarget>
swift::TypeChecker::typeCheckExpression(SolutionApplicationTarget &target,
TypeCheckExprOptions options);
swift::TypeChecker::typeCheckExpression(
SolutionApplicationTarget &target, OptionSet<TypeCheckExprFlags> options);
/// Emit the fixes computed as part of the solution, returning true if we were
/// able to emit an error message, or false if none of the fixits worked out.