rbi
rbi copied to clipboard
Const holds a type rather than a value
Follow up on https://github.com/Shopify/rbi/pull/408#issuecomment-2755037767.
In the context of an RBI file, does it really make sense to hold the value of constants?
This PR proposes to change Const so it only stores the type we find a the T.let if any.
So this:
A = 42
B = T.let(42, Integer)
C = foo(T.let(42, Integer))
gives this:
A = T.let(T.unsafe(nil), T.untyped)
B = T.let(T.unsafe(nil), Integer)
C = T.let(T.unsafe(nil), T.untyped)
This is quite a breaking change for the gem's API and should be released with at least a minor version bump.
I think we can apply the same logic to optional positional and keyword parameters 🤔
Given it's a breaking change, can the description also include the benefits it will bring too?