rbs 1.7.0.beta.2 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +20 -1
  3. data/.gitignore +9 -2
  4. data/CHANGELOG.md +36 -9
  5. data/Rakefile +15 -0
  6. data/Steepfile +0 -1
  7. data/core/binding.rbs +2 -0
  8. data/core/complex.rbs +0 -2
  9. data/core/env.rbs +881 -0
  10. data/core/false_class.rbs +2 -0
  11. data/core/float.rbs +0 -2
  12. data/core/integer.rbs +0 -2
  13. data/core/nil_class.rbs +2 -0
  14. data/core/numeric.rbs +7 -0
  15. data/core/object.rbs +1 -1
  16. data/core/proc.rbs +2 -0
  17. data/core/rational.rbs +0 -2
  18. data/core/symbol.rbs +2 -0
  19. data/core/true_class.rbs +2 -0
  20. data/core/unbound_method.rbs +13 -0
  21. data/docs/rbs_by_example.md +2 -2
  22. data/docs/syntax.md +2 -3
  23. data/ext/rbs_extension/constants.c +0 -1
  24. data/ext/rbs_extension/lexer.c +2526 -1063
  25. data/ext/rbs_extension/lexer.h +33 -17
  26. data/ext/rbs_extension/lexer.re +140 -0
  27. data/ext/rbs_extension/lexstate.c +139 -0
  28. data/ext/rbs_extension/parser.c +2 -32
  29. data/ext/rbs_extension/parser.h +0 -5
  30. data/ext/rbs_extension/parserstate.c +0 -1
  31. data/ext/rbs_extension/rbs_extension.h +1 -1
  32. data/ext/rbs_extension/ruby_objs.c +84 -148
  33. data/ext/rbs_extension/ruby_objs.h +0 -2
  34. data/lib/rbs/collection/installer.rb +1 -0
  35. data/lib/rbs/collection/sources/git.rb +6 -1
  36. data/lib/rbs/errors.rb +6 -0
  37. data/lib/rbs/parser_aux.rb +37 -5
  38. data/lib/rbs/parser_compat/lexer_error.rb +4 -0
  39. data/lib/rbs/parser_compat/located_value.rb +5 -0
  40. data/lib/rbs/parser_compat/semantics_error.rb +4 -0
  41. data/lib/rbs/parser_compat/syntax_error.rb +4 -0
  42. data/lib/rbs/prototype/helpers.rb +113 -0
  43. data/lib/rbs/prototype/rb.rb +2 -105
  44. data/lib/rbs/prototype/runtime.rb +16 -0
  45. data/lib/rbs/test/setup.rb +1 -0
  46. data/lib/rbs/types.rb +2 -2
  47. data/lib/rbs/version.rb +1 -1
  48. data/lib/rbs.rb +12 -0
  49. data/sig/parser.rbs +2 -0
  50. data/sig/rbs.rbs +4 -0
  51. data/stdlib/bigdecimal/0/big_decimal.rbs +44 -0
  52. data/stdlib/csv/0/csv.rbs +49 -3
  53. data/stdlib/io-console/0/io-console.rbs +137 -0
  54. data/stdlib/net-http/0/net-http.rbs +2 -1
  55. data/stdlib/tempfile/0/tempfile.rbs +4 -6
  56. metadata +13 -5
  57. data/lib/rbs/parser.y +0 -1805
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a6f33de7616c04fe5e070fe874581fddcd5d6a600371151fe3ff9638669eb89
4
- data.tar.gz: f95cb049c9f7231886bfa3ea901d45745a86d9c8c2933bc971b6e09830b00245
3
+ metadata.gz: 0e6fc59a79d872f87e6e58e32c2c92d70ec59c0fad26d5a094a7a21d4b108e6c
4
+ data.tar.gz: 950a60b79c02ebdd4d6dd39ff2fc0c7fef9a69843111bc7ed6640c732afd0d98
5
5
  SHA512:
6
- metadata.gz: 71cd7aa025ce3676def36bc814c0fdea25567799ca9b8bcc419fea0c1d75b08fa81d6b5cd568d37e68dce5efce39f0b58007aff1724035c81cadec07fb45f1aa
7
- data.tar.gz: 79c51b0a674179e12337b842c3ef6390805b7ce47603efb23ccb96297811524b58b820cc2dcda46b3806df27a598e8bb492d904d530dc7d005861c93674a2eae
6
+ metadata.gz: a59a9dbf9bbd5c85e3462fb5d0e1edf9a879b87db78cf409a5af921a40ce375f72a7475fe0c7eda0350ed604e876197262e0195a4812177410ff1b31edf41252
7
+ data.tar.gz: b739f7415fefb9ed0cb5db63de98ab648dcd320ac98abd9211bb85448f3fbb14855fcb61715a6c6f4cf520308b2fa0a73c93217bd4e0dd8818d759446e3a6264
@@ -15,10 +15,18 @@ jobs:
15
15
  - master-nightly-focal
16
16
  - 3.0-focal
17
17
  - 2.7-bionic
18
+ - 2.6-bionic
18
19
  job:
19
20
  - test
20
21
  - stdlib_test
21
22
  - rubocop validate test_doc build test_generate_stdlib
23
+ - lexer confirm_lexer
24
+ - lexer compile
25
+ exclude:
26
+ - container_tag: master-nightly-focal
27
+ job: confirm_lexer
28
+ - container_tag: 2.6-bionic
29
+ job: stdlib_test
22
30
  container:
23
31
  image: rubylang/ruby:${{ matrix.container_tag }}
24
32
  steps:
@@ -26,7 +34,18 @@ jobs:
26
34
  - name: Install dependencies
27
35
  run: |
28
36
  apt-get update
29
- apt-get install -y libdb-dev
37
+ apt-get install -y libdb-dev curl autoconf automake m4 libtool
38
+ - name: Install Re2c
39
+ if: contains(matrix.job, 'lexer')
40
+ run: |
41
+ cd /tmp
42
+ curl -L https://github.com/skvadrik/re2c/archive/refs/tags/2.2.tar.gz > re2c-2.2.tar.gz
43
+ tar xf re2c-2.2.tar.gz
44
+ cd re2c-2.2
45
+ autoreconf -i -W all
46
+ ./configure
47
+ make
48
+ make install
30
49
  - name: Update rubygems & bundler
31
50
  run: |
32
51
  ruby -v
data/.gitignore CHANGED
@@ -1,14 +1,21 @@
1
1
  /.bundle/
2
+ /vendor/bundle/
2
3
  /steep/.bundle/
4
+ /steep/vendor/bundle/
3
5
  /.yardoc
4
6
  /_yardoc/
5
7
  /coverage/
6
8
  /pkg/
7
9
  /spec/reports/
8
10
  /tmp/
9
- /.ruby-version
10
- /lib/rbs/parser.output
11
+ **/.ruby-version
12
+ **/.rvmrc
13
+ **/.rbfu-version
14
+ **/.rbenv-version
15
+ **/.versions.conf
11
16
  /vendor/sigs
12
17
  /Gemfile.lock
13
18
 
14
19
  lib/**/*.bundle
20
+ lib/**/*.so
21
+ lib/**/*.dll
data/CHANGELOG.md CHANGED
@@ -2,20 +2,47 @@
2
2
 
3
3
  ## master
4
4
 
5
- ## 1.7.0 (beta.2)
5
+ ## 1.7.0 (2021-11-11)
6
6
 
7
- ## Library changes
7
+ This version replaces `RBS::Parser` implementation from pure Ruby code based on [Racc](https://github.com/ruby/racc) to C extension.
8
+ It improves the RBS file parsing performance up to 5 times faster. :rocket:
8
9
 
9
- * Replace RBS::Parser ([#788](https://github.com/ruby/rbs/pull/788), [#789](https://github.com/ruby/rbs/pull/789))
10
+ * There are some incompatibilties to drop obsolete syntax rules: `super` keyword and `any` type are no longer supported.
11
+ * [re2c](https://github.com/skvadrik/re2c) is used to generate lexical generator.
12
+
13
+ When you want to change the parser/lexer, change the files under `ext/rbs_extension` directory and run `rake compile` to compile the extension.
14
+
15
+ ### Signature updates
16
+
17
+ * io/console ([\#783](https://github.com/ruby/rbs/pull/783))
18
+ * `ENV` -- Note that it introduces a dummy `::ENVClass` class, which is not defined in Ruby. ([\#812](https://github.com/ruby/rbs/pull/812))
19
+ * `Net::HTTPRequest` ([\#784](https://github.com/ruby/rbs/pull/784))
20
+ * `#clone` ([#811](https://github.com/ruby/rbs/pull/811), [\#813](https://github.com/ruby/rbs/pull/813))
21
+ * `Kernel#BigDecimal` ([\#817](https://github.com/ruby/rbs/pull/817))
22
+ * `Tempfile.new`, `Tempfile.create` ([\#792](https://github.com/ruby/rbs/pull/792), [\#791](https://github.com/ruby/rbs/pull/791))
23
+
24
+ ### Library changes
25
+
26
+ * Replace `RBS::Parser` ([#788](https://github.com/ruby/rbs/pull/788), [#789](https://github.com/ruby/rbs/pull/789))
27
+ * Fix unexpected `CollectionNotAvailable` without `gems` from git source ([\#795](https://github.com/ruby/rbs/pull/795))
28
+ * Print deprecation warning ([\#801](https://github.com/ruby/rbs/pull/801))
29
+ * Make `Parser::KEYWORDS` a hash ([\#804](https://github.com/ruby/rbs/pull/804))
30
+ * Use _partial clone_ for `rbs collection` installer ([#805](https://github.com/ruby/rbs/pull/805))
31
+ * Respect logger level for test/setup logger ([\#819](https://github.com/ruby/rbs/pull/819), [\#822](https://github.com/ruby/rbs/pull/822))
32
+
33
+ ## Miscellaneous
34
+
35
+ * Avoid a mixture of `Array#filter` and `Array#select` ([\#820](https://github.com/ruby/rbs/pull/820))
36
+ * Remove leftover documentation about `super` ([\#807](https://github.com/ruby/rbs/pull/807))
10
37
 
11
38
  ## 1.6.2 (2021-09-09)
12
39
 
13
- ## Signature updates
40
+ ### Signature updates
14
41
 
15
42
  * `Enumerator::Lazy#force` ([\#782](https://github.com/ruby/rbs/pull/782))
16
43
  * `IO.readlines` ([\#780](https://github.com/ruby/rbs/pull/780))
17
44
 
18
- ## Miscellaneous
45
+ ### Miscellaneous
19
46
 
20
47
  * Set `$XDG_CACHE_HOME` during test ([\#781](https://github.com/ruby/rbs/pull/781))
21
48
 
@@ -23,7 +50,7 @@
23
50
 
24
51
  This is a minor release including test fixes.
25
52
 
26
- ## Miscellaneous
53
+ ### Miscellaneous
27
54
 
28
55
  * Fix stdlib test for `Resolv::Hosts` by removing `/etc/hosts` dependency ([\#779](https://github.com/ruby/rbs/pull/779))
29
56
  * Fix bundler related test for test-bundled-gems ([\#778](https://github.com/ruby/rbs/pull/778))
@@ -35,18 +62,18 @@ The command helps you manage RBS files from gem_rbs_collection or other reposito
35
62
 
36
63
  This feature is a preview, and any feedback is welcome!
37
64
 
38
- ## Signature updates
65
+ ### Signature updates
39
66
 
40
67
  * objspace ([\#763](https://github.com/ruby/rbs/pull/763), [\#776](https://github.com/ruby/rbs/pull/776))
41
68
  * tempfile ([\#767](https://github.com/ruby/rbs/pull/767), [\#775](https://github.com/ruby/rbs/pull/775))
42
69
  * `IO#set_encoding_by_bom` ([\#106](https://github.com/ruby/rbs/pull/106))
43
70
  * `OpenSSL::PKey::EC#dh_compute_key` ([\#775](https://github.com/ruby/rbs/pull/775))
44
71
 
45
- ## Library changes
72
+ ### Library changes
46
73
 
47
74
  * Add `rbs collection` ([\#589](https://github.com/ruby/rbs/pull/589), [\#772](https://github.com/ruby/rbs/pull/772), [\#773](https://github.com/ruby/rbs/pull/773))
48
75
 
49
- ## Miscellaneous
76
+ ### Miscellaneous
50
77
 
51
78
  * Let `bin/annotate-with-rdoc` process nested constants/classes ([\#766](https://github.com/ruby/rbs/pull/766), [\#768](https://github.com/ruby/rbs/pull/768))
52
79
  * Stop printing version mismatch message in CI ([\#777](https://github.com/ruby/rbs/pull/777))
data/Rakefile CHANGED
@@ -21,6 +21,21 @@ end
21
21
 
22
22
  multitask :default => [:test, :stdlib_test, :rubocop, :validate, :test_doc]
23
23
 
24
+ task :lexer do
25
+ sh "re2c -W --no-generation-date -o ext/rbs_extension/lexer.c ext/rbs_extension/lexer.re"
26
+ end
27
+
28
+ task :confirm_lexer => :lexer do
29
+ puts "Testing if lexer.c is updated with respect to lexer.re"
30
+ sh "git diff --exit-code ext/rbs_extension/lexer.c"
31
+ end
32
+
33
+ rule ".c" => ".re" do |t|
34
+ puts "⚠️⚠️⚠️ #{t.name} is older than #{t.source}. You may need to run `rake lexer` ⚠️⚠️⚠️"
35
+ end
36
+
37
+ task :compile => "ext/rbs_extension/lexer.c"
38
+
24
39
  task :test_doc do
25
40
  files = Dir.chdir(File.expand_path('..', __FILE__)) do
26
41
  `git ls-files -z`.split("\x0").select do |file| Pathname(file).extname == ".md" end
data/Steepfile CHANGED
@@ -3,7 +3,6 @@ D = Steep::Diagnostic
3
3
  target :lib do
4
4
  signature "sig"
5
5
  check "lib"
6
- ignore "lib/rbs/parser.rb"
7
6
  ignore "lib/rbs/prototype", "lib/rbs/test", "lib/rbs/test.rb"
8
7
 
9
8
  library "set", "pathname", "json", "logger", "monitor", "tsort", "uri"
data/core/binding.rbs CHANGED
@@ -31,6 +31,8 @@
31
31
  class Binding
32
32
  public
33
33
 
34
+ def clone: () -> self
35
+
34
36
  # Evaluates the Ruby expression(s) in *string*, in the *binding*'s context. If
35
37
  # the optional *filename* and *lineno* parameters are present, they will be used
36
38
  # when reporting syntax errors.
data/core/complex.rbs CHANGED
@@ -165,8 +165,6 @@ class Complex < Numeric
165
165
 
166
166
  def ceil: (*untyped) -> bot
167
167
 
168
- def clone: (?freeze: bool) -> self
169
-
170
168
  def coerce: (Numeric) -> [ Complex, Complex ]
171
169
 
172
170
  # Returns the complex conjugate.