Skip to content

Conversation

@Earlopain
Copy link
Contributor

An unspecified uplevel is not the same as an uplevel of 1:

$ irb
irb(main):001> warn("foo")
foo
=> nil
irb(main):002> warn("foo", uplevel: 1)
/home/user/.rbenv/versions/2.7.8/lib/ruby/gems/2.7.0/gems/irb-1.14.0/lib/irb/workspace.rb:121: warning: foo
=> nil

cc @koic

@Earlopain Earlopain marked this pull request as ready for review September 14, 2025 10:03
@Earlopain
Copy link
Contributor Author

JRuby can't handle this is seems...

Earlopain added a commit to Earlopain/rubocop that referenced this pull request Sep 14, 2025
Prism 1.5.0 polyfills `warn` in an incompatible way: ruby/prism#3647
Earlopain added a commit to Earlopain/rubocop that referenced this pull request Sep 14, 2025
Prism 1.5.0 polyfills `warn` in an incompatible way: ruby/prism#3647
@Earlopain Earlopain mentioned this pull request Sep 14, 2025
8 tasks
Earlopain added a commit to Earlopain/rubocop that referenced this pull request Sep 14, 2025
Prism 1.5.0 polyfills `warn` in an incompatible way: ruby/prism#3647
Earlopain added a commit to Earlopain/rubocop that referenced this pull request Sep 14, 2025
Prism 1.5.0 polyfills `warn` in an incompatible way: ruby/prism#3647
Copy link
Collaborator

@kddnewton kddnewton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you either keep the Integer check or just make it .nil? Instead of the case? Either way is fine with me

An unspecified uplevel is not the same as an uplevel of 1:

```
$ irb
irb(main):001> warn("foo")
foo
=> nil
irb(main):002> warn("foo", uplevel: 1)
/home/user/.rbenv/versions/2.7.8/lib/ruby/gems/2.7.0/gems/irb-1.14.0/lib/irb/workspace.rb:121: warning: foo
=> nil
```
@kddnewton kddnewton merged commit 1f1d2b4 into ruby:main Sep 15, 2025
60 checks passed
bquorning added a commit to rubocop/rubocop-rspec that referenced this pull request Sep 15, 2025
Prism 1.5.0 polyfills `warn` in an incompatible way:
ruby/prism#3647

Based on Earlopain's commit on RuboCop.
tompng added a commit to ruby/rdoc that referenced this pull request Sep 16, 2025
Fix JRuby ci failure
```
Failure: test_check_files_warn(RDocOptionsTest)
/home/runner/work/rdoc/rdoc/test/rdoc/rdoc_options_test.rb:50:in 'test_check_files_warn'
     49:     assert_empty out
  => 50:     assert_equal "file 'nonexistent' not found\n", err
     51:     assert_empty @options.files
     52:   end
<"file 'nonexistent' not found\n"> expected but was
<"/home/runner/work/rdoc/rdoc/lib/rdoc/options.rb:1370: warning: file 'nonexistent' not found\n">
```

Related to ruby/prism#3647
@Earlopain Earlopain deleted the fix-warn-polyfill branch October 3, 2025 10:38
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 this pull request may close these issues.

2 participants