8000 Retire more RubyVM-specific code by apiology · Pull Request #797 · castwide/solargraph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Retire more RubyVM-specific code #797

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

Merged
merged 73 commits into from
Apr 15, 2025

Conversation

apiology
Copy link
Contributor

No description provided.

@apiology apiology marked this pull request as draft March 20, 2025 12:15
@@ -9,10 +9,6 @@ module Parser
class SyntaxError < StandardError
end

def self.rubyvm?
false
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lekemula - whoops! It looks like solargraph-rspec relies on this method. I'll keep it around with this PR, but mark it as deprecated - maybe you could remove uses of it so it can be removed eventually?

Copy link
Contributor
@lekemula lekemula Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Yeah, that would be nice, once #721 gets released in the next version, I will deprecate any support for the "old-new" RubyVM parser and will open a PR to remove this method here. 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Will your new code work with the current solargraph release? If so, I think it'd be best for solargraph-rspec to release a new version before we merge this so that users can upgrade solargraph-rspec to fix the exception they see. If not, let me know and I'll keep this method around and just mark it as deprecated.

Copy link
Contributor
@lekemula lekemula Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll be releasing it the weekend after this one as I’m currently AFK - no laptop within reach at the moment. Hope that works for you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads-up - no rush here!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiology and others added 26 commits April 6, 2025 17:12
* Add basic plugin integration testing

Add a GitHub Actions workflow to run very basic smoke tests
for solargraph-rails and solargraph rspec (typechecking and then
running solargraph's specs with it installed and configured)

Also:

* Document solargraph-rspec as a plugin in README.md

* Add solargraph-rspec to .Gemfile as well

* Fix YAML syntax

* Fix GitHub workflow syntax

* Fix GitHub workflow syntax

* Fix GitHub workflow syntax

* Fix GitHub workflow syntax

* Switch yq syntax for the *other* yq, cache apt installation

* Switch yq syntax for the *other* yq, cache apt installation

* Restore Legacy module for solargraph-rails backwards compatibility
* BlockSymbol link

* First iteration of block-pass symbol resolution

* Chain::Call#block

* Superfluous block tracking

* Refactor NodeChainer

* Fix chain block check

* Sync with castwide#780

* BlockSymbol link

* First iteration of block-pass symbol resolution

* Change spec to test Call#block

* Resolve generics from BlockSymbol
* More annotations in Solargraph code

* More annotations from strict typechecking

* More internal annotations

* Add some method overloads
…de#789)

* Add #to_rbs methods to pins, use for better .inspect() output

* Add inspect() to Chain::Link, to_rbs to Pin::Namespace

* Fix typo

* Show variable assignments in #desc

* Method generics resolution via argument types (castwide#794)

* Improve block handling in signature selection

Fixes castwide#777

* Resolve method generics

* Track generics in method signatures from RBS and YARD

* Erase method generics that couldn't be resolved

* Refactor Pin#resolve_types to use Pin#transform_types

* Fix issues with UniqueType#transform()

* Cleanups

* Move to keyword parameters for resolved_generic_values

* Add type erasure, method pin rewrite code

* Populate Method parameter/return_type/block from signature

* Mark completed TODOs

* Ruby 3.0 compatibility

* Add erase_generics() to ComplexType::TypeMethods

* TODO -> @todo

* Resolve some TODOs

* Resolve TODOs

* Revert accidental change

* Bring back spec

* Provide full tag to get_method_stack() for better inference

* Fix a missed spot referring to allowlist

* Ensure Signature#generics is not nil

* Various #to_rbs and #inspect improvements

* Clean up code

* Drop accidental addition

* Improve RBS generation from UniqueType

* Use rooted names when generating RBS when available

* Drop bad documentation
…#805)

* Add :if support to NodeChainer for if statements as lvalues

* Add :if support to NodeChainer for if statements as lvalues
* Fix ApiMap::Cache

* Refactoring
* Retire dead DocMap-related code, restore 'solargraph uncache'

* Best-effort work to support bundler's 'path:' directive in Gemfiles

* Restore support for 'solargraph uncache'

* Clarify names in DocMap

* Tell Thor to exit with status 1 on error, inc. deprecated command

* Clarify shell deprecation messages

* Send deprecation errors to stderr

* Fix merge
* Various regression and future-feature specs

* Merge remote-tracking branch 'origin/master' into more_specs

* Another batch of specs

* Drop duplicated spec

* Various regression and future-feature specs

* Various regression and future-feature specs

* Resolve a small issue found on merge

* Fix pre-mature marking of spec as ready
* Map mixins from RBS

* DRY mixin processing
…twide#815)

We were picking the wrong signature for Enumerator#select and
Enumerator#find because Chain::Call didn't have access to the block
that was passed in and didn't think the arity matched as a result.
* Keep gem pins in memory

* DocMap warns on unresolved paths

* Fic cache errors

* Keep stdlib pins in memory

* Move logs for pins in memory from info to debug

* Use previous stdlib memory cache

* Use cursor node in clip cache index
…astwide#814)

* Add more internal type annotations required by strict typechecking

* Add more internal type annotations required by strict typechecking

* Fix types in existing annotations

* Fix names in existing annotations

* Add more internal type annotations required by strict typechecking

* Add more internal type annotations required by strict typechecking
* Use simple return type of literal blocks in inference

Also:
* Document block symbol handling issue
* Add failing spec for less trivial literal block inference

* Mark spec as working after merging in latest master

* Add Thread::Mutex#synchronize spec just to be sure

* Fix an internal return type annotation
* ApiMap#get_methods includes Module

* Redundant code

* Another test
* Revise documentation formatting

* Ruby 3.0 compatibility
* Clean up DocMap logging

* Remove stale requires and autoloads

* Redundant `require 'set'`

* Test redundant require

* Ignore test in Ruby < 3.1.1

* Stub test

* Require set at root and suppress warning
apiology and others added 28 commits April 6, 2025 17:13
…astwide#849)

The 'Unresolved call to' typecheck suppresses warnings for calls
against non-RBS-origin pins.  However, the labeling assigning :rbs as
the source of pins from conversions.rb was recently removed as part of
an unrelated cleanup.
* Lazy dynamic rebinding

* Stub failing test

* Move rebinding to Clip
…astwide#850)

* [regression] Ensure YardMap gems have return type for Class<T>.new

* Handle self return-type-setting at lower level

* Fix bug where signature return type was based only on annotation
* Create implicit .new pins in namespace method queries

* Comment for Host#locate_pins exception
* Add support for simple block argument destructuring

* Add spec for Array<Array(String, Integer)>#each
* Internal typechecking-driven annotations and code changes

* Add @todo for predicate method return type issue

* Internal typechecking-driven annotations and code changes
* Send gem caching notifications

* LanguageServer::Progress

* DRY progress notifications

* Refactor
* [breaking] Fix more complex_type_spec.rb cases

* Consolidate the code that generates substrings to a single place
* Clean up more paths to pass through 'rooted' flag unchanged
* [breaking] Drop special-case interpretation of, e.g., `Array<(String)>` as
  'one element tuple' for future consistency with
  https://yardoc.org/types

  * (String) is a one element tuple in https://yardoc.org/types
  * <String> is an array of zero or more Strings in https://yardoc.org/types
  * Array<(String)> could be an Array of one-element tuples or a
    one element tuple.  https://yardoc.org/types treats it
    as the former.
  * Array<(String), Integer> is not ambiguous if we accept
    (String) as a tuple type, but not currently understood
    by Solargraph.

* Close out complex_type_spec @todos for better RBS output

* Simplify qualify() with transform()

* Resolve merge issue
* Memoize result of Chain#infer

* Add links to cache key

* Add node.location separately to cache key

https://github.com/whitequark/ast/blob/master/lib/ast/node.rb

https://github.com/whitequark/parser/blob/05b88aa0468ce29dfa21e1aff2f0506b1d5d82e1/lib/parser/ast/node.rb#L17

Parser::AST adds 'location' in Parser::AST::Node to its superclass
AST::Node, but doesn't overwrite the #hash and #eql? methods

* Fall back to using links.map(&:word)

* Implement eql? and hash for ApiMap for cache coherency

* Remove @cache from ApiMap#equality_fields
* Ignore malformed mixins

* Ignore malformed overload tags
…astwide#865)

* Add internal type annotations needed for strict-level typechecking

* Fix annotations

* Add internal type annotations needed for strict-level typechecking

* Fix flaky rename specs

* Move to untyped as Hash value

---------

Co-authored-by: Fred Snyder <fsnyder@castwide.com>
)

* Refactor TypeChecker#argument_problems_for for type safety

This should put it in a state that it can pass type checking once we
have another feature or two

* Editor compatibility hack

* Fix class name

* Fix flaky rename specs

---------

Co-authored-by: Fred Snyder <fsnyder@castwide.com>
* One-step source synchronization

* Synchronize libraries
* Show cache progress in shell commands

* Typecheck error
@apiology apiology marked this pull request as ready for review April 6, 2025 22:36
@castwide castwide merged commit 4b8785f into castwide:master Apr 15, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0