Skip to content

Commit aa62509

Browse files
committed
Sema: Remove an unnecessary call to isInvalid()
This forces the interface type, which we don't want to do here.
1 parent e35a068 commit aa62509

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,18 +1406,13 @@ static Type resolveNestedIdentTypeComponent(
14061406

14071407
// Diagnose a bad conformance reference if we need to.
14081408
if (!options.contains(TypeResolutionFlags::SilenceErrors) &&
1409-
inferredAssocType && memberType && memberType->hasError()) {
1409+
inferredAssocType && memberType->hasError()) {
14101410
maybeDiagnoseBadConformanceRef(DC, parentTy, comp->getLoc(),
14111411
inferredAssocType);
14121412
}
14131413

1414-
// If we found a reference to an associated type or other member type that
1415-
// was marked invalid, just return ErrorType to silence downstream errors.
1416-
if (member->isInvalid())
1417-
return ErrorType::get(ctx);
1418-
14191414
// At this point, we need to have resolved the type of the member.
1420-
if (!memberType || memberType->hasError())
1415+
if (memberType->hasError())
14211416
return memberType;
14221417

14231418
// If there are generic arguments, apply them now.

test/decl/nested/protocol.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ func testLookup(_ x: OuterForUFI.Inner) {
106106
x.extMethod()
107107
}
108108

109-
// N.B. Lookup fails here because OuterForUFI.Inner is marked invalid.
110109
func testLookup<T: OuterForUFI.Inner>(_ x: T) {
111-
x.req() // expected-error {{value of type 'T' has no member 'req'}}
112-
x.extMethod() // expected-error {{value of type 'T' has no member 'extMethod'}}
110+
x.req()
111+
x.extMethod()
113112
}

0 commit comments

Comments
 (0)