mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CS] NFC: Store ContextualTypeInfo in SyntacticElementTarget
Move the contextual type locator onto ContextualTypeInfo, and consolidate the separate fields in SyntacticElementTarget into storing a ContextualTypeInfo. This then lets us plumb down the locator for the branch contextual type of an if/switch expression from the initial constraint generation, rather than introducing it later. This should be NFC.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "swift/AST/TypeLoc.h"
|
||||
#include "swift/Basic/Debug.h"
|
||||
#include "swift/Sema/ConstraintLocator.h"
|
||||
#include "swift/Sema/ContextualTypeInfo.h"
|
||||
#include "swift/Sema/OverloadChoice.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
@@ -50,23 +51,6 @@ class ConstraintLocator;
|
||||
class ConstraintSystem;
|
||||
enum class TrailingClosureMatching;
|
||||
|
||||
/// Describes contextual type information about a particular element
|
||||
/// (expression, statement etc.) within a constraint system.
|
||||
struct ContextualTypeInfo {
|
||||
TypeLoc typeLoc;
|
||||
ContextualTypePurpose purpose;
|
||||
|
||||
ContextualTypeInfo() : typeLoc(TypeLoc()), purpose(CTP_Unused) {}
|
||||
|
||||
ContextualTypeInfo(Type contextualTy, ContextualTypePurpose purpose)
|
||||
: typeLoc(TypeLoc::withoutLoc(contextualTy)), purpose(purpose) {}
|
||||
|
||||
ContextualTypeInfo(TypeLoc typeLoc, ContextualTypePurpose purpose)
|
||||
: typeLoc(typeLoc), purpose(purpose) {}
|
||||
|
||||
Type getType() const { return typeLoc.getType(); }
|
||||
};
|
||||
|
||||
/// Describes the kind of constraint placed on one or more types.
|
||||
enum class ConstraintKind : char {
|
||||
/// The two types must be bound to the same type. This is the only
|
||||
|
||||
Reference in New Issue
Block a user