mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema] Add getDeclOrNull to OverloadChoice
This helps clean up a bunch of call sites.
This commit is contained in:
committed by
Hamish Knight
parent
63df26a498
commit
8aa7401ba5
@@ -859,8 +859,7 @@ getCalleeDeclAndArgs(ConstraintSystem &cs,
|
||||
hasTrailingClosure);
|
||||
|
||||
// If there's a declaration, return it.
|
||||
if (choice->isDecl()) {
|
||||
auto decl = choice->getDecl();
|
||||
if (auto *decl = choice->getDeclOrNull()) {
|
||||
bool hasCurriedSelf = false;
|
||||
if (decl->getDeclContext()->isTypeContext()) {
|
||||
if (auto function = dyn_cast<AbstractFunctionDecl>(decl)) {
|
||||
@@ -4475,9 +4474,7 @@ fixMemberRef(ConstraintSystem &cs, Type baseTy,
|
||||
Optional<MemberLookupResult::UnviableReason> reason = None) {
|
||||
// Not all of the choices handled here are going
|
||||
// to refer to a declaration.
|
||||
if (choice.isDecl()) {
|
||||
auto *decl = choice.getDecl();
|
||||
|
||||
if (auto *decl = choice.getDeclOrNull()) {
|
||||
if (auto *CD = dyn_cast<ConstructorDecl>(decl)) {
|
||||
if (auto *fix = validateInitializerRef(cs, CD, locator))
|
||||
return fix;
|
||||
|
||||
Reference in New Issue
Block a user