sord: Some signatures are broken due to lack of module scoping
Describe the bug Because Sord does not nest modules and classes inside each other in the RBI files, module and class names must always be fully qualified.
To Reproduce
module Example
class A; end
class B
# @return [A]
def x
# ...
end
end
end
Expected behavior Sorbet accepts this code.
Actual behavior
Sorbet encounters a reference error because it cannot resolve A
. If Example::A
is used as B#x
’s return type, such an error does not occur.
Additional information This will require arbitrarily deep nesting of modules and classes, and the RBI generator is not capable of handling the indentation for this. It may be best to generate the file with no indentation to begin with, then pass a beautifier over it. (This has the potential to kill two birds with one stone by implementing the parameter line breaking specified in #13.)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (18 by maintainers)
I’m not sure - the output from Sorbet looks a bit fancier than what I’m used to seeing from the stdlib, off the top of my head. (I suppose they could still be using did_you_mean behind the scenes though.) I’ll look into it tomorrow.
On Sun, 23 Jun 2019, 02:07 Connor Shea, notifications@github.com wrote: