diff --git a/lib/tapioca/gem/pipeline.rb b/lib/tapioca/gem/pipeline.rb index bd7d962da..a599bf78a 100644 --- a/lib/tapioca/gem/pipeline.rb +++ b/lib/tapioca/gem/pipeline.rb @@ -271,9 +271,7 @@ def compile_object(name, value) klass = class_of(value) - klass_name = if klass == ObjectSpace::WeakMap - sorbet_supports?(:non_generic_weak_map) ? "ObjectSpace::WeakMap" : "ObjectSpace::WeakMap[T.untyped]" - elsif T::Generic === klass + klass_name = if T::Generic === klass generic_name_of(klass) else name_of(klass) diff --git a/lib/tapioca/helpers/sorbet_helper.rb b/lib/tapioca/helpers/sorbet_helper.rb index f66a1b1f2..1cd4f390a 100644 --- a/lib/tapioca/helpers/sorbet_helper.rb +++ b/lib/tapioca/helpers/sorbet_helper.rb @@ -24,7 +24,6 @@ module SorbetHelper FEATURE_REQUIREMENTS = T.let( { # feature_name: ::Gem::Requirement.new(">= ___"), # https://github.com/sorbet/sorbet/pull/___ - non_generic_weak_map: ::Gem::Requirement.new(">= 0.5.10587"), # https://github.com/sorbet/sorbet/pull/6610 generic_class: ::Gem::Requirement.new(">= 0.5.10820"), # https://github.com/sorbet/sorbet/pull/6781 }.freeze, T::Hash[Symbol, ::Gem::Requirement], diff --git a/spec/tapioca/cli/backwards_compatibility_spec.rb b/spec/tapioca/cli/backwards_compatibility_spec.rb index 5b0a3f1dc..58c983808 100644 --- a/spec/tapioca/cli/backwards_compatibility_spec.rb +++ b/spec/tapioca/cli/backwards_compatibility_spec.rb @@ -27,51 +27,6 @@ def foo(foo) @project.destroy! end - describe "ObjectSpace WeakMap generation" do - before do - foo = mock_gem("foo", "0.0.1") do - write!("lib/foo.rb", <<~RB) - Foo = ObjectSpace::WeakMap.new - RB - end - @project.require_mock_gem(foo) - end - - it "is a generic type with Sorbet < 0.5.10587" do - @project.require_real_gem("sorbet-static", "0.5.10585") - @project.bundle_install! - - @project.tapioca("gem foo") - - assert_project_file_equal("sorbet/rbi/gems/foo@0.0.1.rbi", <<~RBI) - # typed: true - - # DO NOT EDIT MANUALLY - # This is an autogenerated file for types exported from the `foo` gem. - # Please instead update this file by running `bin/tapioca gem foo`. - - Foo = T.let(T.unsafe(nil), ObjectSpace::WeakMap[T.untyped]) - RBI - end - - it "is a non-generic type with Sorbet >= 0.5.10587" do - @project.require_real_gem("sorbet-static", "0.5.10588") - @project.bundle_install! - - @project.tapioca("gem foo") - - assert_project_file_equal("sorbet/rbi/gems/foo@0.0.1.rbi", <<~RBI) - # typed: true - - # DO NOT EDIT MANUALLY - # This is an autogenerated file for types exported from the `foo` gem. - # Please instead update this file by running `bin/tapioca gem foo`. - - Foo = T.let(T.unsafe(nil), ObjectSpace::WeakMap) - RBI - end - end - describe "serialization of T::Class and T.anything" do before do foo = mock_gem("foo", "0.0.1") do diff --git a/spec/tapioca/gem/pipeline_spec.rb b/spec/tapioca/gem/pipeline_spec.rb index 8feb45cde..46d7920c7 100644 --- a/spec/tapioca/gem/pipeline_spec.rb +++ b/spec/tapioca/gem/pipeline_spec.rb @@ -2043,11 +2043,7 @@ module Toto; end RUBY output = template(<<~RBI) - <% if sorbet_supports?(:non_generic_weak_map) %> Foo = T.let(T.unsafe(nil), ObjectSpace::WeakMap) - <% else %> - Foo = T.let(T.unsafe(nil), ObjectSpace::WeakMap[T.untyped]) - <% end %> RBI assert_equal(output, compile)