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

Module#attr_setter does not support frozen-string-literal #286

Open
taichi-ishitani opened this issue Feb 27, 2019 · 0 comments · May be fixed by #287
Open

Module#attr_setter does not support frozen-string-literal #286

taichi-ishitani opened this issue Feb 27, 2019 · 0 comments · May be fixed by #287

Comments

@taichi-ishitani
Copy link

I got the "can't modify frozen String" error when I use the --enable-frozen-string-literal Ruby option.
It is because that Module#attr_setter method does not support frozen-string-literal.

You can see the same error by running commands below

$ export RUBYOPT='--enable-frozen-string-literal'
$ ruby-test test/core/module/test_attr_setter.rb

Then, you will see the error message below

    can't modify frozen String
    C:/Users/ishitani/workspace/facets/lib/core/facets/module/attr_setter.rb:24
    22     code, made = '', []
    23     args.each do |a|
 => 24       code << %{
    25         def #{a}(*args)
    26           args.size > 0 ? ( @#{a}=args[0] ; self ) : @#{a}
    C:/Users/ishitani/workspace/facets/lib/core/facets/module/attr_setter.rb:24
    C:/Users/ishitani/workspace/facets/lib/core/facets/module/attr_setter.rb:23
    test/core/module/test_attr_setter.rb:9
    test/core/module/test_attr_setter.rb:8
    C:/Ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubytest-cli-0.2.0/lib/rubytest-cli.rb:48
    C:/Ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubytest-cli-0.2.0/lib/rubytest-cli.rb:18
    C:/Ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubytest-cli-0.2.0/bin/ruby-test:4
    C:/Ruby/Ruby25-x64/bin/ruby-test:23
taichi-ishitani added a commit to rggen/rggen-core that referenced this issue Feb 27, 2019
taichi-ishitani added a commit to rggen/rggen-core that referenced this issue Mar 5, 2019
taichi-ishitani added a commit to rggen/rggen-core that referenced this issue Mar 5, 2019
taichi-ishitani added a commit to rggen/rggen-core that referenced this issue Mar 5, 2019
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 a pull request may close this issue.

1 participant