class C
def foo
# comment
end
def bar
"some literal"
end
def baz
end
def qux
end
def quux
end
end
end # extra end
Expected:
$ ruby error.rb
error.rb: --> error.rb
Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?
> 1 class C
> 18 end
> 19 end # extra end
error.rb:19: syntax error, unexpected `end' (SyntaxError)
end # extra end
^~~
Actual:
$ ruby error.rb
error.rb: --> error.rb
Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?
1 class C
> 4 end
> 10 def baz
> 11 end
18 end
error.rb:19: syntax error, unexpected `end' (SyntaxError)
end # extra end
^~~
I haven't identified the exact condition to reproduce this issue, but I am wondering that an empty method definition with only comments would confuse the heuristics.