Skip to content

Commit f6db4ee

Browse files
committed
Test that @_implements() diagnoses module selector
1 parent 48546e4 commit f6db4ee

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
@@ -1138,7 +1138,7 @@ Parser::parseImplementsAttribute(SourceLoc AtLoc, SourceLoc Loc) {
11381138
return Status;
11391139
}
11401140

1141-
// FIXME(ModQual): Reject module qualification on MemberName.
1141+
assert(MemberName.getModuleSelector().empty());
11421142
return ParserResult<ImplementsAttr>(
11431143
ImplementsAttr::create(Context, AtLoc, SourceRange(Loc, rParenLoc),
11441144
ProtocolType.get(), MemberName.getFullName(),

test/NameLookup/module_selector.swift

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

0 commit comments

Comments
 (0)