When converting a non-void-returning closure to a contextual function type that returns void, increase the function conversion score count. This ensures that, in the case of overload resolution, we don't accidentally favor a void-returning function over a better (or exact) fit. (rdar://problem/19776288)

Swift SVN r25140
This commit is contained in:
Joe Pamer
2015-02-10 22:02:20 +00:00
parent 6058d291ca
commit 989aa3d58a
2 changed files with 16 additions and 0 deletions

View File

@@ -1957,6 +1957,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
while (!parts.empty()) {
if (parts.back().getKind() == ConstraintLocator::ClosureResult) {
increaseScore(SK_FunctionConversion);
return SolutionKind::Solved;
}
parts.pop_back();