Skip to content

Commit a4bda00

Browse files
committed
[ConstraintSystem] Add a locator element to represent a fallback type
1 parent 978a227 commit a4bda00

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

include/swift/Sema/ConstraintLocatorPathElts.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ SIMPLE_LOCATOR_PATH_ELT(ThrownErrorType)
281281
/// A type coercion operand.
282282
SIMPLE_LOCATOR_PATH_ELT(CoercionOperand)
283283

284+
/// A fallback type for some AST location (i.e. key path literal).
285+
SIMPLE_LOCATOR_PATH_ELT(FallbackType)
286+
284287
#undef LOCATOR_PATH_ELT
285288
#undef CUSTOM_LOCATOR_PATH_ELT
286289
#undef SIMPLE_LOCATOR_PATH_ELT

lib/Sema/ConstraintLocator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ unsigned LocatorPathElt::getNewSummaryFlags() const {
110110
case ConstraintLocator::CoercionOperand:
111111
case ConstraintLocator::PackExpansionType:
112112
case ConstraintLocator::ThrownErrorType:
113+
case ConstraintLocator::FallbackType:
113114
return 0;
114115

115116
case ConstraintLocator::FunctionArgument:
@@ -524,6 +525,10 @@ void LocatorPathElt::dump(raw_ostream &out) const {
524525
out << "thrown error type";
525526
break;
526527
}
528+
case ConstraintLocator::FallbackType: {
529+
out << "fallback type";
530+
break;
531+
}
527532
}
528533
}
529534

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6044,6 +6044,7 @@ void constraints::simplifyLocator(ASTNode &anchor,
60446044
case ConstraintLocator::WrappedValue:
60456045
case ConstraintLocator::OptionalPayload:
60466046
case ConstraintLocator::ImplicitlyUnwrappedDisjunctionChoice:
6047+
case ConstraintLocator::FallbackType:
60476048
break;
60486049
}
60496050

0 commit comments

Comments
 (0)