Skip to content

[IUO] Add a locator for the result of a cast to an IUO type. #13717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2018
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
5 changes: 5 additions & 0 deletions lib/Sema/ConstraintLocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ void ConstraintLocator::Profile(llvm::FoldingSetNodeID &id, Expr *anchor,
case KeyPathComponent:
case ConditionalRequirement:
case TypeParameterRequirement:
case ImplicitlyUnwrappedCoercionResult:
if (unsigned numValues = numNumericValuesInPathElement(elt.getKind())) {
id.AddInteger(elt.getValue());
if (numValues > 1)
Expand Down Expand Up @@ -248,6 +249,10 @@ void ConstraintLocator::dump(SourceManager *sm, raw_ostream &out) {
case TypeParameterRequirement:
out << "type parameter requirement #" << llvm::utostr(elt.getValue());
break;

case ImplicitlyUnwrappedCoercionResult:
out << "implictly unwrapped coercion result";
break;
}
}

Expand Down
5 changes: 5 additions & 0 deletions lib/Sema/ConstraintLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ class ConstraintLocator : public llvm::FoldingSetNode {
ConditionalRequirement,
/// A single requirement placed on the type parameters.
TypeParameterRequirement,
/// \brief A coercion to an Optional type that can potentially be
/// force-unwrapped to the underlying type.
ImplicitlyUnwrappedCoercionResult,
};

/// \brief Determine the number of numeric values used for the given path
Expand Down Expand Up @@ -159,6 +162,7 @@ class ConstraintLocator : public llvm::FoldingSetNode {
case Requirement:
case Witness:
case OpenedGeneric:
case ImplicitlyUnwrappedCoercionResult:
return 0;

case GenericArgument:
Expand Down Expand Up @@ -221,6 +225,7 @@ class ConstraintLocator : public llvm::FoldingSetNode {
case KeyPathComponent:
case ConditionalRequirement:
case TypeParameterRequirement:
case ImplicitlyUnwrappedCoercionResult:
return 0;

case FunctionArgument:
Expand Down