rbs 3.5.3 → 3.6.0.dev.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependabot.yml +5 -1
  3. data/.github/workflows/ruby.yml +2 -18
  4. data/.github/workflows/windows.yml +26 -0
  5. data/CHANGELOG.md +0 -18
  6. data/core/array.rbs +10 -10
  7. data/core/basic_object.rbs +3 -3
  8. data/core/enumerable.rbs +6 -0
  9. data/core/enumerator.rbs +7 -0
  10. data/core/fiber.rbs +1 -1
  11. data/core/global_variables.rbs +2 -2
  12. data/core/kernel.rbs +67 -38
  13. data/core/method.rbs +98 -7
  14. data/core/module.rbs +2 -2
  15. data/core/proc.rbs +184 -23
  16. data/core/ractor.rbs +1 -1
  17. data/core/range.rbs +30 -0
  18. data/core/refinement.rbs +16 -26
  19. data/core/symbol.rbs +34 -26
  20. data/core/thread.rbs +2 -2
  21. data/core/trace_point.rbs +12 -12
  22. data/core/unbound_method.rbs +1 -1
  23. data/docs/syntax.md +21 -9
  24. data/ext/rbs_extension/parser.c +119 -51
  25. data/ext/rbs_extension/ruby_objs.c +2 -1
  26. data/ext/rbs_extension/ruby_objs.h +1 -1
  27. data/lib/rbs/ast/declarations.rb +36 -0
  28. data/lib/rbs/ast/type_param.rb +71 -15
  29. data/lib/rbs/ast/visitor.rb +137 -0
  30. data/lib/rbs/cli/validate.rb +41 -7
  31. data/lib/rbs/cli.rb +3 -3
  32. data/lib/rbs/definition.rb +2 -1
  33. data/lib/rbs/definition_builder/ancestor_builder.rb +30 -4
  34. data/lib/rbs/definition_builder.rb +21 -6
  35. data/lib/rbs/environment_loader.rb +1 -1
  36. data/lib/rbs/errors.rb +7 -2
  37. data/lib/rbs/file_finder.rb +9 -12
  38. data/lib/rbs/locator.rb +8 -5
  39. data/lib/rbs/prototype/rbi.rb +2 -1
  40. data/lib/rbs/prototype/runtime.rb +3 -2
  41. data/lib/rbs/sorter.rb +9 -6
  42. data/lib/rbs/test/type_check.rb +6 -0
  43. data/lib/rbs/types.rb +11 -0
  44. data/lib/rbs/validator.rb +2 -2
  45. data/lib/rbs/vendorer.rb +3 -3
  46. data/lib/rbs/version.rb +1 -1
  47. data/lib/rbs.rb +1 -0
  48. data/sig/declarations.rbs +6 -0
  49. data/sig/definition.rbs +1 -1
  50. data/sig/definition_builder.rbs +3 -1
  51. data/sig/errors.rbs +3 -2
  52. data/sig/file_finder.rbs +24 -2
  53. data/sig/method_types.rbs +1 -1
  54. data/sig/sorter.rbs +1 -1
  55. data/sig/type_param.rbs +41 -9
  56. data/sig/types.rbs +12 -0
  57. data/sig/visitor.rbs +47 -0
  58. data/stdlib/csv/0/csv.rbs +27 -0
  59. data/stdlib/net-http/0/net-http.rbs +1 -1
  60. data/stdlib/zlib/0/gzip_reader.rbs +5 -1
  61. metadata +5 -2
data/lib/rbs/locator.rb CHANGED
@@ -171,13 +171,16 @@ module RBS
171
171
  if test_loc(pos, location: type_param.location)
172
172
  array.unshift(type_param)
173
173
 
174
- if upper_bound = type_param.upper_bound
175
- find_in_type(pos, type: upper_bound, array: array) or
176
- find_in_loc(pos, location: type_param.location, array: array)
177
- else
178
- find_in_loc(pos, location: type_param.location, array: array)
174
+ if upper_bound = type_param.upper_bound_type
175
+ find_in_type(pos, type: upper_bound, array: array) and return true
179
176
  end
180
177
 
178
+ if default_type = type_param.default_type
179
+ find_in_type(pos, type: default_type, array: array) and return true
180
+ end
181
+
182
+ find_in_loc(pos, location: type_param.location, array: array)
183
+
181
184
  true
182
185
  else
183
186
  false
@@ -236,7 +236,8 @@ module RBS
236
236
  name: node.children[0],
237
237
  variance: variance || :invariant,
238
238
  location: nil,
239
- upper_bound: nil
239
+ upper_bound: nil,
240
+ default_type: nil
240
241
  )
241
242
  end
242
243
  else
@@ -332,8 +332,6 @@ module RBS
332
332
 
333
333
  public_instance_methods = mod.public_instance_methods.select {|name| target_method?(mod, instance: name) }
334
334
  unless public_instance_methods.empty?
335
- members << AST::Members::Public.new(location: nil)
336
-
337
335
  public_instance_methods.sort.each do |name|
338
336
  method = mod.instance_method(name)
339
337
  next if todo_object&.skip_instance_method?(module_name: module_name_absolute, method: method, accessibility: :public)
@@ -656,6 +654,9 @@ module RBS
656
654
  ast = RubyVM::AbstractSyntaxTree.of(method)
657
655
  rescue ArgumentError
658
656
  return # When the method is defined in eval
657
+ rescue RuntimeError => error
658
+ raise unless error.message.include?("prism")
659
+ return # When the method was compiled by prism
659
660
  end
660
661
 
661
662
  if ast && ast.type == :SCOPE
data/lib/rbs/sorter.rb CHANGED
@@ -17,18 +17,18 @@ module RBS
17
17
  buffer = Buffer.new(name: path, content: path.read)
18
18
  _, _, sigs = Parser.parse_signature(buffer)
19
19
 
20
- sigs.each do |m|
21
- sort_decl! m
20
+ sigs = sigs.map do |m|
21
+ sort_decl m
22
22
  end
23
23
 
24
24
  stdout.puts "Writing #{path}..."
25
25
  path.open('w') do |out|
26
26
  writer = RBS::Writer.new(out: out)
27
- writer.write sigs
27
+ writer.write _ = sigs
28
28
  end
29
29
  end
30
30
 
31
- def sort_decl!(decl)
31
+ def sort_decl(decl)
32
32
  case decl
33
33
  when Declarations::Class, Declarations::Module, Declarations::Interface
34
34
  partitioned = {
@@ -52,7 +52,8 @@ module RBS
52
52
  private_instance_methods: [],
53
53
  } #: partitioned
54
54
 
55
- decl.members.each { |m| sort_decl! m }
55
+ members = decl.members.map { |m| sort_decl m }
56
+ decl = decl.update(members: _ = members)
56
57
 
57
58
  visibility_annotated_members = [] #: Array[member]
58
59
 
@@ -188,7 +189,9 @@ module RBS
188
189
 
189
190
  members.push(*partitioned[:other_decls])
190
191
 
191
- decl.members.replace(_ = members)
192
+ decl.update(members: _ = members)
193
+ else
194
+ decl
192
195
  end
193
196
  end
194
197
  end
@@ -59,6 +59,8 @@ module RBS
59
59
  end
60
60
 
61
61
  def method_call(method_name, method_type, call, errors:)
62
+ return errors if method_type.type.is_a?(Types::UntypedFunction)
63
+
62
64
  args(method_name, method_type, method_type.type, call.method_call, errors, type_error: Errors::ArgumentTypeError, argument_error: Errors::ArgumentError)
63
65
  self.return(method_name, method_type, method_type.type, call.method_call, errors, return_error: Errors::ReturnTypeError)
64
66
 
@@ -150,6 +152,8 @@ module RBS
150
152
  end
151
153
 
152
154
  def zip_args(args, fun, &block)
155
+ return true if fun.is_a?(Types::UntypedFunction)
156
+
153
157
  case
154
158
  when args.empty?
155
159
  if fun.required_positionals.empty? && fun.trailing_positionals.empty? && fun.required_keywords.empty?
@@ -355,6 +359,8 @@ module RBS
355
359
  fun = method_type.type
356
360
  take_has_rest = !!parameters.find { |(op, _)| op == :rest }
357
361
 
362
+ return true if fun.is_a?(Types::UntypedFunction)
363
+
358
364
  fun.required_positionals.each do
359
365
  op, _ = parameters.first
360
366
  return false if op.nil? || op == :keyreq || op == :key || op == :keyrest
data/lib/rbs/types.rb CHANGED
@@ -1278,6 +1278,17 @@ module RBS
1278
1278
  def return_to_s
1279
1279
  return_type.to_s(1)
1280
1280
  end
1281
+
1282
+ def ==(other)
1283
+ other.is_a?(UntypedFunction) && other.return_type == return_type
1284
+ end
1285
+
1286
+ alias eql? ==
1287
+
1288
+ def hash
1289
+ self.class.hash ^ return_type.hash
1290
+ end
1291
+
1281
1292
  end
1282
1293
 
1283
1294
  class Block
data/lib/rbs/validator.rb CHANGED
@@ -43,7 +43,7 @@ module RBS
43
43
  InvalidTypeApplicationError.check!(
44
44
  type_name: type.name,
45
45
  args: type.args,
46
- params: type_params.each.map(&:name),
46
+ params: type_params,
47
47
  location: type.location
48
48
  )
49
49
  end
@@ -125,7 +125,7 @@ module RBS
125
125
  # @type var each_child: ^(Symbol) { (Symbol) -> void } -> void
126
126
  each_child = -> (name, &block) do
127
127
  if param = params.find {|p| p.name == name }
128
- if b = param.upper_bound
128
+ if b = param.upper_bound_type
129
129
  b.free_variables.each do |tv|
130
130
  block[tv]
131
131
  end
data/lib/rbs/vendorer.rb CHANGED
@@ -31,7 +31,7 @@ module RBS
31
31
 
32
32
  if core_root = loader.core_root
33
33
  RBS.logger.info "Vendoring core RBSs in #{vendor_dir + "core"}..."
34
- FileFinder.each_file(core_root, immediate: false, skip_hidden: true) do |file_path|
34
+ FileFinder.each_file(core_root, skip_hidden: true) do |file_path|
35
35
  paths << [file_path, Pathname("core") + file_path.relative_path_from(core_root)]
36
36
  end
37
37
  end
@@ -43,7 +43,7 @@ module RBS
43
43
 
44
44
  RBS.logger.info "Vendoring #{lib.name}(#{spec.version}) RBSs in #{vendor_dir + dest_dir}..."
45
45
 
46
- FileFinder.each_file(path, skip_hidden: true, immediate: false) do |file_path|
46
+ FileFinder.each_file(path, skip_hidden: true) do |file_path|
47
47
  paths << [file_path, dest_dir + file_path.relative_path_from(path)]
48
48
  end
49
49
 
@@ -52,7 +52,7 @@ module RBS
52
52
 
53
53
  RBS.logger.info "Vendoring #{lib.name}(#{path.version}) RBSs in #{vendor_dir + dest_dir}..."
54
54
 
55
- FileFinder.each_file(path.path, skip_hidden: true, immediate: false) do |file_path|
55
+ FileFinder.each_file(path.path, skip_hidden: true) do |file_path|
56
56
  paths << [file_path, dest_dir + file_path.relative_path_from(path.path)]
57
57
  end
58
58
  else
data/lib/rbs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "3.5.3"
4
+ VERSION = "3.6.0.dev.1"
5
5
  end
data/lib/rbs.rb CHANGED
@@ -22,6 +22,7 @@ require "rbs/ast/directives"
22
22
  require "rbs/ast/declarations"
23
23
  require "rbs/ast/members"
24
24
  require "rbs/ast/annotation"
25
+ require "rbs/ast/visitor"
25
26
  require "rbs/environment"
26
27
  require "rbs/environment/use_map"
27
28
  require "rbs/environment_loader"
data/sig/declarations.rbs CHANGED
@@ -77,6 +77,8 @@ module RBS
77
77
 
78
78
  def initialize: (name: TypeName, type_params: Array[TypeParam], members: Array[member], super_class: Super?, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
79
79
 
80
+ def update: (?name: TypeName, ?type_params: Array[TypeParam], ?members: Array[member], ?super_class: Super?, ?annotations: Array[Annotation], ?location: loc?, ?comment: Comment?) -> Declarations::Class
81
+
80
82
  include _HashEqual
81
83
  include _ToJson
82
84
  end
@@ -131,6 +133,8 @@ module RBS
131
133
 
132
134
  def initialize: (name: TypeName, type_params: Array[TypeParam], members: Array[member], location: loc?, annotations: Array[Annotation], self_types: Array[Self], comment: Comment?) -> void
133
135
 
136
+ def update: (?name: TypeName, ?type_params: Array[TypeParam], ?members: Array[member], ?location: loc?, ?annotations: Array[Annotation], ?self_types: Array[Self], ?comment: Comment?) -> Declarations::Module
137
+
134
138
  include _HashEqual
135
139
  include _ToJson
136
140
  end
@@ -160,6 +164,8 @@ module RBS
160
164
 
161
165
  def initialize: (name: TypeName, type_params: Array[TypeParam], members: Array[member], annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
162
166
 
167
+ def update: (?name: TypeName, ?type_params: Array[TypeParam], ?members: Array[member], ?annotations: Array[Annotation], ?location: loc?, ?comment: Comment?) -> Declarations::Interface
168
+
163
169
  include MixinHelper
164
170
 
165
171
  include _HashEqual
data/sig/definition.rbs CHANGED
@@ -66,7 +66,7 @@ module RBS
66
66
  #
67
67
  def map_type: () { (Types::t) -> Types::t } -> Method
68
68
 
69
- def map_type_bound: () { (AST::TypeParam::bound) -> AST::TypeParam::bound } -> Method
69
+ def map_type_bound: () { (Types::t) -> Types::t } -> Method
70
70
 
71
71
  def map_method_type: () { (MethodType) -> MethodType } -> Method
72
72
 
@@ -116,6 +116,7 @@ module RBS
116
116
  Definition class_definition,
117
117
  MethodBuilder::Methods::Definition method_definition,
118
118
  Substitution subst,
119
+ Hash[Symbol, Definition::Method]? self_type_methods,
119
120
  defined_in: TypeName,
120
121
  ?implemented_in: TypeName?
121
122
  ) -> void
@@ -137,7 +138,8 @@ module RBS
137
138
  TypeName module_name,
138
139
  MethodBuilder::Methods module_methods,
139
140
  interface_methods interface_methods,
140
- Substitution subst
141
+ Substitution subst,
142
+ Hash[Symbol, Definition::Method]? self_type_methods,
141
143
  ) -> void
142
144
 
143
145
  # Updates `definition` with methods and variables of `type_name` that can be a module or a class
data/sig/errors.rbs CHANGED
@@ -60,11 +60,12 @@ module RBS
60
60
  attr_reader type_name: TypeName
61
61
  attr_reader args: Array[Types::t]
62
62
  attr_reader params: Array[Symbol]
63
+ attr_reader type_params: Array[AST::TypeParam]
63
64
  attr_reader location: Location[untyped, untyped]?
64
65
 
65
- def initialize: (type_name: TypeName, args: Array[Types::t], params: Array[Symbol], location: Location[untyped, untyped]?) -> void
66
+ def initialize: (type_name: TypeName, args: Array[Types::t], params: Array[AST::TypeParam], location: Location[untyped, untyped]?) -> void
66
67
 
67
- def self.check!: (type_name: TypeName, args: Array[Types::t], params: Array[Symbol], location: Location[untyped, untyped]?) -> void
68
+ def self.check!: (type_name: TypeName, args: Array[Types::t], params: Array[AST::TypeParam], location: Location[untyped, untyped]?) -> void
68
69
  end
69
70
 
70
71
  class RecursiveAncestorError < DefinitionError
data/sig/file_finder.rbs CHANGED
@@ -1,6 +1,28 @@
1
1
  module RBS
2
2
  module FileFinder
3
- def self?.each_file: (Pathname path, immediate: boolish, skip_hidden: boolish) { (Pathname) -> void } -> void
4
- | (Pathname path, immediate: boolish, skip_hidden: boolish) -> Enumerator[Pathname, void]
3
+ # Enumerate RBS files under path
4
+ #
5
+ # When `path` is a file, it yields the path.
6
+ #
7
+ # ```rb
8
+ # FileFinder.each_file(Pathname("foo.rbs")) {} # => yields `foo.rbs`
9
+ # ```
10
+ #
11
+ # When `path` is a directory, it yields all `.rbs` files under the directory, recursively.
12
+ #
13
+ # * Skips files under directory starting with `_`, if `skip_hidden` is `true`
14
+ # * Yields files under directory starting with `_` even if `skip_hidden` is true, when the `_` directory is given explicitly, and `immediate:` is `true`
15
+ #
16
+ # ```rb
17
+ # FileFinder.each_file(Pathname("sig"), skip_hidden: false) {} # => yields all `.rbs` files under `sig`
18
+ # FileFinder.each_file(Pathname("sig"), skip_hidden: true) {} # => yields all `.rbs` files under `sig`, skips `_` directories
19
+ #
20
+ # FileFinder.each_file(Pathname("_hidden"), skip_hidden: true) {} # => yields all `.rbs` files under `_hidden`, skips other `_` directories
21
+ # ```
22
+ #
23
+ # `immediate` keyword is unused and left for API compatibility.
24
+ #
25
+ def self?.each_file: (Pathname path, ?immediate: top, skip_hidden: boolish) { (Pathname) -> void } -> void
26
+ | (Pathname path, ?immediate: top, skip_hidden: boolish) -> Enumerator[Pathname, void]
5
27
  end
6
28
  end
data/sig/method_types.rbs CHANGED
@@ -40,7 +40,7 @@ module RBS
40
40
  #
41
41
  def map_type: () { (Types::t) -> Types::t } -> MethodType
42
42
 
43
- def map_type_bound: () { (AST::TypeParam::bound) -> AST::TypeParam::bound } -> MethodType
43
+ def map_type_bound: () { (Types::t) -> Types::t } -> MethodType
44
44
 
45
45
  def each_type: () { (Types::t) -> void } -> void
46
46
  | () -> Enumerator[Types::t, void]
data/sig/sorter.rbs CHANGED
@@ -36,6 +36,6 @@ module RBS
36
36
  other_decls: Array[member]
37
37
  }
38
38
 
39
- def sort_decl!: (member decl) -> void
39
+ def sort_decl: (member decl) -> member
40
40
  end
41
41
  end
data/sig/type_param.rbs CHANGED
@@ -4,12 +4,13 @@ module RBS
4
4
  # Key
5
5
  # ^^^ name
6
6
  #
7
- # unchecked out Elem < _ToJson
8
- # ^^^^^^^^^ unchecked
9
- # ^^^ variance
10
- # ^^^^ name
11
- # ^^^^^^^^^ upper_bound
12
- type loc = Location[:name, :variance | :unchecked | :upper_bound]
7
+ # unchecked out Elem < _ToJson = untyped
8
+ # ^^^^^^^^^ unchecked
9
+ # ^^^ variance
10
+ # ^^^^ name
11
+ # ^^^^^^^^^ upper_bound
12
+ # ^^^^^^^^^ default
13
+ type loc = Location[:name, :variance | :unchecked | :upper_bound | :default]
13
14
 
14
15
  type variance = :invariant | :covariant | :contravariant
15
16
 
@@ -19,9 +20,13 @@ module RBS
19
20
  attr_reader variance: variance
20
21
  attr_reader location: loc?
21
22
 
22
- attr_reader upper_bound: bound?
23
+ %a{pure} def upper_bound: () -> bound?
23
24
 
24
- def initialize: (name: Symbol, variance: variance, upper_bound: bound?, location: loc?) -> void
25
+ attr_reader upper_bound_type: Types::t?
26
+
27
+ attr_reader default_type: Types::t?
28
+
29
+ def initialize: (name: Symbol, variance: variance, upper_bound: Types::t?, location: loc?, ?default_type: Types::t?) -> void
25
30
 
26
31
  include _ToJson
27
32
 
@@ -37,7 +42,7 @@ module RBS
37
42
 
38
43
  def unchecked?: () -> bool
39
44
 
40
- def map_type: () { (bound) -> bound } -> TypeParam
45
+ def map_type: () { (Types::t) -> Types::t } -> TypeParam
41
46
 
42
47
  # Helper function to resolve _class instance types_ to _type variables_.
43
48
  #
@@ -69,6 +74,33 @@ module RBS
69
74
  def self.rename: (Array[TypeParam], new_names: Array[Symbol]) -> Array[TypeParam]
70
75
 
71
76
  def to_s: () -> String
77
+
78
+ # Returns an application with respect to type params` default
79
+ #
80
+ def self.application: (Array[TypeParam], Array[Types::t]) -> Substitution?
81
+
82
+ # Returns an array of type args, that fills ommited types with the defaults
83
+ #
84
+ # ```rbs
85
+ # interface _Foo[T, S = untyped]
86
+ # end
87
+ # ```
88
+ #
89
+ # Normalizing type args with `_Foo` works as following:
90
+ #
91
+ # ```rbs
92
+ # _Foo[String] # => _Foo[String, untyped]
93
+ # _Foo[String, Integer] # => _Foo[String, Integer]
94
+ # _Foo # => _Foo (Omitting missing args)
95
+ # _Foo[String, Integer, untyped] # => _Foo[String, Integer, untyped] (Keeping extra args)
96
+ # ```
97
+ #
98
+ # Note that it allows iinvalid arities.
99
+ #
100
+ # * Missing args will be omitted
101
+ # * Extra args will be keeped
102
+ #
103
+ def self.normalize_args: (Array[TypeParam], Array[Types::t]) -> Array[Types::t]
72
104
  end
73
105
  end
74
106
  end
data/sig/types.rbs CHANGED
@@ -446,6 +446,12 @@ module RBS
446
446
  def has_classish_type?: () -> bool
447
447
 
448
448
  def with_nonreturn_void?: () -> bool
449
+
450
+ def ==: (untyped) -> bool
451
+
452
+ alias eql? ==
453
+
454
+ def hash: () -> Integer
449
455
  end
450
456
 
451
457
  # Function type without type checking arguments
@@ -489,6 +495,12 @@ module RBS
489
495
 
490
496
  # Returns `return_type.to_s(1)`
491
497
  def return_to_s: () -> String
498
+
499
+ def ==: (untyped) -> bool
500
+
501
+ alias eql? ==
502
+
503
+ def hash: () -> Integer
492
504
  end
493
505
 
494
506
  type function = Types::Function | Types::UntypedFunction
data/sig/visitor.rbs ADDED
@@ -0,0 +1,47 @@
1
+ module RBS
2
+ module AST
3
+ class Visitor
4
+ def visit_all: (Enumerable[(Members::Base | Declarations::Base)] nodes) -> void
5
+
6
+ def visit: ((Members::Base | Declarations::Base) node) -> void
7
+
8
+ def visit_declaration_global: (Declarations::Global node) -> void
9
+
10
+ def visit_declaration_class: (Declarations::Class node) -> void
11
+
12
+ def visit_declaration_module: (Declarations::Module node) -> void
13
+
14
+ def visit_declaration_constant: (Declarations::Constant node) -> void
15
+
16
+ def visit_declaration_type_alias: (Declarations::TypeAlias node) -> void
17
+
18
+ def visit_declaration_interface: (Declarations::Interface node) -> void
19
+
20
+ def visit_member_alias: (Members::Alias node) -> void
21
+
22
+ def visit_member_class_instance_variable: (Members::ClassInstanceVariable node) -> void
23
+
24
+ def visit_member_class_variable: (Members::ClassVariable node) -> void
25
+
26
+ def visit_member_instance_variable: (Members::InstanceVariable node) -> void
27
+
28
+ def visit_member_private: (Members::Private node) -> void
29
+
30
+ def visit_member_public: (Members::Public node) -> void
31
+
32
+ def visit_member_method_definition: (Members::MethodDefinition node) -> void
33
+
34
+ def visit_member_attr_reader: (Members::AttrReader node) -> void
35
+
36
+ def visit_member_attr_writer: (Members::AttrWriter node) -> void
37
+
38
+ def visit_member_attr_accessor: (Members::AttrAccessor node) -> void
39
+
40
+ def visit_member_include: (Members::Include node) -> void
41
+
42
+ def visit_member_prepend: (Members::Prepend node) -> void
43
+
44
+ def visit_member_extend: (Members::Extend node) -> void
45
+ end
46
+ end
47
+ end
data/stdlib/csv/0/csv.rbs CHANGED
@@ -2287,6 +2287,33 @@ class CSV::Row < Object
2287
2287
  include Enumerable[Array[String]]
2288
2288
  extend Forwardable
2289
2289
 
2290
+ # <!--
2291
+ # rdoc-file=lib/csv/row.rb
2292
+ # - CSV::Row.new(headers, fields, header_row = false) -> csv_row
2293
+ # -->
2294
+ # Returns the new CSV::Row instance constructed from arguments `headers` and
2295
+ # `fields`; both should be Arrays; note that the fields need not be Strings:
2296
+ # row = CSV::Row.new(['Name', 'Value'], ['foo', 0])
2297
+ # row # => #<CSV::Row "Name":"foo" "Value":0>
2298
+ #
2299
+ # If the Array lengths are different, the shorter is `nil`-filled:
2300
+ # row = CSV::Row.new(['Name', 'Value', 'Date', 'Size'], ['foo', 0])
2301
+ # row # => #<CSV::Row "Name":"foo" "Value":0 "Date":nil "Size":nil>
2302
+ #
2303
+ # Each CSV::Row object is either a *field row* or a *header row*; by default, a
2304
+ # new row is a field row; for the row created above:
2305
+ # row.field_row? # => true
2306
+ # row.header_row? # => false
2307
+ #
2308
+ # If the optional argument `header_row` is given as `true`, the created row is a
2309
+ # header row:
2310
+ # row = CSV::Row.new(['Name', 'Value'], ['foo', 0], header_row = true)
2311
+ # row # => #<CSV::Row "Name":"foo" "Value":0>
2312
+ # row.field_row? # => false
2313
+ # row.header_row? # => true
2314
+ #
2315
+ def initialize: (Array[untyped] headers, Array[untyped] fields, ?header_row: bool) -> void
2316
+
2290
2317
  # <!--
2291
2318
  # rdoc-file=lib/csv/row.rb
2292
2319
  # - row << [header, value] -> self
@@ -2437,7 +2437,7 @@ module Net
2437
2437
  # * #each_name: Passes each field name to the block.
2438
2438
  # * #each_value: Passes each string field value to the block.
2439
2439
  #
2440
- module HTTPHeader
2440
+ module HTTPHeader : BasicObject
2441
2441
  # <!--
2442
2442
  # rdoc-file=lib/net/http/header.rb
2443
2443
  # - initialize_http_header(initheader)
@@ -122,6 +122,9 @@ module Zlib
122
122
  class GzipReader < Zlib::GzipFile
123
123
  include Enumerable[String]
124
124
 
125
+ def self.wrap: (IO io) -> instance
126
+ | (IO io) { (instance gz) -> void } -> void
127
+
125
128
  # <!--
126
129
  # rdoc-file=ext/zlib/zlib.c
127
130
  # - Zlib::GzipReader.open(filename) {|gz| ... }
@@ -130,7 +133,8 @@ module Zlib
130
133
  # GzipReader object associated with that file. Further details of this method
131
134
  # are in Zlib::GzipReader.new and ZLib::GzipFile.wrap.
132
135
  #
133
- def self.open: (String filename) { (instance gz) -> void } -> instance
136
+ def self.open: (String | _ToPath filename) -> instance
137
+ | (String | _ToPath filename) { (instance gz) -> void } -> void
134
138
 
135
139
  # <!--
136
140
  # rdoc-file=ext/zlib/zlib.c
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: 3.5.3
4
+ version: 3.6.0.dev.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger
@@ -39,6 +39,7 @@ files:
39
39
  - ".github/workflows/dependabot.yml"
40
40
  - ".github/workflows/ruby.yml"
41
41
  - ".github/workflows/typecheck.yml"
42
+ - ".github/workflows/windows.yml"
42
43
  - ".gitignore"
43
44
  - ".rubocop.yml"
44
45
  - BSDL
@@ -174,6 +175,7 @@ files:
174
175
  - lib/rbs/ast/directives.rb
175
176
  - lib/rbs/ast/members.rb
176
177
  - lib/rbs/ast/type_param.rb
178
+ - lib/rbs/ast/visitor.rb
177
179
  - lib/rbs/buffer.rb
178
180
  - lib/rbs/builtin_names.rb
179
181
  - lib/rbs/cli.rb
@@ -338,6 +340,7 @@ files:
338
340
  - sig/variance_calculator.rbs
339
341
  - sig/vendorer.rbs
340
342
  - sig/version.rbs
343
+ - sig/visitor.rbs
341
344
  - sig/writer.rbs
342
345
  - stdlib/abbrev/0/abbrev.rbs
343
346
  - stdlib/abbrev/0/array.rbs