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

Enumerator's Yielder does not pass through one-elt array properly #4108

Closed
headius opened this issue Aug 24, 2016 · 4 comments

Comments

@headius
Copy link
Member

commented Aug 24, 2016

This is the continuation of #3814.

See the discussion there for the long form.

Short form, the following script should produce the given result. Two fail as shown by specs in #3814, and one works currently but may be the incorrect fix (#2458).

class Enumerator::Yielder
    def yield(*args)
      @proc.call(*args)
    end
end

module Enumerable
  def first
    val = nil
    catch(:foo) do
      each do |x|
        val = x
        throw :foo
      end
    end
    val
  end
end

p Enumerator.new {|y| y.yield([1])}.to_a
p Enumerator.new {|y| y << [1]}.to_a
p Enumerator.new {|y| y.yield([1])}.map {|e| e}.to_a
p Enumerator.new {|y| y.yield([1])}.lazy.map {|e| e}.to_a
p Enumerator.new {|y| y.yield [1]}.first
$ jruby blah.rb
[[1]]
[[1]]
[[1]]
[[1]]
[1]
@glebm

This comment has been minimized.

Copy link
Contributor

commented Nov 12, 2018

I think one of these Enumerable issues prevents sassc and sassc-rails from working on JRuby (wrong number of arguments (1 for 3)), while the Ruby version of Sass is deprecated and EOL next March.

@enebo enebo modified the milestones: JRuby 9.2.4.0, JRuby 9.2.5.0 Nov 13, 2018

@headius

This comment has been minimized.

Copy link
Member Author

commented Nov 20, 2018

Well, I'm thrilled to see that the native replacement for sass is going to be FFI around libsass! We should prioritize getting this fixed in 9.3 or a 9.2 update by early next year.

@headius

This comment has been minimized.

Copy link
Member Author

commented Nov 20, 2018

@glebm Can you give us a reproduction of that error?

@headius

This comment has been minimized.

Copy link
Member Author

commented Nov 20, 2018

@glebm Oh I just noticed sass/sassc-rails#92 👍

@enebo enebo modified the milestones: JRuby 9.2.5.0, JRuby 9.2.6.0 Dec 6, 2018

@enebo enebo modified the milestones: JRuby 9.2.6.0, JRuby 9.2.7.0 Dec 19, 2018

@enebo enebo modified the milestones: JRuby 9.2.7.0, JRuby 9.2.8.0 Jan 9, 2019

kares added a commit that referenced this issue Aug 2, 2019

[test] some asserts from GH-5044 and GH-4108
also from comments GH-3814 which are now passing

`Enumerator.new { |y| y.yield([1]) }.lazy.map { |e| e }.to_a`
seems to be left not working as in MRI

@enebo enebo closed this Aug 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.