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

Raise syntax error when using out as an arg #6052

Merged
merged 1 commit into from May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/compiler/parser/parser_spec.cr
Expand Up @@ -172,13 +172,13 @@ describe "Parser" do
assert_syntax_error "def foo!=; end", "unexpected token: !="
assert_syntax_error "def foo?=(x); end", "unexpected token: ?"

# #5895
# #5895 & #6042
%w(
begin nil true false yield with abstract
def macro require case select if unless include
extend class struct module enum while until return
next break lib fun alias pointerof sizeof
instance_sizeof typeof private protected asm
instance_sizeof typeof private protected asm out
end
).each do |kw|
assert_syntax_error "def foo(#{kw}); end", "cannot use '#{kw}' as an argument name", 1, 9
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/syntax/parser.cr
Expand Up @@ -3672,7 +3672,7 @@ module Crystal
:def, :macro, :require, :case, :select, :if, :unless, :include,
:extend, :class, :struct, :module, :enum, :while, :until, :return,
:next, :break, :lib, :fun, :alias, :pointerof, :sizeof,
:instance_sizeof, :typeof, :private, :protected, :asm,
:instance_sizeof, :typeof, :private, :protected, :asm, :out,
# `end` is also invalid because it maybe terminate `def` block.
:end
true
Expand Down