console1984 icon indicating copy to clipboard operation
console1984 copied to clipboard

Incompatability with `symbol-fstring`

Open ghiculescu opened this issue 1 year ago • 2 comments

An incompability exists with https://github.com/Shopify/symbol-fstring. I'm not sure if the bug is in this gem or that one, but it's easier to make a test case here and I think the bug is here.

The attached test fails, but it passes if you remove the extra gem. It fails because with the gem, const_name is frozen? here. As a result this line raises a FrozenError, and that gets handled here.

This is only an issue when loading a namespaced constant.

I've only made a test case as I don't really know how to fix it :(

ghiculescu avatar Feb 21 '24 01:02 ghiculescu

cc @byroot in case this is an issue in symbol-fstring (I doubt that) or in case you have some good ideas on how to fix this.

ghiculescu avatar Feb 21 '24 01:02 ghiculescu

https://github.com/basecamp/console1984/blob/f0f2efd489b94be8bbc9bcfb6bff778be3885d78/lib/console1984/command_validator/.command_parser.rb#L43

const_name is a symbol here, so Symbol#to_s returns a frozen string when symbol-fstring is present, which is expected.

Amusingly that the first ever recorded incompatibility I'm aware of with it, but as I said, totally expected as it's a monkey patch that changes the behavior.

As for fixing it, explictly using const_name.name.dup would work.

byroot avatar Feb 21 '24 07:02 byroot