Make sure we don’t support @objc class subscripts

Obj-C subscripts don’t work on class objects, but you can declare class methods with the appropriate names. We don’t want to half-support this. Emit an error if you try to write “@objc class subscript” and test that we don’t import the methods as subscripts.
This commit is contained in:
Brent Royal-Gordon
2019-04-02 18:26:03 -07:00
committed by Brent Royal-Gordon
parent 8b0e61aae0
commit 473fe7027e
6 changed files with 59 additions and 2 deletions

View File

@@ -3638,6 +3638,8 @@ ERROR(objc_invalid_on_var,none,
ERROR(objc_invalid_on_subscript,none,
"subscript cannot be %" OBJC_ATTR_SELECT "0 because its type "
"cannot be represented in Objective-C", (unsigned))
ERROR(objc_invalid_on_static_subscript,none,
"%0 cannot be %" OBJC_ATTR_SELECT "1", (DescriptiveDeclKind, unsigned))
ERROR(objc_invalid_with_generic_params,none,
"method cannot be %" OBJC_ATTR_SELECT "0 because it has generic "
"parameters", (unsigned))