rbs 3.9.4 → 4.2.0

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 (354) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +75 -0
  3. data/.clangd +2 -0
  4. data/.dockerignore +37 -0
  5. data/.gitattributes +1 -0
  6. data/.github/dependabot.yml +16 -14
  7. data/.github/workflows/bundle-update.yml +63 -0
  8. data/.github/workflows/c-check.yml +66 -0
  9. data/.github/workflows/changelog.yml +121 -0
  10. data/.github/workflows/comments.yml +6 -4
  11. data/.github/workflows/dependabot.yml +2 -2
  12. data/.github/workflows/jruby.yml +74 -0
  13. data/.github/workflows/release-gems.yml +234 -0
  14. data/.github/workflows/ruby.yml +86 -32
  15. data/.github/workflows/rust.yml +186 -0
  16. data/.github/workflows/truffleruby.yml +54 -0
  17. data/.github/workflows/typecheck.yml +6 -3
  18. data/.github/workflows/wasm.yml +55 -0
  19. data/.github/workflows/windows.yml +10 -4
  20. data/.gitignore +16 -0
  21. data/.rubocop.yml +1 -2
  22. data/CHANGELOG.md +502 -0
  23. data/Dockerfile.jruby +53 -0
  24. data/README.md +42 -5
  25. data/Rakefile +892 -111
  26. data/Steepfile +11 -0
  27. data/config.yml +665 -62
  28. data/core/array.rbs +541 -398
  29. data/core/basic_object.rbs +9 -8
  30. data/core/binding.rbs +0 -2
  31. data/core/builtin.rbs +9 -8
  32. data/core/class.rbs +11 -8
  33. data/core/comparable.rbs +55 -34
  34. data/core/complex.rbs +104 -78
  35. data/core/dir.rbs +61 -49
  36. data/core/encoding.rbs +12 -15
  37. data/core/enumerable.rbs +297 -196
  38. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  39. data/core/enumerator/product.rbs +5 -5
  40. data/core/enumerator.rbs +91 -28
  41. data/core/errno.rbs +11 -2
  42. data/core/errors.rbs +58 -29
  43. data/core/exception.rbs +13 -13
  44. data/core/fiber.rbs +74 -54
  45. data/core/file.rbs +260 -1151
  46. data/core/file_constants.rbs +463 -0
  47. data/core/file_stat.rbs +534 -0
  48. data/core/file_test.rbs +3 -3
  49. data/core/float.rbs +257 -116
  50. data/core/gc.rbs +425 -281
  51. data/core/hash.rbs +1151 -829
  52. data/core/integer.rbs +156 -195
  53. data/core/io/buffer.rbs +53 -42
  54. data/core/io/wait.rbs +13 -35
  55. data/core/io.rbs +222 -155
  56. data/core/kernel.rbs +239 -163
  57. data/core/marshal.rbs +4 -4
  58. data/core/match_data.rbs +16 -14
  59. data/core/math.rbs +107 -66
  60. data/core/method.rbs +69 -33
  61. data/core/module.rbs +302 -150
  62. data/core/nil_class.rbs +7 -6
  63. data/core/numeric.rbs +77 -63
  64. data/core/object.rbs +9 -11
  65. data/core/object_space/weak_key_map.rbs +7 -7
  66. data/core/object_space.rbs +30 -23
  67. data/core/pathname.rbs +1312 -0
  68. data/core/proc.rbs +95 -58
  69. data/core/process.rbs +222 -202
  70. data/core/ractor.rbs +364 -518
  71. data/core/random.rbs +21 -3
  72. data/core/range.rbs +181 -79
  73. data/core/rational.rbs +60 -89
  74. data/core/rbs/ops.rbs +154 -0
  75. data/core/rbs/unnamed/argf.rbs +63 -56
  76. data/core/rbs/unnamed/env_class.rbs +19 -14
  77. data/core/rbs/unnamed/main_class.rbs +123 -0
  78. data/core/rbs/unnamed/random.rbs +11 -118
  79. data/core/regexp.rbs +258 -214
  80. data/core/ruby.rbs +53 -0
  81. data/core/ruby_vm.rbs +78 -34
  82. data/core/rubygems/config_file.rbs +5 -5
  83. data/core/rubygems/errors.rbs +6 -70
  84. data/core/rubygems/requirement.rbs +5 -15
  85. data/core/rubygems/rubygems.rbs +18 -81
  86. data/core/rubygems/specification.rbs +8 -0
  87. data/core/rubygems/version.rbs +2 -163
  88. data/core/set.rbs +493 -363
  89. data/core/signal.rbs +26 -16
  90. data/core/string.rbs +3234 -1285
  91. data/core/struct.rbs +43 -42
  92. data/core/symbol.rbs +41 -34
  93. data/core/thread.rbs +139 -83
  94. data/core/time.rbs +81 -50
  95. data/core/trace_point.rbs +41 -35
  96. data/core/true_class.rbs +2 -2
  97. data/core/unbound_method.rbs +24 -16
  98. data/core/warning.rbs +7 -7
  99. data/docs/CONTRIBUTING.md +3 -2
  100. data/docs/aliases.md +79 -0
  101. data/docs/collection.md +3 -3
  102. data/docs/config.md +171 -0
  103. data/docs/encoding.md +56 -0
  104. data/docs/gem.md +0 -1
  105. data/docs/inline.md +634 -0
  106. data/docs/rbs_by_example.md +20 -20
  107. data/docs/release.md +303 -0
  108. data/docs/rust.md +96 -0
  109. data/docs/sigs.md +3 -3
  110. data/docs/stdlib.md +8 -0
  111. data/docs/syntax.md +60 -18
  112. data/docs/type_fingerprint.md +21 -0
  113. data/docs/wasm_serialization.md +80 -0
  114. data/exe/rbs +1 -1
  115. data/ext/rbs_extension/ast_translation.c +1870 -0
  116. data/ext/rbs_extension/ast_translation.h +41 -0
  117. data/ext/rbs_extension/class_constants.c +189 -0
  118. data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +24 -1
  119. data/ext/rbs_extension/compat.h +10 -0
  120. data/ext/rbs_extension/extconf.rb +26 -1
  121. data/ext/rbs_extension/legacy_location.c +299 -0
  122. data/ext/rbs_extension/legacy_location.h +82 -0
  123. data/ext/rbs_extension/main.c +639 -23
  124. data/ext/rbs_extension/rbs_extension.h +6 -21
  125. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  126. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  127. data/include/rbs/ast.h +1055 -0
  128. data/include/rbs/defines.h +104 -0
  129. data/include/rbs/lexer.h +208 -0
  130. data/include/rbs/location.h +40 -0
  131. data/include/rbs/parser.h +187 -0
  132. data/include/rbs/serialize.h +39 -0
  133. data/include/rbs/string.h +47 -0
  134. data/include/rbs/util/rbs_allocator.h +59 -0
  135. data/include/rbs/util/rbs_assert.h +20 -0
  136. data/include/rbs/util/rbs_buffer.h +83 -0
  137. data/include/rbs/util/rbs_constant_pool.h +6 -70
  138. data/include/rbs/util/rbs_encoding.h +282 -0
  139. data/include/rbs/util/rbs_unescape.h +24 -0
  140. data/include/rbs.h +9 -2
  141. data/lib/rbs/annotate/formatter.rb +3 -13
  142. data/lib/rbs/annotate/rdoc_annotator.rb +30 -32
  143. data/lib/rbs/annotate/rdoc_source.rb +1 -1
  144. data/lib/rbs/ast/annotation.rb +1 -1
  145. data/lib/rbs/ast/comment.rb +1 -1
  146. data/lib/rbs/ast/declarations.rb +11 -11
  147. data/lib/rbs/ast/members.rb +14 -14
  148. data/lib/rbs/ast/ruby/annotations.rb +451 -0
  149. data/lib/rbs/ast/ruby/comment_block.rb +247 -0
  150. data/lib/rbs/ast/ruby/declarations.rb +291 -0
  151. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  152. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  153. data/lib/rbs/ast/ruby/members.rb +762 -0
  154. data/lib/rbs/ast/type_param.rb +25 -5
  155. data/lib/rbs/buffer.rb +142 -20
  156. data/lib/rbs/cli/diff.rb +16 -15
  157. data/lib/rbs/cli/validate.rb +63 -126
  158. data/lib/rbs/cli.rb +59 -29
  159. data/lib/rbs/collection/config/lockfile_generator.rb +28 -3
  160. data/lib/rbs/collection/sources/git.rb +7 -0
  161. data/lib/rbs/definition.rb +6 -1
  162. data/lib/rbs/definition_builder/ancestor_builder.rb +129 -70
  163. data/lib/rbs/definition_builder/method_builder.rb +74 -33
  164. data/lib/rbs/definition_builder.rb +181 -21
  165. data/lib/rbs/diff.rb +7 -1
  166. data/lib/rbs/environment/class_entry.rb +81 -0
  167. data/lib/rbs/environment/module_entry.rb +91 -0
  168. data/lib/rbs/environment.rb +410 -215
  169. data/lib/rbs/environment_loader.rb +2 -8
  170. data/lib/rbs/errors.rb +31 -21
  171. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  172. data/lib/rbs/inline_parser.rb +568 -0
  173. data/lib/rbs/location_aux.rb +36 -4
  174. data/lib/rbs/locator.rb +5 -1
  175. data/lib/rbs/method_type.rb +5 -3
  176. data/lib/rbs/namespace.rb +47 -18
  177. data/lib/rbs/parser_aux.rb +37 -7
  178. data/lib/rbs/prototype/helpers.rb +24 -0
  179. data/lib/rbs/prototype/rb.rb +3 -28
  180. data/lib/rbs/prototype/rbi.rb +196 -45
  181. data/lib/rbs/prototype/runtime/value_object_generator.rb +0 -1
  182. data/lib/rbs/prototype/runtime.rb +13 -3
  183. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  184. data/lib/rbs/resolver/type_name_resolver.rb +120 -44
  185. data/lib/rbs/rewriter.rb +70 -0
  186. data/lib/rbs/source.rb +99 -0
  187. data/lib/rbs/subtractor.rb +7 -4
  188. data/lib/rbs/test/type_check.rb +25 -3
  189. data/lib/rbs/type_name.rb +34 -21
  190. data/lib/rbs/types.rb +135 -81
  191. data/lib/rbs/unit_test/convertibles.rb +1 -0
  192. data/lib/rbs/unit_test/type_assertions.rb +47 -11
  193. data/lib/rbs/validator.rb +2 -2
  194. data/lib/rbs/version.rb +1 -1
  195. data/lib/rbs/wasm/deserializer.rb +213 -0
  196. data/lib/rbs/wasm/location.rb +61 -0
  197. data/lib/rbs/wasm/parser.rb +174 -0
  198. data/lib/rbs/wasm/runtime.rb +211 -0
  199. data/lib/rbs/wasm/serialization_schema.rb +111 -0
  200. data/lib/rbs.rb +25 -2
  201. data/lib/rbs_jars.rb +39 -0
  202. data/lib/rdoc/discover.rb +1 -1
  203. data/lib/rdoc_plugin/parser.rb +8 -3
  204. data/rbs.gemspec +34 -6
  205. data/schema/function.json +12 -1
  206. data/schema/typeParam.json +17 -1
  207. data/sig/ancestor_builder.rbs +1 -1
  208. data/sig/annotate/formatter.rbs +2 -2
  209. data/sig/annotate/rdoc_annotater.rbs +13 -10
  210. data/sig/ast/ruby/annotations.rbs +470 -0
  211. data/sig/ast/ruby/comment_block.rbs +127 -0
  212. data/sig/ast/ruby/declarations.rbs +158 -0
  213. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  214. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  215. data/sig/ast/ruby/members.rbs +198 -0
  216. data/sig/buffer.rbs +81 -5
  217. data/sig/cli/diff.rbs +5 -11
  218. data/sig/cli/validate.rbs +12 -8
  219. data/sig/cli.rbs +18 -18
  220. data/sig/collection/config/lockfile_generator.rbs +2 -0
  221. data/sig/definition.rbs +6 -0
  222. data/sig/definition_builder.rbs +3 -1
  223. data/sig/environment/class_entry.rbs +56 -0
  224. data/sig/environment/module_entry.rbs +65 -0
  225. data/sig/environment.rbs +94 -87
  226. data/sig/errors.rbs +26 -20
  227. data/sig/inline_parser/comment_association.rbs +71 -0
  228. data/sig/inline_parser.rbs +126 -0
  229. data/sig/location.rbs +32 -7
  230. data/sig/locator.rbs +0 -2
  231. data/sig/manifest.yaml +0 -2
  232. data/sig/method_builder.rbs +9 -4
  233. data/sig/namespace.rbs +20 -5
  234. data/sig/parser.rbs +79 -15
  235. data/sig/prototype/helpers.rbs +2 -0
  236. data/sig/prototype/rbi.rbs +33 -4
  237. data/sig/resolver/type_name_resolver.rbs +36 -10
  238. data/sig/rewriter.rbs +45 -0
  239. data/sig/source.rbs +48 -0
  240. data/sig/type_param.rbs +13 -8
  241. data/sig/typename.rbs +15 -5
  242. data/sig/types.rbs +21 -9
  243. data/sig/unit_test/spy.rbs +0 -8
  244. data/sig/unit_test/type_assertions.rbs +17 -2
  245. data/sig/wasm/deserializer.rbs +66 -0
  246. data/sig/wasm/serialization_schema.rbs +13 -0
  247. data/src/ast.c +1644 -0
  248. data/src/lexer.c +3223 -0
  249. data/src/lexer.re +187 -0
  250. data/src/lexstate.c +222 -0
  251. data/src/location.c +31 -0
  252. data/src/parser.c +4318 -0
  253. data/src/serialize.c +965 -0
  254. data/src/string.c +41 -0
  255. data/src/util/rbs_allocator.c +171 -0
  256. data/src/util/rbs_assert.c +19 -0
  257. data/src/util/rbs_buffer.c +54 -0
  258. data/src/util/rbs_constant_pool.c +18 -92
  259. data/src/util/rbs_encoding.c +21454 -0
  260. data/src/util/rbs_unescape.c +167 -0
  261. data/stdlib/abbrev/0/array.rbs +1 -1
  262. data/stdlib/bigdecimal/0/big_decimal.rbs +116 -98
  263. data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
  264. data/stdlib/cgi/0/core.rbs +9 -393
  265. data/stdlib/cgi/0/manifest.yaml +1 -0
  266. data/stdlib/cgi-escape/0/escape.rbs +171 -0
  267. data/stdlib/coverage/0/coverage.rbs +7 -4
  268. data/stdlib/csv/0/csv.rbs +5 -5
  269. data/stdlib/date/0/date.rbs +92 -79
  270. data/stdlib/date/0/date_time.rbs +25 -24
  271. data/stdlib/delegate/0/delegator.rbs +11 -7
  272. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  273. data/stdlib/digest/0/digest.rbs +117 -1
  274. data/stdlib/erb/0/erb.rbs +754 -353
  275. data/stdlib/etc/0/etc.rbs +73 -54
  276. data/stdlib/fileutils/0/fileutils.rbs +179 -160
  277. data/stdlib/forwardable/0/forwardable.rbs +13 -10
  278. data/stdlib/io-console/0/io-console.rbs +2 -2
  279. data/stdlib/ipaddr/0/ipaddr.rbs +0 -5
  280. data/stdlib/json/0/json.rbs +232 -185
  281. data/stdlib/monitor/0/monitor.rbs +9 -9
  282. data/stdlib/net-http/0/net-http.rbs +162 -134
  283. data/stdlib/objspace/0/objspace.rbs +17 -34
  284. data/stdlib/open-uri/0/open-uri.rbs +48 -8
  285. data/stdlib/open3/0/open3.rbs +469 -10
  286. data/stdlib/openssl/0/openssl.rbs +521 -397
  287. data/stdlib/optparse/0/optparse.rbs +26 -17
  288. data/stdlib/pathname/0/pathname.rbs +11 -1381
  289. data/stdlib/pp/0/pp.rbs +9 -8
  290. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  291. data/stdlib/pstore/0/pstore.rbs +35 -30
  292. data/stdlib/psych/0/psych.rbs +65 -12
  293. data/stdlib/psych/0/store.rbs +2 -4
  294. data/stdlib/pty/0/pty.rbs +9 -6
  295. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  296. data/stdlib/rdoc/0/code_object.rbs +4 -3
  297. data/stdlib/rdoc/0/comment.rbs +2 -0
  298. data/stdlib/rdoc/0/options.rbs +76 -0
  299. data/stdlib/rdoc/0/parser.rbs +1 -1
  300. data/stdlib/rdoc/0/rdoc.rbs +7 -5
  301. data/stdlib/rdoc/0/store.rbs +2 -2
  302. data/stdlib/resolv/0/resolv.rbs +26 -69
  303. data/stdlib/ripper/0/ripper.rbs +25 -19
  304. data/stdlib/securerandom/0/manifest.yaml +2 -0
  305. data/stdlib/securerandom/0/securerandom.rbs +7 -20
  306. data/stdlib/shellwords/0/shellwords.rbs +3 -3
  307. data/stdlib/singleton/0/singleton.rbs +6 -0
  308. data/stdlib/socket/0/addrinfo.rbs +9 -9
  309. data/stdlib/socket/0/basic_socket.rbs +3 -3
  310. data/stdlib/socket/0/ip_socket.rbs +10 -8
  311. data/stdlib/socket/0/socket.rbs +23 -10
  312. data/stdlib/socket/0/tcp_server.rbs +1 -1
  313. data/stdlib/socket/0/tcp_socket.rbs +11 -3
  314. data/stdlib/socket/0/udp_socket.rbs +1 -1
  315. data/stdlib/socket/0/unix_server.rbs +1 -1
  316. data/stdlib/stringio/0/stringio.rbs +1211 -96
  317. data/stdlib/strscan/0/string_scanner.rbs +101 -80
  318. data/stdlib/tempfile/0/manifest.yaml +3 -0
  319. data/stdlib/tempfile/0/tempfile.rbs +25 -21
  320. data/stdlib/time/0/time.rbs +8 -6
  321. data/stdlib/timeout/0/timeout.rbs +58 -7
  322. data/stdlib/tsort/0/cyclic.rbs +4 -1
  323. data/stdlib/tsort/0/interfaces.rbs +8 -8
  324. data/stdlib/tsort/0/tsort.rbs +16 -15
  325. data/stdlib/uri/0/common.rbs +42 -20
  326. data/stdlib/uri/0/file.rbs +3 -3
  327. data/stdlib/uri/0/generic.rbs +21 -18
  328. data/stdlib/uri/0/http.rbs +2 -2
  329. data/stdlib/uri/0/ldap.rbs +2 -2
  330. data/stdlib/uri/0/mailto.rbs +3 -3
  331. data/stdlib/uri/0/rfc2396_parser.rbs +12 -12
  332. data/stdlib/zlib/0/deflate.rbs +4 -3
  333. data/stdlib/zlib/0/gzip_file.rbs +1 -1
  334. data/stdlib/zlib/0/gzip_reader.rbs +8 -8
  335. data/stdlib/zlib/0/gzip_writer.rbs +16 -13
  336. data/stdlib/zlib/0/inflate.rbs +1 -1
  337. data/stdlib/zlib/0/need_dict.rbs +1 -1
  338. data/wasm/README.md +109 -0
  339. data/wasm/rbs_wasm.c +479 -0
  340. metadata +133 -19
  341. data/ext/rbs_extension/lexer.c +0 -2728
  342. data/ext/rbs_extension/lexer.h +0 -179
  343. data/ext/rbs_extension/lexer.re +0 -147
  344. data/ext/rbs_extension/lexstate.c +0 -175
  345. data/ext/rbs_extension/location.c +0 -325
  346. data/ext/rbs_extension/location.h +0 -85
  347. data/ext/rbs_extension/parser.c +0 -2982
  348. data/ext/rbs_extension/parser.h +0 -18
  349. data/ext/rbs_extension/parserstate.c +0 -411
  350. data/ext/rbs_extension/parserstate.h +0 -163
  351. data/ext/rbs_extension/unescape.c +0 -32
  352. data/include/rbs/ruby_objs.h +0 -72
  353. data/src/constants.c +0 -153
  354. data/src/ruby_objs.c +0 -799
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87d2bd9e9a3614197bf48bb627818de33e6229d916c9e69da54d869604291264
4
- data.tar.gz: bca64533203a4632c489eb799ebdfd2504761ea94a14459f0459a1e3f87fcb24
3
+ metadata.gz: 3e76f94a794b829effcba20a9dc637da54915d4bb3a87fa1b4200c4091fa60a6
4
+ data.tar.gz: 5f6eb47e5f31023f56ccede03402493f223719fa5dc1033995fecc592e87e2f1
5
5
  SHA512:
6
- metadata.gz: 8bed7eff9963856fc06bcb36f4f48f5fafebdf9e8caaa7df7d5f27a28a29b17e83d3145088e37fb86edd5ead6fb6aff3ecc9c857c517de5e753ef7dff4d58eb8
7
- data.tar.gz: 325b48fd2ebcada1975741733498770c321fe319da5e4c70517b6f2b4adbbd865b73f4dd8557e05268b10de1ce316a8bed7a191f7811fce3f1e6162b16abbb51
6
+ metadata.gz: 168b150476b5515f06f4bc72a58854bc2c60cf073365761ceacf9dc48a5be22d41a0469c168e76ac9d85d03fbdb0e67ac2f7d3564ee6055191432514ff56b10c
7
+ data.tar.gz: 80e89dae7445279f1ee30c825280af61259363911fc78032812dfd1be5f4fc7677598732ca42b3366dff2bc1269fe8b7cd8e6bfa49ccd8a225fe318285bfdfb1
data/.clang-format ADDED
@@ -0,0 +1,75 @@
1
+ ---
2
+ Language: Cpp
3
+
4
+ # Indentation
5
+ UseTab: Never
6
+ IndentWidth: 4
7
+ BreakBeforeBraces: Attach
8
+ IndentCaseLabels: false
9
+ NamespaceIndentation: None
10
+ ContinuationIndentWidth: 4
11
+ IndentPPDirectives: None
12
+ IndentWrappedFunctionNames: false
13
+ AccessModifierOffset: -2
14
+
15
+ # Alignment
16
+ AlignAfterOpenBracket: BlockIndent
17
+ AlignConsecutiveAssignments: false
18
+ AlignConsecutiveDeclarations: false
19
+ AlignConsecutiveMacros: false
20
+ AlignEscapedNewlines: Left
21
+ AlignOperands: false
22
+ AlignTrailingComments: true
23
+ DerivePointerAlignment: false
24
+ PointerAlignment: Right
25
+
26
+ # Function calls formatting
27
+ BinPackArguments: false
28
+ BinPackParameters: false
29
+ AllowAllArgumentsOnNextLine: false
30
+ ExperimentalAutoDetectBinPacking: false
31
+ PenaltyBreakBeforeFirstCallParameter: 1
32
+ AlwaysBreakAfterDefinitionReturnType: None
33
+
34
+ # Wrapping and Breaking
35
+ ColumnLimit: 0
36
+ AllowShortBlocksOnASingleLine: Never
37
+ AllowShortCaseLabelsOnASingleLine: false
38
+ AllowShortFunctionsOnASingleLine: All
39
+ AllowShortIfStatementsOnASingleLine: Always
40
+ AllowShortLoopsOnASingleLine: false
41
+ AlwaysBreakAfterReturnType: None
42
+ AlwaysBreakBeforeMultilineStrings: false
43
+ AlwaysBreakTemplateDeclarations: No
44
+ BreakBeforeBinaryOperators: None
45
+ BreakBeforeTernaryOperators: false
46
+ BreakConstructorInitializers: BeforeColon
47
+ BreakInheritanceList: BeforeColon
48
+ BreakStringLiterals: false
49
+ CompactNamespaces: false
50
+ ConstructorInitializerAllOnOneLineOrOnePerLine: false
51
+ Cpp11BracedListStyle: false
52
+ ReflowComments: false
53
+ SortIncludes: Never
54
+ InsertNewlineAtEOF: true
55
+
56
+ # Spaces
57
+ SpaceAfterCStyleCast: true
58
+ SpaceAfterLogicalNot: false
59
+ SpaceAfterTemplateKeyword: true
60
+ SpaceBeforeAssignmentOperators: true
61
+ SpaceBeforeCpp11BracedList: true
62
+ SpaceBeforeCtorInitializerColon: true
63
+ SpaceBeforeInheritanceColon: true
64
+ SpaceBeforeParens: ControlStatements
65
+ SpaceBeforeRangeBasedForLoopColon: true
66
+ SpaceBeforeSquareBrackets: false
67
+ SpaceInEmptyBlock: false
68
+ SpaceInEmptyParentheses: false
69
+ SpacesBeforeTrailingComments: 1
70
+ SpacesInAngles: false
71
+ SpacesInCStyleCastParentheses: false
72
+ SpacesInConditionalStatement: false
73
+ SpacesInContainerLiterals: true
74
+ SpacesInParentheses: false
75
+ SpacesInSquareBrackets: false
data/.clangd ADDED
@@ -0,0 +1,2 @@
1
+ CompileFlags:
2
+ CompilationDatabase: ext/rbs_extension
data/.dockerignore ADDED
@@ -0,0 +1,37 @@
1
+ # Keep the build context small. .git is intentionally NOT ignored: rbs.gemspec
2
+ # builds its file list with `git ls-files`.
3
+ #
4
+ # Safe to ignore here: untracked/generated paths, and tracked paths the gemspec
5
+ # already rejects (so `gem build` does not expect them on disk). Do NOT ignore a
6
+ # tracked path the gemspec ships — `gem build` would fail with "... are not
7
+ # files". .vscode/ and benchmark/ are tracked but rejected by the gemspec.
8
+ .vscode/
9
+ benchmark/
10
+
11
+ # Editor / tooling / worktree copies (untracked; each is a full repo clone)
12
+ .claude/
13
+ trees/
14
+ .devcontainer/
15
+ .idea/
16
+ .ruby-lsp/
17
+ .yardoc/
18
+ doc/
19
+ datasets/
20
+ tmp/
21
+
22
+ # Build artifact — rebuilt inside the image by `rake wasm:jruby_setup`
23
+ lib/rbs/wasm/*.wasm
24
+ *.gem
25
+ ext/**/*.o
26
+ ext/**/*.so
27
+ ext/**/*.bundle
28
+ *.log
29
+
30
+ # Local scratch / experiment files
31
+ flamegraph.html
32
+ gc.html
33
+ foo.rbs
34
+ sorted.json
35
+ string.json
36
+ Gemfile-*
37
+ gemfiles/
data/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ src/lexer.c linguist-generated
@@ -1,22 +1,24 @@
1
1
  version: 2
2
2
  updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- open-pull-requests-limit: 3
8
- allow:
9
- - dependency-type: all
3
+ # - package-ecosystem: bundler
4
+ # directory: "/"
5
+ # schedule:
6
+ # interval: daily
7
+ # open-pull-requests-limit: 3
8
+ # allow:
9
+ # - dependency-type: all
10
10
 
11
- - package-ecosystem: bundler
12
- directory: "/steep"
13
- schedule:
14
- interval: daily
15
- open-pull-requests-limit: 3
16
- allow:
17
- - dependency-type: all
11
+ # - package-ecosystem: bundler
12
+ # directory: "/steep"
13
+ # schedule:
14
+ # interval: daily
15
+ # open-pull-requests-limit: 3
16
+ # allow:
17
+ # - dependency-type: all
18
18
 
19
19
  - package-ecosystem: 'github-actions'
20
20
  directory: '/'
21
21
  schedule:
22
22
  interval: 'weekly'
23
+ labels:
24
+ - 'skip-changelog'
@@ -0,0 +1,63 @@
1
+ name: Scheduled Bundle Update PR
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 0 * * 2'
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ bundle-update:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
15
+
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
18
+ with:
19
+ ruby-version: '4.0'
20
+
21
+ - name: Set up git
22
+ run: |
23
+ git config --global user.name "github-actions[bot]"
24
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
25
+
26
+ - name: Switch branch
27
+ run: |
28
+ git switch -c bundle-update-$(date +'%Y%m%d')-$(uuidgen | cut -c1-8)
29
+
30
+ - name: Install bundler
31
+ run: gem install bundler
32
+
33
+ - name: Run bundle update
34
+ run: |
35
+ bundle lock --update
36
+ bundle lock --update --gemfile=steep/Gemfile
37
+ git add Gemfile.lock steep/Gemfile.lock
38
+
39
+ if git diff --cached --exit-code; then
40
+ echo "No changes to commit, exiting."
41
+ exit 0
42
+ fi
43
+
44
+ git commit -m "bundle update"
45
+ echo "has_update=true" >> $GITHUB_ENV
46
+
47
+ - name: Push branch
48
+ if: env.has_update == 'true'
49
+ run: git push origin HEAD
50
+
51
+ - name: Create Pull Request
52
+ if: env.has_update == 'true'
53
+ env:
54
+ GH_TOKEN: ${{ secrets.DEPENDABOT_MERGE_GH_TOKEN }}
55
+ run: |
56
+ gh pr create \
57
+ --title "bundle update ($(date +'%Y-%m-%d'))" \
58
+ --body "Automated weekly bundle update" \
59
+ --head "$(git rev-parse --abbrev-ref HEAD)" \
60
+ --base "${{ github.event.repository.default_branch }}" \
61
+ --label "skip-changelog"
62
+
63
+ gh pr merge --auto --merge "$(git rev-parse --abbrev-ref HEAD)"
@@ -0,0 +1,66 @@
1
+ name: C Code Generation and Formatting Check
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request: {}
8
+ merge_group: {}
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ format-check:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
19
+ with:
20
+ ruby-version: "4.0"
21
+ bundler-cache: none
22
+ - name: Set working directory as safe
23
+ run: git config --global --add safe.directory $(pwd)
24
+ - name: Install dependencies
25
+ run: |
26
+ sudo apt-get update
27
+ sudo apt-get install -y libdb-dev curl autoconf automake m4 libtool
28
+ - name: Install clang-format from LLVM
29
+ run: |
30
+ # The codename must match the `runs-on` image: `ubuntu-latest` is 24.04 (noble).
31
+ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key \
32
+ | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
33
+ # Written directly rather than through `apt-add-repository`, which cannot
34
+ # parse `[signed-by=...]` inside a one-line `deb` shortcut.
35
+ echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" \
36
+ | sudo tee /etc/apt/sources.list.d/llvm.list
37
+ sudo apt-get update
38
+ sudo apt-get install -y clang-format-20
39
+ sudo ln -sf /usr/bin/clang-format-20 /usr/local/bin/clang-format
40
+ clang-format --version
41
+ - name: Count processors
42
+ run: nproc
43
+ - name: Install Re2c
44
+ run: |
45
+ cd /tmp
46
+ curl -L https://github.com/skvadrik/re2c/archive/refs/tags/4.5.1.tar.gz > re2c-4.5.1.tar.gz
47
+ tar xf re2c-4.5.1.tar.gz
48
+ cd re2c-4.5.1
49
+ cmake --preset=linux-gcc-release-ootree-skeleton-fast
50
+ cmake --build --preset=linux-gcc-release-ootree-skeleton-fast --parallel="$(nproc)"
51
+ sudo ln -sf "$(pwd)"/.build/linux-gcc-release-ootree-skeleton-fast/re2c /usr/local/bin/re2c
52
+ re2c --version
53
+ - name: Update rubygems & bundler
54
+ run: |
55
+ ruby -v
56
+ gem update --system
57
+ - name: install erb
58
+ run: gem install erb
59
+ - name: bin/setup
60
+ run: |
61
+ bin/setup
62
+ - name: Check C code generation and formatting
63
+ run: |
64
+ clang-format --version
65
+ bundle exec rake lexer templates compile confirm_lexer confirm_templates
66
+ bundle exec rake format:c_check
@@ -0,0 +1,121 @@
1
+ name: Changelog
2
+
3
+ # Prints the changelog template for a release, which is otherwise `rake gem:changelog`
4
+ # on a laptop.
5
+ #
6
+ # The task asks GitHub which pull requests the commits came from, and it asks through
7
+ # `gh`. A Claude Code on the web session cannot reach `api.github.com` at all -- the
8
+ # refusal is keyed on the session, so neither installing `gh` nor rewriting the task
9
+ # against REST gets around it -- and a runner has both `gh` and `github.token`. So the
10
+ # same task runs here, and the release is prepared from a session that could not
11
+ # otherwise produce this list.
12
+ #
13
+ # The ref selector picks the branch the changelog is for *and* the copy of the task
14
+ # that computes it, which are the same thing: dispatch it on `aaa-X.Y.x` for a patch
15
+ # release, on `master` otherwise.
16
+ #
17
+ # Nothing is written. The run reads the repository and prints.
18
+
19
+ on:
20
+ workflow_dispatch:
21
+ inputs:
22
+ version:
23
+ description: "Where the changelog starts, if not the RBS::VERSION of the ref (e.g. 4.1.0)"
24
+ required: false
25
+ type: string
26
+ format:
27
+ description: "The changelog template, or the JSON its sections are sorted from"
28
+ required: false
29
+ default: list
30
+ type: choice
31
+ options:
32
+ - list
33
+ - json
34
+
35
+ permissions:
36
+ contents: read
37
+
38
+ jobs:
39
+ changelog:
40
+ name: changelog
41
+ runs-on: ubuntu-latest
42
+ permissions:
43
+ contents: read # the history and the tags
44
+ pull-requests: read # what the commits came from
45
+ env:
46
+ # The inputs are read through the environment rather than interpolated into
47
+ # the script below.
48
+ VERSION: ${{ inputs.version }}
49
+ FORMAT: ${{ inputs.format }}
50
+ GH_TOKEN: ${{ github.token }}
51
+ steps:
52
+ # `changelog_base` resolves the previous release with `git describe`, the task
53
+ # walks the history back to it, and on a release branch it reads the `-x`
54
+ # trailers of the commits it finds -- so the full history and the tags are all
55
+ # needed. `fetch-depth: 0` fetches both.
56
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
57
+ with:
58
+ fetch-depth: 0
59
+
60
+ # Before the gems are installed, since a version that cannot be a version is
61
+ # cheapest to reject here.
62
+ - name: Check the input
63
+ run: |
64
+ version_pattern='^[0-9]+\.[0-9]+\.[0-9]+(\.(pre|dev)\.[0-9]+)?$'
65
+ if [ -n "$VERSION" ] && ! [[ "$VERSION" =~ $version_pattern ]]; then
66
+ echo "::error::\`$VERSION\` is not a version number."
67
+ exit 1
68
+ fi
69
+
70
+ - name: Set up Ruby
71
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
72
+ with:
73
+ ruby-version: ruby
74
+ bundler: none
75
+ - name: Install gems
76
+ run: |
77
+ bundle config set --local without libs:profilers
78
+ bundle install --jobs 4 --retry 3
79
+
80
+ # Only the changelog goes to STDOUT; the task reports what it is doing, and
81
+ # which pull requests it skipped, on STDERR. `tee` keeps both in the log, in
82
+ # order, and puts the changelog on its own where the next step can read it.
83
+ - name: Print the changelog
84
+ run: |
85
+ if [ "$FORMAT" = "json" ]; then
86
+ task="gem:changelog:json"
87
+ else
88
+ task="gem:changelog"
89
+ fi
90
+ if [ -n "$VERSION" ]; then
91
+ task="$task[$VERSION]"
92
+ fi
93
+
94
+ echo "Running \`rake $task\` on $(git rev-parse --abbrev-ref HEAD)"
95
+ bundle exec rake "$task" | tee changelog.out
96
+
97
+ # Uploaded before it is rendered, so that the changelog survives whatever the
98
+ # summary makes of it. This is also what to reach for when the JSON is long
99
+ # enough to be truncated in the log.
100
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
101
+ with:
102
+ name: changelog
103
+ path: changelog.out
104
+
105
+ # The log carries this too, but the summary renders it. A step summary is
106
+ # capped at 1MiB and the step fails if that is exceeded, which a long JSON
107
+ # could manage -- so past a comfortable fraction of it, link the artifact
108
+ # rather than lose the run over formatting.
109
+ - name: Render the changelog
110
+ run: |
111
+ if [ "$(wc -c < changelog.out)" -gt 900000 ]; then
112
+ echo "The changelog is too long to render here. Download the \`changelog\` artifact." \
113
+ >> "$GITHUB_STEP_SUMMARY"
114
+ exit 0
115
+ fi
116
+
117
+ {
118
+ echo '```markdown'
119
+ cat changelog.out
120
+ echo '```'
121
+ } >> "$GITHUB_STEP_SUMMARY"
@@ -11,12 +11,12 @@ jobs:
11
11
  comments:
12
12
  runs-on: "ubuntu-latest"
13
13
  # env:
14
- # RUBY_COMMIT: 1b0c46daed9186b82ab4fef1a4ab225afe582ee6
14
+ # RUBY_COMMIT: v4.0.0-preview2
15
15
  steps:
16
- - uses: actions/checkout@v4
17
- - uses: ruby/setup-ruby@v1
16
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17
+ - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
18
18
  with:
19
- ruby-version: "3.4.1"
19
+ ruby-version: "4.0.6"
20
20
  bundler: none
21
21
  - name: Install dependencies
22
22
  run: |
@@ -26,6 +26,8 @@ jobs:
26
26
  run: |
27
27
  ruby -v
28
28
  gem update --system
29
+ - name: install erb
30
+ run: gem install erb
29
31
  - name: bin/setup
30
32
  run: |
31
33
  bin/setup
@@ -14,10 +14,10 @@ jobs:
14
14
  if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
15
15
  steps:
16
16
  - name: Dependabot metadata
17
- uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7 # v2.3.0
17
+ uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
18
18
  id: metadata
19
19
  - name: Checkout repository
20
- uses: actions/checkout@v4
20
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
21
21
  with:
22
22
  fetch-depth: 0
23
23
  - name: Abort if blocker files are changed
@@ -0,0 +1,74 @@
1
+ name: JRuby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ paths:
9
+ - ".github/workflows/jruby.yml"
10
+ - "include/**"
11
+ - "src/**"
12
+ - "wasm/**"
13
+ - "lib/**"
14
+ - "sig/**"
15
+ - "core/**"
16
+ - "stdlib/**"
17
+ - "test/**"
18
+ - "Rakefile"
19
+ - "rbs.gemspec"
20
+ # `merge_group` has no `paths` filter, so this runs on every queue entry.
21
+ merge_group: {}
22
+
23
+ permissions:
24
+ contents: read
25
+
26
+ env:
27
+ # Keep in sync with .github/workflows/wasm.yml.
28
+ WASI_SDK_VERSION: "33"
29
+ WASI_SDK_RELEASE: "33.0"
30
+
31
+ jobs:
32
+ test:
33
+ name: jruby
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
37
+ - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
38
+
39
+ # Build the .wasm and fetch the Chicory jars with CRuby + the WASI SDK,
40
+ # then run RBS itself on JRuby against those artifacts.
41
+ - name: Set up Ruby (to assemble the WebAssembly runtime)
42
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
43
+ with:
44
+ ruby-version: ruby
45
+ bundler: none
46
+ - name: Update rubygems & bundler
47
+ run: gem update --system
48
+ - name: Install gems
49
+ run: |
50
+ bundle config set --local without libs:profilers
51
+ bundle install --jobs 4 --retry 3
52
+ - name: Install the WASI SDK
53
+ run: |
54
+ url="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-x86_64-linux.tar.gz"
55
+ mkdir -p "$HOME/wasi-sdk"
56
+ curl -sSL "$url" | tar xz --strip-components=1 -C "$HOME/wasi-sdk"
57
+ echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> "$GITHUB_ENV"
58
+ - name: Build rbs_parser.wasm
59
+ run: bundle exec rake wasm:jruby_setup
60
+
61
+ - name: Set up JRuby
62
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
63
+ with:
64
+ ruby-version: jruby
65
+ bundler: none
66
+ - name: Install runtime and test gems
67
+ run: gem install prism rake rake-compiler test-unit rdoc rspec minitest json-schema pry --no-document
68
+ # jar-dependencies resolves through the JVM, so download the Chicory/ASM
69
+ # jars into ~/.m2 here on JRuby (jar-dependencies is not available in the
70
+ # CRuby step above).
71
+ - name: Download the Chicory and ASM jars
72
+ run: jruby -S rake wasm:install_jars
73
+ - name: Run the test suite on JRuby
74
+ run: jruby -S rake test