* [ruby-core:89561] [Ruby trunk Bug#15255] Change in protected handling 2.3 -> 2.4, 2.5
[not found] <redmine.issue-15255.20181025224331@ruby-lang.org>
@ 2018-10-25 22:43 ` viraptor
2019-08-28 1:12 ` [ruby-core:94622] [Ruby master " merch-redmine
1 sibling, 0 replies; 2+ messages in thread
From: viraptor @ 2018-10-25 22:43 UTC (permalink / raw
To: ruby-core
Issue #15255 has been reported by viraptor (Stan Pitucha).
----------------------------------------
Bug #15255: Change in protected handling 2.3 -> 2.4,2.5
https://bugs.ruby-lang.org/issues/15255
* Author: viraptor (Stan Pitucha)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
It looks like when moving to 2.4 and higher, the access to protected method has changed. In the following case:
~~~ ruby
class Foo
def bar(objects)
objects.map(&:baz)
end
protected
def baz
self.inspect
end
end
a = Foo.new; b = Foo.new
a.bar([b])
~~~
The `protected method '...' called` will be raised. I haven't seen any explicit mention of this in the release notes.
It can be rewritten to successfully run as:
~~~ ruby
objects.map { |x| x.baz }
~~~
But it was an unexpected change. (so potentially a bug?)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ruby-core:94622] [Ruby master Bug#15255] Change in protected handling 2.3 -> 2.4, 2.5
[not found] <redmine.issue-15255.20181025224331@ruby-lang.org>
2018-10-25 22:43 ` [ruby-core:89561] [Ruby trunk Bug#15255] Change in protected handling 2.3 -> 2.4, 2.5 viraptor
@ 2019-08-28 1:12 ` merch-redmine
1 sibling, 0 replies; 2+ messages in thread
From: merch-redmine @ 2019-08-28 1:12 UTC (permalink / raw
To: ruby-core
Issue #15255 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Rejected
Testing Ruby versions from 1.9 to 2.7, only Ruby 2.3 does not raise a `NoMethodError` for the example code. I think that can be considered a bug in Ruby 2.3. As Ruby 2.3 is no longer supported, the bug will not be fixed.
----------------------------------------
Bug #15255: Change in protected handling 2.3 -> 2.4,2.5
https://bugs.ruby-lang.org/issues/15255#change-81212
* Author: viraptor (Stan Pitucha)
* Status: Rejected
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
It looks like when moving to 2.4 and higher, the access to protected method has changed. In the following case:
~~~ ruby
class Foo
def bar(objects)
objects.map(&:baz)
end
protected
def baz
self.inspect
end
end
a = Foo.new; b = Foo.new
a.bar([b])
~~~
The `protected method '...' called` will be raised. I haven't seen any explicit mention of this in the release notes.
It can be rewritten to successfully run as:
~~~ ruby
objects.map { |x| x.baz }
~~~
But it was an unexpected change. (so potentially a bug?)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-28 1:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-15255.20181025224331@ruby-lang.org>
2018-10-25 22:43 ` [ruby-core:89561] [Ruby trunk Bug#15255] Change in protected handling 2.3 -> 2.4, 2.5 viraptor
2019-08-28 1:12 ` [ruby-core:94622] [Ruby master " merch-redmine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).