Skip to content

Commit

Permalink
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
@@ -1218,6 +1218,14 @@ describe "Parser" do

it_parses "Foo.foo(count: 3).bar { }", Call.new(Call.new("Foo".path, "foo", named_args: [NamedArgument.new("count", 3.int32)]), "bar", block: Block.new)

it_parses %(
class Foo
def bar
print as Foo
end
end
), ClassDef.new("Foo".path, Def.new("bar", body: Call.new(nil, "print", Cast.new(Var.new("self"), "Foo".path))))

assert_syntax_error "a = a", "can't use variable name 'a' inside assignment to variable 'a'"

assert_syntax_error "{{ {{ 1 }} }}", "can't nest macro expressions"
2 changes: 1 addition & 1 deletion src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
@@ -3885,7 +3885,7 @@ module Crystal
end

def parse_call_args_space_consumed(check_plus_and_minus = true, allow_curly = false, control = false)
if (@token.keyword?(:as) || @token.keyword?(:end)) && !next_comes_colon_space?
if @token.keyword?(:end) && !next_comes_colon_space?
return nil
end

0 comments on commit 898a7ee

Please sign in to comment.