Граф коммитов

66605 Коммитов

Автор SHA1 Сообщение Дата
Alan Wu 3dd3ea092a Use Module#ancestors order in recursive constant lookup
Before this commit, const_get with inherit=true and constant lookup
expressions searched the ancestors of the starting point in an order
different from `starting_point.ancestors`.

Items in the ancestry list introduced through prepend were searched
after searching the module they were prepended into. This oddity allowed
for situations where constant lookups gave different results even though
`starting_point.ancestors` is the same.

Do the lookup in the same order as `starting_point.ancestors` by
skipping classes and modules that have an origin iclass. The origin
iclass is in the super chain after the prepended modules.

Note that just like before this commit, the starting point of the
constant lookup is always the first item that we search, regardless of
the presence of any prepended modules.

[Bug #17887]
2021-06-30 10:49:27 +09:00
git dcd1eedba7 * 2021-06-30 [ci skip] 2021-06-30 10:47:24 +09:00
Nobuyoshi Nakada 94bd3bde81 Specify version to remove as bare numbers 2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada 21600a5f64 Ensure that version number starts with digits 2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada 0b726924a4 Show the removal version 2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada 8118d435d0 rb_warn_deprecated_to_remove_at [Feature #17432]
At compilation time with RUBY_DEBUG enabled, check if the removal
version has been reached.
2021-06-30 10:47:01 +09:00
Yusuke Endoh d1998d8767 tool/test-bundled-gems.rb: Stop tests conflicting with error_highlight
This hack should be removed after the minitest side is updated.
https://github.com/seattlerb/minitest/pull/880
2021-06-29 23:45:49 +09:00
Yusuke Endoh 9438c99590 Rename error_squiggle to error_highlight 2021-06-29 23:45:49 +09:00
Yusuke Endoh e946049665 [WIP] add error_squiggle gem
```
$ ./local/bin/ruby -e '1.time {}'
-e:1:in `<main>': undefined method `time' for 1:Integer (NoMethodError)

1.time {}
 ^^^^^
Did you mean?  times
```

https://bugs.ruby-lang.org/issues/17930
2021-06-29 23:45:49 +09:00
Peter Zhu 03dc664493 Fix crash on RGENGC_CHECK_MODE=4
When running btest there is a crash when compiled with
RGENGC_CHECK_MODE=4. The crash happens because `during_gc` is not
turned off before `gc_marks_check` is called, causing the marking to
happen on the main mark stack instead of mark stack created in
`objspace_allrefs`.
2021-06-29 09:28:07 -04:00
Samuel Williams 5e75280c8e Add basic test for updated IO wait functions. 2021-06-29 23:54:41 +12:00
Yusuke Endoh 39f99b8176 Use assert_not_match "Did you mean?" for UncorrectableNameCheckTest
... instead of exact matching. I'm now creating a built-in gem that
modifies Exception's error message, so the expectation value is changed.

IMO, it is good to check that did_you_mean suggestion is NOT added in
the uncorrectable case.

https://github.com/ruby/did_you_mean/commit/ebe88ec4d2
2021-06-29 15:49:51 +09:00
Yusuke Endoh 809f120374 Use String#include? instead of end_with? to avoid message duplication
Previously, did_you_mean used `msg.end_with?(suggestion)` to check if
its suggestion is already added.

I'm now creating a gem that also modifies Exception's message. This
breaks did_you_mean's duplication check.
This change makes the check use String#include? instead of end_with?.

https://github.com/ruby/did_you_mean/commit/b35e030549
2021-06-29 15:49:51 +09:00
Yusuke Endoh 612b6fcd37 Let Correctable#original_message skip prepended method definitions
Previously, DidYouMean::Correctable#original_message did
`method(:to_s).super_method.call` to call the original to_s method by
skipping Correctable#to_s.

I'm now creating a gem that prepends another to_s method to NameError,
which confuses the hack. An immediate solution is to replace it with
`method(:to_s).super_method.super_method.call` to skip the two methods.
But it is too ad-hoc.

This changeset uses more extensible approach and allow a prepended
module to declare that they should be skipped by defining a constant
named `SKIP_TO_S_FOR_SUPER_LOOKUP`.

https://github.com/ruby/did_you_mean/commit/8352c154e3
2021-06-29 15:49:51 +09:00
Nobuyoshi Nakada 4670458af8 Should require "rbconfig" to use RbConfig
https://github.com/ruby/did_you_mean/commit/fbe5aaaae8
2021-06-29 15:49:51 +09:00
Yuki Nishijima 8356d9e374 Start v1.6.0 development
https://github.com/ruby/did_you_mean/commit/3f69171813
2021-06-29 15:49:51 +09:00
Nobuyoshi Nakada 9eae8cdefb
Prefer qualified names under Thread 2021-06-29 11:41:10 +09:00
git 983c9ad3f1 * 2021-06-29 [ci skip] 2021-06-29 06:06:50 +09:00
xtkoba d795f494a8 Avoid `free(3)`ing invalid pointer
Fixes [Bug #17794]
2021-06-28 14:06:28 -07:00
Nobuyoshi Nakada b7d01b0d1b
Refined define_thread_class
Reduce duplications
* ID caluculations of the same name
* checks against the same name
* registration to the root module hash
2021-06-28 16:52:49 +09:00
git ac8c674a81 * 2021-06-28 [ci skip] 2021-06-28 12:10:24 +09:00
Nobuyoshi Nakada 47a9b58b2a
Share freeze option handling 2021-06-28 10:53:37 +09:00
Nobuyoshi Nakada e724857f42
Show leaked file descriptors only, without cwd, txt, and so on 2021-06-27 21:17:58 +09:00
Nobuyoshi Nakada 3839a8fe79
Narrow the tracing of object allocations to during each test 2021-06-27 21:13:51 +09:00
Nobuyoshi Nakada 13939d61b4
Check if closed after each yield [Bug #17661] 2021-06-27 11:18:41 +09:00
Takashi Kokubun 35c7e83bb3 [ruby/irb] Optimize show_source command further
https://github.com/ruby/irb/pull/249 actually slowed down how `code` is
concatenated. The original way of creating `code` is faster.

[before]
    user     system      total        real
2.420137   0.005364   2.425501 (  2.426264)

[after]
    user     system      total        real
1.000221   0.007454   1.007675 (  1.008295)

Theoretically, this implementation might skip lines that don't appear in
Ripper tokens, but this assumes such lines don't impact whether the code
passes compilation or not. At least normal blank lines seem to have an
`on_ignored_nl` token anyway though.

https://github.com/ruby/irb/commit/27dd2867cd
2021-06-27 10:52:49 +09:00
Masataka Pocke Kuwabara 6eb7c663c6 [ruby/irb] Improve performance of `show_source` for large class
https://github.com/ruby/irb/commit/2b79e9ad21
2021-06-27 10:36:11 +09:00
Nobuyoshi Nakada bf789af28a
Added macros for days in month 2021-06-27 08:37:45 +09:00
Nobuyoshi Nakada 1fd8b6f2b9
Shrink monthly tables 2021-06-27 08:37:42 +09:00
git b1428b279f * 2021-06-27 [ci skip] 2021-06-27 04:32:56 +09:00
Jeremy Evans e86c1f6fc5
Work around issue transcoding issue with non-ASCII compatible encodings and xml escaping
When using a non-ASCII compatible source and destination encoding
and xml escaping (the :xml option to String#encode), the resulting
string was broken, as it used the correct non-ASCII compatible
encoding, but contained data that was ASCII-compatible instead of
compatible with the string's encoding.

Work around this issue by detecting the case where both the
source and destination encoding are non-ASCII compatible, and
transcoding the source string from the non-ASCII compatible
encoding to UTF-8. The xml escaping code will correctly handle
the UTF-8 source string and the return the correctly encoded
and escaped value.

Fixes [Bug #12052]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-06-26 12:32:39 -07:00
Nobuyoshi Nakada 391abc543c
Scan the coderange in the given encoding 2021-06-26 16:05:15 +09:00
Yusuke Endoh 457a4913be Disable RBIMPL_ATTR_DEPRECATED for Coverity Scan build
Coverity Scan emulates gcc but seems not to support this attribute
correctly.
2021-06-26 02:30:23 +09:00
git c86f03be55 * 2021-06-26 [ci skip] 2021-06-26 00:15:38 +09:00
Yusuke Endoh 68e1dc5172 iseq.c: Make ast_line_count return 0 when syntax error occurred
This broke coverage CI

```
  1) Failure:
TestRequire#test_load_syntax_error [/home/runner/work/actions/actions/ruby/test/ruby/test_require.rb:228]:
Exception(SyntaxError) with message matches to /unexpected/.
[SyntaxError] exception expected, not #<TypeError: no implicit conversion of false into Integer>.
```
https://github.com/ruby/actions/runs/2914743968?check_suite_focus=true
2021-06-26 00:15:16 +09:00
aycabta 5ffb313ccc Revert "Revert "[ruby/reline] Fix failed test""
I'm so sorry, the previous revert was just a mistake.

This reverts commit 9103c3ba8b.
2021-06-25 18:56:46 +09:00
aycabta 9103c3ba8b Revert "[ruby/reline] Fix failed test"
This reverts commit 491591c7cee842601118efc2698e0e41283827b3.
2021-06-25 17:42:45 +09:00
Samuel Williams bf376cae0c [ruby/reline] Fix missing require.
https://github.com/ruby/reline/commit/010b28dfe9
2021-06-25 17:42:45 +09:00
Samuel Williams e788481843 [ruby/reline] Avoid using blocking `IO.select`.
https://github.com/ruby/reline/commit/de94746393
2021-06-25 17:42:45 +09:00
ima1zumi d340b091a8 [ruby/reline] Fix failed test
For ruby/ruby repository's AppVeyor CI (Windows environment), `Reline::IOGate.encoding` will be changed from `UTF-8` to `Windows-31J` after the test is run.
So, when `test/reline/test_key_actor_emacs.rb` is loaded, `Reline::IOGate.encoding == Encoding::UTF_8` will be `true`,
but at the time of test execution, `Reline::IOGate.encoding` is `Windows-31J`.
For this reason, I changed the test method to check `Reline::IOGate.encoding` in the test method.

https://github.com/ruby/reline/commit/10e1ce3320
2021-06-25 17:42:45 +09:00
Hiroshi SHIBATA b048fd572a
Followed up 66d2fc7989 2021-06-25 17:27:17 +09:00
Aaron Patterson b036a44e57
[ruby/racc] Remove Object monkey patch
I don't think we need this monkey patch anymore, so lets remove it!

https://github.com/ruby/racc/commit/464485e912
2021-06-25 17:26:27 +09:00
Hiroshi SHIBATA 7641a83d1f
[ruby/racc] Removed needless condition for old versions of RubyGems.
https://github.com/ruby/racc/commit/fe3183b1ff
2021-06-25 17:26:27 +09:00
Hiroshi SHIBATA dd0a9507a2
[ruby/racc] Drop to support Ruby 2.4
https://github.com/ruby/racc/commit/5af1a42a3b
2021-06-25 17:26:27 +09:00
Hiroshi SHIBATA 77c1f6b1ec
[ruby/racc] Followed up #162
https://github.com/ruby/racc/commit/d66cd12166
2021-06-25 17:26:27 +09:00
Jean Boussier 71344a1d63 [ruby/racc] Stop compressing integer lists
It is unclear why this was implemented, I assume
it was for performance back in 2006.

However today, this compression defeats bytecode caching
entirely and end up being counter productive.

https://github.com/ruby/racc/commit/ae3703c1d0
2021-06-25 17:23:06 +09:00
Jeremy Evans be230615d0 Remove shift of ep when computing Proc#hash
The shift was causing far fewer unique values of hash than expected.

Fix pointed out by xtkoba (Tee KOBAYASHI)

Fixes [Bug #17951]
2021-06-24 12:25:33 -07:00
git 3ab68b910f * 2021-06-25 [ci skip] 2021-06-25 04:22:30 +09:00
Jeremy Evans a2592702ae Actually ignore FNM_CASEFOLD flag in Dir.glob
This was already documented as being ignored, but it wasn't being
ignored, causing an issue in a particular case where a UTF-8
pattern was provided and a filename was tested that wasn't valid
UTF-8.

Fixes [Bug #14456]
2021-06-24 12:22:09 -07:00
Nobuyoshi Nakada 189f154786
[DOC] fixed return value of ENV.clone [ci skip] 2021-06-24 21:53:59 +09:00