rbs 3.9.5 → 3.10.0.pre.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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +74 -0
  3. data/.clangd +2 -0
  4. data/.github/workflows/c-check.yml +54 -0
  5. data/.github/workflows/comments.yml +3 -3
  6. data/.github/workflows/ruby.yml +34 -19
  7. data/.github/workflows/typecheck.yml +1 -1
  8. data/.github/workflows/windows.yml +1 -1
  9. data/.gitignore +4 -0
  10. data/README.md +38 -1
  11. data/Rakefile +152 -23
  12. data/config.yml +190 -62
  13. data/core/array.rbs +44 -43
  14. data/core/dir.rbs +2 -2
  15. data/core/encoding.rbs +3 -2
  16. data/core/enumerable.rbs +89 -2
  17. data/core/errno.rbs +8 -0
  18. data/core/errors.rbs +28 -1
  19. data/core/exception.rbs +2 -2
  20. data/core/fiber.rbs +3 -3
  21. data/core/file.rbs +26 -11
  22. data/core/float.rbs +1 -1
  23. data/core/gc.rbs +422 -281
  24. data/core/hash.rbs +1024 -727
  25. data/core/io/wait.rbs +11 -33
  26. data/core/io.rbs +6 -4
  27. data/core/kernel.rbs +49 -43
  28. data/core/marshal.rbs +1 -1
  29. data/core/match_data.rbs +1 -1
  30. data/core/math.rbs +42 -3
  31. data/core/method.rbs +14 -6
  32. data/core/module.rbs +71 -11
  33. data/core/nil_class.rbs +3 -3
  34. data/core/numeric.rbs +8 -8
  35. data/core/object.rbs +3 -3
  36. data/core/object_space.rbs +13 -0
  37. data/{stdlib/pathname/0 → core}/pathname.rbs +253 -352
  38. data/core/proc.rbs +15 -8
  39. data/core/process.rbs +2 -2
  40. data/core/ractor.rbs +278 -437
  41. data/core/range.rbs +6 -7
  42. data/core/rbs/unnamed/argf.rbs +1 -1
  43. data/core/rbs/unnamed/env_class.rbs +1 -1
  44. data/core/rbs/unnamed/random.rbs +4 -2
  45. data/core/regexp.rbs +22 -17
  46. data/core/ruby_vm.rbs +6 -4
  47. data/core/rubygems/errors.rbs +3 -70
  48. data/core/rubygems/rubygems.rbs +11 -79
  49. data/core/set.rbs +439 -332
  50. data/core/string.rbs +2897 -1117
  51. data/core/struct.rbs +1 -1
  52. data/core/symbol.rbs +4 -4
  53. data/core/thread.rbs +83 -20
  54. data/core/time.rbs +35 -9
  55. data/core/unbound_method.rbs +14 -6
  56. data/docs/aliases.md +79 -0
  57. data/docs/collection.md +2 -2
  58. data/docs/gem.md +0 -1
  59. data/docs/sigs.md +3 -3
  60. data/ext/rbs_extension/ast_translation.c +1016 -0
  61. data/ext/rbs_extension/ast_translation.h +37 -0
  62. data/ext/rbs_extension/class_constants.c +157 -0
  63. data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +7 -1
  64. data/ext/rbs_extension/compat.h +10 -0
  65. data/ext/rbs_extension/extconf.rb +25 -1
  66. data/ext/rbs_extension/legacy_location.c +317 -0
  67. data/ext/rbs_extension/legacy_location.h +45 -0
  68. data/ext/rbs_extension/main.c +365 -14
  69. data/ext/rbs_extension/rbs_extension.h +6 -21
  70. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  71. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  72. data/include/rbs/ast.h +687 -0
  73. data/include/rbs/defines.h +86 -0
  74. data/include/rbs/lexer.h +199 -0
  75. data/include/rbs/location.h +59 -0
  76. data/include/rbs/parser.h +135 -0
  77. data/include/rbs/string.h +49 -0
  78. data/include/rbs/util/rbs_allocator.h +59 -0
  79. data/include/rbs/util/rbs_assert.h +20 -0
  80. data/include/rbs/util/rbs_buffer.h +83 -0
  81. data/include/rbs/util/rbs_constant_pool.h +6 -67
  82. data/include/rbs/util/rbs_encoding.h +282 -0
  83. data/include/rbs/util/rbs_unescape.h +23 -0
  84. data/include/rbs.h +1 -2
  85. data/lib/rbs/annotate/formatter.rb +3 -13
  86. data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
  87. data/lib/rbs/annotate/rdoc_source.rb +1 -1
  88. data/lib/rbs/cli/validate.rb +2 -2
  89. data/lib/rbs/cli.rb +1 -1
  90. data/lib/rbs/collection/config/lockfile_generator.rb +1 -0
  91. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -5
  92. data/lib/rbs/environment.rb +64 -59
  93. data/lib/rbs/environment_loader.rb +1 -1
  94. data/lib/rbs/errors.rb +1 -1
  95. data/lib/rbs/parser_aux.rb +5 -0
  96. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  97. data/lib/rbs/resolver/type_name_resolver.rb +124 -38
  98. data/lib/rbs/test/type_check.rb +13 -0
  99. data/lib/rbs/types.rb +3 -1
  100. data/lib/rbs/version.rb +1 -1
  101. data/lib/rbs.rb +1 -1
  102. data/lib/rdoc/discover.rb +1 -1
  103. data/lib/rdoc_plugin/parser.rb +3 -3
  104. data/sig/annotate/formatter.rbs +2 -2
  105. data/sig/annotate/rdoc_annotater.rbs +1 -1
  106. data/sig/environment.rbs +57 -6
  107. data/sig/manifest.yaml +0 -1
  108. data/sig/parser.rbs +20 -0
  109. data/sig/resolver/type_name_resolver.rbs +38 -7
  110. data/sig/types.rbs +4 -1
  111. data/src/ast.c +1256 -0
  112. data/src/lexer.c +2956 -0
  113. data/src/lexer.re +147 -0
  114. data/src/lexstate.c +205 -0
  115. data/src/location.c +71 -0
  116. data/src/parser.c +3495 -0
  117. data/src/string.c +90 -0
  118. data/src/util/rbs_allocator.c +152 -0
  119. data/src/util/rbs_assert.c +21 -0
  120. data/src/util/rbs_buffer.c +54 -0
  121. data/src/util/rbs_constant_pool.c +16 -86
  122. data/src/util/rbs_encoding.c +21308 -0
  123. data/src/util/rbs_unescape.c +131 -0
  124. data/stdlib/cgi/0/core.rbs +2 -396
  125. data/stdlib/cgi/0/manifest.yaml +1 -0
  126. data/stdlib/cgi-escape/0/escape.rbs +153 -0
  127. data/stdlib/coverage/0/coverage.rbs +3 -1
  128. data/stdlib/delegate/0/delegator.rbs +10 -7
  129. data/stdlib/erb/0/erb.rbs +737 -347
  130. data/stdlib/fileutils/0/fileutils.rbs +18 -13
  131. data/stdlib/forwardable/0/forwardable.rbs +3 -0
  132. data/stdlib/json/0/json.rbs +67 -48
  133. data/stdlib/net-http/0/net-http.rbs +3 -0
  134. data/stdlib/objspace/0/objspace.rbs +8 -3
  135. data/stdlib/open-uri/0/open-uri.rbs +40 -0
  136. data/stdlib/openssl/0/openssl.rbs +182 -149
  137. data/stdlib/optparse/0/optparse.rbs +3 -3
  138. data/stdlib/rdoc/0/code_object.rbs +2 -2
  139. data/stdlib/rdoc/0/comment.rbs +2 -0
  140. data/stdlib/rdoc/0/options.rbs +76 -0
  141. data/stdlib/rdoc/0/rdoc.rbs +7 -5
  142. data/stdlib/rdoc/0/store.rbs +1 -1
  143. data/stdlib/resolv/0/resolv.rbs +25 -68
  144. data/stdlib/ripper/0/ripper.rbs +5 -2
  145. data/stdlib/singleton/0/singleton.rbs +3 -0
  146. data/stdlib/socket/0/socket.rbs +13 -1
  147. data/stdlib/socket/0/tcp_socket.rbs +10 -2
  148. data/stdlib/stringio/0/stringio.rbs +412 -80
  149. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  150. data/stdlib/tempfile/0/tempfile.rbs +1 -1
  151. data/stdlib/tsort/0/cyclic.rbs +3 -0
  152. data/stdlib/uri/0/common.rbs +11 -2
  153. data/stdlib/uri/0/file.rbs +1 -1
  154. data/stdlib/uri/0/generic.rbs +16 -15
  155. data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
  156. data/stdlib/zlib/0/zstream.rbs +1 -0
  157. metadata +41 -18
  158. data/ext/rbs_extension/lexer.c +0 -2728
  159. data/ext/rbs_extension/lexer.h +0 -179
  160. data/ext/rbs_extension/lexer.re +0 -147
  161. data/ext/rbs_extension/lexstate.c +0 -175
  162. data/ext/rbs_extension/location.c +0 -325
  163. data/ext/rbs_extension/location.h +0 -85
  164. data/ext/rbs_extension/parser.c +0 -2982
  165. data/ext/rbs_extension/parser.h +0 -18
  166. data/ext/rbs_extension/parserstate.c +0 -411
  167. data/ext/rbs_extension/parserstate.h +0 -163
  168. data/ext/rbs_extension/unescape.c +0 -32
  169. data/include/rbs/ruby_objs.h +0 -72
  170. data/src/constants.c +0 -153
  171. data/src/ruby_objs.c +0 -799
@@ -0,0 +1,153 @@
1
+ # <!-- rdoc-file=lib/cgi/escape.rb -->
2
+ # :stopdoc
3
+ #
4
+ class CGI
5
+ include Escape
6
+
7
+ extend Escape
8
+
9
+ # <!-- rdoc-file=lib/cgi/escape.rb -->
10
+ # Escape/unescape for CGI, HTML, URI.
11
+ #
12
+ module Escape
13
+ # <!--
14
+ # rdoc-file=lib/cgi/escape.rb
15
+ # - escape(string)
16
+ # -->
17
+ # URL-encode a string into application/x-www-form-urlencoded. Space characters
18
+ # (+" "+) are encoded with plus signs (+"+"+)
19
+ # url_encoded_string = CGI.escape("'Stop!' said Fred")
20
+ # # => "%27Stop%21%27+said+Fred"
21
+ #
22
+ def escape: (string str) -> String
23
+
24
+ # <!--
25
+ # rdoc-file=lib/cgi/escape.rb
26
+ # - escapeElement(string, *elements)
27
+ # -->
28
+ # Escape only the tags of certain HTML elements in `string`.
29
+ #
30
+ # Takes an element or elements or array of elements. Each element is specified
31
+ # by the name of the element, without angle brackets. This matches both the
32
+ # start and the end tag of that element. The attribute list of the open tag will
33
+ # also be escaped (for instance, the double-quotes surrounding attribute
34
+ # values).
35
+ #
36
+ # print CGI.escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
37
+ # # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"
38
+ #
39
+ # print CGI.escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
40
+ # # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"
41
+ #
42
+ def escapeElement: (string string, *String | Array[String] elements) -> String
43
+
44
+ # <!--
45
+ # rdoc-file=lib/cgi/escape.rb
46
+ # - escapeHTML(string)
47
+ # -->
48
+ # Escape special characters in HTML, namely '&"<>
49
+ # CGI.escapeHTML('Usage: foo "bar" <baz>')
50
+ # # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
51
+ #
52
+ def escapeHTML: (string str) -> String
53
+
54
+ # <!--
55
+ # rdoc-file=lib/cgi/escape.rb
56
+ # - escapeURIComponent(string)
57
+ # -->
58
+ # URL-encode a string following RFC 3986 Space characters (+" "+) are encoded
59
+ # with (+"%20"+)
60
+ # url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred")
61
+ # # => "%27Stop%21%27%20said%20Fred"
62
+ #
63
+ def escapeURIComponent: (string) -> String
64
+
65
+ # <!-- rdoc-file=lib/cgi/escape.rb -->
66
+ # Synonym for CGI.escapeElement(str)
67
+ #
68
+ alias escape_element escapeElement
69
+
70
+ # <!-- rdoc-file=lib/cgi/escape.rb -->
71
+ # Synonym for CGI.escapeHTML(str)
72
+ #
73
+ alias escape_html escapeHTML
74
+
75
+ # <!--
76
+ # rdoc-file=lib/cgi/escape.rb
77
+ # - escape_uri_component(string)
78
+ # -->
79
+ #
80
+ alias escape_uri_component escapeURIComponent
81
+
82
+ # <!--
83
+ # rdoc-file=lib/cgi/escape.rb
84
+ # - h(string)
85
+ # -->
86
+ #
87
+ alias h escapeHTML
88
+
89
+ # <!--
90
+ # rdoc-file=lib/cgi/escape.rb
91
+ # - unescape(string, encoding = @@accept_charset)
92
+ # -->
93
+ # URL-decode an application/x-www-form-urlencoded string with
94
+ # encoding(optional).
95
+ # string = CGI.unescape("%27Stop%21%27+said+Fred")
96
+ # # => "'Stop!' said Fred"
97
+ #
98
+ def unescape: (string str, ?encoding encoding) -> String
99
+
100
+ # <!--
101
+ # rdoc-file=lib/cgi/escape.rb
102
+ # - unescapeElement(string, *elements)
103
+ # -->
104
+ # Undo escaping such as that done by CGI.escapeElement()
105
+ #
106
+ # print CGI.unescapeElement(
107
+ # CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
108
+ # # "&lt;BR&gt;<A HREF="url"></A>"
109
+ #
110
+ # print CGI.unescapeElement(
111
+ # CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
112
+ # # "&lt;BR&gt;<A HREF="url"></A>"
113
+ #
114
+ def unescapeElement: (string string, *String | Array[String] elements) -> String
115
+
116
+ # <!--
117
+ # rdoc-file=lib/cgi/escape.rb
118
+ # - unescapeHTML(string)
119
+ # -->
120
+ # Unescape a string that has been HTML-escaped
121
+ # CGI.unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;")
122
+ # # => "Usage: foo \"bar\" <baz>"
123
+ #
124
+ def unescapeHTML: (string str) -> String
125
+
126
+ # <!--
127
+ # rdoc-file=lib/cgi/escape.rb
128
+ # - unescapeURIComponent(string, encoding = @@accept_charset)
129
+ # -->
130
+ # URL-decode a string following RFC 3986 with encoding(optional).
131
+ # string = CGI.unescapeURIComponent("%27Stop%21%27+said%20Fred")
132
+ # # => "'Stop!'+said Fred"
133
+ #
134
+ def unescapeURIComponent: (string) -> String
135
+
136
+ # <!-- rdoc-file=lib/cgi/escape.rb -->
137
+ # Synonym for CGI.unescapeElement(str)
138
+ #
139
+ alias unescape_element unescapeElement
140
+
141
+ # <!-- rdoc-file=lib/cgi/escape.rb -->
142
+ # Synonym for CGI.unescapeHTML(str)
143
+ #
144
+ alias unescape_html unescapeHTML
145
+
146
+ # <!--
147
+ # rdoc-file=lib/cgi/escape.rb
148
+ # - unescape_uri_component(string, encoding = @@accept_charset)
149
+ # -->
150
+ #
151
+ alias unescape_uri_component unescapeURIComponent
152
+ end
153
+ end
@@ -147,8 +147,10 @@
147
147
  module Coverage
148
148
  # <!--
149
149
  # rdoc-file=ext/coverage/lib/coverage.rb
150
- # - line_stub(file)
150
+ # - line_stub(file) -> array
151
151
  # -->
152
+ # A simple helper function that creates the "stub" of line coverage from a given
153
+ # source code.
152
154
  #
153
155
  def self.line_stub: (String) -> Array[Integer?]
154
156
 
@@ -44,7 +44,7 @@ class Delegator < BasicObject
44
44
  # rdoc-file=lib/delegate.rb
45
45
  # - !()
46
46
  # -->
47
- # Delegates ! to the _*getobj*_
47
+ # Delegates ! to the `__getobj__`
48
48
  #
49
49
  def !: () -> untyped
50
50
 
@@ -94,7 +94,7 @@ class Delegator < BasicObject
94
94
  # rdoc-file=lib/delegate.rb
95
95
  # - freeze()
96
96
  # -->
97
- # :method: freeze Freeze both the object returned by _*getobj*_ and self.
97
+ # :method: freeze Freeze both the object returned by `__getobj__` and self.
98
98
  #
99
99
  def freeze: () -> self
100
100
 
@@ -102,7 +102,7 @@ class Delegator < BasicObject
102
102
  # rdoc-file=lib/delegate.rb
103
103
  # - marshal_dump()
104
104
  # -->
105
- # Serialization support for the object returned by _*getobj*_.
105
+ # Serialization support for the object returned by `__getobj__`.
106
106
  #
107
107
  def marshal_dump: () -> untyped
108
108
 
@@ -126,7 +126,7 @@ class Delegator < BasicObject
126
126
  # - methods(all=true)
127
127
  # -->
128
128
  # Returns the methods available to this delegate object as the union of this
129
- # object's and _*getobj*_ methods.
129
+ # object's and `__getobj__` methods.
130
130
  #
131
131
  def methods: (?boolish all) -> Array[Symbol]
132
132
 
@@ -135,7 +135,7 @@ class Delegator < BasicObject
135
135
  # - protected_methods(all=true)
136
136
  # -->
137
137
  # Returns the methods available to this delegate object as the union of this
138
- # object's and _*getobj*_ protected methods.
138
+ # object's and `__getobj__` protected methods.
139
139
  #
140
140
  def protected_methods: (?boolish all) -> Array[Symbol]
141
141
 
@@ -144,7 +144,7 @@ class Delegator < BasicObject
144
144
  # - public_methods(all=true)
145
145
  # -->
146
146
  # Returns the methods available to this delegate object as the union of this
147
- # object's and _*getobj*_ public methods.
147
+ # object's and `__getobj__` public methods.
148
148
  #
149
149
  def public_methods: (?untyped all) -> Array[Symbol]
150
150
 
@@ -168,7 +168,7 @@ class Delegator < BasicObject
168
168
  # - respond_to_missing?(m, include_private)
169
169
  # -->
170
170
  # Checks for a method provided by this the delegate object by forwarding the
171
- # call through _*getobj*_.
171
+ # call through `__getobj__`.
172
172
  #
173
173
  def respond_to_missing?: (Symbol m, bool include_private) -> bool
174
174
 
@@ -180,5 +180,8 @@ class Delegator < BasicObject
180
180
  #
181
181
  def target_respond_to?: (untyped target, Symbol m, bool include_private) -> bool
182
182
 
183
+ # <!-- rdoc-file=lib/delegate.rb -->
184
+ # The version string
185
+ #
183
186
  VERSION: String
184
187
  end