Skip to content

Commit

Permalink
raise syntax error when using out as a varname
Browse files Browse the repository at this point in the history
  • Loading branch information
esse committed May 2, 2018
1 parent 53c4b1e commit ded0226
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
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 & #604
%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
Original file line number Diff line number Diff line change
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

0 comments on commit ded0226

Please sign in to comment.