mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #24059 from sl/sl/sr-10293
Allow var / let as parameter names but provide a warning and fixit to add backticks.
This commit is contained in:
@@ -852,10 +852,9 @@ ERROR(parameter_specifier_as_attr_disallowed,none,
|
||||
"'%0' before a parameter name is not allowed, place it before the parameter type instead",
|
||||
(StringRef))
|
||||
ERROR(parameter_specifier_repeated,none,
|
||||
"parameter must not have multiple '__owned', 'inout', '__shared',"
|
||||
" 'var', or 'let' specifiers", ())
|
||||
ERROR(parameter_let_var_as_attr,none,
|
||||
"'%0' as a parameter attribute is not allowed",
|
||||
"parameter must not have multiple '__owned', 'inout', or '__shared' specifiers", ())
|
||||
WARNING(parameter_let_var_as_attr,none,
|
||||
"'%0' in this position is interpreted as an argument label",
|
||||
(StringRef))
|
||||
|
||||
|
||||
|
||||
@@ -609,6 +609,8 @@ public:
|
||||
|
||||
void skipUntilDeclRBrace(tok T1, tok T2);
|
||||
|
||||
void skipListUntilDeclRBrace(SourceLoc startLoc, tok T1, tok T2);
|
||||
|
||||
/// Skip a single token, but match parentheses, braces, and square brackets.
|
||||
///
|
||||
/// Note: this does \em not match angle brackets ("<" and ">")! These are
|
||||
|
||||
@@ -173,8 +173,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
// 'let', 'var', and 'inout' cannot be argument labels.
|
||||
if (isAny(tok::kw_let, tok::kw_var, tok::kw_inout))
|
||||
// inout cannot be used as an argument label.
|
||||
if (is(tok::kw_inout))
|
||||
return false;
|
||||
|
||||
// All other keywords can be argument labels.
|
||||
|
||||
Reference in New Issue
Block a user