rbs 1.7.0.beta.1 → 1.7.0.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +20 -1
- data/.gitignore +9 -1
- data/CHANGELOG.md +20 -9
- data/Rakefile +16 -1
- data/core/binding.rbs +2 -0
- data/core/complex.rbs +0 -2
- data/core/float.rbs +0 -2
- data/core/integer.rbs +0 -2
- data/core/numeric.rbs +7 -0
- data/core/object.rbs +1 -1
- data/core/proc.rbs +2 -0
- data/core/rational.rbs +0 -2
- data/core/unbound_method.rbs +13 -0
- data/docs/rbs_by_example.md +2 -2
- data/docs/syntax.md +2 -3
- data/ext/{rbs/extension → rbs_extension}/constants.c +0 -1
- data/ext/{rbs/extension → rbs_extension}/constants.h +0 -0
- data/ext/{rbs/extension → rbs_extension}/extconf.rb +1 -1
- data/ext/rbs_extension/lexer.c +2533 -0
- data/ext/{rbs/extension → rbs_extension}/lexer.h +33 -17
- data/ext/rbs_extension/lexer.re +140 -0
- data/ext/rbs_extension/lexstate.c +139 -0
- data/ext/{rbs/extension → rbs_extension}/location.c +0 -0
- data/ext/{rbs/extension → rbs_extension}/location.h +0 -0
- data/ext/{rbs/extension → rbs_extension}/main.c +1 -1
- data/ext/{rbs/extension → rbs_extension}/parser.c +6 -32
- data/ext/{rbs/extension → rbs_extension}/parser.h +0 -5
- data/ext/{rbs/extension → rbs_extension}/parserstate.c +0 -1
- data/ext/{rbs/extension → rbs_extension}/parserstate.h +0 -0
- data/ext/{rbs/extension → rbs_extension}/rbs_extension.h +1 -1
- data/ext/{rbs/extension → rbs_extension}/ruby_objs.c +84 -148
- data/ext/{rbs/extension → rbs_extension}/ruby_objs.h +0 -2
- data/ext/{rbs/extension → rbs_extension}/unescape.c +0 -0
- data/lib/rbs/collection/installer.rb +1 -0
- data/lib/rbs/collection/sources/git.rb +6 -1
- data/lib/rbs/errors.rb +14 -0
- data/lib/rbs/location_aux.rb +13 -0
- data/lib/rbs/parser_aux.rb +39 -0
- data/lib/rbs/parser_compat/lexer_error.rb +4 -0
- data/lib/rbs/parser_compat/located_value.rb +5 -0
- data/lib/rbs/parser_compat/semantics_error.rb +4 -0
- data/lib/rbs/parser_compat/syntax_error.rb +4 -0
- data/lib/rbs/prototype/helpers.rb +113 -0
- data/lib/rbs/prototype/rb.rb +2 -105
- data/lib/rbs/prototype/runtime.rb +16 -0
- data/lib/rbs/types.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +13 -1
- data/rbs.gemspec +1 -1
- data/sig/errors.rbs +10 -0
- data/sig/location.rbs +5 -0
- data/sig/parser.rbs +5 -0
- data/sig/rbs.rbs +4 -0
- data/stdlib/io-console/0/io-console.rbs +137 -0
- data/stdlib/net-http/0/net-http.rbs +2 -1
- data/stdlib/tempfile/0/tempfile.rbs +4 -6
- metadata +27 -19
- data/ext/rbs/extension/lexer.c +0 -1070
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 813a7a51e3db502f844756f75a52356945988ffc9e3230b6ff564d7864af02d4
|
4
|
+
data.tar.gz: 2589b291bd8fa87c7228d3204d2c6b4541617c450e64da2efc28fa658c92f0bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1acea4997b9a4d30da59bb02b0d7bb8afa63794c9102b35efd9627efab007195a60ad3e42ebd1595333cd5965acb1e4d1af576cd23e28efab83da6fed5ee649e
|
7
|
+
data.tar.gz: 4822b8fa8cb7fc652d847d90a1bf15215f8229eda1cd11ef9307e03a4abdc0be1ef3a5b117e6fdd00ec7ad43db8cfd914903125dcacea69a8e477b6b2d1cf917
|
data/.github/workflows/ruby.yml
CHANGED
@@ -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,22 @@
|
|
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
|
-
|
11
|
+
**/.ruby-version
|
12
|
+
**/.rvmrc
|
13
|
+
**/.rbfu-version
|
14
|
+
**/.rbenv-version
|
15
|
+
**/.versions.conf
|
10
16
|
/lib/rbs/parser.output
|
11
17
|
/vendor/sigs
|
12
18
|
/Gemfile.lock
|
13
19
|
|
14
20
|
lib/**/*.bundle
|
21
|
+
lib/**/*.so
|
22
|
+
lib/**/*.dll
|
data/CHANGELOG.md
CHANGED
@@ -2,20 +2,31 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
-
## 1.7.0 (beta.
|
5
|
+
## 1.7.0 (beta.5)
|
6
6
|
|
7
|
-
|
7
|
+
### Signature updates
|
8
|
+
|
9
|
+
* io/console ([\#783](https://github.com/ruby/rbs/pull/783))
|
10
|
+
* `Net::HTTPRequest` ([\#784](https://github.com/ruby/rbs/pull/784))
|
11
|
+
* `Tempfile.new`, `Tempfile.create` ([\#792](https://github.com/ruby/rbs/pull/792), [\#791](https://github.com/ruby/rbs/pull/791))
|
12
|
+
* `#clone` ([#811](https://github.com/ruby/rbs/pull/811))
|
8
13
|
|
9
|
-
|
14
|
+
### Library changes
|
15
|
+
|
16
|
+
* Fix unexpected `CollectionNotAvailable` without `gems` from git source ([\#795](https://github.com/ruby/rbs/pull/795))
|
17
|
+
* Replace RBS::Parser ([#788](https://github.com/ruby/rbs/pull/788), [#789](https://github.com/ruby/rbs/pull/789))
|
18
|
+
* Print deprecation warning ([\#801](https://github.com/ruby/rbs/pull/801))
|
19
|
+
* Make `Parser::KEYWORDS` a hash ([\#804](https://github.com/ruby/rbs/pull/804))
|
20
|
+
* Use _partial clone_ for `rbs collection` installer ([#805](https://github.com/ruby/rbs/pull/805))
|
10
21
|
|
11
22
|
## 1.6.2 (2021-09-09)
|
12
23
|
|
13
|
-
|
24
|
+
### Signature updates
|
14
25
|
|
15
26
|
* `Enumerator::Lazy#force` ([\#782](https://github.com/ruby/rbs/pull/782))
|
16
27
|
* `IO.readlines` ([\#780](https://github.com/ruby/rbs/pull/780))
|
17
28
|
|
18
|
-
|
29
|
+
### Miscellaneous
|
19
30
|
|
20
31
|
* Set `$XDG_CACHE_HOME` during test ([\#781](https://github.com/ruby/rbs/pull/781))
|
21
32
|
|
@@ -23,7 +34,7 @@
|
|
23
34
|
|
24
35
|
This is a minor release including test fixes.
|
25
36
|
|
26
|
-
|
37
|
+
### Miscellaneous
|
27
38
|
|
28
39
|
* Fix stdlib test for `Resolv::Hosts` by removing `/etc/hosts` dependency ([\#779](https://github.com/ruby/rbs/pull/779))
|
29
40
|
* Fix bundler related test for test-bundled-gems ([\#778](https://github.com/ruby/rbs/pull/778))
|
@@ -35,18 +46,18 @@ The command helps you manage RBS files from gem_rbs_collection or other reposito
|
|
35
46
|
|
36
47
|
This feature is a preview, and any feedback is welcome!
|
37
48
|
|
38
|
-
|
49
|
+
### Signature updates
|
39
50
|
|
40
51
|
* objspace ([\#763](https://github.com/ruby/rbs/pull/763), [\#776](https://github.com/ruby/rbs/pull/776))
|
41
52
|
* tempfile ([\#767](https://github.com/ruby/rbs/pull/767), [\#775](https://github.com/ruby/rbs/pull/775))
|
42
53
|
* `IO#set_encoding_by_bom` ([\#106](https://github.com/ruby/rbs/pull/106))
|
43
54
|
* `OpenSSL::PKey::EC#dh_compute_key` ([\#775](https://github.com/ruby/rbs/pull/775))
|
44
55
|
|
45
|
-
|
56
|
+
### Library changes
|
46
57
|
|
47
58
|
* 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
59
|
|
49
|
-
|
60
|
+
### Miscellaneous
|
50
61
|
|
51
62
|
* 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
63
|
* Stop printing version mismatch message in CI ([\#777](https://github.com/ruby/rbs/pull/777))
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ ruby = ENV["RUBY"] || RbConfig.ruby
|
|
9
9
|
rbs = File.join(__dir__, "exe/rbs")
|
10
10
|
bin = File.join(__dir__, "bin")
|
11
11
|
|
12
|
-
Rake::ExtensionTask.new("
|
12
|
+
Rake::ExtensionTask.new("rbs_extension")
|
13
13
|
|
14
14
|
Rake::TestTask.new(:test => :compile) do |t|
|
15
15
|
t.libs << "test"
|
@@ -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/core/binding.rbs
CHANGED
data/core/complex.rbs
CHANGED
data/core/float.rbs
CHANGED
@@ -171,8 +171,6 @@ class Float < Numeric
|
|
171
171
|
def ceil: () -> Integer
|
172
172
|
| (int digits) -> (Integer | Float)
|
173
173
|
|
174
|
-
def clone: (?freeze: bool) -> self
|
175
|
-
|
176
174
|
# Returns an array with both `numeric` and `float` represented as Float objects.
|
177
175
|
#
|
178
176
|
# This is achieved by converting `numeric` to a Float.
|
data/core/integer.rbs
CHANGED
data/core/numeric.rbs
CHANGED
@@ -416,4 +416,11 @@ class Numeric
|
|
416
416
|
# Returns `true` if `num` has a zero value.
|
417
417
|
#
|
418
418
|
def zero?: () -> bool
|
419
|
+
|
420
|
+
# Returns +self+.
|
421
|
+
#
|
422
|
+
# Raises an exception if the value for +freeze+ is neither +true+ nor +nil+.
|
423
|
+
#
|
424
|
+
# Related: Numeric#dup.
|
425
|
+
def clone: (?freeze: true?) -> self
|
419
426
|
end
|
data/core/object.rbs
CHANGED
@@ -76,7 +76,7 @@ class Object < BasicObject
|
|
76
76
|
# This method may have class-specific behavior. If so, that behavior will be
|
77
77
|
# documented under the #`initialize_copy` method of the class.
|
78
78
|
#
|
79
|
-
def clone: (?freeze: bool) -> self
|
79
|
+
def clone: (?freeze: bool?) -> self
|
80
80
|
|
81
81
|
# Defines a singleton method in the receiver. The *method* parameter can be a
|
82
82
|
# `Proc`, a `Method` or an `UnboundMethod` object. If a block is specified, it
|
data/core/proc.rbs
CHANGED
@@ -210,6 +210,8 @@
|
|
210
210
|
# {test: 1}.to_proc.call(:test) #=> 1
|
211
211
|
# %i[test many keys].map(&{test: 1}) #=> [1, nil, nil]
|
212
212
|
class Proc < Object
|
213
|
+
def clone: () -> self
|
214
|
+
|
213
215
|
# Returns the number of mandatory arguments. If the block is declared to
|
214
216
|
# take no arguments, returns 0. If the block is known to take exactly n
|
215
217
|
# arguments, returns n. If the block has optional arguments, returns -n-1,
|
data/core/rational.rbs
CHANGED
data/core/unbound_method.rbs
CHANGED
@@ -45,6 +45,19 @@
|
|
45
45
|
# um.bind(t).call #=> :original
|
46
46
|
#
|
47
47
|
class UnboundMethod
|
48
|
+
# Returns a clone of this method.
|
49
|
+
#
|
50
|
+
# class A
|
51
|
+
# def foo
|
52
|
+
# return "bar"
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# m = A.new.method(:foo)
|
57
|
+
# m.call # => "bar"
|
58
|
+
# n = m.clone.call # => "bar"
|
59
|
+
def clone: () -> self
|
60
|
+
|
48
61
|
# Returns an indication of the number of arguments accepted by a method. Returns
|
49
62
|
# a nonnegative integer for methods that take a fixed number of arguments. For
|
50
63
|
# Ruby methods that take a variable number of arguments, returns -n-1, where n
|
data/docs/rbs_by_example.md
CHANGED
@@ -229,9 +229,9 @@ end
|
|
229
229
|
|
230
230
|
```ruby
|
231
231
|
# .rb
|
232
|
-
[1,2,3,4,5].
|
232
|
+
[1,2,3,4,5].filter {|num| num.even? }
|
233
233
|
# => [2, 4]
|
234
|
-
%w[ a b c d e f ].
|
234
|
+
%w[ a b c d e f ].filter {|v| v =~ /[aeiou]/ }
|
235
235
|
# => ["a", "e"]
|
236
236
|
[1,2,3,4,5].filter
|
237
237
|
```
|
data/docs/syntax.md
CHANGED
@@ -110,10 +110,10 @@ Array[Integer | String] # Array of Integer or String
|
|
110
110
|
Intersection type denotes _a type of all of the given types_.
|
111
111
|
|
112
112
|
```
|
113
|
-
|
113
|
+
_Reader & _Writer # _Reader and _Writer
|
114
114
|
```
|
115
115
|
|
116
|
-
Note that `&` has higher precedence than `|` that `
|
116
|
+
Note that `&` has higher precedence than `|` that `A & B | C` is `(A & B) | C`.
|
117
117
|
|
118
118
|
### Optional type
|
119
119
|
|
@@ -289,7 +289,6 @@ _method-member_ ::= `def` _method-name_ `:` _method-types_ # Instance
|
|
289
289
|
| `def self?.` _method-name_ `:` _method-types_ # Singleton and instance method
|
290
290
|
|
291
291
|
_method-types_ ::= # Empty
|
292
|
-
| `super` # `super` overloading
|
293
292
|
| _type-parameters_ _method-type_ `|` _method-types_ # Overloading types
|
294
293
|
| `...` # Overloading for duplicate definitions
|
295
294
|
|
File without changes
|