Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ruby 3.0 support #1178

Merged
merged 1 commit into from
Dec 26, 2020
Merged

Add Ruby 3.0 support #1178

merged 1 commit into from
Dec 26, 2020

Conversation

mbj
Copy link
Owner

@mbj mbj commented Dec 25, 2020

No description provided.

@mbj mbj marked this pull request as draft December 25, 2020 21:16
@mbj mbj force-pushed the add/ruby-3.0 branch 4 times, most recently from 723c306 to 1ecdf33 Compare December 26, 2020 00:46
@mbj mbj mentioned this pull request Dec 26, 2020
@mbj mbj force-pushed the add/ruby-3.0 branch 4 times, most recently from a4fad01 to 9b3ebca Compare December 26, 2020 02:22
@mbj mbj marked this pull request as ready for review December 26, 2020 02:35
bundle exec mutant run \
--zombie \
--ignore-subject Mutant::CLI#add_debug_options \
--ignore-subject Mutant::Expression::Namespace::Recursive#initialize \
Copy link
Owner Author

Choose a reason for hiding this comment

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

A mutation for 3.0 specific code here. We need version specific configuration to exclude the subject (or mutation) on specific versions.

@mbj mbj merged commit 31752d0 into master Dec 26, 2020
@mbj mbj deleted the add/ruby-3.0 branch December 26, 2020 02:37
@@ -119,7 +119,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7]
ruby: [ruby-2.7, ruby-3.0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you intentionally running rubocop on two versions of ruby?

Copy link
Owner Author

Choose a reason for hiding this comment

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

for the moment yes, will soon remove 2.7.

@@ -17,7 +17,7 @@ class Recursive < self
def initialize(*)
super

@syntax = "#{scope_name}*"
@syntax = "#{scope_name}*".freeze # rubocop:disable Style/RedundantFreeze
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also curious if you know something I don't about this--I thought this was automatically frozen even with interpolation?

# frozen_string_literal: true

class Foo
  def initialize
    @test = "#{rand}-test"
    pp @test.frozen?
  end
end

Foo.new # outputs `true`

Copy link
Owner Author

@mbj mbj Dec 28, 2020

Choose a reason for hiding this comment

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

https://twitter.com/_m_b_j_/status/1342635659547340800

TLDR: MRI decided that, as each dstr gets allocated always freezing makes no sense.

I disagree as freezing is also a correctness mechanism, not just a memory optimization.

Instead: They should have patched MRI that as +"some-#{dstr}" would create a mutable DSTR, without frozen intermediary.

Copy link
Collaborator

Choose a reason for hiding this comment

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

...oh. I don't like that at all. :(

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.

2 participants