-
-
Notifications
You must be signed in to change notification settings - Fork 165
Improve typechecking of generics #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Improve typechecking of generics #1012
Conversation
…ric_typechecking_improvements
| end | ||
|
|
||
| # @return [Hash{String => Array<String>}] | ||
| # @return [Hash{String => Array<Pin::Reference::Include>}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The better typechecking found some issues in the annotations!
| elsif return_type.erased_version_of?(other.return_type) | ||
| other.return_type | ||
| elsif other.return_type.erased_version_of?(return_type) | ||
| return_type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help more precise type definitions make it through as the pins we typecheck against
| generic_values = type.all_params.map(&:to_s) | ||
| include_pin = Solargraph::Pin::Reference::Include.new( | ||
| name: decl.name.relative!.to_s, | ||
| name: type.rooted_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_type takes care of any root information we have available
There are a lot of files changed here, but the vast majority are added specs and fixed annotations, most from the improvements in this PR.
This is a rewrite of the current 'can I use this type here' code. In particular, we now in strong mode validate the type parameters of variable assignment and parameters, with the following exceptions:
Info on each check:
Depends on:
Includes for convenience: