Skip to content

Fails to parse while def f = g do end; end #1772

@tompng

Description

@tompng

Endless method definition with block inside while condition is parsed different from Ruby.
while def f = g do end (syntax error in ruby) is parsed without error.
while def f = g do end; end (syntax ok in ruby) fails to parse.

eval('while def f = g do end') # => syntax error, unexpected end-of-input, expecting `do' for condition or ';' or '\n' (SyntaxError) Prism.parse('while def f = g do end').success? # => true eval('while def f = g do end; end') # => infinite loop Prism.parse('while def f = g do end; end').success? # => false

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions