Skip to content

Commit 58a7720

Browse files
committed
ConstraintSystem: Remove UnviableReason::UR_MissingImport.
Now that `MemberImportVisibility` behavior is implemented using ranking there is no need to support the `UR_MissingImport` unviability reason.
1 parent c868378 commit 58a7720

File tree

6 files changed

+14
-37
lines changed

6 files changed

+14
-37
lines changed

include/swift/Sema/CSFix.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,14 +1926,11 @@ class MoveOutOfOrderArgument final : public ConstraintFix {
19261926
};
19271927

19281928
class AllowInaccessibleMember final : public AllowInvalidMemberRef {
1929-
bool IsMissingImport;
1930-
19311929
AllowInaccessibleMember(ConstraintSystem &cs, Type baseType,
19321930
ValueDecl *member, DeclNameRef name,
1933-
ConstraintLocator *locator, bool isMissingImport)
1931+
ConstraintLocator *locator)
19341932
: AllowInvalidMemberRef(cs, FixKind::AllowInaccessibleMember, baseType,
1935-
member, name, locator),
1936-
IsMissingImport(isMissingImport) {}
1933+
member, name, locator) {}
19371934

19381935
public:
19391936
std::string getName() const override {
@@ -1948,8 +1945,7 @@ class AllowInaccessibleMember final : public AllowInvalidMemberRef {
19481945

19491946
static AllowInaccessibleMember *create(ConstraintSystem &cs, Type baseType,
19501947
ValueDecl *member, DeclNameRef name,
1951-
ConstraintLocator *locator,
1952-
bool isMissingImport);
1948+
ConstraintLocator *locator);
19531949

19541950
static bool classof(const ConstraintFix *fix) {
19551951
return fix->getKind() == FixKind::AllowInaccessibleMember;

include/swift/Sema/ConstraintSystem.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,10 +1980,6 @@ struct MemberLookupResult {
19801980
/// The member is inaccessible (e.g. a private member in another file).
19811981
UR_Inaccessible,
19821982

1983-
/// The member is not visible because it comes from a module that was not
1984-
/// imported.
1985-
UR_MissingImport,
1986-
19871983
/// This is a `WritableKeyPath` being used to look up read-only member,
19881984
/// used in situations involving dynamic member lookup via keypath,
19891985
/// because it's not known upfront what access capability would the

lib/Sema/CSDiagnostics.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6250,11 +6250,6 @@ bool InaccessibleMemberFailure::diagnoseAsError() {
62506250
}
62516251

62526252
auto loc = nameLoc.isValid() ? nameLoc.getStartLoc() : ::getLoc(anchor);
6253-
if (IsMissingImport) {
6254-
maybeDiagnoseMissingImportForMember(Member, getDC(), loc);
6255-
return true;
6256-
}
6257-
62586253
auto accessLevel = Member->getFormalAccessScope().accessLevelForDiagnostics();
62596254
if (auto *CD = dyn_cast<ConstructorDecl>(Member)) {
62606255
emitDiagnosticAt(loc, diag::init_candidate_inaccessible,

lib/Sema/CSDiagnostics.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,13 +1640,11 @@ class ClosureParamDestructuringFailure final : public FailureDiagnostic {
16401640
/// ```
16411641
class InaccessibleMemberFailure final : public FailureDiagnostic {
16421642
ValueDecl *Member;
1643-
bool IsMissingImport;
16441643

16451644
public:
16461645
InaccessibleMemberFailure(const Solution &solution, ValueDecl *member,
1647-
ConstraintLocator *locator, bool isMissingImport)
1648-
: FailureDiagnostic(solution, locator), Member(member),
1649-
IsMissingImport(isMissingImport) {}
1646+
ConstraintLocator *locator)
1647+
: FailureDiagnostic(solution, locator), Member(member) {}
16501648

16511649
bool diagnoseAsError() override;
16521650
};

lib/Sema/CSFix.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,16 +1153,16 @@ MoveOutOfOrderArgument *MoveOutOfOrderArgument::create(
11531153

11541154
bool AllowInaccessibleMember::diagnose(const Solution &solution,
11551155
bool asNote) const {
1156-
InaccessibleMemberFailure failure(solution, getMember(), getLocator(),
1157-
IsMissingImport);
1156+
InaccessibleMemberFailure failure(solution, getMember(), getLocator());
11581157
return failure.diagnose(asNote);
11591158
}
11601159

1161-
AllowInaccessibleMember *AllowInaccessibleMember::create(
1162-
ConstraintSystem &cs, Type baseType, ValueDecl *member, DeclNameRef name,
1163-
ConstraintLocator *locator, bool isMissingImport) {
1164-
return new (cs.getAllocator()) AllowInaccessibleMember(
1165-
cs, baseType, member, name, locator, isMissingImport);
1160+
AllowInaccessibleMember *
1161+
AllowInaccessibleMember::create(ConstraintSystem &cs, Type baseType,
1162+
ValueDecl *member, DeclNameRef name,
1163+
ConstraintLocator *locator) {
1164+
return new (cs.getAllocator())
1165+
AllowInaccessibleMember(cs, baseType, member, name, locator);
11661166
}
11671167

11681168
bool AllowAnyObjectKeyPathRoot::diagnose(const Solution &solution,

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10381,12 +10381,6 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
1038110381
if (lookupUnviable(lookupOptions | NameLookupFlags::IgnoreAccessControl,
1038210382
MemberLookupResult::UR_Inaccessible))
1038310383
return result;
10384-
10385-
// Ignore missing import statements in order to find more candidates that
10386-
// might have been missed before.
10387-
if (lookupUnviable(lookupOptions | NameLookupFlags::IgnoreMissingImports,
10388-
MemberLookupResult::UR_MissingImport))
10389-
return result;
1039010384
}
1039110385

1039210386
return result;
@@ -10587,11 +10581,9 @@ static ConstraintFix *fixMemberRef(
1058710581
}
1058810582

1058910583
case MemberLookupResult::UR_Inaccessible:
10590-
case MemberLookupResult::UR_MissingImport:
1059110584
assert(choice.isDecl());
10592-
return AllowInaccessibleMember::create(
10593-
cs, baseTy, choice.getDecl(), memberName, locator,
10594-
*reason == MemberLookupResult::UR_MissingImport);
10585+
return AllowInaccessibleMember::create(cs, baseTy, choice.getDecl(),
10586+
memberName, locator);
1059510587

1059610588
case MemberLookupResult::UR_UnavailableInExistential: {
1059710589
return choice.isDecl()

0 commit comments

Comments
 (0)