Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/swift/Sema/ConstraintLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ enum ContextualTypePurpose : uint8_t {
/// 'foo(a : @autoclosure () -> Int = 42)'.
CTP_AutoclosureDefaultParameter,

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

CTP_SingleValueStmtBranch, ///< The contextual type for a branch in a single
///< value statement expression.
Expand Down
2 changes: 0 additions & 2 deletions lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9606,7 +9606,6 @@ ExprWalker::rewriteTarget(SyntacticElementTarget target) {
case CTP_EnumCaseRawValue:
case CTP_DefaultParameter:
case CTP_AutoclosureDefaultParameter:
case CTP_CalleeResult:
case CTP_CallArgument:
case CTP_ClosureResult:
case CTP_ArrayElement:
Expand All @@ -9617,7 +9616,6 @@ ExprWalker::rewriteTarget(SyntacticElementTarget target) {
case CTP_SubscriptAssignSource:
case CTP_Condition:
case CTP_WrappedProperty:
case CTP_ComposedPropertyWrapper:
case CTP_CannotFail:
case CTP_SingleValueStmtBranch:
result.setExpr(rewrittenExpr);
Expand Down
8 changes: 0 additions & 8 deletions lib/Sema/CSDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,9 @@ GenericArgumentsMismatchFailure::getDiagnosticFor(
case CTP_CaseStmt:
case CTP_ThrowStmt:
case CTP_ForEachSequence:
case CTP_ComposedPropertyWrapper:
case CTP_Unused:
case CTP_CannotFail:
case CTP_YieldByReference:
case CTP_CalleeResult:
case CTP_EnumCaseRawValue:
case CTP_ExprPattern:
case CTP_SingleValueStmtBranch:
Expand Down Expand Up @@ -2954,9 +2952,6 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
case CTP_CannotFail:
llvm_unreachable("These contextual type purposes cannot fail with a "
"conversion type specified!");
case CTP_CalleeResult:
llvm_unreachable("CTP_CalleeResult does not actually install a "
"contextual type");
case CTP_Initialization:
return diag::cannot_convert_initializer_value_nil;

Expand All @@ -2969,7 +2964,6 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
case CTP_ForEachSequence:
case CTP_YieldByReference:
case CTP_WrappedProperty:
case CTP_ComposedPropertyWrapper:
case CTP_ExprPattern:
case CTP_SingleValueStmtBranch:
return std::nullopt;
Expand Down Expand Up @@ -3754,11 +3748,9 @@ ContextualFailure::getDiagnosticFor(ContextualTypePurpose context,

case CTP_ThrowStmt:
case CTP_ForEachSequence:
case CTP_ComposedPropertyWrapper:
case CTP_Unused:
case CTP_CannotFail:
case CTP_YieldByReference:
case CTP_CalleeResult:
case CTP_ExprPattern:
break;
}
Expand Down
2 changes: 0 additions & 2 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16696,7 +16696,6 @@ void ConstraintSystem::addContextualConversionConstraint(

case CTP_ArrayElement:
case CTP_AssignSource:
case CTP_CalleeResult:
case CTP_CannotFail:
case CTP_Condition:
case CTP_Unused:
Expand All @@ -16712,7 +16711,6 @@ void ConstraintSystem::addContextualConversionConstraint(
case CTP_CoerceOperand:
case CTP_SubscriptAssignSource:
case CTP_WrappedProperty:
case CTP_ComposedPropertyWrapper:
case CTP_ExprPattern:
case CTP_SingleValueStmtBranch:
break;
Expand Down
2 changes: 0 additions & 2 deletions lib/Sema/SyntacticElementTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ bool SyntacticElementTarget::contextualTypeIsOnlyAHint() const {
case CTP_EnumCaseRawValue:
case CTP_DefaultParameter:
case CTP_AutoclosureDefaultParameter:
case CTP_CalleeResult:
case CTP_CallArgument:
case CTP_ClosureResult:
case CTP_ArrayElement:
Expand All @@ -274,7 +273,6 @@ bool SyntacticElementTarget::contextualTypeIsOnlyAHint() const {
case CTP_SubscriptAssignSource:
case CTP_Condition:
case CTP_WrappedProperty:
case CTP_ComposedPropertyWrapper:
case CTP_CannotFail:
case CTP_ExprPattern:
case CTP_SingleValueStmtBranch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ do {
func foo(x: String = ss) {}
}

// CTP_CalleeResult
// CTP_Initialization
do {
func getSubstring() -> Substring { return ss }
let gottenString : String = getSubstring()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ do {
func foo(x: String = String(ss)) {}
}

// CTP_CalleeResult
// CTP_Initialization
do {
func getSubstring() -> Substring { return ss }
let gottenString : String = String(getSubstring())
Expand Down
2 changes: 1 addition & 1 deletion test/Sema/substring_to_string_conversion_swift4.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ do {
func foo(x: String = ss) {} // expected-error {{default argument value of type 'Substring' cannot be converted to type 'String'}} {{24-24=String(}} {{26-26=)}}
}

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