Skip to content

Commit

Permalink
Merge pull request #1567 from Shopify/andyw8/drop-ruby-2.7-support
Browse files Browse the repository at this point in the history
Drop Ruby 2.7 support
  • Loading branch information
andyw8 authored Jul 18, 2023
2 parents 403441f + 375d0c2 commit 9649fc4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ruby: ["3.0", "3.1", "3.2"]
gemfile:
- Gemfile
- gemfiles/Gemfile-rails-6-1
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0
NewCops: disable
SuggestExtensions: false
Exclude:
Expand Down
27 changes: 0 additions & 27 deletions lib/tapioca/sorbet_ext/generic_name_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,6 @@ def initialize(context, type, variance, fixed, lower, upper, bounds_proc)
sig { returns(T.nilable(String)) }
def name
constant_name = super

# This is a hack to work around modules under anonymous modules not having
# names in 2.7: https://bugs.ruby-lang.org/issues/14895
#
# This happens when a type variable is declared under `class << self`, for
# example.
#
# The workaround is to give the parent context a name, at which point, our
# module gets bound to a name under that name, as well.
unless constant_name
constant_name = with_bound_name_pre_3_0 { super }
end

constant_name&.split("::")&.last
end

Expand Down Expand Up @@ -247,20 +234,6 @@ def build_bounds_proc(fixed, lower, upper)
-> { bounds }
end

sig do
type_parameters(:Result)
.params(block: T.proc.returns(T.type_parameter(:Result)))
.returns(T.type_parameter(:Result))
end
def with_bound_name_pre_3_0(&block)
require "securerandom"
temp_name = "TYPE_VARIABLE_TRACKING_#{SecureRandom.hex}"
self.class.const_set(temp_name, @context)
block.call
ensure
self.class.send(:remove_const, temp_name) if temp_name
end

sig { returns(T::Hash[Symbol, T.untyped]) }
def bounds
@bounds ||= @bounds_proc.call
Expand Down
2 changes: 1 addition & 1 deletion tapioca.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
spec.add_dependency("thor", ">= 1.2.0")
spec.add_dependency("yard-sorbet")

spec.required_ruby_version = ">= 2.7"
spec.required_ruby_version = ">= 3.0"
end

0 comments on commit 9649fc4

Please sign in to comment.