Skip to content

Commit b975d7f

Browse files
committed
Test that @_implements() diagnoses module selector
1 parent 4291881 commit b975d7f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ Parser::parseImplementsAttribute(SourceLoc AtLoc, SourceLoc Loc) {
836836
return Status;
837837
}
838838

839-
// FIXME(ModQual): Reject module qualification on MemberName.
839+
assert(MemberName.getModuleSelector().empty());
840840
auto *TE = new (Context) TypeExpr(ProtocolType.get());
841841
return ParserResult<ImplementsAttr>(
842842
ImplementsAttr::create(Context, AtLoc, SourceRange(Loc, rParenLoc),

test/NameLookup/module_selector.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,8 @@ func badModuleNames() {
470470
let y: A.NonexistentModule::MyChildType = fatalError()
471471
// expected-error@-1 {{'NonexistentModule::MyChildType' is not a member type of struct 'ModuleSelectorTestingKit.A'}}
472472
}
473+
public struct BadImplementsAttr: CustomStringConvertible {
474+
@_implements(CustomStringConvertible, Swift::description)
475+
// expected-error@-1 {{name cannot be qualified with module selector here}} {{41-48=}}
476+
public var stringValue: String { fatalError() }
477+
}

0 commit comments

Comments
 (0)