Skip to content

Conversation

@larouxn
Copy link
Contributor

@larouxn larouxn commented Jan 25, 2026

Motivation

While running the test suite for an unrelated change I kept seeing the following warnings.

Defined on line  of 
WARNING: `#sorbet_type` is deprecated. Please rename your method to `#__tapioca_type`."

Traced them back to 9298261 i.e. #2125. It appears #sorbet_type has been deprecated for over a year at this point and the intention was to eventually drop support altogether.

After some migration time, we can drop support for #sorbet_type.

Therefore I'm proposing we drop support for #sorbet_type. CC @amomchilov

Implementation

  1. Removed the handling of and deprecation message for sorbet_type.
  2. Removed the tests for the handling and deprecation code mentioned above.
  3. Renamed remaining sorbet_type to tapioca_type, as appropriate.

Tests

Ran all tests locally and in CI and both passed. Also confirmed sorbet_type is gone save for this unrelated(?) file.

require "tapioca/gem/listeners/sorbet_type_variables"

# typed: strict
# frozen_string_literal: true
module Tapioca
module Gem
module Listeners
class SorbetTypeVariables < Base
include Runtime::Reflection
private
# @override
#: (ScopeNodeAdded event) -> void
def on_scope(event)
constant = event.constant
node = event.node
compile_type_variable_declarations(node, constant)
sclass = RBI::SingletonClass.new
compile_type_variable_declarations(sclass, singleton_class_of(constant))
node << sclass if sclass.nodes.length > 1
end
#: (RBI::Tree tree, T::Module[top] constant) -> void
def compile_type_variable_declarations(tree, constant)
# Try to find the type variables defined on this constant, bail if we can't
type_variables = Runtime::GenericTypeRegistry.lookup_type_variables(constant)
return unless type_variables
# Map each type variable to its string representation.
#
# Each entry of `type_variables` maps a Module to a String, or
# is a `has_attached_class!` declaration, and the order they are inserted
# into the hash is the order they should be defined in the source code.
type_variable_declarations = type_variables.filter_map do |type_variable|
node = node_from_type_variable(type_variable)
next unless node
tree << node
end
return if type_variable_declarations.empty?
tree << RBI::Extend.new("T::Generic")
end
#: (Tapioca::TypeVariableModule type_variable) -> RBI::Node?
def node_from_type_variable(type_variable)
case type_variable.type
when Tapioca::TypeVariableModule::Type::HasAttachedClass
RBI::Send.new(type_variable.serialize)
else
type_variable_name = type_variable.name
return unless type_variable_name
RBI::TypeMember.new(type_variable_name, type_variable.serialize)
end
end
# @override
#: (NodeAdded event) -> bool
def ignore?(event)
event.is_a?(Tapioca::Gem::ForeignScopeNodeAdded)
end
end
end
end
end

Method #sorbet_type was deprecated in favour of #__tapioca_type in mid-December 2024.
- 9298261
- Shopify#2125
@larouxn larouxn requested a review from a team as a code owner January 25, 2026 19:11
Copy link
Contributor

@amomchilov amomchilov left a comment

Choose a reason for hiding this comment

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

Thanks!

@amomchilov amomchilov added chore breaking-change Non-backward compatible change labels Jan 26, 2026
@amomchilov amomchilov merged commit 5f2caba into Shopify:main Jan 26, 2026
18 of 19 checks passed
@larouxn larouxn deleted the drop_support_for_deprecated_sorbet_type branch January 26, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Non-backward compatible change chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants