rbs 1.7.0.beta.4 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CHANGELOG.md +58 -2
- data/Steepfile +0 -1
- data/core/array.rbs +3 -3
- data/core/binding.rbs +2 -0
- data/core/builtin.rbs +4 -0
- data/core/complex.rbs +0 -2
- data/core/enumerable.rbs +3 -3
- 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/thread.rbs +1 -1
- 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 +25 -23
- data/ext/rbs_extension/parser.c +99 -95
- data/ext/rbs_extension/parserstate.c +0 -1
- data/ext/rbs_extension/rbs_extension.h +1 -1
- data/ext/rbs_extension/ruby_objs.c +8 -6
- data/ext/rbs_extension/ruby_objs.h +2 -4
- data/lib/rbs/ast/declarations.rb +6 -2
- data/lib/rbs/cli.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +6 -1
- data/lib/rbs/definition_builder.rb +29 -2
- data/lib/rbs/environment.rb +1 -0
- data/lib/rbs/environment_walker.rb +4 -1
- data/lib/rbs/errors.rb +12 -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/type_alias_regularity.rb +115 -0
- data/lib/rbs/types.rb +11 -23
- data/lib/rbs/validator.rb +40 -7
- data/lib/rbs/variance_calculator.rb +52 -24
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +1 -1
- data/lib/rbs.rb +2 -0
- data/schema/decls.json +13 -1
- data/schema/types.json +8 -2
- data/sig/collection/collections.rbs +2 -0
- data/sig/declarations.rbs +9 -6
- data/sig/definition_builder.rbs +29 -0
- data/sig/environment_walker.rbs +26 -0
- data/sig/errors.rbs +10 -0
- data/sig/type_alias_regularity.rbs +92 -0
- data/sig/types.rbs +11 -8
- data/sig/validator.rbs +7 -0
- data/sig/variance_calculator.rbs +50 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +44 -0
- data/stdlib/csv/0/csv.rbs +49 -3
- data/stdlib/date/0/date.rbs +2 -2
- data/stdlib/set/0/set.rbs +3 -3
- data/steep/Gemfile.lock +10 -10
- metadata +8 -6
- data/lib/rbs/parser.y +0 -1805
- data/lib/ruby/signature.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b12d92ea4eeeb5dbd6de6c5d58351b0306bdcd017d0f1e51a36599766bfded3
|
4
|
+
data.tar.gz: d60cfb836027441a5bb3f85fbebb0e2ab9bc03c49a21f00c3f10d4ab8dd1de65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ef926a62415189173d41204d1a16674a4a8331e3fdefafe00a4e52c9cbf0f3eb84281194a5b5c43027455334c13ea0ab14e1b3f0a6b8d5f5644cb80733a246b
|
7
|
+
data.tar.gz: ce07016eee6b4142a66a28d8c7ffc356b3d4fdd747027f2dd521b347efcb6ac791385e903a1e3b9f8d468ec66e13995e341516137ceba990db511982c6d0d206
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,20 +2,76 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
-
## 1.
|
5
|
+
## 1.8.0 (2021-12-02)
|
6
|
+
|
7
|
+
RBS 1.8.0 ships with a language feature enchancement, _generic type alias_.
|
8
|
+
You can define a type alias with type parameters now.
|
9
|
+
|
10
|
+
```rbs
|
11
|
+
type list[T] = [T, list[T]] | nil # Defines a list of type T
|
12
|
+
|
13
|
+
type int_list = list[Integer] # List of Integer
|
14
|
+
type string_list = list[String] # List of String
|
15
|
+
```
|
16
|
+
|
17
|
+
You can find the detail in the [PR](https://github.com/ruby/rbs/pull/823).
|
18
|
+
|
19
|
+
### Signature updates
|
20
|
+
|
21
|
+
* `Date#+`, `Date#-` ([\#830](https://github.com/ruby/rbs/pull/830))
|
22
|
+
* `#include?`, `#member?`, `#delete`, `#count` ([\#835](https://github.com/ruby/rbs/pull/835))
|
23
|
+
|
24
|
+
### Language updates
|
25
|
+
|
26
|
+
* Generic type alias ([\#823](https://github.com/ruby/rbs/pull/823))
|
27
|
+
|
28
|
+
## 1.7.1 (2021-11-18)
|
29
|
+
|
30
|
+
### Signature updates
|
31
|
+
|
32
|
+
* `Thread#value` ([\#824](https://github.com/ruby/rbs/pull/824/files))
|
33
|
+
|
34
|
+
### Library changes
|
35
|
+
|
36
|
+
* Unquote parameter name ([\#827](https://github.com/ruby/rbs/pull/827))
|
37
|
+
* Remove `ruby/signature.rb` ([\#825](https://github.com/ruby/rbs/pull/825))
|
38
|
+
|
39
|
+
### Miscellaneous
|
40
|
+
|
41
|
+
* Use `untyped` as an expectation of return value of `IO#ready?` in test ([\#828](https://github.com/ruby/rbs/pull/828/files))
|
42
|
+
|
43
|
+
## 1.7.0 (2021-11-11)
|
44
|
+
|
45
|
+
This version replaces `RBS::Parser` implementation from pure Ruby code based on [Racc](https://github.com/ruby/racc) to C extension.
|
46
|
+
It improves the RBS file parsing performance up to 5 times faster. :rocket:
|
47
|
+
|
48
|
+
* There are some incompatibilties to drop obsolete syntax rules: `super` keyword and `any` type are no longer supported.
|
49
|
+
* [re2c](https://github.com/skvadrik/re2c) is used to generate lexical generator.
|
50
|
+
|
51
|
+
When you want to change the parser/lexer, change the files under `ext/rbs_extension` directory and run `rake compile` to compile the extension.
|
6
52
|
|
7
53
|
### Signature updates
|
8
54
|
|
9
55
|
* io/console ([\#783](https://github.com/ruby/rbs/pull/783))
|
56
|
+
* `ENV` -- Note that it introduces a dummy `::ENVClass` class, which is not defined in Ruby. ([\#812](https://github.com/ruby/rbs/pull/812))
|
10
57
|
* `Net::HTTPRequest` ([\#784](https://github.com/ruby/rbs/pull/784))
|
58
|
+
* `#clone` ([#811](https://github.com/ruby/rbs/pull/811), [\#813](https://github.com/ruby/rbs/pull/813))
|
59
|
+
* `Kernel#BigDecimal` ([\#817](https://github.com/ruby/rbs/pull/817))
|
11
60
|
* `Tempfile.new`, `Tempfile.create` ([\#792](https://github.com/ruby/rbs/pull/792), [\#791](https://github.com/ruby/rbs/pull/791))
|
12
61
|
|
13
62
|
### Library changes
|
14
63
|
|
64
|
+
* Replace `RBS::Parser` ([#788](https://github.com/ruby/rbs/pull/788), [#789](https://github.com/ruby/rbs/pull/789))
|
15
65
|
* Fix unexpected `CollectionNotAvailable` without `gems` from git source ([\#795](https://github.com/ruby/rbs/pull/795))
|
16
|
-
* Replace RBS::Parser ([#788](https://github.com/ruby/rbs/pull/788), [#789](https://github.com/ruby/rbs/pull/789))
|
17
66
|
* Print deprecation warning ([\#801](https://github.com/ruby/rbs/pull/801))
|
18
67
|
* Make `Parser::KEYWORDS` a hash ([\#804](https://github.com/ruby/rbs/pull/804))
|
68
|
+
* Use _partial clone_ for `rbs collection` installer ([#805](https://github.com/ruby/rbs/pull/805))
|
69
|
+
* Respect logger level for test/setup logger ([\#819](https://github.com/ruby/rbs/pull/819), [\#822](https://github.com/ruby/rbs/pull/822))
|
70
|
+
|
71
|
+
## Miscellaneous
|
72
|
+
|
73
|
+
* Avoid a mixture of `Array#filter` and `Array#select` ([\#820](https://github.com/ruby/rbs/pull/820))
|
74
|
+
* Remove leftover documentation about `super` ([\#807](https://github.com/ruby/rbs/pull/807))
|
19
75
|
|
20
76
|
## 1.6.2 (2021-09-09)
|
21
77
|
|
data/Steepfile
CHANGED
data/core/array.rbs
CHANGED
@@ -699,7 +699,7 @@ class Array[unchecked out Elem] < Object
|
|
699
699
|
# ary.count {|x| x%2 == 0} #=> 3
|
700
700
|
#
|
701
701
|
def count: () -> ::Integer
|
702
|
-
| (
|
702
|
+
| (Elem obj) -> ::Integer
|
703
703
|
| () { (Elem) -> boolish } -> ::Integer
|
704
704
|
|
705
705
|
# Calls the given block for each element `n` times or forever if `nil` is given.
|
@@ -733,7 +733,7 @@ class Array[unchecked out Elem] < Object
|
|
733
733
|
# a.delete("z") #=> nil
|
734
734
|
# a.delete("z") {"not found"} #=> "not found"
|
735
735
|
#
|
736
|
-
def delete: (
|
736
|
+
def delete: (Elem obj) -> Elem?
|
737
737
|
| [S, T] (S obj) { (S) -> T } -> (Elem | T)
|
738
738
|
|
739
739
|
# Deletes the element at the specified `index`, returning that element, or `nil`
|
@@ -1029,7 +1029,7 @@ class Array[unchecked out Elem] < Object
|
|
1029
1029
|
# a.include?("b") #=> true
|
1030
1030
|
# a.include?("z") #=> false
|
1031
1031
|
#
|
1032
|
-
def include?: (
|
1032
|
+
def include?: (Elem object) -> bool
|
1033
1033
|
|
1034
1034
|
# Returns the *index* of the first object in `ary` such that the object is `==`
|
1035
1035
|
# to `obj`.
|
data/core/binding.rbs
CHANGED
data/core/builtin.rbs
CHANGED
data/core/complex.rbs
CHANGED
data/core/enumerable.rbs
CHANGED
@@ -63,7 +63,7 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
|
|
63
63
|
# ary.count{ |x| x%2==0 } #=> 3
|
64
64
|
# ```
|
65
65
|
def count: () -> Integer
|
66
|
-
| (
|
66
|
+
| (Elem) -> Integer
|
67
67
|
| () { (Elem) -> boolish } -> Integer
|
68
68
|
|
69
69
|
def cycle: (?Integer n) { (Elem arg0) -> untyped } -> NilClass
|
@@ -130,7 +130,7 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
|
|
130
130
|
def group_by: [U] () { (Elem arg0) -> U } -> ::Hash[U, ::Array[Elem]]
|
131
131
|
| () -> ::Enumerator[Elem, ::Array[Elem]]
|
132
132
|
|
133
|
-
def `include?`: (
|
133
|
+
def `include?`: (Elem arg0) -> bool
|
134
134
|
|
135
135
|
def inject: (untyped init, Symbol method) -> untyped
|
136
136
|
| (Symbol method) -> untyped
|
@@ -341,7 +341,7 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
|
|
341
341
|
def map: [U] () { (Elem arg0) -> U } -> ::Array[U]
|
342
342
|
| () -> ::Enumerator[Elem, ::Array[untyped]]
|
343
343
|
|
344
|
-
def member?: (
|
344
|
+
def member?: (Elem arg0) -> bool
|
345
345
|
|
346
346
|
alias reduce inject
|
347
347
|
|