-
-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parameter names not being checked #4061
Conversation
const char* bad5 = | ||
"trait Foo\n" | ||
" fun foo(_x: U64) => 3"; | ||
|
||
TEST_ERROR(bad5); | ||
|
||
const char* bad5_be = | ||
"trait Foo\n" | ||
" be foo(_x: U64) => 3"; | ||
|
||
TEST_ERROR(bad5_be); | ||
|
||
const char* bad5_new = | ||
"class Foo\n" | ||
" new create(_x: U64) => 3"; | ||
|
||
TEST_ERROR(bad5_new); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to have a test for this being allowed, however, under the rules it shouldnt be allowed. It was only allowed at some point because you could use _
in case method parameters. Otherwise it was supposed to be illegal.
@@ -553,31 +553,115 @@ TEST_F(SugarTest, FunctionNoReturnBody) | |||
} | |||
|
|||
|
|||
TEST_F(SugarTest, FunctionParamMustBeId) | |||
TEST_F(SugarTest, MethodParamMustBeId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we check parameter names after sugaring be
, fun
, and new
, i updated the tests to check for each type as it would otherwise be possible to break for say be
because we were only checking fun
.
accordingly, the test name was updated.
In 2018, when we removed case functions from Pony, we also removed the checking to make sure that parameters names were valid.
We've added checking of parameter names to make sure they match the naming rules for parameters in Pony.
Fixes #4054