rbs 4.1.0 → 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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.github/dependabot.yml +1 -1
  4. data/.github/workflows/bundle-update.yml +3 -3
  5. data/.github/workflows/c-check.yml +2 -2
  6. data/.github/workflows/changelog.yml +121 -0
  7. data/.github/workflows/comments.yml +2 -2
  8. data/.github/workflows/dependabot.yml +1 -1
  9. data/.github/workflows/jruby.yml +4 -9
  10. data/.github/workflows/release-gems.yml +234 -0
  11. data/.github/workflows/ruby.yml +6 -6
  12. data/.github/workflows/rust.yml +12 -12
  13. data/.github/workflows/truffleruby.yml +2 -2
  14. data/.github/workflows/typecheck.yml +2 -2
  15. data/.github/workflows/wasm.yml +3 -3
  16. data/.github/workflows/windows.yml +2 -2
  17. data/.rubocop.yml +0 -1
  18. data/CHANGELOG.md +83 -0
  19. data/README.md +1 -1
  20. data/Rakefile +443 -86
  21. data/config.yml +7 -0
  22. data/core/io.rbs +2 -1
  23. data/docs/CONTRIBUTING.md +1 -1
  24. data/docs/release.md +265 -31
  25. data/docs/stdlib.md +8 -0
  26. data/docs/syntax.md +12 -0
  27. data/ext/rbs_extension/ast_translation.c +15 -0
  28. data/ext/rbs_extension/class_constants.c +2 -0
  29. data/ext/rbs_extension/class_constants.h +1 -0
  30. data/ext/rbs_extension/main.c +55 -19
  31. data/include/rbs/ast.h +25 -17
  32. data/include/rbs/defines.h +8 -3
  33. data/include/rbs/lexer.h +13 -12
  34. data/include/rbs/parser.h +37 -3
  35. data/lib/rbs/ast/declarations.rb +1 -1
  36. data/lib/rbs/ast/type_param.rb +1 -1
  37. data/lib/rbs/definition_builder/ancestor_builder.rb +8 -5
  38. data/lib/rbs/definition_builder/method_builder.rb +4 -4
  39. data/lib/rbs/definition_builder.rb +5 -2
  40. data/lib/rbs/environment/class_entry.rb +12 -0
  41. data/lib/rbs/environment/module_entry.rb +26 -1
  42. data/lib/rbs/parser_aux.rb +2 -2
  43. data/lib/rbs/prototype/helpers.rb +19 -52
  44. data/lib/rbs/prototype/runtime/value_object_generator.rb +0 -1
  45. data/lib/rbs/prototype/runtime.rb +1 -1
  46. data/lib/rbs/types.rb +44 -2
  47. data/lib/rbs/unit_test/type_assertions.rb +5 -5
  48. data/lib/rbs/version.rb +1 -1
  49. data/lib/rbs/wasm/parser.rb +62 -25
  50. data/lib/rbs/wasm/runtime.rb +19 -4
  51. data/lib/rbs/wasm/serialization_schema.rb +3 -2
  52. data/rbs.gemspec +1 -5
  53. data/schema/function.json +12 -1
  54. data/sig/environment/class_entry.rbs +6 -0
  55. data/sig/environment/module_entry.rbs +15 -0
  56. data/sig/parser.rbs +4 -4
  57. data/sig/types.rbs +11 -1
  58. data/sig/unit_test/type_assertions.rbs +2 -2
  59. data/src/ast.c +19 -3
  60. data/src/lexer.c +1562 -1560
  61. data/src/lexer.re +50 -18
  62. data/src/lexstate.c +2 -1
  63. data/src/parser.c +136 -73
  64. data/src/serialize.c +20 -13
  65. data/src/util/rbs_encoding.c +195 -49
  66. data/stdlib/erb/0/erb.rbs +4 -4
  67. data/stdlib/monitor/0/monitor.rbs +4 -4
  68. data/stdlib/singleton/0/singleton.rbs +3 -0
  69. data/stdlib/stringio/0/stringio.rbs +2 -1
  70. data/stdlib/zlib/0/gzip_file.rbs +1 -1
  71. data/stdlib/zlib/0/gzip_writer.rbs +2 -1
  72. data/wasm/README.md +53 -4
  73. data/wasm/rbs_wasm.c +93 -37
  74. metadata +6 -4
  75. data/.github/workflows/milestone.yml +0 -91
data/src/parser.c CHANGED
@@ -124,6 +124,7 @@ typedef struct {
124
124
  rbs_hash_t *required_keywords;
125
125
  rbs_hash_t *optional_keywords;
126
126
  rbs_node_t *rest_keywords;
127
+ rbs_node_t *forwarding;
127
128
  } method_params;
128
129
 
129
130
  /**
@@ -183,7 +184,7 @@ static void parser_advance_no_gap(rbs_parser_t *parser) {
183
184
  | {(tUIDENT `::`)*} <tXIDENT>
184
185
  | {<tXIDENT>}
185
186
  */
186
- NODISCARD
187
+ RBS_NODISCARD
187
188
  static bool parse_type_name(rbs_parser_t *parser, TypeNameKind kind, rbs_range_t *rg, rbs_type_name_t **type_name) {
188
189
  bool absolute = false;
189
190
 
@@ -267,7 +268,7 @@ error_handling: {
267
268
  type_list ::= {} type `,` ... <`,`> eol
268
269
  | {} type `,` ... `,` <type> eol
269
270
  */
270
- NODISCARD
271
+ RBS_NODISCARD
271
272
  static bool parse_type_list(rbs_parser_t *parser, enum RBSTokenType eol, rbs_node_list_t *types, bool void_allowed, bool self_allowed, bool classish_allowed) {
272
273
  while (true) {
273
274
  rbs_node_t *type;
@@ -297,7 +298,7 @@ static bool parse_type_list(rbs_parser_t *parser, enum RBSTokenType eol, rbs_nod
297
298
  type_list_with_commas ::= {} type `,` ... <`,`> eol
298
299
  | {} type `,` ... `,` <type> eol
299
300
  */
300
- NODISCARD
301
+ RBS_NODISCARD
301
302
  static bool parse_type_list_with_commas(rbs_parser_t *parser, enum RBSTokenType eol, rbs_node_list_t *types, rbs_location_range_list_t *comma_locations, bool void_allowed, bool self_allowed, bool classish_allowed) {
302
303
  while (true) {
303
304
  rbs_node_t *type;
@@ -336,6 +337,7 @@ static bool is_keyword_token(enum RBSTokenType type) {
336
337
  case tUIDENT:
337
338
  case tULIDENT:
338
339
  case tULLIDENT:
340
+ case tNONASCIIIDENT:
339
341
  case tQIDENT:
340
342
  case tBANGIDENT:
341
343
  KEYWORD_CASES
@@ -345,11 +347,20 @@ static bool is_keyword_token(enum RBSTokenType type) {
345
347
  }
346
348
  }
347
349
 
350
+ /**
351
+ * Ruby lets a local variable name open with a character outside ASCII, and a
352
+ * parameter name is a local variable name. Nothing here reads the case of that
353
+ * character, so both spellings are a name.
354
+ * */
355
+ static bool is_param_name_token(enum RBSTokenType type) {
356
+ return type == tLIDENT || type == tNONASCIIIDENT;
357
+ }
358
+
348
359
  /*
349
360
  function_param ::= {} <type>
350
361
  | {} type <param>
351
362
  */
352
- NODISCARD
363
+ RBS_NODISCARD
353
364
  static bool parse_function_param(rbs_parser_t *parser, rbs_types_function_param_t **function_param, bool self_allowed, bool classish_allowed) {
354
365
  rbs_range_t type_range;
355
366
  type_range.start = parser->next_token.range.start;
@@ -401,22 +412,25 @@ static rbs_constant_id_t intern_token_start_end(rbs_parser_t *parser, rbs_token_
401
412
  keyword_key ::= {} <keyword> `:`
402
413
  | {} keyword <`?`> `:`
403
414
  */
404
- NODISCARD
415
+ RBS_NODISCARD
405
416
  static bool parse_keyword_key(rbs_parser_t *parser, rbs_ast_symbol_t **key) {
406
417
  rbs_parser_advance(parser);
407
418
 
408
- rbs_location_range symbol_range = rbs_location_range_current_token(parser);
419
+ rbs_range_t symbol_range = parser->current_token.range;
409
420
 
410
421
  if (parser->next_token.type == pQUESTION) {
422
+ // The `?` is part of the key, so it is part of the location too.
423
+ symbol_range.end = parser->next_token.range.end;
424
+
411
425
  *key = rbs_ast_symbol_new(
412
426
  ALLOCATOR(),
413
- symbol_range,
427
+ RBS_RANGE_LEX2AST(symbol_range),
414
428
  &parser->constant_pool,
415
429
  intern_token_start_end(parser, parser->current_token, parser->next_token)
416
430
  );
417
431
  rbs_parser_advance(parser);
418
432
  } else {
419
- *key = rbs_ast_symbol_new(ALLOCATOR(), symbol_range, &parser->constant_pool, INTERN_TOKEN(parser, parser->current_token));
433
+ *key = rbs_ast_symbol_new(ALLOCATOR(), RBS_RANGE_LEX2AST(symbol_range), &parser->constant_pool, INTERN_TOKEN(parser, parser->current_token));
420
434
  }
421
435
 
422
436
  return true;
@@ -425,7 +439,7 @@ static bool parse_keyword_key(rbs_parser_t *parser, rbs_ast_symbol_t **key) {
425
439
  /*
426
440
  keyword ::= {} keyword `:` <function_param>
427
441
  */
428
- NODISCARD
442
+ RBS_NODISCARD
429
443
  static bool parse_keyword(rbs_parser_t *parser, rbs_hash_t *keywords, rbs_hash_t *memo, bool self_allowed, bool classish_allowed) {
430
444
  rbs_ast_symbol_t *key = NULL;
431
445
  CHECK_PARSE(parse_keyword_key(parser, &key));
@@ -484,10 +498,12 @@ static bool parser_advance_if(rbs_parser_t *parser, enum RBSTokenType type) {
484
498
  /*
485
499
  params ::= {} `)`
486
500
  | {} `?` `)` -- Untyped function params (assign params.required = nil)
501
+ | {} `...` `)` -- Forwarding params
487
502
  | <required_params> `)`
488
503
  | <required_params> `,` `)`
489
504
 
490
505
  required_params ::= {} function_param `,` <required_params>
506
+ | {} function_param `,` `...`
491
507
  | {} <function_param>
492
508
  | {} <optional_params>
493
509
 
@@ -510,8 +526,8 @@ static bool parser_advance_if(rbs_parser_t *parser, enum RBSTokenType type) {
510
526
  | {} `?` <optional_keyword>
511
527
  | {} `**` <function_param>
512
528
  */
513
- NODISCARD
514
- static bool parse_params(rbs_parser_t *parser, method_params *params, bool self_allowed, bool classish_allowed) {
529
+ RBS_NODISCARD
530
+ static bool parse_params(rbs_parser_t *parser, method_params *params, bool forwarding_allowed, bool self_allowed, bool classish_allowed) {
515
531
  if (parser->next_token.type == pQUESTION && parser->next_token2.type == pRPAREN) {
516
532
  params->required_positionals = NULL;
517
533
  rbs_parser_advance(parser);
@@ -534,6 +550,24 @@ static bool parse_params(rbs_parser_t *parser, method_params *params, bool self_
534
550
  case pRPAREN:
535
551
  goto EOP;
536
552
 
553
+ case pDOT3: {
554
+ if (!forwarding_allowed) {
555
+ rbs_parser_set_error(parser, parser->next_token, true, "forwarding parameter is not allowed in this context");
556
+ return false;
557
+ }
558
+
559
+ if (!parser->options.enable_forwarding_params) {
560
+ rbs_parser_set_error(parser, parser->next_token, true, "forwarding parameter syntax is not enabled");
561
+ return false;
562
+ }
563
+
564
+ rbs_parser_advance(parser);
565
+ params->forwarding = (rbs_node_t *) rbs_types_function_forwarding_param_new(
566
+ ALLOCATOR(),
567
+ rbs_location_range_current_token(parser)
568
+ );
569
+ goto EOP;
570
+ }
537
571
  default:
538
572
  if (is_keyword(parser)) {
539
573
  goto PARSE_KEYWORDS;
@@ -645,6 +679,7 @@ PARSE_KEYWORDS:
645
679
  case tQIDENT:
646
680
  case tULIDENT:
647
681
  case tULLIDENT:
682
+ case tNONASCIIIDENT:
648
683
  case tBANGIDENT:
649
684
  KEYWORD_CASES
650
685
  if (is_keyword(parser)) {
@@ -677,7 +712,7 @@ EOP:
677
712
  optional ::= {} <simple_type>
678
713
  | {} simple_type <`?`>
679
714
  */
680
- NODISCARD
715
+ RBS_NODISCARD
681
716
  static bool parse_optional(rbs_parser_t *parser, rbs_node_t **optional, bool void_allowed, bool self_allowed, bool classish_allowed) {
682
717
  rbs_range_t rg;
683
718
  rg.start = parser->next_token.range.start;
@@ -710,6 +745,7 @@ static void initialize_method_params(method_params *params, rbs_allocator_t *all
710
745
  .required_keywords = rbs_hash_new(allocator),
711
746
  .optional_keywords = rbs_hash_new(allocator),
712
747
  .rest_keywords = NULL,
748
+ .forwarding = NULL,
713
749
  };
714
750
  }
715
751
 
@@ -717,7 +753,7 @@ static void initialize_method_params(method_params *params, rbs_allocator_t *all
717
753
  self_type_binding ::= {} <>
718
754
  | {} `[` `self` `:` type <`]`>
719
755
  */
720
- NODISCARD
756
+ RBS_NODISCARD
721
757
  static bool parse_self_type_binding(rbs_parser_t *parser, rbs_node_t **self_type, bool self_allowed, bool classish_allowed) {
722
758
  if (parser->next_token.type == pLBRACKET) {
723
759
  rbs_parser_advance(parser);
@@ -745,8 +781,8 @@ typedef struct {
745
781
  | {} self_type_binding? `{` self_type_binding `->` optional `}` `->` <optional>
746
782
  | {} self_type_binding? `->` <optional>
747
783
  */
748
- NODISCARD
749
- static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool block_allowed, parse_function_result **result, bool self_allowed, bool classish_allowed) {
784
+ RBS_NODISCARD
785
+ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool block_allowed, bool forwarding_allowed, parse_function_result **result, bool self_allowed, bool classish_allowed) {
750
786
  rbs_node_t *function = NULL;
751
787
  rbs_types_block_t *block = NULL;
752
788
  rbs_node_t *function_self_type = NULL;
@@ -758,7 +794,7 @@ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool
758
794
 
759
795
  if (parser->next_token.type == pLPAREN) {
760
796
  rbs_parser_advance(parser);
761
- CHECK_PARSE(parse_params(parser, &params, self_allowed, classish_allowed));
797
+ CHECK_PARSE(parse_params(parser, &params, forwarding_allowed, self_allowed, classish_allowed));
762
798
  ADVANCE_ASSERT(parser, pRPAREN);
763
799
  }
764
800
 
@@ -776,8 +812,14 @@ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool
776
812
 
777
813
  bool required = true;
778
814
  rbs_range_t block_range;
815
+ bool has_block = parser->next_token.type == pLBRACE || (parser->next_token.type == pQUESTION && parser->next_token2.type == pLBRACE);
779
816
 
780
- if (!block_allowed && (parser->next_token.type == pLBRACE || (parser->next_token.type == pQUESTION && parser->next_token2.type == pLBRACE))) {
817
+ if (params.forwarding && has_block) {
818
+ rbs_parser_set_error(parser, parser->next_token, true, "method type with forwarding parameter cannot have block");
819
+ return false;
820
+ }
821
+
822
+ if (!block_allowed && has_block) {
781
823
  rbs_parser_set_error(parser, parser->next_token, true, "block is not allowed in this context");
782
824
  return false;
783
825
  }
@@ -799,7 +841,7 @@ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool
799
841
 
800
842
  if (parser->next_token.type == pLPAREN) {
801
843
  rbs_parser_advance(parser);
802
- CHECK_PARSE(parse_params(parser, &block_params, self_allowed, classish_allowed));
844
+ CHECK_PARSE(parse_params(parser, &block_params, false, self_allowed, classish_allowed));
803
845
  ADVANCE_ASSERT(parser, pRPAREN);
804
846
  }
805
847
 
@@ -828,6 +870,7 @@ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool
828
870
  block_params.required_keywords,
829
871
  block_params.optional_keywords,
830
872
  block_params.rest_keywords,
873
+ block_params.forwarding,
831
874
  block_return_type
832
875
  );
833
876
  }
@@ -853,6 +896,7 @@ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool
853
896
  params.required_keywords,
854
897
  params.optional_keywords,
855
898
  params.rest_keywords,
899
+ params.forwarding,
856
900
  type
857
901
  );
858
902
  }
@@ -866,11 +910,11 @@ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, bool
866
910
  /*
867
911
  proc_type ::= {`^`} <function>
868
912
  */
869
- NODISCARD
913
+ RBS_NODISCARD
870
914
  static bool parse_proc_type(rbs_parser_t *parser, rbs_types_proc_t **proc, bool self_allowed, bool classish_allowed) {
871
915
  rbs_position_t start = parser->current_token.range.start;
872
916
  parse_function_result *result = rbs_allocator_alloc(ALLOCATOR(), parse_function_result);
873
- CHECK_PARSE(parse_function(parser, true, true, &result, self_allowed, classish_allowed));
917
+ CHECK_PARSE(parse_function(parser, true, true, false, &result, self_allowed, classish_allowed));
874
918
 
875
919
  rbs_position_t end = parser->current_token.range.end;
876
920
  rbs_location_range range = { .start_char = start.char_pos, .start_byte = start.byte_pos, .end_char = end.char_pos, .end_byte = end.byte_pos };
@@ -894,7 +938,7 @@ static void check_key_duplication(rbs_parser_t *parser, rbs_hash_t *fields, rbs_
894
938
  record_attribute ::= {} keyword_token `:` <type>
895
939
  | {} literal_type `=>` <type>
896
940
  */
897
- NODISCARD
941
+ RBS_NODISCARD
898
942
  static bool parse_record_attributes(rbs_parser_t *parser, rbs_hash_t **fields, bool self_allowed, bool classish_allowed) {
899
943
  *fields = rbs_hash_new(ALLOCATOR());
900
944
 
@@ -964,7 +1008,7 @@ static bool parse_record_attributes(rbs_parser_t *parser, rbs_hash_t **fields, b
964
1008
  /*
965
1009
  symbol ::= {<tSYMBOL>}
966
1010
  */
967
- NODISCARD
1011
+ RBS_NODISCARD
968
1012
  static bool parse_symbol(rbs_parser_t *parser, rbs_location_range location, rbs_types_literal_t **symbol) {
969
1013
  size_t offset_bytes = parser->lexer->encoding->char_width((const uint8_t *) ":", (size_t) 1);
970
1014
  size_t bytes = rbs_token_bytes(parser->current_token) - offset_bytes;
@@ -1013,7 +1057,7 @@ static bool parse_symbol(rbs_parser_t *parser, rbs_location_range location, rbs_
1013
1057
  type_args ::= {} <> /empty/
1014
1058
  | {} `[` type_list <`]`>
1015
1059
  */
1016
- NODISCARD
1060
+ RBS_NODISCARD
1017
1061
  static bool parse_instance_type(rbs_parser_t *parser, bool parse_alias, rbs_node_t **type) {
1018
1062
  TypeNameKind expected_kind = (TypeNameKind) (INTERFACE_NAME | CLASS_NAME);
1019
1063
  if (parse_alias) {
@@ -1085,7 +1129,7 @@ static bool parse_instance_type(rbs_parser_t *parser, bool parse_alias, rbs_node
1085
1129
  /*
1086
1130
  singleton_type ::= {`singleton`} `(` type_name <`)`> type_args?
1087
1131
  */
1088
- NODISCARD
1132
+ RBS_NODISCARD
1089
1133
  static bool parse_singleton_type(rbs_parser_t *parser, rbs_types_class_singleton_t **singleton, bool self_allowed, bool classish_allowed) {
1090
1134
  ASSERT_TOKEN(parser, kSINGLETON);
1091
1135
 
@@ -1153,7 +1197,7 @@ static bool parser_typevar_member(rbs_parser_t *parser, rbs_constant_id_t id) {
1153
1197
  | {} `{` record_attributes <`}`>
1154
1198
  | {} `^` <function>
1155
1199
  */
1156
- NODISCARD
1200
+ RBS_NODISCARD
1157
1201
  static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type, bool void_allowed, bool self_allowed, bool classish_allowed) {
1158
1202
  rbs_parser_advance(parser);
1159
1203
 
@@ -1349,7 +1393,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type, bool void_allo
1349
1393
  intersection ::= {} optional `&` ... '&' <optional>
1350
1394
  | {} <optional>
1351
1395
  */
1352
- NODISCARD
1396
+ RBS_NODISCARD
1353
1397
  static bool parse_intersection(rbs_parser_t *parser, rbs_node_t **type, bool void_allowed, bool self_allowed, bool classish_allowed) {
1354
1398
  rbs_range_t rg;
1355
1399
  rg.start = parser->next_token.range.start;
@@ -1424,7 +1468,7 @@ bool rbs_parse_type(rbs_parser_t *parser, rbs_node_t **type, bool void_allowed,
1424
1468
 
1425
1469
  type_param ::= tUIDENT upper_bound? lower_bound? default_type? (module_type_params == false)
1426
1470
  */
1427
- NODISCARD
1471
+ RBS_NODISCARD
1428
1472
  static bool parse_type_params(rbs_parser_t *parser, rbs_range_t *rg, bool module_type_params, rbs_node_list_t **params) {
1429
1473
  *params = rbs_node_list_new(ALLOCATOR());
1430
1474
 
@@ -1564,7 +1608,7 @@ static bool parse_type_params(rbs_parser_t *parser, rbs_range_t *rg, bool module
1564
1608
  return true;
1565
1609
  }
1566
1610
 
1567
- NODISCARD
1611
+ RBS_NODISCARD
1568
1612
  static bool parser_pop_typevar_table(rbs_parser_t *parser) {
1569
1613
  id_table *table;
1570
1614
 
@@ -1587,7 +1631,7 @@ static bool parser_pop_typevar_table(rbs_parser_t *parser) {
1587
1631
  /*
1588
1632
  method_type ::= {} type_params <function>
1589
1633
  */
1590
- // TODO: Should this be NODISCARD?
1634
+ // TODO: Should this be RBS_NODISCARD?
1591
1635
  bool rbs_parse_method_type(rbs_parser_t *parser, rbs_method_type_t **method_type, bool require_eof, bool classish_allowed) {
1592
1636
  rbs_parser_push_typevar_table(parser, false);
1593
1637
 
@@ -1602,7 +1646,7 @@ bool rbs_parse_method_type(rbs_parser_t *parser, rbs_method_type_t **method_type
1602
1646
  type_range.start = parser->next_token.range.start;
1603
1647
 
1604
1648
  parse_function_result *result = rbs_allocator_alloc(ALLOCATOR(), parse_function_result);
1605
- CHECK_PARSE(parse_function(parser, false, true, &result, true, classish_allowed));
1649
+ CHECK_PARSE(parse_function(parser, false, true, true, &result, true, classish_allowed));
1606
1650
 
1607
1651
  CHECK_PARSE(parser_pop_typevar_table(parser));
1608
1652
 
@@ -1626,7 +1670,7 @@ bool rbs_parse_method_type(rbs_parser_t *parser, rbs_method_type_t **method_type
1626
1670
  /*
1627
1671
  global_decl ::= {tGIDENT} `:` <type>
1628
1672
  */
1629
- NODISCARD
1673
+ RBS_NODISCARD
1630
1674
  static bool parse_global_decl(rbs_parser_t *parser, rbs_node_list_t *annotations, rbs_ast_declarations_global_t **global) {
1631
1675
  rbs_range_t decl_range;
1632
1676
  decl_range.start = parser->current_token.range.start;
@@ -1651,7 +1695,7 @@ static bool parse_global_decl(rbs_parser_t *parser, rbs_node_list_t *annotations
1651
1695
  /*
1652
1696
  const_decl ::= {const_name} `:` <type>
1653
1697
  */
1654
- NODISCARD
1698
+ RBS_NODISCARD
1655
1699
  static bool parse_const_decl(rbs_parser_t *parser, rbs_node_list_t *annotations, rbs_ast_declarations_constant_t **constant) {
1656
1700
  rbs_range_t decl_range;
1657
1701
 
@@ -1677,7 +1721,7 @@ static bool parse_const_decl(rbs_parser_t *parser, rbs_node_list_t *annotations,
1677
1721
  /*
1678
1722
  type_decl ::= {kTYPE} alias_name `=` <type>
1679
1723
  */
1680
- NODISCARD
1724
+ RBS_NODISCARD
1681
1725
  static bool parse_type_decl(rbs_parser_t *parser, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_ast_declarations_type_alias_t **typealias) {
1682
1726
  rbs_parser_push_typevar_table(parser, true);
1683
1727
 
@@ -1717,7 +1761,7 @@ static bool parse_type_decl(rbs_parser_t *parser, rbs_position_t comment_pos, rb
1717
1761
  /*
1718
1762
  annotation ::= {<tANNOTATION>}
1719
1763
  */
1720
- NODISCARD
1764
+ RBS_NODISCARD
1721
1765
  static bool parse_annotation(rbs_parser_t *parser, rbs_ast_annotation_t **annotation) {
1722
1766
  rbs_range_t rg = parser->current_token.range;
1723
1767
 
@@ -1777,7 +1821,7 @@ static bool parse_annotation(rbs_parser_t *parser, rbs_ast_annotation_t **annota
1777
1821
  annotations ::= {} annotation ... <annotation>
1778
1822
  | {<>}
1779
1823
  */
1780
- NODISCARD
1824
+ RBS_NODISCARD
1781
1825
  static bool parse_annotations(rbs_parser_t *parser, rbs_node_list_t *annotations, rbs_position_t *annot_pos) {
1782
1826
  *annot_pos = NullPosition;
1783
1827
 
@@ -1804,7 +1848,7 @@ static bool parse_annotations(rbs_parser_t *parser, rbs_node_list_t *annotations
1804
1848
  method_name ::= {} <IDENT | keyword>
1805
1849
  | {} (IDENT | keyword)~<`?`>
1806
1850
  */
1807
- NODISCARD
1851
+ RBS_NODISCARD
1808
1852
  static bool parse_method_name(rbs_parser_t *parser, rbs_range_t *range, rbs_ast_symbol_t **symbol) {
1809
1853
  rbs_parser_advance(parser);
1810
1854
 
@@ -1813,6 +1857,7 @@ static bool parse_method_name(rbs_parser_t *parser, rbs_range_t *range, rbs_ast_
1813
1857
  case tLIDENT:
1814
1858
  case tULIDENT:
1815
1859
  case tULLIDENT:
1860
+ case tNONASCIIIDENT:
1816
1861
  KEYWORD_CASES
1817
1862
  if (parser->next_token.type == pQUESTION && parser->current_token.range.end.byte_pos == parser->next_token.range.start.byte_pos) {
1818
1863
  range->start = parser->current_token.range.start;
@@ -1922,7 +1967,7 @@ static InstanceSingletonKind parse_instance_singleton_kind(rbs_parser_t *parser,
1922
1967
  * @param instance_only `true` to reject singleton method definition.
1923
1968
  * @param accept_overload `true` to accept overloading (...) definition.
1924
1969
  * */
1925
- NODISCARD
1970
+ RBS_NODISCARD
1926
1971
  static bool parse_member_def(rbs_parser_t *parser, bool instance_only, bool accept_overload, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_ast_members_method_definition_t **method_definition) {
1927
1972
  rbs_range_t member_range;
1928
1973
  member_range.start = parser->current_token.range.start;
@@ -2070,7 +2115,7 @@ static bool parse_member_def(rbs_parser_t *parser, bool instance_only, bool acce
2070
2115
  *
2071
2116
  * @param kind
2072
2117
  * */
2073
- NODISCARD
2118
+ RBS_NODISCARD
2074
2119
  static bool class_instance_name(rbs_parser_t *parser, TypeNameKind kind, rbs_node_list_t *args, rbs_range_t *name_range, rbs_range_t *args_range, rbs_type_name_t **name, bool classish_allowed) {
2075
2120
  rbs_parser_advance(parser);
2076
2121
 
@@ -2098,7 +2143,7 @@ static bool class_instance_name(rbs_parser_t *parser, TypeNameKind kind, rbs_nod
2098
2143
  *
2099
2144
  * @param from_interface `true` when the member is in an interface.
2100
2145
  * */
2101
- NODISCARD
2146
+ RBS_NODISCARD
2102
2147
  static bool parse_mixin_member(rbs_parser_t *parser, bool from_interface, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_node_t **mixin_member) {
2103
2148
  rbs_range_t member_range;
2104
2149
  member_range.start = parser->current_token.range.start;
@@ -2189,7 +2234,7 @@ static bool parse_mixin_member(rbs_parser_t *parser, bool from_interface, rbs_po
2189
2234
  *
2190
2235
  * @param[in] instance_only `true` to reject `self.` alias.
2191
2236
  * */
2192
- NODISCARD
2237
+ RBS_NODISCARD
2193
2238
  static bool parse_alias_member(rbs_parser_t *parser, bool instance_only, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_ast_members_alias_t **alias_member) {
2194
2239
  rbs_range_t member_range;
2195
2240
  member_range.start = parser->current_token.range.start;
@@ -2240,7 +2285,7 @@ static bool parse_alias_member(rbs_parser_t *parser, bool instance_only, rbs_pos
2240
2285
  | {kSELF} `.` tAIDENT `:` <type>
2241
2286
  | {tA2IDENT} `:` <type>
2242
2287
  */
2243
- NODISCARD
2288
+ RBS_NODISCARD
2244
2289
  static bool parse_variable_member(rbs_parser_t *parser, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_node_t **variable_member) {
2245
2290
  if (annotations->length > 0) {
2246
2291
  rbs_parser_set_error(parser, parser->current_token, true, "annotation cannot be given to variable members");
@@ -2344,7 +2389,7 @@ static bool parse_variable_member(rbs_parser_t *parser, rbs_position_t comment_p
2344
2389
  visibility_member ::= {<`public`>}
2345
2390
  | {<`private`>}
2346
2391
  */
2347
- NODISCARD
2392
+ RBS_NODISCARD
2348
2393
  static bool parse_visibility_member(rbs_parser_t *parser, rbs_node_list_t *annotations, rbs_node_t **visibility_member) {
2349
2394
  if (annotations->length > 0) {
2350
2395
  rbs_parser_set_error(parser, parser->current_token, true, "annotation cannot be given to visibility members");
@@ -2382,7 +2427,7 @@ static bool parse_visibility_member(rbs_parser_t *parser, rbs_node_list_t *annot
2382
2427
  | `(` tAIDENT `)` # Ivar name
2383
2428
  | `(` `)` # No variable
2384
2429
  */
2385
- NODISCARD
2430
+ RBS_NODISCARD
2386
2431
  static bool parse_attribute_member(rbs_parser_t *parser, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_node_t **attribute_member) {
2387
2432
  rbs_range_t member_range;
2388
2433
 
@@ -2511,7 +2556,7 @@ static bool parse_attribute_member(rbs_parser_t *parser, rbs_position_t comment_
2511
2556
  | mixin_member (interface only)
2512
2557
  | alias_member (instance only)
2513
2558
  */
2514
- NODISCARD
2559
+ RBS_NODISCARD
2515
2560
  static bool parse_interface_members(rbs_parser_t *parser, rbs_node_list_t **members) {
2516
2561
  *members = rbs_node_list_new(ALLOCATOR());
2517
2562
 
@@ -2559,7 +2604,7 @@ static bool parse_interface_members(rbs_parser_t *parser, rbs_node_list_t **memb
2559
2604
  /*
2560
2605
  interface_decl ::= {`interface`} interface_name module_type_params interface_members <kEND>
2561
2606
  */
2562
- NODISCARD
2607
+ RBS_NODISCARD
2563
2608
  static bool parse_interface_decl(rbs_parser_t *parser, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_ast_declarations_interface_t **interface_decl) {
2564
2609
  rbs_parser_push_typevar_table(parser, true);
2565
2610
 
@@ -2603,7 +2648,7 @@ static bool parse_interface_decl(rbs_parser_t *parser, rbs_position_t comment_po
2603
2648
  module_self_type ::= <module_name>
2604
2649
  | module_name `[` type_list <`]`>
2605
2650
  */
2606
- NODISCARD
2651
+ RBS_NODISCARD
2607
2652
  static bool parse_module_self_types(rbs_parser_t *parser, rbs_node_list_t *array) {
2608
2653
  while (true) {
2609
2654
  rbs_parser_advance(parser);
@@ -2642,7 +2687,7 @@ static bool parse_module_self_types(rbs_parser_t *parser, rbs_node_list_t *array
2642
2687
  return true;
2643
2688
  }
2644
2689
 
2645
- NODISCARD
2690
+ RBS_NODISCARD
2646
2691
  static bool parse_nested_decl(rbs_parser_t *parser, const char *nested_in, rbs_position_t annot_pos, rbs_node_list_t *annotations, rbs_node_t **decl);
2647
2692
 
2648
2693
  /*
@@ -2656,7 +2701,7 @@ static bool parse_nested_decl(rbs_parser_t *parser, const char *nested_in, rbs_p
2656
2701
  | `public`
2657
2702
  | `private`
2658
2703
  */
2659
- NODISCARD
2704
+ RBS_NODISCARD
2660
2705
  static bool parse_module_members(rbs_parser_t *parser, rbs_node_list_t **members) {
2661
2706
  *members = rbs_node_list_new(ALLOCATOR());
2662
2707
 
@@ -2743,7 +2788,7 @@ static bool parse_module_members(rbs_parser_t *parser, rbs_node_list_t **members
2743
2788
  module_decl ::= {module_name} module_type_params module_members <kEND>
2744
2789
  | {module_name} module_name module_type_params `:` module_self_types module_members <kEND>
2745
2790
  */
2746
- NODISCARD
2791
+ RBS_NODISCARD
2747
2792
  static bool parse_module_decl0(rbs_parser_t *parser, rbs_range_t keyword_range, rbs_type_name_t *module_name, rbs_range_t name_range, rbs_ast_comment_t *comment, rbs_node_list_t *annotations, rbs_ast_declarations_module_t **module_decl) {
2748
2793
  rbs_parser_push_typevar_table(parser, true);
2749
2794
 
@@ -2791,7 +2836,7 @@ static bool parse_module_decl0(rbs_parser_t *parser, rbs_range_t keyword_range,
2791
2836
  | {`module`} module_name module_decl0 <kEND>
2792
2837
 
2793
2838
  */
2794
- NODISCARD
2839
+ RBS_NODISCARD
2795
2840
  static bool parse_module_decl(rbs_parser_t *parser, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_node_t **module_decl) {
2796
2841
  rbs_range_t keyword_range = parser->current_token.range;
2797
2842
 
@@ -2834,7 +2879,7 @@ static bool parse_module_decl(rbs_parser_t *parser, rbs_position_t comment_pos,
2834
2879
  class_decl_super ::= {} `<` <class_instance_name>
2835
2880
  | {<>}
2836
2881
  */
2837
- NODISCARD
2882
+ RBS_NODISCARD
2838
2883
  static bool parse_class_decl_super(rbs_parser_t *parser, rbs_range_t *lt_range, rbs_ast_declarations_class_super_t **super) {
2839
2884
  if (parser_advance_if(parser, pLT)) {
2840
2885
  *lt_range = parser->current_token.range;
@@ -2862,7 +2907,7 @@ static bool parse_class_decl_super(rbs_parser_t *parser, rbs_range_t *lt_range,
2862
2907
  /*
2863
2908
  class_decl ::= {class_name} type_params class_decl_super class_members <`end`>
2864
2909
  */
2865
- NODISCARD
2910
+ RBS_NODISCARD
2866
2911
  static bool parse_class_decl0(rbs_parser_t *parser, rbs_range_t keyword_range, rbs_type_name_t *name, rbs_range_t name_range, rbs_ast_comment_t *comment, rbs_node_list_t *annotations, rbs_ast_declarations_class_t **class_decl) {
2867
2912
  rbs_parser_push_typevar_table(parser, true);
2868
2913
 
@@ -2901,7 +2946,7 @@ static bool parse_class_decl0(rbs_parser_t *parser, rbs_range_t keyword_range, r
2901
2946
  class_decl ::= {`class`} class_name `=` <class_name>
2902
2947
  | {`class`} class_name <class_decl0>
2903
2948
  */
2904
- NODISCARD
2949
+ RBS_NODISCARD
2905
2950
  static bool parse_class_decl(rbs_parser_t *parser, rbs_position_t comment_pos, rbs_node_list_t *annotations, rbs_node_t **class_decl) {
2906
2951
  rbs_range_t keyword_range = parser->current_token.range;
2907
2952
 
@@ -2946,7 +2991,7 @@ static bool parse_class_decl(rbs_parser_t *parser, rbs_position_t comment_pos, r
2946
2991
  | {<module_decl>}
2947
2992
  | {<class_decl>}
2948
2993
  */
2949
- NODISCARD
2994
+ RBS_NODISCARD
2950
2995
  static bool parse_nested_decl(rbs_parser_t *parser, const char *nested_in, rbs_position_t annot_pos, rbs_node_list_t *annotations, rbs_node_t **decl) {
2951
2996
  rbs_parser_push_typevar_table(parser, true);
2952
2997
 
@@ -2998,7 +3043,7 @@ static bool parse_nested_decl(rbs_parser_t *parser, const char *nested_in, rbs_p
2998
3043
  return true;
2999
3044
  }
3000
3045
 
3001
- NODISCARD
3046
+ RBS_NODISCARD
3002
3047
  static bool parse_decl(rbs_parser_t *parser, rbs_node_t **decl) {
3003
3048
  rbs_node_list_t *annotations = rbs_node_list_new(ALLOCATOR());
3004
3049
  rbs_position_t annot_pos = NullPosition;
@@ -3054,7 +3099,7 @@ static bool parse_decl(rbs_parser_t *parser, rbs_node_t **decl) {
3054
3099
  namespace ::= {} (`::`)? (`tUIDENT` `::`)* `tUIDENT` <`::`>
3055
3100
  | {} <> (empty -- returns empty namespace)
3056
3101
  */
3057
- NODISCARD
3102
+ RBS_NODISCARD
3058
3103
  static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace_t **out_ns) {
3059
3104
  bool is_absolute = false;
3060
3105
 
@@ -3097,7 +3142,7 @@ static bool parse_namespace(rbs_parser_t *parser, rbs_range_t *rg, rbs_namespace
3097
3142
  | {} namespace tUIDENT `as` <tUIDENT>
3098
3143
  | {} namespace <tSTAR>
3099
3144
  */
3100
- NODISCARD
3145
+ RBS_NODISCARD
3101
3146
  static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
3102
3147
  while (true) {
3103
3148
  rbs_range_t namespace_range = NULL_RANGE;
@@ -3178,7 +3223,7 @@ static bool parse_use_clauses(rbs_parser_t *parser, rbs_node_list_t *clauses) {
3178
3223
  /*
3179
3224
  use_directive ::= {} `use` <clauses>
3180
3225
  */
3181
- NODISCARD
3226
+ RBS_NODISCARD
3182
3227
  static bool parse_use_directive(rbs_parser_t *parser, rbs_ast_directives_use_t **use_directive) {
3183
3228
  if (parser->next_token.type == kUSE) {
3184
3229
  rbs_parser_advance(parser);
@@ -3396,7 +3441,7 @@ void rbs_parser_push_typevar_table(rbs_parser_t *parser, bool reset) {
3396
3441
  parser->vars = table;
3397
3442
  }
3398
3443
 
3399
- NODISCARD
3444
+ RBS_NODISCARD
3400
3445
  bool rbs_parser_insert_typevar(rbs_parser_t *parser, rbs_constant_id_t id) {
3401
3446
  id_table *table = parser->vars;
3402
3447
 
@@ -3511,21 +3556,36 @@ rbs_lexer_t *rbs_lexer_new(rbs_allocator_t *allocator, rbs_string_t string, cons
3511
3556
  lexer->current_character_bytes = 1;
3512
3557
  }
3513
3558
 
3514
- if (start_pos > 0) {
3515
- while (lexer->current.byte_pos < start_pos) {
3516
- rbs_skip(lexer);
3517
- }
3559
+ // `rbs_skip` moves a whole character at a time, and moves nothing at all
3560
+ // once the input is spent, so this walk can only ever stand on the first
3561
+ // byte of a character.
3562
+ while (lexer->current.byte_pos < start_pos && lexer->current_code_point != '\0') {
3563
+ rbs_skip(lexer);
3518
3564
  }
3519
3565
 
3566
+ // Stopping anywhere else means `start_pos` is a position the lexer cannot
3567
+ // start from: over it, and the walk stepped across a character that
3568
+ // straddles it; short of it, and the input ran out first.
3569
+ if (lexer->current.byte_pos != start_pos) return NULL;
3570
+
3520
3571
  lexer->start = lexer->current;
3521
3572
 
3522
3573
  return lexer;
3523
3574
  }
3524
3575
 
3525
3576
  rbs_parser_t *rbs_parser_new(rbs_string_t string, const rbs_encoding_t *encoding, int start_pos, int end_pos) {
3577
+ return rbs_parser_new_with_options(string, encoding, start_pos, end_pos, (rbs_parser_options_t) { 0 });
3578
+ }
3579
+
3580
+ rbs_parser_t *rbs_parser_new_with_options(rbs_string_t string, const rbs_encoding_t *encoding, int start_pos, int end_pos, rbs_parser_options_t options) {
3526
3581
  rbs_allocator_t *allocator = rbs_allocator_init();
3527
3582
 
3528
3583
  rbs_lexer_t *lexer = rbs_lexer_new(allocator, string, encoding, start_pos, end_pos);
3584
+ if (lexer == NULL) {
3585
+ rbs_allocator_free(allocator);
3586
+ return NULL;
3587
+ }
3588
+
3529
3589
  rbs_parser_t *parser = rbs_allocator_alloc(allocator, rbs_parser_t);
3530
3590
 
3531
3591
  *parser = (rbs_parser_t) {
@@ -3542,6 +3602,8 @@ rbs_parser_t *rbs_parser_new(rbs_string_t string, const rbs_encoding_t *encoding
3542
3602
  .constant_pool = { 0 },
3543
3603
  .allocator = allocator,
3544
3604
  .error = NULL,
3605
+
3606
+ .options = options,
3545
3607
  };
3546
3608
 
3547
3609
  // The parser's constant pool is mainly used for storing the names of type variables, which usually aren't many.
@@ -3602,7 +3664,7 @@ void rbs_parser_set_error(rbs_parser_t *parser, rbs_token_t tok, bool syntax_err
3602
3664
  /*
3603
3665
  parse_method_overload ::= {} annotations <method_type>
3604
3666
  */
3605
- NODISCARD
3667
+ RBS_NODISCARD
3606
3668
  static bool parse_method_overload(rbs_parser_t *parser, rbs_node_list_t *annotations, rbs_method_type_t **method_type) {
3607
3669
  rbs_position_t pos = NullPosition;
3608
3670
 
@@ -3619,7 +3681,7 @@ static bool parse_method_overload(rbs_parser_t *parser, rbs_node_list_t *annotat
3619
3681
  | {} overload `|` ... `|` `...` -- returns true (dot3_location is set)
3620
3682
  | {<>} -- returns false
3621
3683
  */
3622
- NODISCARD
3684
+ RBS_NODISCARD
3623
3685
  static bool parse_inline_method_overloads(rbs_parser_t *parser, rbs_node_list_t *overloads, rbs_location_range_list_t *bar_locations, rbs_location_range *dot3_location) {
3624
3686
  while (true) {
3625
3687
  rbs_node_list_t *annotations = rbs_node_list_new(ALLOCATOR());
@@ -3658,7 +3720,7 @@ static bool parse_inline_method_overloads(rbs_parser_t *parser, rbs_node_list_t
3658
3720
  }
3659
3721
  }
3660
3722
 
3661
- NODISCARD
3723
+ RBS_NODISCARD
3662
3724
  static bool parse_inline_comment(rbs_parser_t *parser, rbs_location_range *comment_range) {
3663
3725
  if (parser->next_token.type != tINLINECOMMENT) {
3664
3726
  *comment_range = RBS_LOCATION_NULL_RANGE;
@@ -3671,7 +3733,7 @@ static bool parse_inline_comment(rbs_parser_t *parser, rbs_location_range *comme
3671
3733
  return true;
3672
3734
  }
3673
3735
 
3674
- NODISCARD
3736
+ RBS_NODISCARD
3675
3737
  static bool parse_inline_param_type_annotation(rbs_parser_t *parser, rbs_ast_ruby_annotations_t **annotation, rbs_range_t rbs_range) {
3676
3738
  rbs_parser_advance(parser);
3677
3739
 
@@ -3711,7 +3773,7 @@ static bool parse_inline_param_type_annotation(rbs_parser_t *parser, rbs_ast_rub
3711
3773
  return true;
3712
3774
  }
3713
3775
 
3714
- NODISCARD
3776
+ RBS_NODISCARD
3715
3777
  static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_annotations_t **annotation) {
3716
3778
  switch (parser->next_token.type) {
3717
3779
  case pCOLON: {
@@ -3912,6 +3974,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a
3912
3974
  return true;
3913
3975
  }
3914
3976
  case tLIDENT:
3977
+ case tNONASCIIIDENT:
3915
3978
  PARAM_NAME_CASES {
3916
3979
  return parse_inline_param_type_annotation(parser, annotation, rbs_range);
3917
3980
  }
@@ -3920,7 +3983,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a
3920
3983
  rbs_location_range star_loc = rbs_location_range_current_token(parser);
3921
3984
 
3922
3985
  rbs_location_range name_loc = RBS_LOCATION_NULL_RANGE;
3923
- if (parser->next_token.type == tLIDENT) {
3986
+ if (is_param_name_token(parser->next_token.type)) {
3924
3987
  rbs_parser_advance(parser);
3925
3988
  name_loc = rbs_location_range_current_token(parser);
3926
3989
  }
@@ -3960,7 +4023,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a
3960
4023
  rbs_location_range star2_loc = rbs_location_range_current_token(parser);
3961
4024
 
3962
4025
  rbs_location_range name_loc = RBS_LOCATION_NULL_RANGE;
3963
- if (parser->next_token.type == tLIDENT) {
4026
+ if (is_param_name_token(parser->next_token.type)) {
3964
4027
  rbs_parser_advance(parser);
3965
4028
  name_loc = rbs_location_range_current_token(parser);
3966
4029
  }
@@ -4000,7 +4063,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a
4000
4063
  rbs_location_range ampersand_loc = rbs_location_range_current_token(parser);
4001
4064
 
4002
4065
  rbs_location_range name_loc = RBS_LOCATION_NULL_RANGE;
4003
- if (parser->next_token.type == tLIDENT) {
4066
+ if (is_param_name_token(parser->next_token.type)) {
4004
4067
  rbs_parser_advance(parser);
4005
4068
  name_loc = rbs_location_range_current_token(parser);
4006
4069
  }
@@ -4018,7 +4081,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a
4018
4081
  type_range.start = parser->next_token.range.start;
4019
4082
 
4020
4083
  parse_function_result *result = rbs_allocator_alloc(ALLOCATOR(), parse_function_result);
4021
- if (!parse_function(parser, true, false, &result, true, true)) {
4084
+ if (!parse_function(parser, true, false, false, &result, true, true)) {
4022
4085
  return false;
4023
4086
  }
4024
4087
 
@@ -4115,7 +4178,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a
4115
4178
  }
4116
4179
  }
4117
4180
 
4118
- NODISCARD
4181
+ RBS_NODISCARD
4119
4182
  static bool parse_inline_trailing_annotation(rbs_parser_t *parser, rbs_ast_ruby_annotations_t **annotation) {
4120
4183
  rbs_range_t prefix_range = parser->next_token.range;
4121
4184