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

84217 Коммитов

Автор SHA1 Сообщение Дата
Kevin Menard d473256abe [ruby/prism] Extract a magic value to a named constant.
https://github.com/ruby/prism/commit/54d14a35a9
2024-03-08 18:48:54 +00:00
Kevin Menard 82fb6a90d5 [ruby/prism] Track both the unescaped bytes and source string for a regular expression so we can accurately set its encoding flags.
https://github.com/ruby/prism/commit/dc6dd3a926
2024-03-08 18:48:53 +00:00
Jean Boussier 2d80b6093f Retire RUBY_MARK_UNLESS_NULL
Marking `Qnil` or `Qfalse` works fine, having
an extra macro to avoid it isn't needed.
2024-03-08 14:13:14 +01:00
Koichi ITO af8a4205bf Fix an error for `Prism::Translation::Parser::Lexer`
This PR fixes the following error for `Prism::Translation::Parser::Lexer` on the main branch:

```console
$ cat example.rb
'a' # aあ
"
#{x}
"

$ bundle exec rubocop
Parser::Source::Range: end_pos must not be less than begin_pos
/Users/koic/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/parser-3.3.0.5/lib/parser/source/range.rb:39:in `initialize'
/Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:299:in `new'
/Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:299:in `block in to_a'
/Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:297:in `map'
/Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser/lexer.rb:297:in `to_a'
/Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:263:in `build_tokens'
/Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:92:in `tokenize'
```

This change was made in https://github.com/ruby/prism/pull/2557, and it seems there was
an inconsistency in Range due to forgetting to apply `offset_cache` to `start_offset`.
2024-03-08 12:33:02 +00:00
Hartley McGuire 4756eaf5aa [ruby/rdoc] Fix ToMarkdown missing newlines for label-lists
Previously, using ToMarkdown on a label-list would generate output that
could not be reparsed by the RDoc::Markdown parser:

```
md = <<~MD
apple
: a red fruit

banana
: a yellow fruit
MD

doc = RDoc::Markdown.parse(md)
doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]]

new_md = doc.accept(RDoc::Markup::ToMarkdown.new)
new_md # => "apple\n:   a red fruit\nbanana\n:   a yellow fruit\n\n"

new_doc = RDoc::Markdown.parse(new_md)
new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit\nbanana\n: a yellow fruit"]]]]
```

The issue is that the [PHP Markdown Extra spec][1] requires a newline
after each definition list item, but ToMarkdown was not putting newlines
between label-list items.

This commit fixes the issue by properly appending a newline after each
label-list item so that the output of ToMarkdown can be reparsed by
RDoc::Markdown:

```
md = <<~MD
apple
: a red fruit

banana
: a yellow fruit
MD

doc = RDoc::Markdown.parse(mdoc)
doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]]

new_md = doc.accept(RDoc::Markup::ToMarkdown.new)
new_md # => "apple\n:   a red fruit\n\nbanana\n:   a yellow fruit\n\n"

new_doc = RDoc::Markdown.parse(new_md)
new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]]
```

[1]: https://michelf.ca/projects/php-markdown/extra/#def-list

https://github.com/ruby/rdoc/commit/c65266437c
2024-03-08 10:13:04 +00:00
alpaca-tc e8f796e954 [ruby/irb] rdoc version lock is required
(https://github.com/ruby/irb/pull/897)

Some features of irb do not work properly when using the old rdoc.
I have compared several major versions and found that it works as intended from 4.0.0.

This problem occurs when there is a Gemfile.lock is installed with the old rdoc.
I don't know why this Gemfile.lock installs an older rdoc than the ruby bundled rdoc,
but specifying the version in the gemspec will at least prevent the problem.

NOTE: ruby/irb#704 problem does not occur with this change.

The following is test code.

```
 ### Usage: ruby __FILE__.rb
 # # input RDoc and Tab
 # >> RDoc<Tab>
 #
 ### Expect: Display document of RDoc
 ### Actual: <internal:marshal>:34:in `load': instance of RDoc::Constant needs to have method `marshal_load' (TypeError)
require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
  gem 'irb'
  # gem 'rdoc', '~> 4.0.0'
  gem 'rdoc', '~> 3.12.0'
end

require 'rdoc'
require 'irb'

IRB.start
```

https://github.com/ruby/irb/commit/1a1fbba020
2024-03-08 09:23:40 +00:00
dependabot[bot] 86ce78d73a [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.89 to 0.9.90.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.89...v0.9.90)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

https://github.com/rubygems/rubygems/commit/ce663279b9
2024-03-08 12:27:31 +09:00
Nobuyoshi Nakada 69cfcd46c2
Remove duplicate dependency line 2024-03-08 11:58:41 +09:00
Hiroshi SHIBATA 52a2bc4a34 Try to run CI with Ubuntu 22.04 2024-03-08 10:15:56 +09:00
Kevin Newton 7e1183200a [ruby/prism] Fix up test suite
https://github.com/ruby/prism/commit/2929c35630
2024-03-07 23:13:41 +00:00
Kevin Newton 811296b4af [PRISM] Use new integer logic 2024-03-07 18:02:33 -05:00
Kevin Newton f5294ebbdb [ruby/prism] Shared integer parsing logic
https://github.com/ruby/prism/commit/a2594a23c1
2024-03-07 18:02:33 -05:00
Kevin Newton c1462250b8 [ruby/prism] Style and allocation functions
https://github.com/ruby/prism/commit/97f838c323
2024-03-07 18:02:33 -05:00
tompng 81f02eb6ba [ruby/prism] Change pm_integer_t structure
https://github.com/ruby/prism/commit/588acf823f
2024-03-07 18:02:33 -05:00
tompng 5113d6b059 [ruby/prism] Faster pm_integer_parse pm_integer_string using karatsuba algorithm
https://github.com/ruby/prism/commit/ae4fb6b988
2024-03-07 18:02:33 -05:00
tompng 4186609d88 [ruby/prism] Add bignum parse test
https://github.com/ruby/prism/commit/503a0ea6cd
2024-03-07 18:02:33 -05:00
tompng 05526a444c [ruby/prism] Make pm_integer -> Integer faster
https://github.com/ruby/prism/commit/47601e7928
2024-03-07 18:02:33 -05:00
Kevin Newton 977012bae8 [ruby/prism] Remove restrict to fix windows 2015
https://github.com/ruby/prism/commit/f0a2ce1c0e
2024-03-07 21:23:18 +00:00
Kevin Newton ec159fc8ba [ruby/prism] Support parsing streams
https://github.com/ruby/prism/commit/efdc2b7222
2024-03-07 20:40:39 +00:00
Kevin Newton 76e11595e2 [ruby/prism] Fix up tilde heredoc line continuations
https://github.com/ruby/prism/commit/15e74b2f65
2024-03-07 20:25:24 +00:00
John Hawthorn 18ee7c9a10 Clear all refined CCs on reopening refinement mod
In cfd7729ce7 we started using inline
caches for refinements. However, we weren't clearing inline caches when
defined on a reopened refinement module.

Fixes [Bug #20246]
2024-03-07 10:06:48 -08:00
Nobuyoshi Nakada 4a4e5dd9c9
Setup ruby before setup directories
When `makeup: true`, setup/directories also prepare auto generated
source files, and requires baseruby.
2024-03-08 01:10:32 +09:00
Koichi ITO 0e4bfd08e5 [ruby/prism] Fix an AST and token incompatibility for `Prism::Translation::Parser`
Fixes https://github.com/ruby/prism/pull/2506.

This PR fixes an AST and token incompatibility between Parser gem and `Prism::Translation::Parser`
for symbols quoted with line breaks.

https://github.com/ruby/prism/commit/06ab4df8cd
2024-03-07 14:05:20 +00:00
Nobuyoshi Nakada 78725f14b2
RMDIRS includes `-p` option [ci skip] 2024-03-07 17:13:43 +09:00
Nobuyoshi Nakada 1c083c4db0
Clean up files made by runnable in clean-runnable [ci skip] 2024-03-07 16:40:27 +09:00
Nobuyoshi Nakada d1c66456b8
Ingore errors when removing intermediate files recursively [ci skip] 2024-03-07 16:29:48 +09:00
Nobuyoshi Nakada 810779fab9
Clean up dump file generated by `--yjit-exit-locations` [ci skip] 2024-03-07 14:33:40 +09:00
Nobuyoshi Nakada fbec42fb39
Clean up the incidentals to encoding/transcoding objects [ci skip] 2024-03-07 14:16:22 +09:00
Nobuyoshi Nakada d3279a0c11
[Bug #20327] Do not count subsecond to calculate UTC offset
Assume that there will never be any time zones with UTC offsets that
are subseconds.  Historically, UTC offset has only been used down to
the second.
2024-03-07 13:08:37 +09:00
Kevin Newton e13fd48f55 [PRISM] Update dependencies for prism diagnostics 2024-03-06 21:42:54 -05:00
Kevin Newton 5141643a27 [ruby/prism] Fix rebase templates
https://github.com/ruby/prism/commit/31b8c6142f
2024-03-06 21:42:54 -05:00
Kevin Newton d266b71467 [ruby/prism] Use the diagnostic types in the parser translation layer
https://github.com/ruby/prism/commit/1a8a0063dc
2024-03-06 21:42:54 -05:00
Kevin Newton 48ca2ce5fc [ruby/prism] Dispatch on_tlambda and on_tlambeg
https://github.com/ruby/prism/commit/1ca58e0121
2024-03-06 21:42:54 -05:00
Kevin Newton 56026edaba [ruby/prism] Use the diagnostic types in the ripper translation layer
https://github.com/ruby/prism/commit/a7ab3a41c8
2024-03-06 21:42:54 -05:00
Kevin Newton 38c2774420 [ruby/prism] Expose types on diagnostics
https://github.com/ruby/prism/commit/a735c2262f
2024-03-06 21:42:54 -05:00
git c0cb3f60e1 Update default gems list at 9fcb2bd5c0 [ci skip] 2024-03-07 02:15:40 +00:00
Stan Lo 9fcb2bd5c0 [ruby/irb] Bump version to v1.12.0
(https://github.com/ruby/irb/pull/895)

https://github.com/ruby/irb/commit/a79e84a692
2024-03-07 02:14:44 +00:00
Hiroshi SHIBATA 2bc4575ac0 Removed unused fixtures at time examples 2024-03-07 10:05:53 +09:00
BurdetteLamar cc757f4a61 Add 'In brief' for Array#[] 2024-03-06 16:42:29 -05:00
Ufuk Kayserilioglu 06fca8dbca [ruby/prism] Fix parsing errors for `:!@` and `:~@` in Sorbet
https://github.com/ruby/prism/commit/dc070b44bc
2024-03-06 21:37:55 +00:00
Ufuk Kayserilioglu de411ef0b6 [ruby/prism] Small changes to make type-checking pass
https://github.com/ruby/prism/commit/5b2970e75b
2024-03-06 21:37:54 +00:00
Ufuk Kayserilioglu 8d191a9f57 [ruby/prism] Move polyfill to separate file to type-check it independently.
https://github.com/ruby/prism/commit/2a583b041b
2024-03-06 21:37:53 +00:00
Ufuk Kayserilioglu 3ad17b3bec [ruby/prism] `Prism::Compiler` should be a subclass of `Prism::Visitor`
https://github.com/ruby/prism/commit/a01d6a4e32
2024-03-06 21:37:53 +00:00
Ufuk Kayserilioglu 8dfe0c7c28 [ruby/prism] Fix some type-checking errors by using different method calls
For example, use `.fetch` or `.dig` instead of `[]`, and use `===` instead of `is_a?` for checking types of objects.

https://github.com/ruby/prism/commit/548b54915f
2024-03-06 21:37:52 +00:00
Ufuk Kayserilioglu ddc81ee3f9 [ruby/prism] Fix some missing methods/signatures in RBIs
https://github.com/ruby/prism/commit/1d87b8c46c
2024-03-06 21:37:51 +00:00
Ufuk Kayserilioglu 2e1d735dce [ruby/prism] Move template related methods/classes under `Prism::Template` namespace
https://github.com/ruby/prism/commit/0e4dbcd3e4
2024-03-06 21:37:49 +00:00
Kevin Newton 4c64d2aeac [ruby/prism] Update ripper documentation
https://github.com/ruby/prism/commit/34ba70c4f9
2024-03-06 21:37:40 +00:00
Kevin Newton 4b5fc91617 [ruby/prism] Fix implicit local variables in hashes
https://github.com/ruby/prism/commit/05e0c6792c
2024-03-06 21:37:26 +00:00
Maxime Chevalier-Boisvert 38a4b5c1fa
YJIT: String#getbyte codegen (#10188)
* WIP getbyte implementation

* WIP String#getbyte implementation

* Fix whitespace in stats.rs

* fix?

* Fix whitespace, add comment

---------

Co-authored-by: Aaron Patterson <aaron.patterson@shopify.com>
2024-03-06 20:56:30 +00:00
Jean Boussier d4f3dcf4df Refactor VM root modules
This `st_table` is used to both mark and pin classes
defined from the C API. But `vm->mark_object_ary` already
does both much more efficiently.

Currently a Ruby process starts with 252 rooted classes,
which uses `7224B` in an `st_table` or `2016B` in an `RArray`.

So a baseline of 5kB saved, but since `mark_object_ary` is
preallocated with `1024` slots but only use `405` of them,
it's a net `7kB` save.

`vm->mark_object_ary` is also being refactored.

Prior to this changes, `mark_object_ary` was a regular `RArray`, but
since this allows for references to be moved, it was marked a second
time from `rb_vm_mark()` to pin these objects.

This has the detrimental effect of marking these references on every
minors even though it's a mostly append only list.

But using a custom TypedData we can save from having to mark
all the references on minor GC runs.

Addtionally, immediate values are now ignored and not appended
to `vm->mark_object_ary` as it's just wasted space.
2024-03-06 15:33:43 -05:00