Tags: sorbet/sorbet
Tags
Sorbet optimizations (1/4): tests + benchmarks (#10359) * bench: add benchmarks for the upcoming sorbet-runtime optimizations Adds/extends benchmarks (deep_clone, enum, prop_definition, serialize_custom_type, sigs, type_derivation, typecheck, validation, and the bench tasks runner) so the perf impact of the following PRs in this stack can be measured before and after each change. Committed-By-Agent: claude * test: pin behavior the optimization PRs must preserve These assertions pass against master today, so they land first to lock in current behavior before the later PRs change the implementations: - setter_factory: set-after-soft-error across all setter entry points - ruby2_keywords: keyword/splat forwarding through sig wrappers - validate_override_types: override with a rest param vs fewer base positionals Tests that depend on new behavior (e.g. the deep_clone rename) ride along with their respective PRs instead. Committed-By-Agent: claude
Reapply "sorbet-runtime: DSL methods for `abstract` et al (#10276)" (#… …10354) * prework: Track method_name in the DeclarationBlock * Introduce T::Sig::DSL with abstract, override, final, overridable * Add tests for T::Sig::DSL method modifiers * Support final def self.foo (singleton class methods) Fix ensure_valid_declare_dsl! to accept the case where the DSL caller's self is a class but the method owner (from _on_method_added) is its singleton class. Also fix declare_final to use previous_declaration.mod (the actual method owner) for final bookkeeping. * Add T::Syntax module * More tests * T::Sig::DSL -> T::DefMods * Fix cop * Error eagerly if does not override anything * Make it work with `allow_incompatible: :visibility` * Leave a comment about eager `super` for abstract * Remove this comment Even if the `original_method` were in the `DeclarationBlock`, I don't think that we'd want to use it, because I'm not confident that the `super_method` on the `original_method` would necessarily be the same as the method that we're calling. e.g. at that point, the `original_method` will have been replaced with a shim method that forces the signature. I think that we want to grab the new method just to be sure that the `super_method` is looking at the current override chain of the method. * Add suggested test
Add a `consume!` API for getting the `active_declaration` (#10344) * no-op: Convert RBIs to use attr_accessor * Add a `consume!` API for getting the `active_declaration` * Force reset at the end of run_all_sig_blocks * Ban `run_all_sig_blocks` with pending signatures
`reset!` eagerly, after fetching the `active_declaration` (#10353) * Add some regression tests * `reset!` eagerly, after fetching the `active_declaration` I'm working on a change to introduce a `consume!` method, which (among other things), makes it look like the `active_declaration` is "dropped" after you read it. My first stab at this (in #10276) failed because I forgot to address how this would affect the logic after `_check_final_ancestors`: <bb9f012> Looking at this change, what's not obvious from the (collapsed) diff is that re-reading `current_declaration = (...).active_declaration` on line 205 will always be `nil`, because `consume!` dropped `active_declaration`. Looking back at why that assignment exists at all (see #3964), we can maintain the original motivation by simply not having `_check_final_ancestors` need to worry about this. As of that first PR, we needed the reassignment because maybe `_check_final_ancestors` would have called `reset!` as a way to signal to the caller that the sig should **not** be stored into the `@sig_wrappers` Hash. But the easiest way to signal that would just be to return something from `_check_final_ancestors` that indicates that something failed, and that we should early return directly. In particular, it was never the case that `current_declaration = (...).active_declaration` would ever produce a _new_, _unrelated_ declaration. So it was really just a roundabout way to request that `current_declaration` be `nil`'d out, meaning we should return.
sealed class postfix completion (#10347) * completion for sealed subclasses * fix message * add some tests * fix tests * Update main/lsp/requests/completion.cc Co-authored-by: Jake Zimmerman <zimmerman.jake@gmail.com> * Update main/lsp/requests/completion.cc Co-authored-by: Jake Zimmerman <zimmerman.jake@gmail.com> * flip condition * style * remove comment * add crash test * add empty test * fix tests and add to exclude for prism * . * add monkeypatch case test * add two cases for monkeypatch test * rename test files * add comment * rename test file name * fix ignore --------- Co-authored-by: Brian Shu <bshu@stripe.com> Co-authored-by: Jake Zimmerman <zimmerman.jake@gmail.com>
PreviousNext