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

[Truffle] Breaking outer while loop fails #2675

Closed
bjfish opened this issue Mar 10, 2015 · 2 comments
Closed

[Truffle] Breaking outer while loop fails #2675

bjfish opened this issue Mar 10, 2015 · 2 comments
Assignees
Milestone

Comments

@bjfish
Copy link
Contributor

bjfish commented Mar 10, 2015

This causes array#cycle spec to fail

def yield_me
  n = 0
  while true
    [0, 1, 2].each do |n|
      puts "hello"
      yield(n)
      puts "shouldn't print this"
    end
  end
end

yield_me { |n| break if n == 0 }

Expected output (ruby 2.2, jruby )

$ ruby looping.rb 
hello

Actual output

$ ~/Documents/jruby-mine/bin/jruby -X+T -Xtruffle.printRuntime=true looping.rb
jruby: using Default Truffle Runtime
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello

... forever

@chrisseaton chrisseaton added this to the truffle-dev milestone Mar 10, 2015
@chrisseaton
Copy link
Contributor

This doesn't break out of the while loop - it breaks out of the block lexically enclosing the break - the block on the last line. Same problem as #2826 I think. @eregon is already investigating.

eregon added a commit that referenced this issue Apr 20, 2015
* Breaks out of the call site.
* Relax the type of the ForNode child.
* Fix #2826, #2675.
@eregon
Copy link
Member

eregon commented Apr 20, 2015

Fixed in 434c8a2.

@eregon eregon closed this as completed Apr 20, 2015
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
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

No branches or pull requests

4 participants