Skip to content
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

Disallow empty parameter and argument names #11971

Merged

Conversation

HertzDevil
Copy link
Contributor

Resolves #11970.

def foo("" x); end   # Error: external parameter name cannot be empty
macro foo("" x); end # Error: external parameter name cannot be empty
foo("": 1)           # Error: named argument cannot have an empty name
Foo("": T)           # Error: named argument cannot have an empty name
fun foo(Int32); end  # Error: top-level fun parameter must have a name
{"": 1}              # Error: named tuple name cannot be empty

Annotations already produce an error before because their named arguments cannot use StringLiteral keys. The rest are breaking changes.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser breaking-change labels Apr 5, 2022
@straight-shoota straight-shoota added this to the 1.5.0 milestone May 16, 2022
@straight-shoota straight-shoota merged commit 8bdd9e5 into crystal-lang:master May 17, 2022
@HertzDevil HertzDevil deleted the bug/empty-parameter-names branch May 17, 2022 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty external parameter names
3 participants