ruby-syntax-tree / syntax_tree

Interact with the Ruby syntax tree

Home Page:https://ruby-syntax-tree.github.io/syntax_tree/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`NoMethodError location for "":String` in `on_regexp_add`

vinistock opened this issue · comments

I don't know what Ruby code triggers this error, but we caught it in the Ruby LSP's telemetry. It appears that part is an empty string and then invoking location on it breaks.

Happens on this line

location: regexp_content.location.to(part.location)

Oh man I would love to know what triggered this. It is almost definitely a syntax error that is passing an unexpected type up the tree somehow. I'll see if I can replicate, but without the source I don't really know.

Okay, I totally believe you, but I cannot figure out a way to reproduce this at all. If you find the original source that did this, I can 100% fix it, but I don't want to add a type check unless I can add a test as well. I'm going to close for now since there's nothing really either of us can do.