aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
Commit message (Collapse)AuthorAgeFilesLines
* Make prepending a refined module after inclusion not break refinementsJeremy Evans2019-11-281-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | After the previous commit, this was still broken. The reason it was broken is that a refined module that hasn't been prepended to yet keeps the refined methods in the module's method table. When prepending, the module's method table is moved to the origin iclass, and then the refined methods are moved from the method table to a new method table in the module itself. Unfortunately, that means that if a class has included the module, prepending breaks the refinements, because when the methods are moved from the origin iclass method table to the module method table, they are removed from the method table from the iclass created when the module was included earlier. Fix this by always creating an origin class when including a module that has any refinements, even if the refinements are not currently used. I wasn't sure the best way to do that. The approach I choose was to use an object flag. The flag is set on the module when Module#refine is called, and if the flag is present when the module is included in another module or class, an origin iclass is created for the module. Fixes [Bug #13446]
* Honor refinements for modules that prepend other modulesJeremy Evans2019-11-281-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This previously did not work, and the reason it did not work is that: 1) Refining a module or class that prepends other modules places the refinements in the class itself and not the origin iclass. 2) Inclusion of a module that prepends other modules skips the module itself, including only iclasses for the prepended modules and the origin iclass. Those two behaviors combined meant that the method table for the refined methods for the included module never ends up in the method lookup chain for the class including the module. Fix this by not skipping the module itself when the module is included. This requires some code rearranging in rb_include_class_new to make sure the correct method tables and origin settings are used for the created iclass. As origin iclasses shouldn't be exposed to Ruby, this also requires skipping modules that have origin iclasses in Module#ancestors (classes that have origin iclasses were already skipped). Fixes [Bug #16242]
* Raise `NoMatchingPatternError` when expr `in` pat doesn't matchNobuyoshi Nakada2019-11-281-1/+4
| | | | | | | | * `expr in pattern` should raise `NoMatchingError` when unmatched * `expr in pattern` should return `nil`. (this is unspecified, but this feature is experimental, at all) [Feature #16355]
* Don't modify rest array when using ruby2_keywordsJeremy Evans2019-11-271-0/+9
| | | | | | Previously, the rest array was modified, but it turns out that is not necessary. Not modifying the rest array fixes cases when the rest array is used more than once.
* Skip test_validate_gemspec when tarball and git installed tooKazuhiro NISHIYAMA2019-11-231-1/+1
| | | | | | `git --version` failed as expected when git is not installed, but unexpectedly pass when git installed and pwd is not in git working directory. So use `git rev-parse` instead, and it failed when git installed too.
* Refined inspection of argument forwardingNobuyoshi Nakada2019-11-211-2/+4
|
* Add tests of argument forwarding's parameters and inspectKazuhiro NISHIYAMA2019-11-201-0/+5
|
* Update representation (discussed on ruby tracker)zverok2019-11-201-20/+20
|
* Fix test_module.rbzverok2019-11-201-1/+1
|
* Method parameters inspectzverok2019-11-201-6/+63
| | | | | | | | | Example: def m(a, b=nil, *c, d:, e: nil, **rest, &block) end p method(:m) #=> #<Method: m(a, b=<default>, *c, d:, e: <default>, **rest, &block) ...>
* Fix memory corruption in Enumerable#reverse_each [ruby-dev:50867] [Bug #16354]Kazuki Tsujimoto2019-11-191-0/+13
|
* Avoid needless object allocationKazuki Tsujimoto2019-11-192-1/+3
|
* Add a testKazuhiro NISHIYAMA2019-11-191-3/+23
| | | | | | and rename from b.rb [ruby-core:95055] [Bug #16177]
* pack is not using invokebuiltin anymoreTakashi Kokubun2019-11-181-6/+3
|
* catch up last commit.Koichi Sasada2019-11-181-1/+1
| | | | Array#pack uses `opt_invokebuiltin_delegate_leave` now.
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-1823-484/+51
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-187-106/+0
| | | | | | | | | | | | | | | | | This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd.
* `#@1` is no longer an embedded variableNobuyoshi Nakada2019-11-141-0/+1
|
* test/ruby/test_proc.rb: suppress "method redefined" warningsYusuke Endoh2019-11-141-1/+4
|
* Suspend many fibers test on JIT for nowTakashi Kokubun2019-11-131-0/+1
| | | | | | | | https://github.com/ruby/ruby/runs/301411717 No C backtrace information and this is hard to fix immediately. As CI doesn't provide helpful information, this should be debugged locally or at least have more logs there.
* Skip tailcall test for MJITTakashi Kokubun2019-11-121-0/+1
| | | | failing in https://github.com/ruby/ruby/runs/300579218
* Avoid top-level search for nested constant reference from nil in defined?Dylan Thacker-Smith2019-11-131-0/+5
| | | | | | | | | | | | Fixes [Bug #16332] Constant access was changed to no longer allow top-level constant access through `nil`, but `defined?` wasn't changed at the same time to stay consistent. Use a separate defined type to distinguish between a constant referenced from the current lexical scope and one referenced from another namespace.
* Show the name `Kernel#proc` in the warning messageNobuyoshi Nakada2019-11-121-2/+7
|
* Added assertions for realpath and realdirpathNobuyoshi Nakada2019-11-121-0/+6
| | | | | It is said that realpath(3) and realdirpath(3) on some platforms may return a relative path.
* Revert "Method reference operator"Nobuyoshi Nakada2019-11-125-64/+3
| | | | | This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b. [Feature #16275]
* Warn on `...` at EOLNobuyoshi Nakada2019-11-121-0/+7
|
* Clear current argument name at empty block argument [Bug #16343]Nobuyoshi Nakada2019-11-121-0/+20
|
* test/ruby/test_require.rb: Remove the tests of require with $SAFEYusuke Endoh2019-11-121-55/+0
| | | | | | | | | | The taint mechanism is decided to be removed at 2.7. [Feature #16131] So, this change removes the tests that expects a SecurityError when requiring a file under $SAFE >= 1. The reason why they should be removed in advance is because the upstream of rubygems has already removed a call to "untaint" method, which makes the tests fail.
* Skip test_validate_gemspec unless git installedKazuhiro NISHIYAMA2019-11-111-0/+1
|
* Revert "Warn EOF char in comment"NARUSE, Yui2019-11-112-15/+0
| | | | This reverts commit 69ec3f70fab0c1c537c68fb135cc315181b1d750.
* Revert "Elaborated EOF char message a little"NARUSE, Yui2019-11-112-4/+4
| | | | This reverts commit 6eaac7cfac668d6669be694fd7b723c4982ed218.
* Elaborated EOF char message a littleNobuyoshi Nakada2019-11-112-4/+4
|
* Warn EOF char in commentNobuyoshi Nakada2019-11-112-0/+15
|
* Fixed embedded document with EOF charNobuyoshi Nakada2019-11-111-0/+9
|
* Prefer assert_syntax_error and assert_valid_syntaxNobuyoshi Nakada2019-11-112-268/+143
|
* Fix uplevel of test_jitTakashi Kokubun2019-11-101-3/+3
|
* Disallow omission of parentheses/brackets in single line pattern matching ↵Kazuki Tsujimoto2019-11-101-1/+7
| | | | [Feature #16182]
* Test opt_invokebuiltin_delegate_leave in test_jitTakashi Kokubun2019-11-091-0/+9
|
* Support RB_BUILTIN in ISeq#to_aTakashi Kokubun2019-11-092-2/+9
|
* Test invokebuiltin in test_jitTakashi Kokubun2019-11-091-5/+15
| | | | ISeq#to_a is commented out because it's broken now
* Extend sleep duration for SolarisTakashi Kokubun2019-11-091-1/+1
|
* Fix passing actual object_id to finalizerJohn Hawthorn2019-11-081-0/+8
| | | | | | | | | | Previously we were passing the memory_id. This was broken previously if compaction was run (which changes the memory_id) and now that object_id is a monotonically increasing number it was always broken. This commit fixes this by defering removal from the object_id table until finalizers have run (for objects with finalizers) and also copying the SEEN_OBJ_ID flag onto the zombie objects.
* Fix typoKazuki Tsujimoto2019-11-081-1/+1
|
* Define Struct#deconstruct_keysKazuki Tsujimoto2019-11-082-0/+36
|
* use builtin for TracePoint.Koichi Sasada2019-11-081-37/+101
| | | | Define TracePoint in trace_point.rb and use __builtin_ syntax.
* Add a counter for compactionAaron Patterson2019-11-071-0/+6
| | | | | Keep track of the number of times the compactor ran. I would like to use this as a way to keep track of inline cache reference updates.
* Use a monotonically increasing number for object_idJohn Hawthorn2019-11-072-90/+8
| | | | | | | | | | | | | | | | | This changes object_id from being based on the objects location in memory (or a nearby memory location in the case of a conflict) to be based on an always increasing number. This number is a Ruby Integer which allows it to overflow the size of a pointer without issue (very unlikely to happen in real programs especially on 64-bit, but a nice guarantee). This changes obj_to_id_tbl and id_to_obj_tbl to both be maps of Ruby objects to Ruby objects (previously they were Ruby object to C integer) which simplifies updating them after compaction as we can run them through gc_update_table_refs. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
* Disallow duplicated pattern variableKazuki Tsujimoto2019-11-071-8/+59
|
* Revert "Use a monotonically increasing number for object_id"Aaron Patterson2019-11-062-8/+90
| | | | This reverts commit bd2b314a05ae9192b3143e1e678a37c370d8a9ce.
* Use a monotonically increasing number for object_idJohn Hawthorn2019-11-062-90/+8
| | | | | | | | | | | | | | | | | This changes object_id from being based on the objects location in memory (or a nearby memory location in the case of a conflict) to be based on an always increasing number. This number is a Ruby Integer which allows it to overflow the size of a pointer without issue (very unlikely to happen in real programs especially on 64-bit, but a nice guarantee). This changes obj_to_id_tbl and id_to_obj_tbl to both be maps of Ruby objects to Ruby objects (previously they were Ruby object to C integer) which simplifies updating them after compaction as we can run them through gc_update_table_refs. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>