Commit graph

66813 commits

Author SHA1 Message Date
Yusuke Endoh
8ccc257434 Add the gemspec for error_highlight 2021-06-30 14:02:28 +09:00
Yusuke Endoh
b270b5df2c Prevent "warning: ambiguity between regexp and two divisions" 2021-06-30 13:41:18 +09:00
Yusuke Endoh
6c6b128c67 [ruby/error_highlight] Bump version
8d483c251e
2021-06-30 13:36:31 +09:00
Yusuke Endoh
ca4e5b1eb3 [ruby/error_highlight] Reconsider the API of ErrorHighlight.spot
acb2046a82
2021-06-30 12:49:27 +09:00
Yusuke Endoh
f428ced69c [ruby/error_highlight] Experimentally support a custom formatter
f40a1de20e
2021-06-30 12:49:18 +09:00
Yusuke Endoh
db7e9b1aac [ruby/error_highlight] Add some comments
e0c90c72c3
2021-06-30 11:46:47 +09:00
Yusuke Endoh
3391682eda tool/sync_default_gems.rb: remove unneeded code for error_highlight sync 2021-06-30 11:39:39 +09:00
Yusuke Endoh
393f84da4a tool/sync_default_gems.rb: Add error_highlight gem 2021-06-30 10:56:59 +09:00
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.

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?.

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`.

8352c154e3
2021-06-29 15:49:51 +09:00
Nobuyoshi Nakada
4670458af8 Should require "rbconfig" to use RbConfig
fbe5aaaae8
2021-06-29 15:49:51 +09:00
Yuki Nishijima
8356d9e374 Start v1.6.0 development
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.

27dd2867cd
2021-06-27 10:52:49 +09:00
Masataka Pocke Kuwabara
6eb7c663c6 [ruby/irb] Improve performance of show_source for large class
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>.
```
2914743968
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.
010b28dfe9
2021-06-25 17:42:45 +09:00
Samuel Williams
e788481843 [ruby/reline] Avoid using blocking IO.select.
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.

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!

464485e912
2021-06-25 17:26:27 +09:00