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

17551 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA b17ae88894
[flori/json] skip TruffleRuby
https://github.com/flori/json/commit/bab704eb49
2023-10-11 15:45:17 +09:00
Hiroshi SHIBATA e42df781d9
[flori/json] define_method is also private at Ruby 2.3 and 2.4
https://github.com/flori/json/commit/3804f38bf4
2023-10-11 15:45:17 +09:00
Hiroshi SHIBATA 1b19e9198d
[flori/json] remove_method of Module is private at Ruby 2.3 and 2.4
https://github.com/flori/json/commit/6cbadf6b6e
2023-10-11 15:45:17 +09:00
Hiroshi SHIBATA 40ab7b8c24
Skip test_bug_13526 with High Sierra 2023-10-11 13:46:58 +09:00
Haldun Bayhantopcu 7eccc13c1f [ruby/prism] Emit error when assigning to a numbered parameter
https://github.com/ruby/prism/commit/66248ac2f6
2023-10-06 14:10:28 +00:00
Matt Valentine-House 7db4ce13ed [ruby/prism] Introduce transparent scopes.
A transparent scope is a scope that cannot have local variables added to
it's local table. When a local is added to it's table, it instead gets
added to the first non-transparent parent scope.

This is used in for loops to ensure the correct depth for local
variables inside the body

https://github.com/ruby/prism/commit/ddb8e82253

Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
2023-10-06 12:21:03 +00:00
Nobuyoshi Nakada 723318f5d7 [ruby/openssl] Exact checks with `assert_include`
Where `assert_match` converts string matcher argument to regexp first
with escaping, `assert_include` does the same thing simpler.

https://github.com/ruby/openssl/commit/81007e0a49
2023-10-06 09:45:20 +00:00
Nobuyoshi Nakada 95ced6d8d2 [ruby/openssl] Exact checks with `assert_include`
https://github.com/ruby/openssl/commit/9a6e24daaf
2023-10-06 07:37:52 +00:00
Nobuyoshi Nakada b459bca0a6 Use size of `uintptr_t` for `j` and `J` tests
`RbConfig::SIZEOF` has been added later than the time this check was
committed first.
2023-10-06 16:33:44 +09:00
Nobuyoshi Nakada 0202ca7cfc Move rbconfig to the top
It is required in the always defined class level.
2023-10-06 16:33:44 +09:00
Vinicius Stock 69b024d7cc [ruby/prism] Add full_name to ConstantPathNode and ConstantPathTargetNode
https://github.com/ruby/prism/commit/b390553028
2023-10-06 01:57:34 +00:00
Haldun Bayhantopcu 8d8fe54355 [ruby/prism] Check for duplicate parameter names in destructured params
https://github.com/ruby/prism/commit/c3438aabea
2023-10-05 16:35:45 +00:00
Haldun Bayhantopcu 38cb92a00c [ruby/prism] Check for duplicate names in shadow args
https://github.com/ruby/prism/commit/e100c6b8ae
2023-10-05 15:12:05 +00:00
Haldun Bayhantopcu fb9795cf7a [ruby/prism] Fix parsing shadow args in lambda blocks
https://github.com/ruby/prism/commit/53efaf252d
2023-10-05 11:25:32 +00:00
Jean byroot Boussier f087f2c74c [ruby/stringio] StringIO#pread: handle 0 length like IO#pread
(https://github.com/ruby/stringio/pull/67)

Fix: https://github.com/ruby/stringio/issues/66

If length is 0, IO#pread don't even try to read the IO, it simply return
the buffer untouched if there is one or a new empty buffer otherwise.

It also doesn't validate the offset when length is 0.

cc @jdelStrother @kou

https://github.com/ruby/stringio/commit/37e9279337

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-10-05 07:44:08 +00:00
Brian Hawley 9d58f93828 [ruby/net-http] Net::HTTPResponse nil checking
Fix nil handling in read_body and stream_check.

Fixes: #70

https://github.com/ruby/net-http/commit/36f916ac18
2023-10-05 07:11:52 +00:00
Matt Valentine-House 05b9b58d55 [Prism] Fix IfNode and ElseNode
ElseNode looks to have been implemented at the same time as IfNode, but
was resulting in a stack underflow error.

The following is from the test code

```
if foo
  bar
end
```

```
❯ make run
compiling compile.c
linking miniruby
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
CRUBY: **************************************************
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,19)>
0000 putself                                                          (   2)[Li]
0001 opt_send_without_block                 <calldata!mid:foo, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 branchunless                           9
0005 putself
0006 opt_send_without_block                 <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0008 pop
0009 putobject_INT2FIX_1_
0010 leave
PRISM: **************************************************
-- raw disasm--------
   0000 putself                                                          (   2)
   0001 send                 <calldata:foo, 0>, nil                      (   2)
   0004 branchunless         <L001>                                      (   2)
   0006 jump                 <L000>                                      (   2)
 <L000> [sp: 0]
*  0008 pop                                                              (   1)
   0009 putself                                                          (   2)
   0010 send                 <calldata:bar, 0>, nil                      (   2)
   0013 pop                                                              (   2)
   0014 jump                 <L002>                                      (   1)
 <L001> [sp: 0]
 <L002> [sp: -1]
   0016 putobject            1                                           (   2)
   0018 leave                                                            (   1)
---------------------
<compiled>: <compiled>:1: argument stack underflow (-1) (SyntaxError)
make: *** [run] Error 1
```

This commit fixes the stack underflow error for both IfNode and ElseNode
and introduces tests for them.
2023-10-04 13:53:31 -04:00
Kouhei Yanagita 6ae2996e29
Optimize `Range#count` by using `range_size` if possible 2023-10-05 00:19:55 +09:00
Stan Lo b43cc51dca [ruby/irb] Clear all context usages in RubyLex
(https://github.com/ruby/irb/pull/684)

After this change, `RubyLex` will not interact with `Context` directly
in any way. This decoupling has a few benefits:

- It makes `RubyLex` easier to test as it no longer has a dependency on
  `Context`. We can see this from the removal of `build_context` from
  `test_ruby_lex.rb`.
- It will make `RubyLex` easier to understand as it will not be affected
  by state changes in `Context` objects.
- It allows `RubyLex` to be used in places where `Context` is not available.

https://github.com/ruby/irb/commit/d5b262a076
2023-10-04 12:13:33 +00:00
Josef Šimánek 0046c67dd8
[rubygems/rubygems] Fix typo: eglible -> eligible.
https://github.com/rubygems/rubygems/commit/1e487e1337
2023-10-03 16:13:18 +09:00
Kosuke Shibata 2325e1cd81
[ruby/csv] Add CSV::InvalidEncodingError
(https://github.com/ruby/csv/pull/287)

To handle encoding errors in CSV parsing with the appropriate error
class

https://github.com/ruby/csv/commit/68b44887e5
2023-10-03 16:13:18 +09:00
Takashi Kokubun 492e9437dd
YJIT: Fix assert_no_exits (#8579) 2023-10-02 14:09:51 -07:00
Nobuyoshi Nakada 9059dfce12
`yield` cannot be placed outside methods even in blocks 2023-10-02 23:20:03 +09:00
Benoit Daloze 87dad067e0 Sync with prism CallNode#name changes
* https://github.com/ruby/prism/pull/1533
2023-10-02 09:18:56 -04:00
Charles Oliver Nutter 5c501bcbdb [ruby/psych] Add test for code_point_limit
Only supported on JRuby currently.

https://github.com/ruby/psych/commit/0c1754eefe
2023-10-02 11:47:35 +09:00
Nobuyoshi Nakada ec3d81629f
[Bug #19906] Add the test 2023-10-01 23:58:24 +09:00
Nobuyoshi Nakada b0d7935e80
Move repeating `matches` and `unmatches` to keyword arguments
And default to the corresponding instance variables.
2023-10-01 18:55:58 +09:00
Nobuyoshi Nakada 3ae44035dd
Add tests for Unicode age property 15.0 2023-10-01 18:23:49 +09:00
tomoya ishida c9e28ea2f9 [ruby/irb] Fix Reline's test failure running with `make test-all
TESTS='reline irb'`
(https://github.com/ruby/irb/pull/722)

* Specify TestInputMethod in test to avoid RelineInputMethod to be used

* Reset Reline in teardown to avoid test failure of `make test-all TESTS="irb reline"`

https://github.com/ruby/irb/commit/5d67967eb1
2023-09-30 17:56:06 +00:00
Josef Šimánek 4cf68908e5 [rubygems/rubygems] Update SPDX list and warn on deprecated identifiers.
https://github.com/rubygems/rubygems/commit/61667028f5
2023-09-30 11:20:08 +00:00
Nobuyoshi Nakada 94e79e4c2d
Fix failures when all network interfaces are down 2023-09-30 19:03:04 +09:00
Takashi Kokubun 0b67e3fd3e
YJIT: Chain-guard opt_mult overflow (#8554)
* YJIT: Chain-guard opt_mult overflow

* YJIT: Support regenerating Jo after Mul
2023-09-29 21:55:48 -04:00
Jun Aruga 7278747d08 [ruby/zlib] Revert "Workaround: Fix test failures on Ubuntu jammy s390x."
This reverts commit https://github.com/ruby/zlib/commit/9f3b9c470c05 because we will
fix the issue on alternative way.

https://github.com/ruby/zlib/commit/3dfe3f9110
2023-09-29 16:14:29 +00:00
Kevin Newton 2e25289aee Handle static array nodes 2023-09-29 09:51:23 -04:00
Kevin Newton 38e3cafe62 Compile implicit nodes 2023-09-29 09:51:23 -04:00
Kevin Newton 396042a25c Fix up static hash compilation 2023-09-29 09:51:23 -04:00
Nobuyoshi Nakada 01c7656775
Fix to replace only `-e` that is a path name in `assert_crash_report` 2023-09-29 17:43:14 +09:00
Jean byroot Boussier f14cee39b8 [ruby/ostruct] Emit a performance warning when OpenStruct is used
(https://github.com/ruby/ostruct/pull/56)

The OpenStruct documentation clearly state that it shouldn't
be used when performance is expected.

Ruby 3.3 introduce a new category of warnings that is silenced
by default: performance.

The expected use case is to enable this warning when looking
for potential performance issues within an application.

As such I think it would make sense to emit a performance warning
when OpenStruct is used, as it may help pinpoint that a dependency
rely on it, etc.

https://github.com/ruby/ostruct/commit/5826e12db8

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-09-29 06:48:55 +00:00
Kevin Newton b1a28b05db Support local variable targeting in pattern matching 2023-09-28 15:13:09 -04:00
Kevin Newton 41d3e23582 Support the AlternationPatternNode 2023-09-28 15:13:09 -04:00
Kevin Newton 6e88a56f63 Compile basic pattern matching expressions 2023-09-28 15:13:09 -04:00
Nobuyoshi Nakada eaa0fbf9b9 Fix `retry` in nested `rescue` blocks
Restore `rescue`-context from the outer context.
`retry` targets the next outer block except for between `rescue` and
`else` or `ensure`, otherwise, if there is no enclosing block, it
should be syntax error.
2023-09-29 03:14:17 +09:00
Kevin Newton 5a376f0f71 Consolidate regexp options, interpolated match last line 2023-09-28 14:11:34 -04:00
Aaron Patterson d3574c117a Move IO#readline to Ruby
This commit moves IO#readline to Ruby.  In order to call C functions,
keyword arguments must be converted to hashes.  Prior to this commit,
code like `io.readline(chomp: true)` would allocate a hash.  This
commits moves the keyword "denaturing" to Ruby, allowing us to send
positional arguments to the C API and avoiding the hash allocation.

Here is an allocation benchmark for the method:

```
x = GC.stat(:total_allocated_objects)
File.open("/usr/share/dict/words") do |f|
  f.readline(chomp: true) until f.eof?
end
p ALLOCATIONS: GC.stat(:total_allocated_objects) - x
```

Before this commit, the output was this:

```
$ make run
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
{:ALLOCATIONS=>707939}
```

Now it is this:

```
$ make run
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
{:ALLOCATIONS=>471962}
```

[Bug #19890] [ruby-core:114803]
2023-09-28 10:43:45 -07:00
Matt Valentine-House 414c781158 [YARP] Implement MatchWriteNode 2023-09-28 16:51:30 +01:00
Kevin Newton f4580ce95c
Fix order-dependent tests in test_compile_prism 2023-09-28 10:23:12 -04:00
tomoya ishida d4942546af [ruby/reline] Properly restore Reline::IOGate in test teardown
(https://github.com/ruby/reline/pull/593)

* Properly restore Reline::IOGate in test teardown

* GeneralIO.reset should reset class variable existence

https://github.com/ruby/reline/commit/c16d33dae5
2023-09-28 13:53:30 +00:00
Kevin Newton a213d21448 Move CRuby-specific prism files to top level 2023-09-28 09:44:16 -04:00
Haldun Bayhantopcu 834560a923 [ruby/prism] Check whether the predicate is closed for conditionals
https://github.com/ruby/prism/commit/bf43006d0a
2023-09-28 13:32:02 +00:00
Haldun Bayhantopcu 7799fe90da [ruby/prism] Check for a semicolon or a newline after the inheritance operator
https://github.com/ruby/prism/commit/0326ba6775
2023-09-28 13:31:22 +00:00