Skip to content

Commit 3861d58

Browse files
committed
[CS] Remove CTP_CannotFail
This is now unused.
1 parent ae82b29 commit 3861d58

File tree

5 files changed

+2
-11
lines changed

5 files changed

+2
-11
lines changed

include/swift/Sema/ConstraintLocator.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ enum ContextualTypePurpose : uint8_t {
8383

8484
CTP_ExprPattern, ///< `~=` operator application associated with expression
8585
/// pattern.
86-
87-
CTP_CannotFail, ///< Conversion can never fail. abort() if it does.
8886
};
8987

9088
namespace constraints {

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9589,7 +9589,6 @@ ExprWalker::rewriteTarget(SyntacticElementTarget target) {
95899589
case CTP_SubscriptAssignSource:
95909590
case CTP_Condition:
95919591
case CTP_WrappedProperty:
9592-
case CTP_CannotFail:
95939592
case CTP_SingleValueStmtBranch:
95949593
result.setExpr(rewrittenExpr);
95959594
break;

lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,6 @@ GenericArgumentsMismatchFailure::getDiagnosticFor(
864864
case CTP_ThrowStmt:
865865
case CTP_ForEachSequence:
866866
case CTP_Unused:
867-
case CTP_CannotFail:
868867
case CTP_YieldByReference:
869868
case CTP_EnumCaseRawValue:
870869
case CTP_ExprPattern:
@@ -973,7 +972,7 @@ bool GenericArgumentsMismatchFailure::diagnoseAsError() {
973972

974973
case ConstraintLocator::ContextualType: {
975974
auto purpose = getContextualTypePurpose();
976-
assert(!(purpose == CTP_Unused || purpose == CTP_CannotFail));
975+
assert(purpose != CTP_Unused);
977976

978977
// If this is call to a closure e.g. `let _: A = { B() }()`
979978
// let's point diagnostic to its result.
@@ -2949,9 +2948,7 @@ static std::optional<Diag<Type>>
29492948
getContextualNilDiagnostic(ContextualTypePurpose CTP) {
29502949
switch (CTP) {
29512950
case CTP_Unused:
2952-
case CTP_CannotFail:
2953-
llvm_unreachable("These contextual type purposes cannot fail with a "
2954-
"conversion type specified!");
2951+
llvm_unreachable("Expected a contextual purpose");
29552952
case CTP_Initialization:
29562953
return diag::cannot_convert_initializer_value_nil;
29572954

@@ -3749,7 +3746,6 @@ ContextualFailure::getDiagnosticFor(ContextualTypePurpose context,
37493746
case CTP_ThrowStmt:
37503747
case CTP_ForEachSequence:
37513748
case CTP_Unused:
3752-
case CTP_CannotFail:
37533749
case CTP_YieldByReference:
37543750
case CTP_ExprPattern:
37553751
break;

lib/Sema/CSSimplify.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16680,7 +16680,6 @@ void ConstraintSystem::addContextualConversionConstraint(
1668016680

1668116681
case CTP_ArrayElement:
1668216682
case CTP_AssignSource:
16683-
case CTP_CannotFail:
1668416683
case CTP_Condition:
1668516684
case CTP_Unused:
1668616685
case CTP_YieldByValue:

lib/Sema/SyntacticElementTarget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ bool SyntacticElementTarget::contextualTypeIsOnlyAHint() const {
273273
case CTP_SubscriptAssignSource:
274274
case CTP_Condition:
275275
case CTP_WrappedProperty:
276-
case CTP_CannotFail:
277276
case CTP_ExprPattern:
278277
case CTP_SingleValueStmtBranch:
279278
return false;

0 commit comments

Comments
 (0)