summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix code locations of array node inside hash node when multiple kw splatsJeremy Evans2019-09-051-0/+7
| | | | | | | | | | This is broken at least since 2.5 (I didn't check earlier versions). It resulted in failure in test_ast.rb when the tests were added before the parser change. Basically, in remove_duplicate_keys, if the node is modified, set the location information to the previous location information. The removal of keys should not affect the location in the code.
* Make m(**{}) mean call without keywordsJeremy Evans2019-09-051-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, **{} was removed by the parser: ``` $ ruby --dump=parse -e '{**{}}' @ NODE_SCOPE (line: 1, location: (1,0)-(1,6)) +- nd_tbl: (empty) +- nd_args: | (null node) +- nd_body: @ NODE_HASH (line: 1, location: (1,0)-(1,6))* +- nd_brace: 1 (hash literal) +- nd_head: (null node) ``` Since it was removed by the parser, the compiler did not know about it, and `m(**{})` was therefore treated as `m()`. This modifies the parser to not remove the `**{}`. A simple approach for this is fairly simple by just removing a few lines from the parser, but that would cause two hash allocations every time it was used. The approach taken here modifies both the parser and the compiler, and results in `**{}` not allocating any hashes in the usual case. The basic idea is we use a literal node in the parser containing a frozen empty hash literal. In the compiler, we recognize when that is used, and if it is the only keyword present, we just push it onto the VM stack (no creation of a new hash or merging of keywords). If it is the first keyword present, we push a new empty hash onto the VM stack, so that later keywords can merge into it. If it is not the first keyword present, we can ignore it, since the there is no reason to merge an empty hash into the existing hash. Example instructions for `m(**{})` Before (note ARGS_SIMPLE): ``` == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,7)> (catch: FALSE) 0000 putself ( 1)[Li] 0001 opt_send_without_block <callinfo!mid:m, argc:0, FCALL|ARGS_SIMPLE>, <callcache> 0004 leave ``` After (note putobject and KW_SPLAT): ``` == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,7)> (catch: FALSE) 0000 putself ( 1)[Li] 0001 putobject {} 0003 opt_send_without_block <callinfo!mid:m, argc:1, FCALL|KW_SPLAT>, <callcache> 0006 leave ``` Example instructions for `m(**h, **{})` Before and After (no change): ``` == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE) 0000 putself ( 1)[Li] 0001 putspecialobject 1 0003 newhash 0 0005 putself 0006 opt_send_without_block <callinfo!mid:h, argc:0, FCALL|VCALL|ARGS_SIMPLE>, <callcache> 0009 opt_send_without_block <callinfo!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE>, <callcache> 0012 opt_send_without_block <callinfo!mid:m, argc:1, FCALL|KW_SPLAT>, <callcache> 0015 leave ``` Example instructions for `m(**{}, **h)` Before: ``` == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE) 0000 putself ( 1)[Li] 0001 putspecialobject 1 0003 newhash 0 0005 putself 0006 opt_send_without_block <callinfo!mid:h, argc:0, FCALL|VCALL|ARGS_SIMPLE>, <callcache> 0009 opt_send_without_block <callinfo!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE>, <callcache> 0012 opt_send_without_block <callinfo!mid:m, argc:1, FCALL|KW_SPLAT>, <callcache> 0015 leave ``` After (basically the same except for the addition of swap): ``` == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE) 0000 putself ( 1)[Li] 0001 newhash 0 0003 putspecialobject 1 0005 swap 0006 putself 0007 opt_send_without_block <callinfo!mid:h, argc:0, FCALL|VCALL|ARGS_SIMPLE>, <callcache> 0010 opt_send_without_block <callinfo!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE>, <callcache> 0013 opt_send_without_block <callinfo!mid:m, argc:1, FCALL|KW_SPLAT>, <callcache> 0016 leave ```
* Add tests for `File.absolute_path?`David Rodríguez2019-09-051-0/+18
| | | | [Feature #15868]
* [rubygems/rubygems] Bump rubocop to 0.74.0 and fix new offensesDavid Rodríguez2019-09-055-6/+6
| | | | https://github.com/rubygems/rubygems/commit/d4fc383497
* [rubygems/rubygems] Fix Layout/SpaceAroundOperators: Operator = should be ↵bronzdoc2019-09-051-1/+1
| | | | | | surrounded by a single space. https://github.com/rubygems/rubygems/commit/eaa38ebeb1
* [rubygems/rubygems] Error out if there are multiple gemspecs and no gemspec ↵bronzdoc2019-09-051-31/+7
| | | | | | is specified https://github.com/rubygems/rubygems/commit/547947bbf0
* [rubygems/rubygems] Remove useless gem setupbronzdoc2019-09-051-10/+1
| | | | https://github.com/rubygems/rubygems/commit/c8913e37a7
* [rubygems/rubygems] Test building a gem with multiple gemspec without a gem ↵bronzdoc2019-09-051-0/+59
| | | | | | name specified https://github.com/rubygems/rubygems/commit/38c72fd145
* [rubygems/rubygems] Build the first gemspec we found if no gemspec is specifiedbronzdoc2019-09-051-0/+39
| | | | https://github.com/rubygems/rubygems/commit/ab186266b7
* [rubygems/rubygems] Improve gemspec assignment and error messagebronzdoc2019-09-051-1/+1
| | | | https://github.com/rubygems/rubygems/commit/dc70c5a192
* [rubygems/rubygems] Don't fail when `uninstall --all` with default gemDavid Rodríguez2019-09-052-4/+49
| | | | | | | Instead, display an informative message saying that uninstallation of specific versions is being skipped because of being default gems. https://github.com/rubygems/rubygems/commit/b44845aa1d
* [rubygems/rubygems] Little refactor to avoid rubocop's false positiveDavid Rodríguez2019-09-051-6/+8
| | | | | | | Otherwise it detects duplicate methods here, because it doesn't see that we are reopening the class in two different places. https://github.com/rubygems/rubygems/commit/ae3fb47f5f
* Implement Enumerator::Lazy#eager [Feature #15901]Akinori MUSHA2019-09-041-0/+8
|
* Check frozen flag on MJIT setinstancevariableTakashi Kokubun2019-09-041-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It does not seem to have a significant performance impact, hopefully? ``` $ benchmark-driver -v benchmark.yml --rbenv 'before --jit;after --jit' --repeat-count=24 --output=all before --jit: ruby 2.7.0dev (2019-09-03T21:02:24Z master 77596fb7a9) +JIT [x86_64-linux] after --jit: ruby 2.7.0dev (2019-09-04T01:54:44Z master 7363e22d79) +JIT [x86_64-linux] Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 48.44054595799523 71.67010255902900 fps 71.32797692837639 71.97846863769546 72.51921961607691 78.87360980544105 73.54082925611047 79.80408132389941 74.03503843709451 79.85739528572826 74.04863857926493 79.89850834901381 75.30266276129467 80.34607233076015 75.69063990896244 80.88474397425360 75.70458132587405 81.09234267781642 77.39842764662852 82.13766823612643 77.76922944068329 82.20398304840373 81.17984044023393 82.26722630628272 82.85235776076533 82.71375902781254 83.04906099135320 82.75893420702198 83.10214168136230 82.79668965325972 83.71456007558125 82.85131667916379 84.06658306760725 82.95676565411722 84.25690684305728 83.19972846225775 84.27938663923503 83.28510503845854 84.45467716218090 83.41003730434703 84.51563186125925 83.67773614721280 84.56139892968321 84.02082201151110 84.69819452180658 84.10495346787033 84.78125989622576 84.47867803506055 ``` Note for backporter: test_jit's `success_count` would be 1 in Ruby 2.6, since 2.7 introduced "MJIT recompile" on JIT-ed code cancel. [Bug #16139]
* Do not turn on keyword_init for Struct subclass if keyword hash is emptyJeremy Evans2019-09-031-0/+4
| | | | | | | This was accidentally turned on because there was no checking for Qundef. Also, since only a single keyword is currently supported, simplify the rb_get_kwargs call.
* Fix Enumerator::Lazy#{to_enum,enum_for} where method is defined in LazyJeremy Evans2019-09-031-0/+48
| | | | | | | | | | | | | | | | | | | Previously, passing to_enum/enum_for a method that was defined in Lazy itself returned wrong results: [1,2,3].to_enum(:map).to_a # => [1, 2, 3] [1,2,3].lazy.to_enum(:map).to_a # => [] I'm not sure why methods that are designed to be lazy do not work with to_enum/enum_for. However, one possible way to work around this bug is to have to_enum/enum_for use the implementation found in Enumerable/Enumerator, which is what this commit does. While this commit works around the problem, it is a band-aid, not a real fix. It doesn't handle aliases of Enumerable::Lazy methods, for instance. A better fix would be appreciated.
* Make Enumerator::Lazy#with_index be lazyJeremy Evans2019-09-031-0/+22
| | | | | | | | | | Previously, Enumerator::Lazy#with_index was not defined, so it picked up the default implementation from Enumerator, which was not lazy. Based on earlier patch from nobu. Fixes [Bug #7877]
* Stop testing inexistent instructionsTakashi Kokubun2019-09-031-9/+5
|
* Try extending timeout of IO.selectTakashi Kokubun2019-09-031-1/+2
| | | | | hoping to stabilize: https://app.wercker.com/ruby/ruby/runs/mjit-test1/5d6df8a8a952c20008acf75b?step=5d6df90e4971a6000714c627
* Examine TestIO#test_select_exceptfds on Solaris with 1 byte dataNaohisa Goto2019-09-031-3/+5
| | | | | | | On Solaris, it seems that the select(3C) in this test works only when sending 1 byte out-of-band data, though I cannot investigate the cause. The behavior is observed on a Solaris 10 server in addition to Solaris 11 on which the test had been skipped.
* test/ruby/test_fiber.rb: reduce the count of object creation to cause GCYusuke Endoh2019-09-031-1/+3
| | | | | | | | | | | | | The test consistently fails on OpenBSD. https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20190903T010009Z.fail.html.gz ``` 1) Failure: TestFiber#test_fork_from_fiber [/home/chkbuild/chkbuild/tmp/build/20190903T010009Z/ruby/test/ruby/test_fiber.rb:327]: [ruby-core:41456]. <0> expected but was <1>. ```
* Make Array#uniq return subclass instance if called on subclass instanceJeremy Evans2019-09-021-0/+25
| | | | | | | | Previously, Array#uniq would return subclass instance if the length of the array were 2 or greater, and would return Array instance if the length of the array were 0 or 1. Fixes [Bug #7768]
* Add insn tests for newarraykwsplatTakashi Kokubun2019-09-031-0/+4
|
* Drop unstable Travis osx in favor of GitHub ActionsTakashi Kokubun2019-09-034-17/+0
| | | | | | | | | | | | For some reason, the Travis osx environment has been really unstable. It failed on today's cron too: https://travis-ci.org/ruby/ruby/builds/579843163 As we have almost the same test environment (including OpenSSL version) in GitHub Actions and it seems to be more stable and faster, I think there's no motivation to maintain Travis osx CI environment. By removing this, we'd be able to simplify .travis.yml as well.
* Merge pull request #2418 from jeremyevans/array-empty-kwsplatJeremy Evans2019-09-021-0/+27
| | | Ignore empty keyword splats in arrays
* test/drb/drbtest.rb: Skip test_06_timeout on Solaris10sYusuke Endoh2019-09-021-6/+9
| | | | | | | | | | The test seems to have a race condition, which fails on very slow machine like Solaris10s. So skip it. In addition, this change restores timeout guard that was removed at 0660d7cb538cf5284d50f66adfcbd78609839715. This is because the test gets stuck forever when something wrong occurs. It is better to fail the test than stuck.
* Do not clear backtrace in Exception#exceptionNobuyoshi Nakada2019-09-021-0/+12
| | | | [Bug #15558]
* Rewrote using assert_separatelyNobuyoshi Nakada2019-09-021-16/+8
|
* Prohibit nul-separated glob pattern [Feature #14643] (#2419)Nobuyoshi Nakada2019-09-021-3/+2
|
* Add Net::FTP#features and Net::FTP#optionShugo Maeda2019-09-021-0/+96
| | | | | Patch by darkphnx (Dan Wentworth) . Thanks! [Feature #15964]
* Revert "Make Enumerator::Lazy#with_index be lazy"Jeremy Evans2019-09-011-22/+0
| | | | | | This reverts commit 83498854eb5a824f1f83c31fac18c9279f9ee10d. This didn't pass rubyspec.
* Fix opt_regexpmatch1 referencesTakashi Kokubun2019-09-021-4/+1
|
* Make Enumerator::Lazy#with_index be lazyJeremy Evans2019-09-011-0/+22
| | | | | | | | | | Previously, Enumerator::Lazy#with_index was not defined, so it picked up the default implementation from Enumerator, which was not lazy. Based on earlier patch from nobu. Fixes [Bug #7877]
* Skip POINTOPOINT of IPv4 too instead of IPv6 onlyKazuhiro NISHIYAMA2019-09-021-5/+4
| | | | | | | | | Fix following error on `utun*`: ``` 1) Error: TestSocket#test_udp_server: Errno::ECONNREFUSED: Connection refused - recvmsg(2) ```
* Fix method name in test to not override existing method nameJeremy Evans2019-09-011-1/+1
|
* Fix keyword argument separation warning in method_missingJeremy Evans2019-09-011-0/+73
| | | | | | vm_call_method_missing was dropping VM_CALL_KW_SPLAT, so this just makes it not drop it, to get the same behavior as calling the method directly.
* test/drb/drbtest.rb: Use EnvUtil.timeout for timeout scale factorYusuke Endoh2019-09-011-1/+1
|
* Revert "Revert "Revert "Skip BUGs on Solaris"""Yusuke Endoh2019-09-012-3/+1
| | | | | | | This reverts commit 3be3948870f6589343c4aecb541e22fae7751b47. The Solaris environment couldn't lookup the hostname itself by a wrong setting. Now it is fixed, so try again.
* Revert "Revert "Skip BUGs on Solaris""Yusuke Endoh2019-09-012-1/+3
| | | | | | | This reverts commit 84dca8eff0cbcb1c23623b47fb78b0daf5c76e35. "exceution expired" occurred on Solaris. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20190901T072504Z.fail.html.gz
* Make pattern matching support **nil syntaxKazuki Tsujimoto2019-09-011-0/+38
|
* Automatically detect missing symbolsTakashi Kokubun2019-09-011-0/+1
| | | | | | | | which are usually optimized away by -O3. This CI can detect missing exports like ea84a680755b5a7fa700618cbe78e3b2fc7be01d which was needed for 761346a9604ca2c79777d1d67fb5dcc3c30dbf69.
* test/ruby/test_keyword.rb: Add remove_method before method redefinitionYusuke Endoh2019-09-011-0/+10
| | | | to suppress redefinition warnings.
* Revert "Skip BUGs on Solaris"Yusuke Endoh2019-09-012-3/+1
| | | | | | | This reverts commit 8adefd4cf29288f6e43f20efbdd44b215ae16c7a. I couldn't see any failure on Solaris if the guard is removed. Give it a try.
* Fix keyword argument separation warning when using sendJeremy Evans2019-08-311-0/+68
| | | | | | vm_call_opt_send was dropping VM_CALL_KW_SPLAT, so this just makes it not drop it, to get the same behavior as calling the method directly.
* Don't pass an empty keyword hash when double splatting empty hash when ↵Jeremy Evans2019-08-311-0/+138
| | | | | | | | calling cfunc This mirrors earlier changes in keyword argument separation for calling Ruby methods and calling procs/lambdas, so that behavior is kept the same.
* Split warning messages for tag-jumpNobuyoshi Nakada2019-09-012-21/+21
|
* Don't pass an empty keyword hash when double splatting empty hashJeremy Evans2019-08-301-0/+49
|
* Use more accurate source location in keyword argument separation warningsJeremy Evans2019-08-301-4/+4
| | | | | | | | This shows locations in places it didn't before, such as for proc calls, and fixes the location for super calls. This requires making iseq_location non-static and MJIT exported, which I hope will not cause problems.
* Warn for keyword to last hash parameter when method has no optional/rest ↵Jeremy Evans2019-08-301-2/+23
| | | | | | | | | parameters Previously, there was no warning in this case, even though we will be changing the behavior in Ruby 3. Fixes [Bug #14130]
* Remove a verbose warning that is no longer neededJeremy Evans2019-08-301-3/+3
| | | | This warns about a case that we will continue to support.