<internal: is a common prefix also used by core Ruby files in CRuby.
test_no_kernel_require_in_*warn_with_uplevel already test this.
Unfortunately just skipping <internal: in the Ruby implementation
is not enough, because RubyGems' #warn would not skip the <internal: require (TruffleRuby defines #require in Ruby),
and the Ruby implementation's #warn would not skip
RubyGems's #require. The #caller_locations(0) look like this:
warnee.rb:1:in <top (required)>' # where #warn is called <internal:core> core/kernel.rb:234:in gem_original_require' # not skipped by RubyGems' warn, skipped by the Ruby impl
rubygems/core_ext/kernel_require.rb:54:in require' # not skipped by the Ruby impl's warn, what would be shown without this fix warn.rb:1:in ' # what would be correct
warn.rb is
require "warnee"
warnee.rb is
puts caller_locations(0), nil
warn "oops", uplevel: 1
[rubygems/rubygems] Ignore internal frames in RubyGems' Kernel#warn
See https://github.com/oracle/truffleruby/issues/2046
<internal:
is a common prefix also used by core Ruby files in CRuby.test_no_kernel_require_in_*warn_with_uplevel already test this.
Unfortunately just skipping
<internal:
in the Ruby implementationis not enough, because RubyGems' #warn would not skip the
<internal:
require (TruffleRuby defines #require in Ruby),and the Ruby implementation's #warn would not skip
RubyGems's #require. The #caller_locations(0) look like this:
warnee.rb:1:in
<top (required)>' # where #warn is called <internal:core> core/kernel.rb:234:in
gem_original_require' # not skipped by RubyGems' warn, skipped by the Ruby implrubygems/core_ext/kernel_require.rb:54:in
require' # not skipped by the Ruby impl's warn, what would be shown without this fix warn.rb:1:in
' # what would be correctwarn.rb is
require "warnee"
warnee.rb is
puts caller_locations(0), nil
warn "oops", uplevel: 1
https://github.com/rubygems/rubygems/commit/7c838f7419