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

Different behavior of block.call and yield with break #1335

Closed
iliabylich opened this issue Feb 8, 2016 · 1 comment · Fixed by #2357
Closed

Different behavior of block.call and yield with break #1335

iliabylich opened this issue Feb 8, 2016 · 1 comment · Fixed by #2357
Labels
bug compiler v1.2 Still an issue on v1.2

Comments

@iliabylich
Copy link
Contributor

Here's the code I used for testing:

class A
  include Enumerable

  def each
    yield :value1
    yield :value2
  end

  def method1(&block)
    map { |a| block.call(a) }
  end

  def method2(&block)
    map { |a| yield(a) }
  end
end

a = A.new
puts a.method1 { break :broken }
puts a.method2 { break :broken }

MRI:

broken
broken

Opal:

["broken", "broken"]
broken

So, yield works correctly, block.call stops break from re-throwing.
cc @elia You've made some changes to break behavior about a month ago. Can it be related?

@elia
Copy link
Member

elia commented Feb 8, 2016

@elia You've made some changes to break behavior about a month ago. Can it be related?

absolutely ☹️ especially if it used to work properly, otherwise could be one of the cases that have entries in the bugs/ filters (https://github.com/opal/opal/blob/master/spec/filters/bugs/language.rb#L233-L237)

@hmdne hmdne added the v1.2 Still an issue on v1.2 label Aug 14, 2021
@hmdne hmdne linked a pull request Nov 10, 2021 that will close this issue
hmdne pushed a commit to hmdne/opal that referenced this issue Jan 27, 2024
Bumps [eslint](https://github.com/eslint/eslint) from 7.28.0 to 7.29.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v7.28.0...v7.29.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug compiler v1.2 Still an issue on v1.2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants