rbs 1.7.0.beta.1 → 1.7.0.beta.5

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +20 -1
  3. data/.gitignore +9 -1
  4. data/CHANGELOG.md +20 -9
  5. data/Rakefile +16 -1
  6. data/core/binding.rbs +2 -0
  7. data/core/complex.rbs +0 -2
  8. data/core/float.rbs +0 -2
  9. data/core/integer.rbs +0 -2
  10. data/core/numeric.rbs +7 -0
  11. data/core/object.rbs +1 -1
  12. data/core/proc.rbs +2 -0
  13. data/core/rational.rbs +0 -2
  14. data/core/unbound_method.rbs +13 -0
  15. data/docs/rbs_by_example.md +2 -2
  16. data/docs/syntax.md +2 -3
  17. data/ext/{rbs/extension → rbs_extension}/constants.c +0 -1
  18. data/ext/{rbs/extension → rbs_extension}/constants.h +0 -0
  19. data/ext/{rbs/extension → rbs_extension}/extconf.rb +1 -1
  20. data/ext/rbs_extension/lexer.c +2533 -0
  21. data/ext/{rbs/extension → rbs_extension}/lexer.h +33 -17
  22. data/ext/rbs_extension/lexer.re +140 -0
  23. data/ext/rbs_extension/lexstate.c +139 -0
  24. data/ext/{rbs/extension → rbs_extension}/location.c +0 -0
  25. data/ext/{rbs/extension → rbs_extension}/location.h +0 -0
  26. data/ext/{rbs/extension → rbs_extension}/main.c +1 -1
  27. data/ext/{rbs/extension → rbs_extension}/parser.c +6 -32
  28. data/ext/{rbs/extension → rbs_extension}/parser.h +0 -5
  29. data/ext/{rbs/extension → rbs_extension}/parserstate.c +0 -1
  30. data/ext/{rbs/extension → rbs_extension}/parserstate.h +0 -0
  31. data/ext/{rbs/extension → rbs_extension}/rbs_extension.h +1 -1
  32. data/ext/{rbs/extension → rbs_extension}/ruby_objs.c +84 -148
  33. data/ext/{rbs/extension → rbs_extension}/ruby_objs.h +0 -2
  34. data/ext/{rbs/extension → rbs_extension}/unescape.c +0 -0
  35. data/lib/rbs/collection/installer.rb +1 -0
  36. data/lib/rbs/collection/sources/git.rb +6 -1
  37. data/lib/rbs/errors.rb +14 -0
  38. data/lib/rbs/location_aux.rb +13 -0
  39. data/lib/rbs/parser_aux.rb +39 -0
  40. data/lib/rbs/parser_compat/lexer_error.rb +4 -0
  41. data/lib/rbs/parser_compat/located_value.rb +5 -0
  42. data/lib/rbs/parser_compat/semantics_error.rb +4 -0
  43. data/lib/rbs/parser_compat/syntax_error.rb +4 -0
  44. data/lib/rbs/prototype/helpers.rb +113 -0
  45. data/lib/rbs/prototype/rb.rb +2 -105
  46. data/lib/rbs/prototype/runtime.rb +16 -0
  47. data/lib/rbs/types.rb +2 -2
  48. data/lib/rbs/version.rb +1 -1
  49. data/lib/rbs.rb +13 -1
  50. data/rbs.gemspec +1 -1
  51. data/sig/errors.rbs +10 -0
  52. data/sig/location.rbs +5 -0
  53. data/sig/parser.rbs +5 -0
  54. data/sig/rbs.rbs +4 -0
  55. data/stdlib/io-console/0/io-console.rbs +137 -0
  56. data/stdlib/net-http/0/net-http.rbs +2 -1
  57. data/stdlib/tempfile/0/tempfile.rbs +4 -6
  58. metadata +27 -19
  59. data/ext/rbs/extension/lexer.c +0 -1070
@@ -0,0 +1,113 @@
1
+ module RBS
2
+ module Prototype
3
+ module Helpers
4
+ private
5
+
6
+ def block_from_body(node)
7
+ _, args_node, body_node = node.children
8
+
9
+ _pre_num, _pre_init, _opt, _first_post, _post_num, _post_init, _rest, _kw, _kwrest, block = args_from_node(args_node)
10
+
11
+ method_block = nil
12
+
13
+ if block
14
+ method_block = Types::Block.new(
15
+ # HACK: The `block` is :& on `def m(...)` syntax.
16
+ # In this case the block looks optional in most cases, so it marks optional.
17
+ # In other cases, we can't determine which is required or optional, so it marks required.
18
+ required: block != :&,
19
+ type: Types::Function.empty(untyped)
20
+ )
21
+ end
22
+
23
+ if body_node
24
+ if (yields = any_node?(body_node) {|n| n.type == :YIELD })
25
+ method_block = Types::Block.new(
26
+ required: true,
27
+ type: Types::Function.empty(untyped)
28
+ )
29
+
30
+ yields.each do |yield_node|
31
+ array_content = yield_node.children[0]&.children&.compact || []
32
+
33
+ positionals, keywords = if keyword_hash?(array_content.last)
34
+ [array_content.take(array_content.size - 1), array_content.last]
35
+ else
36
+ [array_content, nil]
37
+ end
38
+
39
+ if (diff = positionals.size - method_block.type.required_positionals.size) > 0
40
+ diff.times do
41
+ method_block.type.required_positionals << Types::Function::Param.new(
42
+ type: untyped,
43
+ name: nil
44
+ )
45
+ end
46
+ end
47
+
48
+ if keywords
49
+ keywords.children[0].children.each_slice(2) do |key_node, value_node|
50
+ if key_node
51
+ key = key_node.children[0]
52
+ method_block.type.required_keywords[key] ||=
53
+ Types::Function::Param.new(
54
+ type: untyped,
55
+ name: nil
56
+ )
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ method_block
65
+ end
66
+
67
+ def each_child(node, &block)
68
+ each_node node.children, &block
69
+ end
70
+
71
+ def each_node(nodes)
72
+ nodes.each do |child|
73
+ if child.is_a?(RubyVM::AbstractSyntaxTree::Node)
74
+ yield child
75
+ end
76
+ end
77
+ end
78
+
79
+
80
+ def any_node?(node, nodes: [], &block)
81
+ if yield(node)
82
+ nodes << node
83
+ end
84
+
85
+ each_child node do |child|
86
+ any_node? child, nodes: nodes, &block
87
+ end
88
+
89
+ nodes.empty? ? nil : nodes
90
+ end
91
+
92
+ def keyword_hash?(node)
93
+ if node
94
+ if node.type == :HASH
95
+ node.children[0].children.compact.each_slice(2).all? {|key, _|
96
+ key.type == :LIT && key.children[0].is_a?(Symbol)
97
+ }
98
+ end
99
+ end
100
+ end
101
+
102
+ # NOTE: args_node may be a nil by a bug
103
+ # https://bugs.ruby-lang.org/issues/17495
104
+ def args_from_node(args_node)
105
+ args_node&.children || [0, nil, nil, nil, 0, nil, nil, nil, nil, nil]
106
+ end
107
+
108
+ def untyped
109
+ @untyped ||= Types::Bases::Any.new(location: nil)
110
+ end
111
+ end
112
+ end
113
+ end
@@ -1,6 +1,8 @@
1
1
  module RBS
2
2
  module Prototype
3
3
  class RB
4
+ include Helpers
5
+
4
6
  Context = Struct.new(:module_function, :singleton, :namespace, keyword_init: true) do
5
7
  def self.initial(namespace: Namespace.root)
6
8
  self.new(module_function: false, singleton: false, namespace: namespace)
@@ -372,18 +374,6 @@ module RBS
372
374
  end
373
375
  end
374
376
 
375
- def each_node(nodes)
376
- nodes.each do |child|
377
- if child.is_a?(RubyVM::AbstractSyntaxTree::Node)
378
- yield child
379
- end
380
- end
381
- end
382
-
383
- def each_child(node, &block)
384
- each_node node.children, &block
385
- end
386
-
387
377
  def function_type_from_body(node, def_name)
388
378
  table_node, args_node, *_ = node.children
389
379
 
@@ -568,95 +558,6 @@ module RBS
568
558
  end
569
559
  end
570
560
 
571
- def block_from_body(node)
572
- _, args_node, body_node = node.children
573
-
574
- _pre_num, _pre_init, _opt, _first_post, _post_num, _post_init, _rest, _kw, _kwrest, block = args_from_node(args_node)
575
-
576
- method_block = nil
577
-
578
- if block
579
- method_block = Types::Block.new(
580
- # HACK: The `block` is :& on `def m(...)` syntax.
581
- # In this case the block looks optional in most cases, so it marks optional.
582
- # In other cases, we can't determine which is required or optional, so it marks required.
583
- required: block != :&,
584
- type: Types::Function.empty(untyped)
585
- )
586
- end
587
-
588
- if body_node
589
- if (yields = any_node?(body_node) {|n| n.type == :YIELD })
590
- method_block = Types::Block.new(
591
- required: true,
592
- type: Types::Function.empty(untyped)
593
- )
594
-
595
- yields.each do |yield_node|
596
- array_content = yield_node.children[0]&.children&.compact || []
597
-
598
- positionals, keywords = if keyword_hash?(array_content.last)
599
- [array_content.take(array_content.size - 1), array_content.last]
600
- else
601
- [array_content, nil]
602
- end
603
-
604
- if (diff = positionals.size - method_block.type.required_positionals.size) > 0
605
- diff.times do
606
- method_block.type.required_positionals << Types::Function::Param.new(
607
- type: untyped,
608
- name: nil
609
- )
610
- end
611
- end
612
-
613
- if keywords
614
- keywords.children[0].children.each_slice(2) do |key_node, value_node|
615
- if key_node
616
- key = key_node.children[0]
617
- method_block.type.required_keywords[key] ||=
618
- Types::Function::Param.new(
619
- type: untyped,
620
- name: nil
621
- )
622
- end
623
- end
624
- end
625
- end
626
- end
627
- end
628
-
629
- method_block
630
- end
631
-
632
- # NOTE: args_node may be a nil by a bug
633
- # https://bugs.ruby-lang.org/issues/17495
634
- def args_from_node(args_node)
635
- args_node&.children || [0, nil, nil, nil, 0, nil, nil, nil, nil, nil]
636
- end
637
-
638
- def keyword_hash?(node)
639
- if node
640
- if node.type == :HASH
641
- node.children[0].children.compact.each_slice(2).all? {|key, _|
642
- key.type == :LIT && key.children[0].is_a?(Symbol)
643
- }
644
- end
645
- end
646
- end
647
-
648
- def any_node?(node, nodes: [], &block)
649
- if yield(node)
650
- nodes << node
651
- end
652
-
653
- each_child node do |child|
654
- any_node? child, nodes: nodes, &block
655
- end
656
-
657
- nodes.empty? ? nil : nodes
658
- end
659
-
660
561
  def node_type(node, default: Types::Bases::Any.new(location: nil))
661
562
  case node.type
662
563
  when :LIT
@@ -689,10 +590,6 @@ module RBS
689
590
  end
690
591
  end
691
592
 
692
- def untyped
693
- @untyped ||= Types::Bases::Any.new(location: nil)
694
- end
695
-
696
593
  def private
697
594
  @private ||= AST::Members::Private.new(location: nil)
698
595
  end
@@ -1,6 +1,8 @@
1
1
  module RBS
2
2
  module Prototype
3
3
  class Runtime
4
+ include Helpers
5
+
4
6
  attr_reader :patterns
5
7
  attr_reader :env
6
8
  attr_reader :merge
@@ -138,6 +140,8 @@ module RBS
138
140
  end
139
141
  end
140
142
 
143
+ block ||= block_from_ast_of(method)
144
+
141
145
  return_type = if method.name == :initialize
142
146
  Types::Bases::Void.new(location: nil)
143
147
  else
@@ -522,6 +526,18 @@ module RBS
522
526
  []
523
527
  end
524
528
  end
529
+
530
+ def block_from_ast_of(method)
531
+ return nil if RUBY_VERSION < '3.1'
532
+
533
+ begin
534
+ ast = RubyVM::AbstractSyntaxTree.of(method)
535
+ rescue ArgumentError
536
+ return # When the method is defined in eval
537
+ end
538
+
539
+ block_from_body(ast) if ast&.type == :SCOPE
540
+ end
525
541
  end
526
542
  end
527
543
  end
data/lib/rbs/types.rb CHANGED
@@ -433,7 +433,7 @@ module RBS
433
433
  return "{ }" if self.fields.empty?
434
434
 
435
435
  fields = self.fields.map do |key, type|
436
- if key.is_a?(Symbol) && key.match?(/\A[A-Za-z_][A-Za-z_]*\z/) && !Parser::KEYWORDS.key?(key)
436
+ if key.is_a?(Symbol) && key.match?(/\A[A-Za-z_][A-Za-z_]*\z/) && !Parser::KEYWORDS.include?(key)
437
437
  "#{key}: #{type}"
438
438
  else
439
439
  "#{key.inspect} => #{type}"
@@ -690,7 +690,7 @@ module RBS
690
690
 
691
691
  def to_s
692
692
  if name
693
- if Parser::KEYWORDS.key?(name)
693
+ if Parser::KEYWORDS.include?(name)
694
694
  "#{type} `#{name}`"
695
695
  else
696
696
  "#{type} #{name}"
data/lib/rbs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RBS
2
- VERSION = "1.7.0.beta.1"
2
+ VERSION = "1.7.0.beta.5"
3
3
  end
data/lib/rbs.rb CHANGED
@@ -32,6 +32,7 @@ require "rbs/constant"
32
32
  require "rbs/constant_table"
33
33
  require "rbs/ast/comment"
34
34
  require "rbs/writer"
35
+ require "rbs/prototype/helpers"
35
36
  require "rbs/prototype/rbi"
36
37
  require "rbs/prototype/rb"
37
38
  require "rbs/prototype/runtime"
@@ -46,7 +47,7 @@ require "rbs/locator"
46
47
  require "rbs/type_alias_dependency"
47
48
  require "rbs/collection"
48
49
 
49
- require "rbs/extension"
50
+ require "rbs_extension"
50
51
  require "rbs/parser_aux"
51
52
  require "rbs/location_aux"
52
53
 
@@ -68,5 +69,16 @@ module RBS
68
69
  @logger_level = level
69
70
  @logger = nil
70
71
  end
72
+
73
+ def print_warning()
74
+ @warnings ||= Set[]
75
+
76
+ message = yield()
77
+
78
+ unless @warnings.include?(message)
79
+ @warnings << message
80
+ logger.warn { message }
81
+ end
82
+ end
71
83
  end
72
84
  end
data/rbs.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
31
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
32
32
  end
33
- spec.extensions = %w{ext/rbs/extension/extconf.rb}
33
+ spec.extensions = %w{ext/rbs_extension/extconf.rb}
34
34
 
35
35
  spec.bindir = "exe"
36
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
data/sig/errors.rbs CHANGED
@@ -24,6 +24,16 @@ module RBS
24
24
  attr_reader token_type: String
25
25
 
26
26
  def initialize: (Location[untyped, untyped], String error_message, String token_type) -> void
27
+
28
+ def error_value: () -> String
29
+
30
+ def token_str: () -> String
31
+ end
32
+
33
+ class Parser
34
+ SemanticsError: singleton(ParsingError)
35
+ SyntaxError: singleton(ParsingError)
36
+ LexerError: singleton(ParsingError)
27
37
  end
28
38
 
29
39
  # Error class for errors raised during loading environments.
data/sig/location.rbs CHANGED
@@ -20,6 +20,9 @@ module RBS
20
20
 
21
21
  def initialize: (Buffer, Integer start_pos, Integer end_pos) -> void
22
22
 
23
+ def self.new: (Buffer, Integer start_pos, Integer end_pos) -> instance
24
+ | (buffer: Buffer, start_pos: Integer, end_pos: Integer) -> instance
25
+
23
26
  def inspect: () -> String
24
27
 
25
28
  # Returns the name of the buffer.
@@ -92,5 +95,7 @@ module RBS
92
95
  def _add_optional_no_child: (OptionalChildKeys name) -> void
93
96
  def _optional_keys: () -> Array[Symbol]
94
97
  def _required_keys: () -> Array[Symbol]
98
+
99
+ WithChildren: singleton(Location)
95
100
  end
96
101
  end
data/sig/parser.rbs CHANGED
@@ -6,6 +6,8 @@ module RBS
6
6
 
7
7
  def self.parse_signature: (Buffer | String, ?line: Integer, ?column: Integer) -> Array[AST::Declarations::t]
8
8
 
9
+ KEYWORDS: Hash[String, bot]
10
+
9
11
  private
10
12
 
11
13
  def self.buffer: (String | Buffer source) -> Buffer
@@ -18,5 +20,8 @@ module RBS
18
20
 
19
21
  %a{no-defn}
20
22
  def self._parse_signature: (Buffer, Integer line, Integer column) -> Array[AST::Declarations::t]
23
+
24
+ class LocatedValue
25
+ end
21
26
  end
22
27
  end
data/sig/rbs.rbs CHANGED
@@ -8,6 +8,10 @@ module RBS
8
8
  def self.logger_output: () -> IO
9
9
 
10
10
  def self.logger_output=: (IO) -> IO
11
+
12
+ def self.print_warning: () { () -> String } -> void
13
+
14
+ self.@warnings: Set[String]
11
15
  end
12
16
 
13
17
  module Ruby
@@ -0,0 +1,137 @@
1
+ class IO
2
+ class ConsoleMode
3
+ def echo=: (bool) -> bool
4
+ def raw: (?min: int, ?time: int, ?intr: bool) -> self
5
+ def raw!: (?min: int, ?time: int, ?intr: bool) -> self
6
+ end
7
+
8
+ # Returns an File instance opened console.
9
+ #
10
+ # If `sym` is given, it will be sent to the opened console with `args` and the
11
+ # result will be returned instead of the console IO itself.
12
+ def self.console: () -> File?
13
+ | (:close) -> nil
14
+ | (Symbol sym, *untyped args) -> untyped
15
+
16
+ # returns console window size
17
+ #
18
+ # You must require 'io/console/size' to use this method.
19
+ def self.console_size: () -> [Integer, Integer]
20
+
21
+ # fallback to console window size
22
+ #
23
+ # You must require 'io/console/size' to use this method.
24
+ def self.default_console_size: -> [Integer, Integer]
25
+
26
+ def beep: () -> self
27
+
28
+ def check_winsize_changed: () { () -> void } -> self
29
+ def clear_screen: () -> self
30
+
31
+ # Returns a data represents the current console mode.
32
+ def console_mode: () -> IO::ConsoleMode
33
+
34
+ # Sets the console mode to `mode`.
35
+ def console_mode=: (IO::ConsoleMode mode) -> IO::ConsoleMode
36
+
37
+ # Yields `self` within cooked mode.
38
+ #
39
+ # STDIN.cooked(&:gets)
40
+ #
41
+ # will read and return a line with echo back and line editing.
42
+ def cooked: [T] () { (self) -> T } -> T
43
+
44
+ # Enables cooked mode.
45
+ #
46
+ # If the terminal mode needs to be back, use io.cooked { ... }.
47
+ def cooked!: () -> self
48
+
49
+ def cursor: () -> [Integer, Integer]
50
+ def cursor=: ([Integer, Integer]) -> [Integer, Integer]
51
+
52
+ def cursor_down: (int) -> self
53
+ def cursor_left: (int) -> self
54
+ def cursor_right: (int) -> self
55
+ def cursor_up: (int) -> self
56
+
57
+ # Enables/disables echo back. On some platforms, all combinations of this flags
58
+ # and raw/cooked mode may not be valid.
59
+ def echo=: (bool flag) -> bool
60
+
61
+ # Returns `true` if echo back is enabled.
62
+ def echo?: () -> bool
63
+
64
+ def erase_line: (0 | 1 | 2 | nil) -> self
65
+ def erase_screen: (0 | 1 | 2 | 3 | nil) -> self
66
+
67
+ # Reads and returns a character in raw mode.
68
+ #
69
+ # See IO#raw for details on the parameters.
70
+ def getch: (?min: int, ?time: int, ?intr: bool) -> String
71
+
72
+ # Reads and returns a line without echo back.
73
+ # Prints +prompt+ unless it is +nil+.
74
+ #
75
+ # The newline character that terminates the
76
+ # read line is removed from the returned string,
77
+ # see String#chomp!.
78
+ def getpass: (?String) -> String
79
+
80
+ def goto: (int, int) -> self
81
+
82
+ def goto_column: (int) -> self
83
+
84
+ # Flushes input buffer in kernel.
85
+ def iflush: () -> self
86
+
87
+ # Flushes input and output buffers in kernel.
88
+ def ioflush: () -> self
89
+
90
+ # Yields `self` with disabling echo back.
91
+ #
92
+ # STDIN.noecho(&:gets)
93
+ #
94
+ # will read and return a line without echo back.
95
+ def noecho: [T] () { (self) -> T } -> T
96
+
97
+ # Flushes output buffer in kernel.
98
+ def oflush: () -> self
99
+
100
+ def pressed?: (Integer | Symbol | String) -> bool
101
+
102
+ # Yields `self` within raw mode, and returns the result of the block.
103
+ #
104
+ # STDIN.raw(&:gets)
105
+ #
106
+ # will read and return a line without echo back and line editing.
107
+ #
108
+ # The parameter `min` specifies the minimum number of bytes that should be
109
+ # received when a read operation is performed. (default: 1)
110
+ #
111
+ # The parameter `time` specifies the timeout in *seconds* with a precision of
112
+ # 1/10 of a second. (default: 0)
113
+ #
114
+ # If the parameter `intr` is `true`, enables break, interrupt, quit, and suspend
115
+ # special characters.
116
+ #
117
+ # Refer to the manual page of termios for further details.
118
+ def raw: [T] (?min: int, ?time: int, ?intr: bool) { (self) -> T } -> T
119
+
120
+ # Enables raw mode, and returns `io`.
121
+ #
122
+ # If the terminal mode needs to be back, use `io.raw { ... }`.
123
+ #
124
+ # See IO#raw for details on the parameters.
125
+ def raw!: (?min: int, ?time: int, ?intr: bool) -> self
126
+
127
+ def scroll_backward: (int) -> self
128
+ def scroll_forward: (int) -> self
129
+
130
+ # Returns console size.
131
+ def winsize: () -> [Integer, Integer]
132
+
133
+ # Tries to set console size. The effect depends on the platform and the running
134
+ # environment.
135
+ def winsize=: ([Integer, Integer]) -> [Integer, Integer]
136
+ | ([Integer, Integer, Integer, Integer]) -> [Integer, Integer, Integer, Integer]
137
+ end
@@ -1204,6 +1204,7 @@ module Net
1204
1204
 
1205
1205
  class HTTPRequest < HTTPGenericRequest
1206
1206
  def initialize: (String path, ?Hash[String, untyped] initheader) -> void
1207
+ | (URI::Generic uri, ?Hash[String, untyped] initheader) -> void
1207
1208
  end
1208
1209
 
1209
1210
  class HTTP::Get < HTTPRequest
@@ -1843,4 +1844,4 @@ module Net
1843
1844
  class HTTPFatalError < ProtoFatalError
1844
1845
  include Net::HTTPExceptions
1845
1846
  end
1846
- end
1847
+ end
@@ -95,8 +95,8 @@ class Tempfile < File
95
95
  # # ... do something with f ...
96
96
  # end
97
97
  #
98
- def self.create: (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) -> File
99
- | [A] (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) { (File) -> A } -> A
98
+ def self.create: (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) -> File
99
+ | [A] (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) { (File) -> A } -> A
100
100
 
101
101
  # Creates a new Tempfile.
102
102
  #
@@ -220,8 +220,6 @@ class Tempfile < File
220
220
  def initialize: (::Tempfile tmpfile) -> void
221
221
  end
222
222
 
223
- private
224
-
225
223
  # Creates a temporary file with permissions 0600 (= only readable and writable
226
224
  # by the owner) and opens it with mode "w+".
227
225
  #
@@ -265,6 +263,6 @@ class Tempfile < File
265
263
  # If Tempfile.new cannot find a unique filename within a limited number of
266
264
  # tries, then it will raise an exception.
267
265
  #
268
- def self.new: (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) -> instance
269
- | [A] (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) { (instance) -> A } -> A
266
+ def self.new: (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) -> instance
267
+ | [A] (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) { (instance) -> A } -> A
270
268
  end
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.7.0.beta.1
4
+ version: 1.7.0.beta.5
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-09-13 00:00:00.000000000 Z
11
+ date: 2021-11-07 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.
@@ -17,7 +17,7 @@ email:
17
17
  executables:
18
18
  - rbs
19
19
  extensions:
20
- - ext/rbs/extension/extconf.rb
20
+ - ext/rbs_extension/extconf.rb
21
21
  extra_rdoc_files: []
22
22
  files:
23
23
  - ".github/dependabot.yml"
@@ -98,22 +98,24 @@ files:
98
98
  - docs/stdlib.md
99
99
  - docs/syntax.md
100
100
  - exe/rbs
101
- - ext/rbs/extension/constants.c
102
- - ext/rbs/extension/constants.h
103
- - ext/rbs/extension/extconf.rb
104
- - ext/rbs/extension/lexer.c
105
- - ext/rbs/extension/lexer.h
106
- - ext/rbs/extension/location.c
107
- - ext/rbs/extension/location.h
108
- - ext/rbs/extension/main.c
109
- - ext/rbs/extension/parser.c
110
- - ext/rbs/extension/parser.h
111
- - ext/rbs/extension/parserstate.c
112
- - ext/rbs/extension/parserstate.h
113
- - ext/rbs/extension/rbs_extension.h
114
- - ext/rbs/extension/ruby_objs.c
115
- - ext/rbs/extension/ruby_objs.h
116
- - ext/rbs/extension/unescape.c
101
+ - ext/rbs_extension/constants.c
102
+ - ext/rbs_extension/constants.h
103
+ - ext/rbs_extension/extconf.rb
104
+ - ext/rbs_extension/lexer.c
105
+ - ext/rbs_extension/lexer.h
106
+ - ext/rbs_extension/lexer.re
107
+ - ext/rbs_extension/lexstate.c
108
+ - ext/rbs_extension/location.c
109
+ - ext/rbs_extension/location.h
110
+ - ext/rbs_extension/main.c
111
+ - ext/rbs_extension/parser.c
112
+ - ext/rbs_extension/parser.h
113
+ - ext/rbs_extension/parserstate.c
114
+ - ext/rbs_extension/parserstate.h
115
+ - ext/rbs_extension/rbs_extension.h
116
+ - ext/rbs_extension/ruby_objs.c
117
+ - ext/rbs_extension/ruby_objs.h
118
+ - ext/rbs_extension/unescape.c
117
119
  - goodcheck.yml
118
120
  - lib/rbs.rb
119
121
  - lib/rbs/ancestor_graph.rb
@@ -152,6 +154,11 @@ files:
152
154
  - lib/rbs/namespace.rb
153
155
  - lib/rbs/parser.y
154
156
  - lib/rbs/parser_aux.rb
157
+ - lib/rbs/parser_compat/lexer_error.rb
158
+ - lib/rbs/parser_compat/located_value.rb
159
+ - lib/rbs/parser_compat/semantics_error.rb
160
+ - lib/rbs/parser_compat/syntax_error.rb
161
+ - lib/rbs/prototype/helpers.rb
155
162
  - lib/rbs/prototype/rb.rb
156
163
  - lib/rbs/prototype/rbi.rb
157
164
  - lib/rbs/prototype/runtime.rb
@@ -245,6 +252,7 @@ files:
245
252
  - stdlib/fileutils/0/fileutils.rbs
246
253
  - stdlib/find/0/find.rbs
247
254
  - stdlib/forwardable/0/forwardable.rbs
255
+ - stdlib/io-console/0/io-console.rbs
248
256
  - stdlib/ipaddr/0/ipaddr.rbs
249
257
  - stdlib/json/0/json.rbs
250
258
  - stdlib/logger/0/formatter.rbs