Skip to content

Revert "Return a shared type instance from type constructors when runtime checking is disabled"#23091

Merged
dduugg merged 1 commit into
mainfrom
revert-23078-shared-type-instance
Jul 14, 2026
Merged

Revert "Return a shared type instance from type constructors when runtime checking is disabled"#23091
dduugg merged 1 commit into
mainfrom
revert-23078-shared-type-instance

Conversation

@dduugg

@dduugg dduugg commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

Reverts #23078 ("Return a shared type instance from type constructors when runtime checking is disabled").

Changes

Reverts the 33-line change to Library/Homebrew/standalone/sorbet.rb in full, restoring the original type constructor behaviour when $HOMEBREW_SORBET_RUNTIME is unset.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • AI was used to generate or assist with generating this PR.

Copilot AI review requested due to automatic review settings July 14, 2026 00:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request reverts the prior optimization in standalone/sorbet.rb that returned a shared type instance from Sorbet type constructors when $HOMEBREW_SORBET_RUNTIME is unset, restoring the original runtime-disabled behavior for type construction.

Changes:

  • Removes the no-op overrides for Sorbet type constructors (e.g., T.nilable, T.any, and typed collection indexers) in the runtime-disabled branch.
  • Stops prepending the removed constructor-override module into T’s singleton class, so type constructors behave as they did before PR #23078.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dduugg

dduugg commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of #23093, which fixes the root cause (splitting the shared no-op type instance so only nilable returns a type containing NilClass) instead of reverting #23078 outright — keeps its measured performance win while restoring correct default: application on deserialization.

@dduugg dduugg closed this Jul 14, 2026
@dduugg dduugg reopened this Jul 14, 2026
@dduugg

dduugg commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

The additional failure of https://github.com/Homebrew/brew/actions/runs/29296519551/job/86971139791 leads me to think that #23078 was a bit too creative with sorbet-runtime overrides (although the tapioca code should probably use the unpatched sorbet-runtime path, it still illustrates the dragons lurking with the approach). I will more thoughtfully revisit this approach another time.

@dduugg dduugg enabled auto-merge July 14, 2026 01:01
@dduugg dduugg added this pull request to the merge queue Jul 14, 2026
Merged via the queue into main with commit e322eef Jul 14, 2026
82 checks passed
@dduugg dduugg deleted the revert-23078-shared-type-instance branch July 14, 2026 01:35
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.

3 participants