Don't require redundant attribute @return and @param tags#748
Don't require redundant attribute @return and @param tags#748castwide merged 1 commit intocastwide:masterfrom
Conversation
|
This change looks like solid inference from static code analysis. I have plans to replace Solargaphs's Long story short, I'm inclined to merge this PR, but I need to check on a couple things first. |
|
One of the updates I'm planning is a feature to generate RBS from a combination of YARD docs and Solargraph's type inference. This PR, in addition to providing smarter typechecking, gets us another step closer to comprehensive RBS without requiring redundant tags when the inferred types are sufficient. Thanks again, @apiology! |
|
Yeah, I love the idea. I've been playing around with using @AaronC81's https://github.com/AaronC81/sord and https://github.com/AaronC81/parlour to use my yard type annotations supplemented with judicious use of Sorbet/RBI annotations when needed to feed into Sorbet's engine and to generate .rbi and .rbs files to package with my published gems: https://github.com/apiology/cookiecutter-gem/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/Makefile#L31-L41 At a higher level - seems like we want to let annotations interoperate between and inside gems and local source files so we're not throwing away information. Once we have that, I think we should think about decoupling inference and type checking engines from annotation processors so we can focus energy on having really high quality implementations of all three. ...one step at a time :) |
|
@Morriar just dropped support for RBS comments in Sorbet - sorbet/sorbet#8470 I haven't played around with it yet, but it's in line with these thoughts (excuse the pun): https://sorbet.org/docs/rbs-support |
If the underlying instance variable is already typed (either via @type or via creation from a typed initializer param), don't require attributes (e.g., attr_accessor, attr_reader, etc.) to have redundant @return and @param tags, even under strong typechecking.