Skip to content

Commit d7b2a02

Browse files
committed
---
yaml --- r: 345055 b: refs/heads/master c: 48b1731 h: refs/heads/master i: 345053: 0d61816 345051: 99ceda0 345047: 8e9812b 345039: 1aa840e 345023: 2ba59f2
1 parent f3a251d commit d7b2a02

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: cb3e06b13ef44d3db48917bb699af71e1353648d
2+
refs/heads/master: 48b173118941961c699e06948d9bff1a0ed52238
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/Sema/CSSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ bool ConstraintSystem::solveForDisjunction(
20662066

20672067
auto noSolutions = solveForDisjunctionChoices(
20682068
disjunction->getNestedConstraints(), locator, solutions,
2069-
allowFreeTypeVariables, isExplicitConversionConstraint(disjunction));
2069+
allowFreeTypeVariables, disjunction->isExplicitConversion());
20702070

20712071
if (hasDisabledChoices) {
20722072
// Re-enable previously disabled overload choices.

trunk/lib/Sema/Constraint.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,17 @@ static void uniqueTypeVariables(SmallVectorImpl<TypeVariableType *> &typeVars) {
536536
typeVars.end());
537537
}
538538

539+
bool Constraint::isExplicitConversion() const {
540+
assert(Kind == ConstraintKind::Disjunction);
541+
542+
if (auto *locator = getLocator()) {
543+
if (auto anchor = locator->getAnchor())
544+
return isa<CoerceExpr>(anchor);
545+
}
546+
547+
return false;
548+
}
549+
539550
Constraint *Constraint::create(ConstraintSystem &cs, ConstraintKind kind,
540551
Type first, Type second,
541552
ConstraintLocator *locator) {

trunk/lib/Sema/Constraint.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,10 @@ class Constraint final : public llvm::ilist_node<Constraint>,
583583
return count;
584584
}
585585

586+
/// Determine if this constraint represents explicit conversion,
587+
/// e.g. coercion constraint "as X" which forms a disjunction.
588+
bool isExplicitConversion() const;
589+
586590
/// Retrieve the overload choice for an overload-binding constraint.
587591
OverloadChoice getOverloadChoice() const {
588592
assert(Kind == ConstraintKind::BindOverload);

trunk/lib/Sema/ConstraintSystem.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,20 +2108,6 @@ class ConstraintSystem {
21082108
Type getResultType(const AbstractClosureExpr *E);
21092109

21102110
private:
2111-
/// Determine if the given constraint represents explicit conversion,
2112-
/// e.g. coercion constraint "as X" which forms a disjunction.
2113-
bool isExplicitConversionConstraint(Constraint *constraint) const {
2114-
if (constraint->getKind() != ConstraintKind::Disjunction)
2115-
return false;
2116-
2117-
if (auto locator = constraint->getLocator()) {
2118-
if (auto anchor = locator->getAnchor())
2119-
return isa<CoerceExpr>(anchor);
2120-
}
2121-
2122-
return false;
2123-
}
2124-
21252111
/// Introduce the constraints associated with the given type variable
21262112
/// into the worklist.
21272113
void addTypeVariableConstraintsToWorkList(TypeVariableType *typeVar);

0 commit comments

Comments
 (0)