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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +20 -1
- data/.gitignore +9 -2
- data/CHANGELOG.md +36 -9
- data/Rakefile +15 -0
- data/Steepfile +0 -1
- data/core/binding.rbs +2 -0
- data/core/complex.rbs +0 -2
- data/core/env.rbs +881 -0
- data/core/false_class.rbs +2 -0
- data/core/float.rbs +0 -2
- data/core/integer.rbs +0 -2
- data/core/nil_class.rbs +2 -0
- 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/symbol.rbs +2 -0
- data/core/true_class.rbs +2 -0
- 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/constants.c +0 -1
- data/ext/rbs_extension/lexer.c +2526 -1063
- data/ext/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/parser.c +2 -32
- data/ext/rbs_extension/parser.h +0 -5
- data/ext/rbs_extension/parserstate.c +0 -1
- data/ext/rbs_extension/rbs_extension.h +1 -1
- data/ext/rbs_extension/ruby_objs.c +84 -148
- data/ext/rbs_extension/ruby_objs.h +0 -2
- data/lib/rbs/collection/installer.rb +1 -0
- data/lib/rbs/collection/sources/git.rb +6 -1
- data/lib/rbs/errors.rb +6 -0
- data/lib/rbs/parser_aux.rb +37 -5
- 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/test/setup.rb +1 -0
- data/lib/rbs/types.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +12 -0
- data/sig/parser.rbs +2 -0
- data/sig/rbs.rbs +4 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +44 -0
- data/stdlib/csv/0/csv.rbs +49 -3
- 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 +13 -5
- data/lib/rbs/parser.y +0 -1805
data/core/false_class.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/nil_class.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/symbol.rbs
CHANGED
data/core/true_class.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
|
|