Strongly prefer available declarations to unavailable ones in type checking.

Fixes rdar://problem/18847642, rdar://problem/16554496, and the
current 1_stdlib/Array.swift.

Swift SVN r25212
This commit is contained in:
Doug Gregor
2015-02-12 01:01:11 +00:00
parent 26ee4c324b
commit 0e74268ea5
6 changed files with 36 additions and 12 deletions

View File

@@ -1311,6 +1311,11 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
refType = ImplicitlyUnwrappedOptionalType::get(refType->getRValueType());
}
// If the declaration is unavailable, note that in the score.
if (choice.getDecl()->getAttrs().isUnavailable(getASTContext())) {
increaseScore(SK_Unavailable);
}
break;
}