Commit graph

16449 commits

Author SHA1 Message Date
Vladimir Dementyev
1b89b99941
Mark pattern labels as unremoveable
Peephole optimization doesn't play well with find pattern at
least. The only case when a pattern matching could have
unreachable patterns is when we have lasgn/dasgn node, which
shouldn't happen in real-life.

Fixes https://bugs.ruby-lang.org/issues/17534
2021-01-19 08:34:01 +09:00
Takashi Kokubun
9d1475c621
Fix JIT link failures
forgotten in https://github.com/ruby/ruby/pull/4018
2021-01-18 14:52:33 -08:00
Nobuhiro IMAI
166f33d0d1 [ruby/irb] skip a failling test on TruffleRuby
* due to the difference of backtrace pointed out by @aycabta

5e00a0ae61
2021-01-18 02:13:01 +09:00
Nobuhiro IMAI
d290a02bd7 [ruby/irb] handle repeated exception separately
fcf6b34bc5
2021-01-18 02:12:53 +09:00
Nobuhiro IMAI
3f0b4665df [ruby/irb] handle __ENCODING__ as a keyword as well
a6a33d908f
2021-01-18 02:12:43 +09:00
aycabta
f3156e457d [ruby/reline] Windows needs more times to wait rendering
53ff2b09c7
2021-01-18 02:09:34 +09:00
aycabta
9279d3f255 [ruby/reline] Tests with yamatanooroti don't need chdir
Because of chdir, log files ware created in temporary directries on Windows.

200b469a68
2021-01-18 02:08:41 +09:00
Nobuyoshi Nakada
f96eaf54a2
Use the dedicated assertion 2021-01-17 21:55:48 +09:00
Takashi Kokubun
8d099aa040
Warn Struct#initialize with only keyword args (#4070)
* Warn Struct#initialize with only keyword args

A part of [Feature #16806]

* Do not warn if `keyword_init: false`

is explicitly specified

* Add a NEWS entry

* s/in/from/

* Make sure all fields are initialized
2021-01-17 01:35:54 -08:00
manga_osyo
b84b253a69 Fix Ripper with heredoc. 2021-01-17 12:58:13 +09:00
Kenta Murata
b130644584 [ruby/bigdecimal] Fix for the coerce cases in divide and DoDivmod
1cb92487f7
2021-01-16 00:09:26 +09:00
Nobuyoshi Nakada
0d57d59933 Keep encoding in the result of File.expand_path [Bug #17517] 2021-01-15 17:46:48 +09:00
Jeremy Evans
e09094546a Make Module#prepend affect ancestor chain even if argument already included in receiver
Previously, if a class included a module and then prepended the
same module, the prepend had no effect.  This changes the behavior
so that the prepend has an effect unless the module is already
prepended the receiver.

While here, rename the origin_seen variable in include_modules_at,
since it is misleading. The variable tracks whether c has been seen,
not whether the origin of klass has been.

Fixes [Bug #17423]
2021-01-14 20:43:30 -08:00
Takashi Kokubun
e1fee7f949
Rename RubyVM::MJIT to RubyVM::JIT
because the name "MJIT" is an internal code name, it's inconsistent with
--jit while they are related to each other, and I want to discourage future
JIT implementation-specific (e.g. MJIT-specific) APIs by this rename.

[Feature #17490]
2021-01-13 22:46:51 -08:00
Aaron Patterson
efcdf68e64 Guard callinfo
Callinfo was being written in to an array and the GC would not see the
reference on the stack.  `new_insn_send` creates a new callinfo object,
then it calls `new_insn_core`.  `new_insn_core` allocates a new INSN
linked list item, which can end up calling `xmalloc` which will trigger
a GC:

  70cd351c7c/compile.c (L968-L969)

Since the callinfo object isn't on the stack, the GC won't see it, and
it can get collected.  This patch just refactors `new_insn_send` to keep
the object on the stack

Co-authored-by: John Hawthorn <john@hawthorn.email>
2021-01-13 16:13:53 -08:00
Nobuyoshi Nakada
0036648a42
Capture to reserved name variables if already defined [Bug #17533] 2021-01-13 21:16:00 +09:00
Nobuyoshi Nakada
e9b93d67ba
Positional and keyword arguments for timezone are exclusive
[Feature #17485]
2021-01-13 18:37:36 +09:00
Nobuyoshi Nakada
4b15caee8f
Added in: timezone option to Time.new [Feature #17485] 2021-01-13 18:15:50 +09:00
Nobuyoshi Nakada
6f6dfdcc68 Make warning values consistent [Bug #17523]
They should be affected, as well as `$VERBOSE`, by `-w`/`-W`
options, not only in the main script but in scripts loaded by `-r`
option too.
2021-01-13 18:12:49 +09:00
Nobuyoshi Nakada
85b5d4c8bf Revert "[Bug #11213] let defined?(super) call respond_to_missing?"
This reverts commit fac2498e02 for
now, due to [Bug #17509], the breakage in the case `super` is
called in `respond_to?`.
2021-01-13 18:11:46 +09:00
Nobuyoshi Nakada
9441f3f970 Allow UTC offset without colons per ISO-8601 [Bug #17504] 2021-01-13 16:37:59 +09:00
Marc-Andre Lafortune
f48edc28dd Fix method protection for modules in the ancestry chain.
[Fixes ruby/ostruct#23]
2021-01-12 23:29:39 -05:00
Kenta Murata
a5b4b806de
[ruby/bigdecimal] Allow digits=0 in BigDecimal(flt) and Float#to_d
Using dtoa of mode=0, we can determine the number of digits in decimal that is
necessary to represent the given Float number without errors.

This change permits digits=0 in BigDecimal(flt) and Float#to_d, and these
methods use dtoa of mode=0 when the given digits is 0.

Internal implicit conversion from Float also uses digits=0.

[Fix GH-70]

2dbe170e35
2021-01-13 11:49:18 +09:00
Hiroshi SHIBATA
30f1316401
Skip test when UDP server is no response. 2021-01-13 11:27:30 +09:00
Kenta Murata
2175c2c957 [ruby/bigdecimal] Use pre-allocated objects for special values
95c201f2d3
2021-01-13 01:58:23 +09:00
Kenta Murata
6670de82c2
[ruby/bigdecimal] Fix exception message raised in Kernel.BigDecimal
d163f170a4
ff8eeeb064
2021-01-13 01:27:04 +09:00
aycabta
eb5a094fc0 [ruby/reline] Move the cursor correctly when deleting at eol
This fixes ruby/reline#246.

07a73ba601
2021-01-13 01:12:54 +09:00
aycabta
44817db28b [ruby/reline] Handle ed_search_{prev,next}_history in multiline correctly
The current line was being handled incorrectly when displaying the hit
history, so it has been fixed to be correct.

a3df4343b3
2021-01-13 01:12:54 +09:00
Hiroshi SHIBATA
0dc95266e8
Fix the failing test with XDG_CONFIG_HOME 2021-01-12 20:15:18 +09:00
Nobuyoshi Nakada
7dc0511ea4 Remove "." and ".." from Dir.glob with FNM_DOTMATCH [Bug #17280]
Co-authored-by: Jeremy Evans <code@jeremyevans.net>
2021-01-12 20:02:43 +09:00
Nobuyoshi Nakada
1eb8eb55c2
Convert time component strings to integers more strictly
https://bugs.ruby-lang.org/issues/17485#change-89871
2021-01-12 17:24:43 +09:00
Nobuyoshi Nakada
b017848f8a
Show seconds of utc_offset if not zero 2021-01-12 17:00:14 +09:00
Nobuyoshi Nakada
480f436dac
Suppress constant redefinition warnings 2021-01-11 00:33:26 +09:00
Nobuyoshi Nakada
590dc06e38 Get rid of defining methods for tests in core classes
Not to interfere in other tests.
2021-01-09 22:38:06 +09:00
Kenta Murata
89f3125207 [ruby/bigdecimal] Add test cases of conversion from Float
28d3836366
2021-01-09 20:35:08 +09:00
Nobuhiro IMAI
7ff0e93f96
parse.y: handle "duplicated argument name" appropriately on ripper.y
refs: 733ed1e184
2021-01-09 13:33:33 +09:00
Takashi Kokubun
98bd7e87a0 [ruby/irb] Make IRB::ColorPrinter.pp compatible with PP.pp
The incompatible interface is not helpful, again if you want to use it
as a standalone library, falling it back to PP.

Original PP.pp also ends with `out << "\n"`.

4c74c7d84c
2021-01-07 22:43:40 -08:00
Koichi Sasada
d4b7e967b6 should use assert_include here.
Random ordering test can introduce antoher candidate so it should be
`assert_include`.
2021-01-08 14:44:26 +09:00
aycabta
01235f800f [ruby/reline] Suppress auto indent for adding newlines in pasting
Co-authored-by: Juanito Fatas <me@juanitofatas.com>

074bb017a7
2021-01-08 13:25:18 +09:00
aycabta
76c9a3c8c6 [ruby/reline] Suppress crashing when dynamic_prompt_proc returns a broken prompt list
Co-authored-by: Juanito Fatas <me@juanitofatas.com>

558f7be168
2021-01-08 13:25:18 +09:00
aycabta
88af5085db [ruby/reline] Suppress crashing when auto_indent_proc returns broken indent info
Co-authored-by: Juanito Fatas <me@juanitofatas.com>

7c24276275
2021-01-08 13:25:18 +09:00
aycabta
e356b71d35 [ruby/reline] Remove debug print
d7fbaedc6a
2021-01-08 13:25:18 +09:00
aycabta
ea75aed98e [ruby/reline] Correct var names in Reline were different from vi-*-mode-string
8255fc93b9
2021-01-08 13:25:18 +09:00
aycabta
54c1dcba2b [ruby/reline] Update cursor correctly when just cursor moving
This fixes ruby/reline#236 and ruby/reline#239.

3e3c89d00b
2021-01-08 13:25:18 +09:00
aycabta
111fddd543 [ruby/irb] Fix BACK_TRACE_LIMIT logic
30dc5d43fe
2021-01-08 13:25:18 +09:00
aycabta
917050220a [ruby/irb] Use Exception#full_message to show backtrace in the correct order
[Bug #17466]

1c76845cca
2021-01-08 13:25:18 +09:00
Nobuhiro IMAI
ed3264d37a [ruby/irb] refactoring an error handling in IRB::Inspector
* moved rescue clause to `#inspect_value` to catch all failures in inspectors
* test with all (currently five kind of) inspect modes
  - tweaked the input due to only `Marshal` can inspect(dump) a `BasicObject`

9d112fab8e
2021-01-08 13:25:18 +09:00
Nobuhiro IMAI
f594775230 [ruby/irb] do not escape a predicate method for doc namespace
* Fixes #88

d431a30af4
2021-01-08 13:25:18 +09:00
Kenta Murata
82f6085b3e [ruby/bigdecimal] Fix trailing zero handling in rb_uint64_convert_to_BigDecimal
2056604d56
2021-01-07 10:20:40 +09:00
Kenta Murata
698d7947c3 [ruby/bigdecimal] Include TestBigDecimalBase in TestBigDecimalUtil
f732201df1
2021-01-07 10:19:46 +09:00