mirror of
https://github.com/microsoft/pyright.git
synced 2024-11-13 09:34:44 +03:00
Added check for position-only argument separator ("/") appearing as the first parameter in a parameter list. This is a syntax error.
This commit is contained in:
parent
7f8b9b38cc
commit
a2c7e7c3fb
@ -472,6 +472,7 @@ export namespace Localizer {
|
||||
export const positionArgAfterNamedArg = () => getRawString('Diagnostic.positionArgAfterNamedArg');
|
||||
export const positionOnlyAfterNameOnly = () => getRawString('Diagnostic.positionOnlyAfterNameOnly');
|
||||
export const positionOnlyIncompatible = () => getRawString('Diagnostic.positionOnlyIncompatible');
|
||||
export const positionOnlyFirstParam = () => getRawString('Diagnostic.positionOnlyFirstParam');
|
||||
export const privateUsedOutsideOfClass = () =>
|
||||
new ParameterizedString<{ name: string }>(getRawString('Diagnostic.privateUsedOutsideOfClass'));
|
||||
export const privateUsedOutsideOfModule = () =>
|
||||
|
@ -222,6 +222,7 @@
|
||||
"positionArgAfterNamedArg": "Positional argument cannot appear after named arguments",
|
||||
"positionOnlyAfterNameOnly": "\"/\" parameter must appear before \"*\" parameter",
|
||||
"positionOnlyIncompatible": "Position-only argument separator requires Python 3.8 or greater",
|
||||
"positionOnlyFirstParam": "Position-only argument separator is not allowed as first parameter",
|
||||
"privateUsedOutsideOfClass": "\"{name}\" is private and used outside of the class in which it is declared",
|
||||
"privateUsedOutsideOfModule": "\"{name}\" is private and used outside of the module in which it is declared",
|
||||
"protectedUsedOutsideOfClass": "\"{name}\" is protected and used outside of the class in which it is declared",
|
||||
|
@ -823,6 +823,10 @@ export class Parser {
|
||||
} else {
|
||||
paramMap.set(name, name);
|
||||
}
|
||||
} else if (param.category === ParameterCategory.Simple) {
|
||||
if (paramList.length === 0) {
|
||||
this._addError(Localizer.Diagnostic.positionOnlyFirstParam(), param);
|
||||
}
|
||||
}
|
||||
|
||||
if (param.category === ParameterCategory.Simple) {
|
||||
|
Loading…
Reference in New Issue
Block a user