Skip to content

Commit deba793

Browse files
authored
Merge pull request #85531 from hamishknight/context-free
2 parents 8748213 + 9a31ef0 commit deba793

File tree

8 files changed

+3
-20
lines changed

8 files changed

+3
-20
lines changed

include/swift/Sema/ConstraintLocator.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ enum ContextualTypePurpose : uint8_t {
6161
/// 'foo(a : @autoclosure () -> Int = 42)'.
6262
CTP_AutoclosureDefaultParameter,
6363

64-
CTP_CalleeResult, ///< Constraint is placed on the result of a callee.
6564
CTP_CallArgument, ///< Call to function or operator requires type.
6665
CTP_ClosureResult, ///< Closure result expects a specific type.
6766
CTP_ArrayElement, ///< ArrayExpr wants elements to have a specific type.
@@ -78,8 +77,6 @@ enum ContextualTypePurpose : uint8_t {
7877
/// to a type of a switch subject or an `Error` type.
7978
CTP_ForEachSequence, ///< Sequence expression associated with `for-in` loop.
8079
CTP_WrappedProperty, ///< Property type expected to match 'wrappedValue' type
81-
CTP_ComposedPropertyWrapper, ///< Composed wrapper type expected to match
82-
///< former 'wrappedValue' type
8380

8481
CTP_SingleValueStmtBranch, ///< The contextual type for a branch in a single
8582
///< value statement expression.

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9606,7 +9606,6 @@ ExprWalker::rewriteTarget(SyntacticElementTarget target) {
96069606
case CTP_EnumCaseRawValue:
96079607
case CTP_DefaultParameter:
96089608
case CTP_AutoclosureDefaultParameter:
9609-
case CTP_CalleeResult:
96109609
case CTP_CallArgument:
96119610
case CTP_ClosureResult:
96129611
case CTP_ArrayElement:
@@ -9617,7 +9616,6 @@ ExprWalker::rewriteTarget(SyntacticElementTarget target) {
96179616
case CTP_SubscriptAssignSource:
96189617
case CTP_Condition:
96199618
case CTP_WrappedProperty:
9620-
case CTP_ComposedPropertyWrapper:
96219619
case CTP_CannotFail:
96229620
case CTP_SingleValueStmtBranch:
96239621
result.setExpr(rewrittenExpr);

lib/Sema/CSDiagnostics.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -863,11 +863,9 @@ GenericArgumentsMismatchFailure::getDiagnosticFor(
863863
case CTP_CaseStmt:
864864
case CTP_ThrowStmt:
865865
case CTP_ForEachSequence:
866-
case CTP_ComposedPropertyWrapper:
867866
case CTP_Unused:
868867
case CTP_CannotFail:
869868
case CTP_YieldByReference:
870-
case CTP_CalleeResult:
871869
case CTP_EnumCaseRawValue:
872870
case CTP_ExprPattern:
873871
case CTP_SingleValueStmtBranch:
@@ -2954,9 +2952,6 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
29542952
case CTP_CannotFail:
29552953
llvm_unreachable("These contextual type purposes cannot fail with a "
29562954
"conversion type specified!");
2957-
case CTP_CalleeResult:
2958-
llvm_unreachable("CTP_CalleeResult does not actually install a "
2959-
"contextual type");
29602955
case CTP_Initialization:
29612956
return diag::cannot_convert_initializer_value_nil;
29622957

@@ -2969,7 +2964,6 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
29692964
case CTP_ForEachSequence:
29702965
case CTP_YieldByReference:
29712966
case CTP_WrappedProperty:
2972-
case CTP_ComposedPropertyWrapper:
29732967
case CTP_ExprPattern:
29742968
case CTP_SingleValueStmtBranch:
29752969
return std::nullopt;
@@ -3754,11 +3748,9 @@ ContextualFailure::getDiagnosticFor(ContextualTypePurpose context,
37543748

37553749
case CTP_ThrowStmt:
37563750
case CTP_ForEachSequence:
3757-
case CTP_ComposedPropertyWrapper:
37583751
case CTP_Unused:
37593752
case CTP_CannotFail:
37603753
case CTP_YieldByReference:
3761-
case CTP_CalleeResult:
37623754
case CTP_ExprPattern:
37633755
break;
37643756
}

lib/Sema/CSSimplify.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16696,7 +16696,6 @@ void ConstraintSystem::addContextualConversionConstraint(
1669616696

1669716697
case CTP_ArrayElement:
1669816698
case CTP_AssignSource:
16699-
case CTP_CalleeResult:
1670016699
case CTP_CannotFail:
1670116700
case CTP_Condition:
1670216701
case CTP_Unused:
@@ -16712,7 +16711,6 @@ void ConstraintSystem::addContextualConversionConstraint(
1671216711
case CTP_CoerceOperand:
1671316712
case CTP_SubscriptAssignSource:
1671416713
case CTP_WrappedProperty:
16715-
case CTP_ComposedPropertyWrapper:
1671616714
case CTP_ExprPattern:
1671716715
case CTP_SingleValueStmtBranch:
1671816716
break;

lib/Sema/SyntacticElementTarget.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ bool SyntacticElementTarget::contextualTypeIsOnlyAHint() const {
263263
case CTP_EnumCaseRawValue:
264264
case CTP_DefaultParameter:
265265
case CTP_AutoclosureDefaultParameter:
266-
case CTP_CalleeResult:
267266
case CTP_CallArgument:
268267
case CTP_ClosureResult:
269268
case CTP_ArrayElement:
@@ -274,7 +273,6 @@ bool SyntacticElementTarget::contextualTypeIsOnlyAHint() const {
274273
case CTP_SubscriptAssignSource:
275274
case CTP_Condition:
276275
case CTP_WrappedProperty:
277-
case CTP_ComposedPropertyWrapper:
278276
case CTP_CannotFail:
279277
case CTP_ExprPattern:
280278
case CTP_SingleValueStmtBranch:

test/Migrator/Inputs/substring_to_string_conversion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ do {
2828
func foo(x: String = ss) {}
2929
}
3030

31-
// CTP_CalleeResult
31+
// CTP_Initialization
3232
do {
3333
func getSubstring() -> Substring { return ss }
3434
let gottenString : String = getSubstring()

test/Migrator/substring_to_string_conversion.swift.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ do {
2828
func foo(x: String = String(ss)) {}
2929
}
3030

31-
// CTP_CalleeResult
31+
// CTP_Initialization
3232
do {
3333
func getSubstring() -> Substring { return ss }
3434
let gottenString : String = String(getSubstring())

test/Sema/substring_to_string_conversion_swift4.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ do {
3030
func foo(x: String = ss) {} // expected-error {{default argument value of type 'Substring' cannot be converted to type 'String'}} {{24-24=String(}} {{26-26=)}}
3131
}
3232

33-
// CTP_CalleeResult
33+
// CTP_Initialization
3434
do {
3535
func getSubstring() -> Substring { return ss }
3636
let gottenString : String = getSubstring() // expected-error {{cannot convert value of type 'Substring' to specified type 'String'}} {{31-31=String(}} {{45-45=)}}

0 commit comments

Comments
 (0)