Skip to content

Commit 1b7afe2

Browse files
committed
Remove all code related to generic_class Sorbet flag
Since sorbet/sorbet#6781 was merged and released as 0.5.10820, we no longer need to check for the existence of generic class support in Sorbet. Since we are moving to >= 0.5.10820, we can remove all code related to the `generic_class` flag.
1 parent 1e3c9ac commit 1b7afe2

4 files changed

Lines changed: 1 addition & 71 deletions

File tree

lib/tapioca/dsl/compilers/active_record_delegated_types.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@ def populate_role_accessors(mod, role, types)
110110
return_type: "ActiveSupport::StringInquirer",
111111
)
112112

113-
return_type = sorbet_supports?(:generic_class) ? "T::Class[T.anything]" : "Class"
114113
mod.create_method(
115114
"#{role}_class",
116115
parameters: [],
117-
return_type: return_type,
116+
return_type: "T::Class[T.anything]",
118117
)
119118

120119
mod.create_method(

lib/tapioca/helpers/sorbet_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ module SorbetHelper
2424
FEATURE_REQUIREMENTS = T.let(
2525
{
2626
# feature_name: ::Gem::Requirement.new(">= ___"), # https://github.com/sorbet/sorbet/pull/___
27-
generic_class: ::Gem::Requirement.new(">= 0.5.10820"), # https://github.com/sorbet/sorbet/pull/6781
2827
}.freeze,
2928
T::Hash[Symbol, ::Gem::Requirement],
3029
)

spec/tapioca/cli/backwards_compatibility_spec.rb

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -27,68 +27,6 @@ def foo(foo)
2727
@project.destroy!
2828
end
2929

30-
describe "serialization of T::Class and T.anything" do
31-
before do
32-
foo = mock_gem("foo", "0.0.1") do
33-
write!("lib/foo.rb", <<~RB)
34-
Foo = T.type_alias { T.any(T.anything, T::Class[String]) }
35-
RB
36-
end
37-
@project.require_mock_gem(foo)
38-
end
39-
40-
it "serializes both as untyped with Sorbet < 0.5.10782" do
41-
@project.require_real_gem("sorbet-static", "0.5.10780")
42-
@project.bundle_install!
43-
44-
@project.tapioca("gem foo")
45-
46-
assert_project_file_equal("sorbet/rbi/gems/foo@0.0.1.rbi", <<~RBI)
47-
# typed: true
48-
49-
# DO NOT EDIT MANUALLY
50-
# This is an autogenerated file for types exported from the `foo` gem.
51-
# Please instead update this file by running `bin/tapioca gem foo`.
52-
53-
Foo = T.type_alias { T.untyped }
54-
RBI
55-
end
56-
57-
it "serializes T::Class as untyped with Sorbet >= 0.5.10782 and < 0.5.10820" do
58-
@project.require_real_gem("sorbet-static", "0.5.10800")
59-
@project.bundle_install!
60-
61-
@project.tapioca("gem foo")
62-
63-
assert_project_file_equal("sorbet/rbi/gems/foo@0.0.1.rbi", <<~RBI)
64-
# typed: true
65-
66-
# DO NOT EDIT MANUALLY
67-
# This is an autogenerated file for types exported from the `foo` gem.
68-
# Please instead update this file by running `bin/tapioca gem foo`.
69-
70-
Foo = T.type_alias { T.any(T.anything, T.untyped) }
71-
RBI
72-
end
73-
74-
it "serializes them correctly with Sorbet >= 0.5.10820" do
75-
@project.require_real_gem("sorbet-static", "0.5.10860")
76-
@project.bundle_install!
77-
78-
@project.tapioca("gem foo")
79-
80-
assert_project_file_equal("sorbet/rbi/gems/foo@0.0.1.rbi", <<~RBI)
81-
# typed: true
82-
83-
# DO NOT EDIT MANUALLY
84-
# This is an autogenerated file for types exported from the `foo` gem.
85-
# Please instead update this file by running `bin/tapioca gem foo`.
86-
87-
Foo = T.type_alias { T.any(T.anything, T::Class[::String]) }
88-
RBI
89-
end
90-
end
91-
9230
describe "compilation of constants of generic types" do
9331
before do
9432
@expected_out = <<~OUT

spec/tapioca/runtime/generic_type_registry_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,13 @@ class GenericTypeRegistrySpec < Minitest::Spec
3636
Tapioca::TypeVariableModule::Type::Member,
3737
:invariant,
3838
nil,
39-
nil,
40-
nil,
41-
nil,
4239
)
4340

4441
fake_type_member2 = Tapioca::TypeVariableModule.new(
4542
not_actually_generic,
4643
Tapioca::TypeVariableModule::Type::Member,
4744
:invariant,
4845
nil,
49-
nil,
50-
nil,
51-
nil,
5246
)
5347

5448
GenericTypeRegistry.register_type_variable(not_actually_generic, fake_type_member1)

0 commit comments

Comments
 (0)