AaronC81 / sord

Convert YARD docs to Sorbet RBI and Ruby 3/Steep RBS files
https://sord.aaronc.cc
MIT License
293 stars 18 forks source link

Add unary minus default parameter workaround #127

Closed AaronC81 closed 3 years ago

AaronC81 commented 3 years ago

This adds a workaround for #75 (which is a bug in YARD, not Sord) by checking for a unary minus at the beginning of a default parameter value, and if one is there, chops off its final character.

Looking at the original example from haml, previously:

sig { params(index: T.untyped).returns(T.untyped) }
def rstrip_buffer!(index = -1)); end

Now:

sig { params(index: T.untyped).returns(T.untyped) }
def rstrip_buffer!(index = -1); end

(cc @connorshea)