rbs 1.0.3 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -2
  3. data/CHANGELOG.md +65 -0
  4. data/Gemfile +0 -1
  5. data/Rakefile +3 -2
  6. data/Steepfile +2 -0
  7. data/bin/rbs-prof +1 -1
  8. data/core/array.rbs +10 -6
  9. data/core/complex.rbs +1 -1
  10. data/core/enumerable.rbs +15 -1
  11. data/core/enumerator.rbs +4 -0
  12. data/core/file.rbs +2 -1
  13. data/core/integer.rbs +2 -1
  14. data/core/module.rbs +1 -1
  15. data/core/rational.rbs +2 -1
  16. data/core/string.rbs +2 -1
  17. data/core/symbol.rbs +2 -1
  18. data/core/thread.rbs +14 -1
  19. data/core/time.rbs +2 -1
  20. data/docs/stdlib.md +1 -1
  21. data/lib/rbs.rb +3 -0
  22. data/lib/rbs/ancestor_graph.rb +90 -0
  23. data/lib/rbs/ast/members.rb +13 -0
  24. data/lib/rbs/char_scanner.rb +20 -0
  25. data/lib/rbs/definition_builder.rb +50 -25
  26. data/lib/rbs/definition_builder/method_builder.rb +23 -2
  27. data/lib/rbs/environment.rb +42 -5
  28. data/lib/rbs/environment_walker.rb +4 -4
  29. data/lib/rbs/errors.rb +32 -17
  30. data/lib/rbs/parser.rb +437 -416
  31. data/lib/rbs/parser.y +29 -16
  32. data/lib/rbs/test/type_check.rb +7 -3
  33. data/lib/rbs/version.rb +1 -1
  34. data/sig/ancestor_graph.rbs +40 -0
  35. data/sig/char_scanner.rbs +9 -0
  36. data/sig/definition_builder.rbs +5 -1
  37. data/sig/environment.rbs +22 -2
  38. data/sig/environment_walker.rbs +39 -0
  39. data/sig/errors.rbs +42 -17
  40. data/sig/members.rbs +2 -0
  41. data/sig/method_builder.rbs +2 -0
  42. data/sig/parser.rbs +11 -4
  43. data/sig/polyfill.rbs +0 -14
  44. data/sig/types.rbs +7 -1
  45. data/stdlib/bigdecimal/0/big_decimal.rbs +1 -1
  46. data/stdlib/cgi/0/core.rbs +595 -0
  47. data/stdlib/date/0/date.rbs +1 -1
  48. data/stdlib/json/0/json.rbs +288 -0
  49. data/stdlib/pathname/0/pathname.rbs +2 -1
  50. data/stdlib/rubygems/0/basic_specification.rbs +3 -0
  51. data/stdlib/rubygems/0/config_file.rbs +3 -0
  52. data/stdlib/rubygems/0/dependency_installer.rbs +5 -0
  53. data/stdlib/rubygems/0/installer.rbs +3 -0
  54. data/stdlib/rubygems/0/path_support.rbs +3 -0
  55. data/stdlib/rubygems/0/platform.rbs +3 -0
  56. data/stdlib/rubygems/0/request_set.rbs +7 -0
  57. data/stdlib/rubygems/0/requirement.rbs +3 -0
  58. data/stdlib/rubygems/0/rubygems.rbs +710 -0
  59. data/stdlib/rubygems/0/source_list.rbs +2 -0
  60. data/stdlib/rubygems/0/specification.rbs +3 -0
  61. data/stdlib/rubygems/0/stream_ui.rbs +3 -0
  62. data/stdlib/rubygems/0/uninstaller.rbs +3 -0
  63. data/stdlib/rubygems/0/version.rbs +228 -0
  64. data/stdlib/set/0/set.rbs +7 -0
  65. data/stdlib/strscan/0/string_scanner.rbs +582 -0
  66. data/stdlib/timeout/0/timeout.rbs +57 -0
  67. data/stdlib/uri/0/rfc2396_parser.rbs +144 -7
  68. data/steep/Gemfile.lock +17 -19
  69. metadata +24 -2
@@ -0,0 +1,57 @@
1
+ # Timeout long-running blocks
2
+ #
3
+ # ## Synopsis
4
+ #
5
+ # require 'timeout'
6
+ # status = Timeout::timeout(5) {
7
+ # # Something that should be interrupted if it takes more than 5 seconds...
8
+ # }
9
+ #
10
+ # ## Description
11
+ #
12
+ # Timeout provides a way to auto-terminate a potentially long-running operation
13
+ # if it hasn't finished in a fixed amount of time.
14
+ #
15
+ # Previous versions didn't use a module for namespacing, however #timeout is
16
+ # provided for backwards compatibility. You should prefer Timeout.timeout
17
+ # instead.
18
+ #
19
+ # ## Copyright
20
+ #
21
+ # Copyright
22
+ # : (C) 2000 Network Applied Communication Laboratory, Inc.
23
+ # Copyright
24
+ # : (C) 2000 Information-technology Promotion Agency, Japan
25
+ #
26
+ module Timeout
27
+ # Perform an operation in a block, raising an error if it takes longer than
28
+ # `sec` seconds to complete.
29
+ #
30
+ # `sec`
31
+ # : Number of seconds to wait for the block to terminate. Any number may be
32
+ # used, including Floats to specify fractional seconds. A value of 0 or
33
+ # `nil` will execute the block without any timeout.
34
+ # `klass`
35
+ # : Exception Class to raise if the block fails to terminate in `sec` seconds.
36
+ # Omitting will use the default, Timeout::Error
37
+ # `message`
38
+ # : Error message to raise with Exception Class. Omitting will use the
39
+ # default, "execution expired"
40
+ #
41
+ #
42
+ # Returns the result of the block **if** the block completed before `sec`
43
+ # seconds, otherwise throws an exception, based on the value of `klass`.
44
+ #
45
+ # The exception thrown to terminate the given block cannot be rescued inside the
46
+ # block unless `klass` is given explicitly. However, the block can use ensure to
47
+ # prevent the handling of the exception. For that reason, this method cannot be
48
+ # relied on to enforce timeouts for untrusted blocks.
49
+ #
50
+ # Note that this is both a method of module Timeout, so you can `include
51
+ # Timeout` into your classes so they have a #timeout method, as well as a module
52
+ # method, so you can call it directly as Timeout.timeout().
53
+ #
54
+ def self?.timeout: [T] (Numeric? sec, ?singleton(Exception) klass, ?String message) { (Numeric sec) -> T } -> T
55
+ end
56
+
57
+ Timeout::VERSION: String
@@ -1,9 +1,146 @@
1
- # Class that parses String's into URI's.
2
- #
3
- # It contains a Hash set of patterns and Regexp's that match and validate.
4
- class URI::RFC2396_Parser
5
- end
1
+ module URI
2
+ # Includes URI::REGEXP::PATTERN
3
+ #
4
+ module RFC2396_REGEXP
5
+ end
6
+
7
+ # Class that parses String's into URI's.
8
+ #
9
+ # It contains a Hash set of patterns and Regexp's that match and validate.
10
+ #
11
+ class RFC2396_Parser
12
+ include RFC2396_REGEXP
13
+
14
+ # The Hash of patterns.
15
+ #
16
+ # See also URI::Parser.initialize_pattern.
17
+ #
18
+ attr_reader pattern: Hash[Symbol, String]
19
+
20
+ # The Hash of Regexp.
21
+ #
22
+ # See also URI::Parser.initialize_regexp.
23
+ #
24
+ attr_reader regexp: Hash[Symbol, Regexp]
25
+
26
+ # == Synopsis
27
+ #
28
+ # URI::Parser.new([opts])
29
+ #
30
+ # == Args
31
+ #
32
+ # The constructor accepts a hash as options for parser.
33
+ # Keys of options are pattern names of URI components
34
+ # and values of options are pattern strings.
35
+ # The constructor generates set of regexps for parsing URIs.
36
+ #
37
+ # You can use the following keys:
38
+ #
39
+ # * :ESCAPED (URI::PATTERN::ESCAPED in default)
40
+ # * :UNRESERVED (URI::PATTERN::UNRESERVED in default)
41
+ # * :DOMLABEL (URI::PATTERN::DOMLABEL in default)
42
+ # * :TOPLABEL (URI::PATTERN::TOPLABEL in default)
43
+ # * :HOSTNAME (URI::PATTERN::HOSTNAME in default)
44
+ #
45
+ # == Examples
46
+ #
47
+ # p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
48
+ # u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP http://example.jp/%uABCD>
49
+ # URI.parse(u.to_s) #=> raises URI::InvalidURIError
50
+ #
51
+ # s = "http://example.com/ABCD"
52
+ # u1 = p.parse(s) #=> #<URI::HTTP http://example.com/ABCD>
53
+ # u2 = URI.parse(s) #=> #<URI::HTTP http://example.com/ABCD>
54
+ # u1 == u2 #=> true
55
+ # u1.eql?(u2) #=> false
56
+ #
57
+ def initialize: (?Hash[Symbol, String] opts) -> void
58
+
59
+ # ## Args
60
+ #
61
+ # `str`
62
+ # : String to make safe
63
+ # `unsafe`
64
+ # : Regexp to apply. Defaults to [self.regexp](:UNSAFE)
65
+ #
66
+ #
67
+ # ## Description
68
+ #
69
+ # Constructs a safe String from `str`, removing unsafe characters, replacing
70
+ # them with codes.
71
+ #
72
+ def escape: (String str, ?Regexp unsafe) -> String
73
+
74
+ # ## Args
75
+ #
76
+ # `str`
77
+ # : String to search
78
+ # `schemes`
79
+ # : Patterns to apply to `str`
80
+ #
81
+ #
82
+ # ## Description
83
+ #
84
+ # Attempts to parse and merge a set of URIs. If no `block` given, then returns
85
+ # the result, else it calls `block` for each element in result.
86
+ #
87
+ # See also URI::Parser.make_regexp.
88
+ #
89
+ def extract: (String str, ?Array[String] schemes) -> Array[String]
90
+ | (String str, ?Array[String] schemes) { (String) -> untyped } -> nil
91
+
92
+ # ## Args
93
+ #
94
+ # `uris`
95
+ # : an Array of Strings
96
+ #
97
+ #
98
+ # ## Description
99
+ #
100
+ # Attempts to parse and merge a set of URIs.
101
+ #
102
+ def join: (*String uris) -> URI::Generic
103
+
104
+ # Returns Regexp that is default [self.regexp](:ABS_URI_REF), unless `schemes`
105
+ # is provided. Then it is a Regexp.union with [self.pattern](:X_ABS_URI).
106
+ #
107
+ def make_regexp: (?Array[String] schemes) -> Regexp
108
+
109
+ # ## Args
110
+ #
111
+ # `uri`
112
+ # : String
113
+ #
114
+ #
115
+ # ## Description
116
+ #
117
+ # Parses `uri` and constructs either matching URI scheme object (File, FTP,
118
+ # HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic.
119
+ #
120
+ # ## Usage
121
+ #
122
+ # p = URI::Parser.new
123
+ # p.parse("ldap://ldap.example.com/dc=example?user=john")
124
+ # #=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>
125
+ #
126
+ def parse: (String uri) -> URI::Generic
127
+
128
+ # Returns a split URI against [regexp](:ABS_URI).
129
+ #
130
+ def split: (String uri) -> [ String?, String?, String?, String?, String?, String?, String?, String?, String? ]
6
131
 
7
- # Includes URI::REGEXP::PATTERN
8
- module URI::RFC2396_REGEXP
132
+ # ## Args
133
+ #
134
+ # `str`
135
+ # : String to remove escapes from
136
+ # `escaped`
137
+ # : Regexp to apply. Defaults to [self.regexp](:ESCAPED)
138
+ #
139
+ #
140
+ # ## Description
141
+ #
142
+ # Removes escapes from `str`.
143
+ #
144
+ def unescape: (String str, ?Regexp escaped) -> String
145
+ end
9
146
  end
data/steep/Gemfile.lock CHANGED
@@ -1,42 +1,40 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (6.1.0)
4
+ activesupport (6.1.2.1)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
6
  i18n (>= 1.6, < 2)
7
7
  minitest (>= 5.1)
8
8
  tzinfo (~> 2.0)
9
9
  zeitwerk (~> 2.3)
10
- ast (2.4.1)
11
- ast_utils (0.3.0)
12
- parser (~> 2.4)
13
- thor (>= 0.19)
14
- concurrent-ruby (1.1.7)
15
- ffi (1.13.1)
16
- i18n (1.8.5)
10
+ ast (2.4.2)
11
+ ast_utils (0.4.0)
12
+ parser (>= 2.7.0)
13
+ concurrent-ruby (1.1.8)
14
+ ffi (1.14.2)
15
+ i18n (1.8.8)
17
16
  concurrent-ruby (~> 1.0)
18
17
  language_server-protocol (3.15.0.1)
19
- listen (3.3.3)
18
+ listen (3.4.1)
20
19
  rb-fsevent (~> 0.10, >= 0.10.3)
21
20
  rb-inotify (~> 0.9, >= 0.9.10)
22
- minitest (5.14.2)
23
- parser (2.7.2.0)
21
+ minitest (5.14.3)
22
+ parser (3.0.0.0)
24
23
  ast (~> 2.4.1)
25
24
  rainbow (3.0.0)
26
25
  rb-fsevent (0.10.4)
27
26
  rb-inotify (0.10.1)
28
27
  ffi (~> 1.0)
29
- rbs (0.20.1)
30
- steep (0.38.0)
28
+ rbs (1.0.4)
29
+ steep (0.41.0)
31
30
  activesupport (>= 5.1)
32
- ast_utils (~> 0.3.0)
31
+ ast_utils (>= 0.4.0)
33
32
  language_server-protocol (~> 3.15.0.1)
34
33
  listen (~> 3.0)
35
- parser (~> 2.7.0)
34
+ parser (>= 2.7)
36
35
  rainbow (>= 2.2.2, < 4.0)
37
- rbs (>= 0.20.0)
38
- thor (1.0.1)
39
- tzinfo (2.0.3)
36
+ rbs (~> 1.0.3)
37
+ tzinfo (2.0.4)
40
38
  concurrent-ruby (~> 1.0)
41
39
  zeitwerk (2.4.2)
42
40
 
@@ -47,4 +45,4 @@ DEPENDENCIES
47
45
  steep
48
46
 
49
47
  BUNDLED WITH
50
- 2.2.0.rc.2
48
+ 2.2.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-28 00:00:00.000000000 Z
11
+ date: 2021-03-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RBS is the language for type signatures for Ruby and standard library
14
14
  definitions.
@@ -102,12 +102,14 @@ files:
102
102
  - exe/rbs
103
103
  - goodcheck.yml
104
104
  - lib/rbs.rb
105
+ - lib/rbs/ancestor_graph.rb
105
106
  - lib/rbs/ast/annotation.rb
106
107
  - lib/rbs/ast/comment.rb
107
108
  - lib/rbs/ast/declarations.rb
108
109
  - lib/rbs/ast/members.rb
109
110
  - lib/rbs/buffer.rb
110
111
  - lib/rbs/builtin_names.rb
112
+ - lib/rbs/char_scanner.rb
111
113
  - lib/rbs/cli.rb
112
114
  - lib/rbs/constant.rb
113
115
  - lib/rbs/constant_table.rb
@@ -158,9 +160,11 @@ files:
158
160
  - schema/methodType.json
159
161
  - schema/types.json
160
162
  - sig/ancestor_builder.rbs
163
+ - sig/ancestor_graph.rbs
161
164
  - sig/annotation.rbs
162
165
  - sig/buffer.rbs
163
166
  - sig/builtin_names.rbs
167
+ - sig/char_scanner.rbs
164
168
  - sig/cli.rbs
165
169
  - sig/comment.rbs
166
170
  - sig/constant.rbs
@@ -170,6 +174,7 @@ files:
170
174
  - sig/definition_builder.rbs
171
175
  - sig/environment.rbs
172
176
  - sig/environment_loader.rbs
177
+ - sig/environment_walker.rbs
173
178
  - sig/errors.rbs
174
179
  - sig/location.rbs
175
180
  - sig/members.rbs
@@ -195,6 +200,7 @@ files:
195
200
  - stdlib/benchmark/0/benchmark.rbs
196
201
  - stdlib/bigdecimal-math/0/big_math.rbs
197
202
  - stdlib/bigdecimal/0/big_decimal.rbs
203
+ - stdlib/cgi/0/core.rbs
198
204
  - stdlib/coverage/0/coverage.rbs
199
205
  - stdlib/csv/0/csv.rbs
200
206
  - stdlib/date/0/date.rbs
@@ -220,10 +226,26 @@ files:
220
226
  - stdlib/prime/0/prime.rbs
221
227
  - stdlib/pstore/0/pstore.rbs
222
228
  - stdlib/pty/0/pty.rbs
229
+ - stdlib/rubygems/0/basic_specification.rbs
230
+ - stdlib/rubygems/0/config_file.rbs
231
+ - stdlib/rubygems/0/dependency_installer.rbs
232
+ - stdlib/rubygems/0/installer.rbs
233
+ - stdlib/rubygems/0/path_support.rbs
234
+ - stdlib/rubygems/0/platform.rbs
235
+ - stdlib/rubygems/0/request_set.rbs
236
+ - stdlib/rubygems/0/requirement.rbs
237
+ - stdlib/rubygems/0/rubygems.rbs
238
+ - stdlib/rubygems/0/source_list.rbs
239
+ - stdlib/rubygems/0/specification.rbs
240
+ - stdlib/rubygems/0/stream_ui.rbs
241
+ - stdlib/rubygems/0/uninstaller.rbs
242
+ - stdlib/rubygems/0/version.rbs
223
243
  - stdlib/securerandom/0/securerandom.rbs
224
244
  - stdlib/set/0/set.rbs
225
245
  - stdlib/singleton/0/singleton.rbs
246
+ - stdlib/strscan/0/string_scanner.rbs
226
247
  - stdlib/time/0/time.rbs
248
+ - stdlib/timeout/0/timeout.rbs
227
249
  - stdlib/tmpdir/0/tmpdir.rbs
228
250
  - stdlib/tsort/0/cyclic.rbs
229
251
  - stdlib/tsort/0/interfaces.rbs