mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add @_disfavoredOverload attribute to affect overload resolution.
Introduce an attribute @_disfavoredOverload that can be used to state that a particular declaration should be avoided if there is a successful type-check for a non-@_disfavoredOverload. It's a way to nudge overload resolution away from particular solutions.
This commit is contained in:
@@ -641,6 +641,7 @@ namespace {
|
||||
continue;
|
||||
|
||||
if (!decl->getAttrs().isUnavailable(CS.getASTContext()) &&
|
||||
!decl->getAttrs().hasAttribute<DisfavoredOverloadAttr>() &&
|
||||
isFavored(decl, overloadType)) {
|
||||
// If we might need to roll back the favored constraints, keep
|
||||
// track of those we are favoring.
|
||||
|
||||
Reference in New Issue
Block a user