rbs 1.3.2 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c090bba432d9f46788964c4ae2e0def7a084141fb847d214b7153429ce2afe1d
4
- data.tar.gz: 8441fe573994cbe36ba2e87706aca5e063136859b127ae6df9773e5593754f12
3
+ metadata.gz: d4c3e2d7c96d7bfa810d993696088e8e4d7cd17301c5a96f925b38a6d2d6ef0c
4
+ data.tar.gz: f1a618f362782267bcbb221314f0070f0d6e6be4cd2436e3bf904c7bcbace039
5
5
  SHA512:
6
- metadata.gz: 13b2d6ff0fe6ddc6fc46c6499f88246b37e953e9784a543b3e17ef0457965dde9874fa61ae69de2fb22bb27bf0f155ffe62655cc8a4d95f45a3d80fa38599e61
7
- data.tar.gz: 9c6d7ff8e47a97235d4aebcb6cec1728cae0a03d9e18285e7649c585672690a0bbd4ff6de048c8fe36fb85f34b294c27ed28f97478bec456fe1b5645bedbafc3
6
+ metadata.gz: c98f6bdf67e2fc41f421ccd778a029b74f5ecc121f79e3c0740fb2d5b7eb03d8ac95116ba2bfa4193d6aeee2fb1d819f5144d6e6c883e1e332ee4fa96f41cbb7
7
+ data.tar.gz: 515b1091e01179d3b472e8a7dc16fb520767a2b2d7617bebd14fce0d806ff6368ee633234de91cc49c0814673d55f5b44cff87bb5bbb5098f25b46002d14d7b7
@@ -26,7 +26,7 @@ jobs:
26
26
  container:
27
27
  image: rubylang/ruby:${{ matrix.container_tag }}
28
28
  steps:
29
- - uses: actions/checkout@v1
29
+ - uses: actions/checkout@v2
30
30
  - name: Install dependencies
31
31
  run: |
32
32
  apt-get update
data/CHANGELOG.md CHANGED
@@ -2,6 +2,58 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.5.1 (2021-08-22)
6
+
7
+ ### Miscellaneous
8
+
9
+ * Fix Net_HTTP_test ([\#759](https://github.com/ruby/rbs/pull/759))
10
+
11
+ ## 1.5.0 (2021-08-22)
12
+
13
+ This release includes stdlib signature updates.
14
+
15
+ ### Signature updates
16
+
17
+ * digest ([\#744](https://github.com/ruby/rbs/pull/744), [\#757](https://github.com/ruby/rbs/pull/757))
18
+ * io-wait ([\#756](https://github.com/ruby/rbs/pull/756), [\#758](https://github.com/ruby/rbs/pull/758))
19
+ * `Ractor` ([\#755](https://github.com/ruby/rbs/pull/755))
20
+ * `File::Stat#size?` ([\#754](https://github.com/ruby/rbs/pull/754))
21
+ * `$-i`, `$0`, `$PROGRAM_NAME` ([\#753](https://github.com/ruby/rbs/pull/753))
22
+
23
+ ## 1.4.0 (2021-08-19)
24
+
25
+ This release includes feature enhancements including recursive `type` definition validation, improved compatibility of global variable names, and various method type updates.
26
+
27
+ ### Signature updates
28
+
29
+ * openssl ([\#743](https://github.com/ruby/rbs/pull/743))
30
+ * `Array`, `Enumerator`, `Enumerable`, `Hash`, `FalseClass`, `Float`, `Hash`, `Integer`, `Object`, `Range`, `TrueClass` ([\#728](https://github.com/ruby/rbs/pull/728))
31
+ * `Array#[]` ([\#732](https://github.com/ruby/rbs/pull/732))
32
+ * `Exception#set_backtrace` ([\#738](https://github.com/ruby/rbs/pull/738))
33
+ * `Kernel#Array` ([\#733](https://github.com/ruby/rbs/pull/733))
34
+ * `Kernel#spawn` ([\#748](https://github.com/ruby/rbs/pull/748))
35
+ * `Kernel#String` ([\#745](https://github.com/ruby/rbs/pull/745), [\#751](https://github.com/ruby/rbs/pull/751))
36
+ * `URI::Generic#fragment` ([\#752](https://github.com/ruby/rbs/pull/752))
37
+ * `URI::Generic#merge` ([\#746](https://github.com/ruby/rbs/pull/746))
38
+
39
+ ### Language updates
40
+
41
+ * Add global variables signature ([\#749](https://github.com/ruby/rbs/pull/749))
42
+
43
+ ### Library changes
44
+
45
+ * Add Recursiive type alias defnition validation ([\#719](https://github.com/ruby/rbs/pull/719))
46
+ * Generate included modules with complete name ([\#731](https://github.com/ruby/rbs/pull/731))
47
+ * Fix `rbs-prototype-rb` error when multi assign with const ([\#740](https://github.com/ruby/rbs/pull/740))
48
+
49
+ ## 1.3.3 (2021-07-28)
50
+
51
+ This release includes a minor update of `resolv` library RBS and a fix of test for `ruby/ruby` CI.
52
+
53
+ ### Signature updates
54
+
55
+ * resolv ([#726](https://github.com/ruby/rbs/pull/726))
56
+
5
57
  ## 1.3.2 (2021-07-23)
6
58
 
7
59
  This release is to fix a bug introduced by parser update in 1.3.0.
data/Gemfile CHANGED
@@ -15,6 +15,7 @@ gem "json-schema"
15
15
  gem 'stackprof'
16
16
  gem "goodcheck"
17
17
  gem "dbm"
18
+ gem 'digest'
18
19
 
19
20
  # Test gems
20
21
  gem "rbs-amber", path: "test/assets/test-gem"
data/Rakefile CHANGED
@@ -63,6 +63,10 @@ task :validate => :parser do
63
63
  lib << "timeout"
64
64
  end
65
65
 
66
+ if lib == ["openssl"]
67
+ lib << "socket"
68
+ end
69
+
66
70
  sh "#{ruby} #{rbs} #{lib.map {|l| "-r #{l}"}.join(" ")} validate --silent"
67
71
  end
68
72
  end
data/core/array.rbs CHANGED
@@ -452,7 +452,7 @@ class Array[unchecked out Elem] < Object
452
452
  #
453
453
  def []: (int index) -> Elem
454
454
  | (int start, int length) -> ::Array[Elem]?
455
- | (::Range[::Integer] range) -> ::Array[Elem]?
455
+ | (::Range[::Integer?] range) -> ::Array[Elem]?
456
456
 
457
457
  # Element Assignment --- Sets the element at `index`, or replaces a subarray
458
458
  # from the `start` index for `length` elements, or replaces a subarray specified
@@ -486,9 +486,9 @@ class Array[unchecked out Elem] < Object
486
486
  | (int start, int length, Elem obj) -> Elem
487
487
  | (int start, int length, ::Array[Elem]) -> ::Array[Elem]
488
488
  | (int start, int length, nil) -> nil
489
- | (::Range[::Integer], Elem obj) -> Elem
490
- | (::Range[::Integer], ::Array[Elem]) -> ::Array[Elem]
491
- | (::Range[::Integer], nil) -> nil
489
+ | (::Range[::Integer?], Elem obj) -> Elem
490
+ | (::Range[::Integer?], ::Array[Elem]) -> ::Array[Elem]
491
+ | (::Range[::Integer?], nil) -> nil
492
492
 
493
493
  # See also Enumerable#all?
494
494
  #
@@ -576,7 +576,8 @@ class Array[unchecked out Elem] < Object
576
576
  # true/false, or always return a number. It is undefined which value is
577
577
  # actually picked up at each iteration.
578
578
  #
579
- def bsearch: () { (Elem) -> (true | false) } -> Elem?
579
+ def bsearch: () -> ::Enumerator[Elem, Elem?]
580
+ | () { (Elem) -> (true | false) } -> Elem?
580
581
  | () { (Elem) -> ::Integer } -> Elem?
581
582
 
582
583
  # By using binary search, finds an index of a value from this array which meets
@@ -855,7 +856,7 @@ class Array[unchecked out Elem] < Object
855
856
  # 0 -- 1 -- 2 --
856
857
  #
857
858
  def each_index: () { (::Integer index) -> void } -> self
858
- | () -> ::Enumerator[Elem, self]
859
+ | () -> ::Enumerator[::Integer, self]
859
860
 
860
861
  # Returns `true` if `self` contains no elements.
861
862
  #
@@ -1585,7 +1586,7 @@ class Array[unchecked out Elem] < Object
1585
1586
  # a.sample(4, random: Random.new(1)) #=> [6, 10, 9, 2]
1586
1587
  #
1587
1588
  def sample: (?random: _Rand rng) -> Elem?
1588
- | (?int n, ?random: _Rand rng) -> ::Array[Elem]
1589
+ | (int n, ?random: _Rand rng) -> ::Array[Elem]
1589
1590
 
1590
1591
  # Returns a new array containing all elements of `ary` for which the given
1591
1592
  # `block` returns a true value.
data/core/builtin.rbs CHANGED
@@ -31,7 +31,7 @@ interface _Each[out A]
31
31
  end
32
32
 
33
33
  interface _Reader
34
- def read: (?int length, ?string outbuf) -> String?
34
+ def read: (?int? length, ?string outbuf) -> String?
35
35
  end
36
36
 
37
37
  interface _ReaderPartial
data/core/enumerable.rbs CHANGED
@@ -48,7 +48,8 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
48
48
  def collect: [U] () { (Elem arg0) -> U } -> ::Array[U]
49
49
  | () -> ::Enumerator[Elem, ::Array[untyped]]
50
50
 
51
- def collect_concat: [U] () { (Elem arg0) -> ::Enumerator[U, untyped] } -> ::Array[U]
51
+ def collect_concat: [U] () { (Elem) -> (::Array[U] | U) } -> ::Array[U]
52
+ | () -> ::Enumerator[Elem, ::Array[untyped]]
52
53
 
53
54
  # Returns the number of items in `enum` through enumeration. If an
54
55
  # argument is given, the number of items in `enum` that are equal to
@@ -79,11 +80,11 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
79
80
  def each_cons: (Integer n) { (::Array[Elem] arg0) -> untyped } -> NilClass
80
81
  | (Integer n) -> ::Enumerator[::Array[Elem], NilClass]
81
82
 
82
- def each_with_index: () { (Elem arg0, Integer arg1) -> untyped } -> void
83
- | () -> ::Enumerator[[ Elem, Integer ], void]
83
+ def each_with_index: () { (Elem, Integer index) -> untyped } -> self
84
+ | () -> ::Enumerator[[ Elem, Integer ], self]
84
85
 
85
- def each_with_object: [U] (U arg0) { (Elem arg0, untyped arg1) -> untyped } -> U
86
- | [U] (U arg0) -> ::Enumerator[[ Elem, U ], U]
86
+ def each_with_object: [U] (U obj) { (Elem, U obj) -> untyped } -> U
87
+ | [U] (U obj) -> ::Enumerator[[ Elem, U ], U]
87
88
 
88
89
  # Returns an array containing the items in *enum* .
89
90
  #
@@ -102,7 +103,7 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
102
103
  alias select find_all
103
104
  alias filter find_all
104
105
 
105
- def find_index: (?untyped value) -> Integer?
106
+ def find_index: (untyped value) -> Integer?
106
107
  | () { (Elem) -> boolish } -> Integer?
107
108
  | () -> ::Enumerator[Elem, Integer?]
108
109
 
@@ -123,8 +124,8 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
123
124
  def grep: (untyped arg0) -> ::Array[Elem]
124
125
  | [U] (untyped arg0) { (Elem arg0) -> U } -> ::Array[U]
125
126
 
126
- def grep_v: (untyped arg0) -> ::Array[Integer]
127
- | [U] (untyped arg0) { (Elem arg0) -> U } -> ::Array[U]
127
+ def grep_v: (untyped) -> ::Array[Elem]
128
+ | [U] (untyped) { (Elem) -> U } -> ::Array[U]
128
129
 
129
130
  def group_by: [U] () { (Elem arg0) -> U } -> ::Hash[U, ::Array[Elem]]
130
131
  | () -> ::Enumerator[Elem, ::Array[Elem]]
@@ -410,8 +411,8 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
410
411
  def zip: [Elem2] (::Enumerable[Elem2] enum) -> ::Array[[Elem, Elem2 | nil]]
411
412
  | [U, Elem2] (::Enumerable[Elem2]) { ([Elem, Elem2 | nil]) -> U } -> nil
412
413
 
413
- def chunk: [U] () { (Elem elt) -> U } -> ::Enumerator[[U, Array[Elem]], void]
414
- | () -> ::Enumerator[Elem, Enumerator[untyped, untyped]]
414
+ def chunk: [U] () { (Elem elt) -> U } -> ::Enumerator[[U, ::Array[Elem]], void]
415
+ | () -> ::Enumerator[Elem, ::Enumerator[[untyped, ::Array[Elem]], void]]
415
416
 
416
417
  def chunk_while: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem], void]
417
418
 
data/core/enumerator.rbs CHANGED
@@ -238,8 +238,8 @@ class Enumerator[unchecked out Elem, out Return] < Object
238
238
  def with_index: (?Integer offset) { (Elem arg0, Integer arg1) -> untyped } -> Return
239
239
  | (?Integer offset) -> ::Enumerator[[ Elem, Integer ], Return]
240
240
 
241
- def with_object: [U] (U arg0) { (Elem arg0, U arg1) -> untyped } -> U
242
- | [U] (U arg0) -> ::Enumerator[[ Elem, U ], Return]
241
+ def with_object: [U] (U obj) { (Elem, U obj) -> untyped } -> U
242
+ | [U] (U obj) -> ::Enumerator[[ Elem, U ], U]
243
243
  end
244
244
 
245
245
  class Enumerator::Generator[out Elem] < Object
data/core/exception.rbs CHANGED
@@ -185,6 +185,7 @@ class Exception < Object
185
185
  def message: () -> String
186
186
 
187
187
  def set_backtrace: (String | ::Array[String] arg0) -> ::Array[String]
188
+ | (nil) -> nil
188
189
 
189
190
  # Returns exception’s message (or the name of the exception if no message
190
191
  # is set).
data/core/false_class.rbs CHANGED
@@ -5,12 +5,12 @@
5
5
  class FalseClass
6
6
  public
7
7
 
8
- def !: () -> bool
8
+ def !: () -> true
9
9
 
10
10
  # And---Returns `false`. *obj* is always evaluated as it is the argument to a
11
11
  # method call---there is no short-circuit evaluation in this case.
12
12
  #
13
- def &: (untyped obj) -> bool
13
+ def &: (untyped obj) -> false
14
14
 
15
15
  # Case Equality -- For class Object, effectively the same as calling `#==`, but
16
16
  # typically overridden by descendants to provide meaningful semantics in `case`
@@ -24,7 +24,7 @@ class FalseClass
24
24
  #
25
25
  def ^: (nil) -> false
26
26
  | (false) -> false
27
- | (untyped obj) -> bool
27
+ | (untyped obj) -> true
28
28
 
29
29
  alias inspect to_s
30
30
 
@@ -36,5 +36,5 @@ class FalseClass
36
36
  #
37
37
  def |: (nil) -> false
38
38
  | (false) -> false
39
- | (untyped obj) -> bool
39
+ | (untyped obj) -> true
40
40
  end
data/core/file.rbs CHANGED
@@ -1042,7 +1042,7 @@ class File::Stat < Object
1042
1042
 
1043
1043
  def rdev_minor: () -> Integer
1044
1044
 
1045
- def read: (?Integer length, ?String outbuf) -> String
1045
+ def read: (?int? length, ?string outbuf) -> String?
1046
1046
 
1047
1047
  def readable?: () -> bool
1048
1048
 
@@ -1054,6 +1054,8 @@ class File::Stat < Object
1054
1054
 
1055
1055
  def size: () -> Integer
1056
1056
 
1057
+ def size?: () -> Integer?
1058
+
1057
1059
  def socket?: () -> bool
1058
1060
 
1059
1061
  def sticky?: () -> bool
data/core/float.rbs CHANGED
@@ -180,7 +180,7 @@ class Float < Numeric
180
180
  # 1.2.coerce(3) #=> [3.0, 1.2]
181
181
  # 2.5.coerce(1.1) #=> [1.1, 2.5]
182
182
  #
183
- def coerce: (Numeric) -> [Numeric, Numeric]
183
+ def coerce: (Numeric) -> [Float, Float]
184
184
 
185
185
  def conj: () -> Float
186
186
 
@@ -0,0 +1,180 @@
1
+ # The Exception object set by Kernel#raise.
2
+ $!: Exception | nil
3
+
4
+ # The array contains the module names loaded by require.
5
+ $": Array[String]
6
+
7
+ # The process number of the Ruby running this script. Same as Process.pid.
8
+ $$: Integer
9
+
10
+ # The string matched by the last successful match.
11
+ $&: String | nil
12
+
13
+ # The string to the right of the last successful match.
14
+ $': String | nil
15
+
16
+ # The same as ARGV.
17
+ $*: Array[String]
18
+
19
+ # The highest group matched by the last successful match.
20
+ $+: String | nil
21
+
22
+ # The output field separator for Kernel#print and Array#join. Non-nil $, will be deprecated.
23
+ $,: String | nil
24
+
25
+ # The input record separator, newline by default.
26
+ $-0: String | nil
27
+
28
+ # The default separator for String#split. Non-nil $; will be deprecated.
29
+ $-F: Regexp | String | nil
30
+
31
+ # Load path for searching Ruby scripts and extension libraries used
32
+ # by Kernel#load and Kernel#require.
33
+ # Has a singleton method <code>$LOAD_PATH.resolve_feature_path(feature)</code>
34
+ # that returns [+:rb+ or +:so+, path], which resolves the feature to
35
+ # the path the original Kernel#require method would load.
36
+ $-I: Array[String]
37
+
38
+ $-W: 0 | 1 | 2
39
+
40
+ # True if option <tt>-a</tt> is set. Read-only variable.
41
+ $-a: bool
42
+
43
+ # The debug flag, which is set by the <tt>-d</tt> switch. Enabling debug
44
+ # output prints each exception raised to $stderr (but not its
45
+ # backtrace). Setting this to a true value enables debug output as
46
+ # if <tt>-d</tt> were given on the command line. Setting this to a false
47
+ # value disables debug output.
48
+ $-d: bool
49
+
50
+ # In in-place-edit mode, this variable holds the extension, otherwise +nil+.
51
+ $-i: String?
52
+
53
+ # True if option <tt>-l</tt> is set. Read-only variable.
54
+ $-l: bool
55
+
56
+ # True if option <tt>-p</tt> is set. Read-only variable.
57
+ $-p: bool
58
+
59
+ # The verbose flag, which is set by the <tt>-w</tt> or <tt>-v</tt> switch.
60
+ # Setting this to a true value enables warnings as if <tt>-w</tt> or <tt>-v</tt> were given
61
+ # on the command line. Setting this to +nil+ disables warnings,
62
+ # including from Kernel#warn.
63
+ $-v: bool | nil
64
+
65
+ # The verbose flag, which is set by the <tt>-w</tt> or <tt>-v</tt> switch.
66
+ # Setting this to a true value enables warnings as if <tt>-w</tt> or <tt>-v</tt> were given
67
+ # on the command line. Setting this to +nil+ disables warnings,
68
+ # including from Kernel#warn.
69
+ $-w: bool | nil
70
+
71
+ # The current input line number of the last file that was read.
72
+ $.: Integer
73
+
74
+ # The input record separator, newline by default. Aliased to $-0.
75
+ $/: String | nil
76
+
77
+ # Contains the name of the script being executed. May be assignable.
78
+ $0: String
79
+
80
+ # The Nth group of the last successful match. May be > 1.
81
+ $1: String | nil
82
+
83
+ # The Nth group of the last successful match. May be > 1.
84
+ $2: String | nil
85
+
86
+ # The Nth group of the last successful match. May be > 1.
87
+ $3: String | nil
88
+
89
+ # The Nth group of the last successful match. May be > 1.
90
+ $4: String | nil
91
+
92
+ # The Nth group of the last successful match. May be > 1.
93
+ $5: String | nil
94
+
95
+ # The Nth group of the last successful match. May be > 1.
96
+ $6: String | nil
97
+
98
+ # The Nth group of the last successful match. May be > 1.
99
+ $7: String | nil
100
+
101
+ # The Nth group of the last successful match. May be > 1.
102
+ $8: String | nil
103
+
104
+ # The Nth group of the last successful match. May be > 1.
105
+ $9: String | nil
106
+
107
+ # Load path for searching Ruby scripts and extension libraries used
108
+ # by Kernel#load and Kernel#require.
109
+ # Has a singleton method <code>$LOAD_PATH.resolve_feature_path(feature)</code>
110
+ # that returns [+:rb+ or +:so+, path], which resolves the feature to
111
+ # the path the original Kernel#require method would load.
112
+ $:: Array[String]
113
+
114
+ # The default separator for String#split. Non-nil $; will be deprecated. Aliased to $-F.
115
+ $;: Regexp | String | nil
116
+
117
+ # The same as ARGF.
118
+ $<: IO
119
+
120
+ # This variable is no longer effective. Deprecated.
121
+ $=: bool
122
+
123
+ # The default output stream for Kernel#print and Kernel#printf. $stdout by default.
124
+ $>: IO
125
+
126
+ # The status of the last executed child process (thread-local).
127
+ $?: Process::Status | nil
128
+
129
+ # The same as <code>$!.backtrace</code>.
130
+ $@: Array[String] | nil
131
+
132
+ # The debug flag, which is set by the <tt>-d</tt> switch. Enabling debug
133
+ # output prints each exception raised to $stderr (but not its
134
+ # backtrace). Setting this to a true value enables debug output as
135
+ # if <tt>-d</tt> were given on the command line. Setting this to a false
136
+ # value disables debug output. Aliased to $-d.
137
+ $DEBUG: bool
138
+
139
+ # Current input filename from ARGF. Same as ARGF.filename.
140
+ $FILENAME: String
141
+
142
+ # The array contains the module names loaded by require.
143
+ $LOADED_FEATURES: Array[String]
144
+
145
+ # Load path for searching Ruby scripts and extension libraries used
146
+ # by Kernel#load and Kernel#require. Aliased to $: and $-I.
147
+ # Has a singleton method <code>$LOAD_PATH.resolve_feature_path(feature)</code>
148
+ # that returns [+:rb+ or +:so+, path], which resolves the feature to
149
+ # the path the original Kernel#require method would load.
150
+ $LOAD_PATH: Array[String]
151
+
152
+ # Contains the name of the script being executed. May be assignable.
153
+ $PROGRAM_NAME: String
154
+
155
+ # The verbose flag, which is set by the <tt>-w</tt> or <tt>-v</tt> switch.
156
+ # Setting this to a true value enables warnings as if <tt>-w</tt> or <tt>-v</tt> were given
157
+ # on the command line. Setting this to +nil+ disables warnings,
158
+ # including from Kernel#warn. Aliased to $-v and $-w.
159
+ $VERBOSE: bool | nil
160
+
161
+ # The output record separator for Kernel#print and IO#write. Default is +nil+.
162
+ $\: String | nil
163
+
164
+ # The last input line of string by gets or readline.
165
+ $_: String | nil
166
+
167
+ # The string to the left of the last successful match.
168
+ $`: String | nil
169
+
170
+ # The current standard error output.
171
+ $stderr: IO
172
+
173
+ # The current standard input.
174
+ $stdin: IO
175
+
176
+ # The current standard output.
177
+ $stdout: IO
178
+
179
+ # The information about the last match in the current scope (thread-local and frame-local).
180
+ $~: MatchData | nil