rbs 1.7.0.beta.5 → 1.8.1
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 +64 -3
- data/Steepfile +0 -1
- data/core/array.rbs +3 -3
- data/core/builtin.rbs +4 -0
- data/core/enumerable.rbs +3 -3
- data/core/env.rbs +881 -0
- data/core/false_class.rbs +2 -0
- data/core/nil_class.rbs +2 -0
- data/core/symbol.rbs +2 -0
- data/core/thread.rbs +1 -1
- data/core/true_class.rbs +2 -0
- data/docs/syntax.md +23 -20
- data/ext/rbs_extension/parser.c +97 -95
- data/ext/rbs_extension/ruby_objs.c +8 -6
- data/ext/rbs_extension/ruby_objs.h +2 -2
- data/lib/rbs/ast/declarations.rb +6 -2
- data/lib/rbs/cli.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +9 -7
- data/lib/rbs/definition_builder.rb +58 -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/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 +44 -15
- 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 +1 -0
- data/schema/decls.json +13 -1
- data/schema/types.json +8 -2
- data/sig/collection/collections.rbs +4 -2
- data/sig/declarations.rbs +9 -6
- data/sig/definition_builder.rbs +36 -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 +7 -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: df1527cdbc750871d430d1c69bd4c9188b8814af7f3163d62adc5f9c1297e0dc
|
4
|
+
data.tar.gz: 3d0cc66c78d043e5fd98b86b342a7e8944c1cee8bf31f8f876530caba4cd9bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c7f150ac87495a3ef064b5b499a5ef72c13eeb23985b84def107c111c6973a02ce6c3984bf22d1389882adf6d02f70fc82773d78383dd3992a2d7dbe58a7e59
|
7
|
+
data.tar.gz: f99bd7edbf1b4cf1cb5f018538345fe8ea50653ad6fa908aa3cd98c46d45b095aabb0cc2314cfae064997c0db2c6a31c6f9ab4fda1b15d2890a6b9be8dc8244a
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,22 +2,83 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
-
## 1.
|
5
|
+
## 1.8.1 (2021-12-13)
|
6
|
+
|
7
|
+
### Library changes
|
8
|
+
|
9
|
+
* Validate `extend` arguments ([\#840](https://github.com/ruby/rbs/pull/840))
|
10
|
+
* Allow a relative path as git remote in collection ([\#839](https://github.com/ruby/rbs/pull/839))
|
11
|
+
|
12
|
+
## 1.8.0 (2021-12-02)
|
13
|
+
|
14
|
+
RBS 1.8.0 ships with a language feature enchancement, _generic type alias_.
|
15
|
+
You can define a type alias with type parameters now.
|
16
|
+
|
17
|
+
```rbs
|
18
|
+
type list[T] = [T, list[T]] | nil # Defines a list of type T
|
19
|
+
|
20
|
+
type int_list = list[Integer] # List of Integer
|
21
|
+
type string_list = list[String] # List of String
|
22
|
+
```
|
23
|
+
|
24
|
+
You can find the detail in the [PR](https://github.com/ruby/rbs/pull/823).
|
25
|
+
|
26
|
+
### Signature updates
|
27
|
+
|
28
|
+
* `Date#+`, `Date#-` ([\#830](https://github.com/ruby/rbs/pull/830))
|
29
|
+
* `#include?`, `#member?`, `#delete`, `#count` ([\#835](https://github.com/ruby/rbs/pull/835))
|
30
|
+
|
31
|
+
### Language updates
|
32
|
+
|
33
|
+
* Generic type alias ([\#823](https://github.com/ruby/rbs/pull/823))
|
34
|
+
|
35
|
+
## 1.7.1 (2021-11-18)
|
36
|
+
|
37
|
+
### Signature updates
|
38
|
+
|
39
|
+
* `Thread#value` ([\#824](https://github.com/ruby/rbs/pull/824/files))
|
40
|
+
|
41
|
+
### Library changes
|
42
|
+
|
43
|
+
* Unquote parameter name ([\#827](https://github.com/ruby/rbs/pull/827))
|
44
|
+
* Remove `ruby/signature.rb` ([\#825](https://github.com/ruby/rbs/pull/825))
|
45
|
+
|
46
|
+
### Miscellaneous
|
47
|
+
|
48
|
+
* Use `untyped` as an expectation of return value of `IO#ready?` in test ([\#828](https://github.com/ruby/rbs/pull/828/files))
|
49
|
+
|
50
|
+
## 1.7.0 (2021-11-11)
|
51
|
+
|
52
|
+
This version replaces `RBS::Parser` implementation from pure Ruby code based on [Racc](https://github.com/ruby/racc) to C extension.
|
53
|
+
It improves the RBS file parsing performance up to 5 times faster. :rocket:
|
54
|
+
|
55
|
+
* There are some incompatibilties to drop obsolete syntax rules: `super` keyword and `any` type are no longer supported.
|
56
|
+
* [re2c](https://github.com/skvadrik/re2c) is used to generate lexical generator.
|
57
|
+
|
58
|
+
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
59
|
|
7
60
|
### Signature updates
|
8
61
|
|
9
62
|
* io/console ([\#783](https://github.com/ruby/rbs/pull/783))
|
63
|
+
* `ENV` -- Note that it introduces a dummy `::ENVClass` class, which is not defined in Ruby. ([\#812](https://github.com/ruby/rbs/pull/812))
|
10
64
|
* `Net::HTTPRequest` ([\#784](https://github.com/ruby/rbs/pull/784))
|
65
|
+
* `#clone` ([#811](https://github.com/ruby/rbs/pull/811), [\#813](https://github.com/ruby/rbs/pull/813))
|
66
|
+
* `Kernel#BigDecimal` ([\#817](https://github.com/ruby/rbs/pull/817))
|
11
67
|
* `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))
|
13
68
|
|
14
69
|
### Library changes
|
15
70
|
|
71
|
+
* Replace `RBS::Parser` ([#788](https://github.com/ruby/rbs/pull/788), [#789](https://github.com/ruby/rbs/pull/789))
|
16
72
|
* 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
73
|
* Print deprecation warning ([\#801](https://github.com/ruby/rbs/pull/801))
|
19
74
|
* Make `Parser::KEYWORDS` a hash ([\#804](https://github.com/ruby/rbs/pull/804))
|
20
75
|
* Use _partial clone_ for `rbs collection` installer ([#805](https://github.com/ruby/rbs/pull/805))
|
76
|
+
* Respect logger level for test/setup logger ([\#819](https://github.com/ruby/rbs/pull/819), [\#822](https://github.com/ruby/rbs/pull/822))
|
77
|
+
|
78
|
+
## Miscellaneous
|
79
|
+
|
80
|
+
* Avoid a mixture of `Array#filter` and `Array#select` ([\#820](https://github.com/ruby/rbs/pull/820))
|
81
|
+
* Remove leftover documentation about `super` ([\#807](https://github.com/ruby/rbs/pull/807))
|
21
82
|
|
22
83
|
## 1.6.2 (2021-09-09)
|
23
84
|
|
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/builtin.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
|
|