rbs-relaxed 3.9.0.1 → 3.9.4.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +24 -2
  3. data/.github/workflows/typecheck.yml +0 -2
  4. data/.github/workflows/windows.yml +1 -1
  5. data/.rubocop.yml +4 -0
  6. data/CHANGELOG.md +93 -0
  7. data/Rakefile +17 -2
  8. data/config.yml +4 -0
  9. data/core/data.rbs +1 -1
  10. data/core/enumerator.rbs +14 -2
  11. data/core/exception.rbs +1 -1
  12. data/core/hash.rbs +2 -2
  13. data/core/kernel.rbs +4 -4
  14. data/core/method.rbs +2 -2
  15. data/core/module.rbs +4 -4
  16. data/core/object.rbs +1 -1
  17. data/core/proc.rbs +2 -2
  18. data/core/rbs/unnamed/argf.rbs +3 -3
  19. data/core/rubygems/version.rbs +2 -2
  20. data/core/string.rbs +3 -3
  21. data/core/unbound_method.rbs +1 -1
  22. data/ext/rbs_extension/parser.c +59 -50
  23. data/ext/rbs_extension/parserstate.c +15 -1
  24. data/include/rbs/ruby_objs.h +4 -4
  25. data/lib/rbs/ast/declarations.rb +9 -4
  26. data/lib/rbs/ast/type_param.rb +0 -10
  27. data/lib/rbs/collection/config/lockfile_generator.rb +29 -3
  28. data/lib/rbs/definition.rb +40 -31
  29. data/lib/rbs/definition_builder/ancestor_builder.rb +2 -0
  30. data/lib/rbs/definition_builder.rb +86 -34
  31. data/lib/rbs/environment.rb +8 -4
  32. data/lib/rbs/errors.rb +10 -31
  33. data/lib/rbs/prototype/rb.rb +2 -1
  34. data/lib/rbs/prototype/rbi.rb +2 -1
  35. data/lib/rbs/prototype/runtime.rb +3 -0
  36. data/lib/rbs/types.rb +3 -7
  37. data/lib/rbs/unit_test/type_assertions.rb +2 -2
  38. data/lib/rbs/unit_test/with_aliases.rb +3 -1
  39. data/lib/rbs/version.rb +1 -1
  40. data/sig/annotate/rdoc_source.rbs +2 -0
  41. data/sig/cli.rbs +2 -0
  42. data/sig/collection/config/lockfile_generator.rbs +1 -1
  43. data/sig/declarations.rbs +10 -3
  44. data/sig/definition.rbs +67 -14
  45. data/sig/definition_builder.rbs +17 -3
  46. data/sig/errors.rbs +7 -10
  47. data/sig/namespace.rbs +1 -1
  48. data/sig/typename.rbs +1 -1
  49. data/sig/types.rbs +0 -3
  50. data/src/ruby_objs.c +8 -4
  51. data/src/util/rbs_constant_pool.c +1 -1
  52. data/stdlib/cgi/0/core.rbs +10 -0
  53. data/stdlib/ipaddr/0/ipaddr.rbs +8 -0
  54. data/stdlib/net-http/0/net-http.rbs +1 -1
  55. data/stdlib/openssl/0/openssl.rbs +67 -67
  56. data/stdlib/resolv/0/resolv.rbs +8 -8
  57. data/stdlib/socket/0/addrinfo.rbs +1 -1
  58. data/stdlib/stringio/0/stringio.rbs +1 -1
  59. data/stdlib/uri/0/common.rbs +17 -0
  60. metadata +3 -6
@@ -105,7 +105,15 @@ module RBS
105
105
 
106
106
  def source_location: (Definition::Ancestor::Instance::source, AST::Declarations::t) -> Location[untyped, untyped]?
107
107
 
108
- def insert_variable: (TypeName, Hash[Symbol, Definition::Variable], name: Symbol, type: Types::t) -> void
108
+ def validate_variable: (Definition::Variable) -> void
109
+
110
+ def insert_variable: (
111
+ TypeName,
112
+ Hash[Symbol, Definition::Variable],
113
+ name: Symbol,
114
+ type: Types::t,
115
+ source: Definition::Variable::source
116
+ ) -> void
109
117
 
110
118
  # Add method definition to `methods`, which will be merged to `class_definition` after defining all methods at this *level* -- class, module, or interface
111
119
  #
@@ -142,11 +150,17 @@ module RBS
142
150
  Hash[Symbol, Definition::Method]? self_type_methods,
143
151
  ) -> void
144
152
 
145
- # Updates `definition` with methods and variables of `type_name` that can be a module or a class
153
+ # Updates `definition` with methods and instance variables of `type_name` that can be a module or a class
146
154
  #
147
155
  # It processes includes and prepends recursively.
156
+ # If `define_class_vars:` is falsy, it skips inserting class variables.
148
157
  #
149
- def define_instance: (Definition definition, TypeName type_name, Substitution subst) -> void
158
+ def define_instance: (
159
+ Definition definition,
160
+ TypeName type_name,
161
+ Substitution subst,
162
+ define_class_vars: bool
163
+ ) -> void
150
164
 
151
165
  # Updates `definition` with methods defined in an interface `type_name`
152
166
  #
data/sig/errors.rbs CHANGED
@@ -185,23 +185,20 @@ module RBS
185
185
  class VariableDuplicationError < DefinitionError
186
186
  include DetailedMessageable
187
187
 
188
- attr_reader member: AST::Members::Var
189
-
190
- def initialize: (member: AST::Members::Var) -> void
188
+ attr_reader type_name: TypeName
189
+ attr_reader variable_name: Symbol
190
+ attr_reader location: Location[untyped, untyped]?
191
191
 
192
- def location: () -> Location[bot, bot]
192
+ def initialize: (type_name: TypeName, variable_name: Symbol, location: Location[untyped, untyped]?) -> void
193
+ def kind: () -> String
193
194
  end
194
195
 
195
196
  class InstanceVariableDuplicationError < VariableDuplicationError
196
- def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::InstanceVariable, type_name: TypeName) -> void
197
+ def kind: () -> String
197
198
  end
198
199
 
199
200
  class ClassInstanceVariableDuplicationError < VariableDuplicationError
200
- def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::ClassInstanceVariable, type_name: TypeName) -> void
201
- end
202
-
203
- class ClassVariableDuplicationError < VariableDuplicationError
204
- def self.check!: (variables: Hash[Symbol, Definition::Variable], member: AST::Members::ClassVariable, type_name: TypeName) -> void
201
+ def kind: () -> String
205
202
  end
206
203
 
207
204
  # The `alias` member declares an alias from unknown method
data/sig/namespace.rbs CHANGED
@@ -142,5 +142,5 @@ end
142
142
 
143
143
  module Kernel
144
144
  # Deprecated: Use `RBS::Namespace.parse` instead
145
- %a{steep:deprecated} def Namespace: (String) -> RBS::Namespace
145
+ %a{deprecated} def Namespace: (String) -> RBS::Namespace
146
146
  end
data/sig/typename.rbs CHANGED
@@ -75,5 +75,5 @@ end
75
75
 
76
76
  module Kernel
77
77
  # Deprecated: Use `RBS::TypeName.parse` instead
78
- %a{steep:deprecated} def TypeName: (String name) -> RBS::TypeName
78
+ %a{deprecated: Use `RBS::TypeName.parse` instead} def TypeName: (String name) -> RBS::TypeName
79
79
  end
data/sig/types.rbs CHANGED
@@ -114,9 +114,6 @@ module RBS
114
114
  @string: String?
115
115
 
116
116
  def initialize: (location: Location[bot, bot]?, ?todo: bool) -> void
117
-
118
- %a{steep:deprecated}
119
- def todo!: () -> self
120
117
  end
121
118
 
122
119
  class Nil < Base
data/src/ruby_objs.c CHANGED
@@ -71,12 +71,13 @@ VALUE rbs_ast_decl_class_super(VALUE name, VALUE args, VALUE location) {
71
71
  );
72
72
  }
73
73
 
74
- VALUE rbs_ast_decl_class_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment) {
74
+ VALUE rbs_ast_decl_class_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment, VALUE annotations) {
75
75
  VALUE _init_kwargs = rb_hash_new();
76
76
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("new_name")), new_name);
77
77
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("old_name")), old_name);
78
78
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
79
79
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
80
+ rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
80
81
 
81
82
  return CLASS_NEW_INSTANCE(
82
83
  RBS_AST_Declarations_ClassAlias,
@@ -85,12 +86,13 @@ VALUE rbs_ast_decl_class_alias(VALUE new_name, VALUE old_name, VALUE location, V
85
86
  );
86
87
  }
87
88
 
88
- VALUE rbs_ast_decl_constant(VALUE name, VALUE type, VALUE location, VALUE comment) {
89
+ VALUE rbs_ast_decl_constant(VALUE name, VALUE type, VALUE location, VALUE comment, VALUE annotations) {
89
90
  VALUE _init_kwargs = rb_hash_new();
90
91
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
91
92
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
92
93
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
93
94
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
95
+ rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
94
96
 
95
97
  return CLASS_NEW_INSTANCE(
96
98
  RBS_AST_Declarations_Constant,
@@ -99,12 +101,13 @@ VALUE rbs_ast_decl_constant(VALUE name, VALUE type, VALUE location, VALUE commen
99
101
  );
100
102
  }
101
103
 
102
- VALUE rbs_ast_decl_global(VALUE name, VALUE type, VALUE location, VALUE comment) {
104
+ VALUE rbs_ast_decl_global(VALUE name, VALUE type, VALUE location, VALUE comment, VALUE annotations) {
103
105
  VALUE _init_kwargs = rb_hash_new();
104
106
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
105
107
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
106
108
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
107
109
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
110
+ rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
108
111
 
109
112
  return CLASS_NEW_INSTANCE(
110
113
  RBS_AST_Declarations_Global,
@@ -159,12 +162,13 @@ VALUE rbs_ast_decl_module_self(VALUE name, VALUE args, VALUE location) {
159
162
  );
160
163
  }
161
164
 
162
- VALUE rbs_ast_decl_module_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment) {
165
+ VALUE rbs_ast_decl_module_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment, VALUE annotations) {
163
166
  VALUE _init_kwargs = rb_hash_new();
164
167
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("new_name")), new_name);
165
168
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("old_name")), old_name);
166
169
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
167
170
  rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
171
+ rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
168
172
 
169
173
  return CLASS_NEW_INSTANCE(
170
174
  RBS_AST_Declarations_ModuleAlias,
@@ -169,7 +169,7 @@ rbs_constant_pool_resize(rbs_constant_pool_t *pool) {
169
169
  }
170
170
 
171
171
  // This storage is initialized by `Init_rbs_extension()` in `main.c`.
172
- static rbs_constant_pool_t RBS_GLOBAL_CONSTANT_POOL_STORAGE = {};
172
+ static rbs_constant_pool_t RBS_GLOBAL_CONSTANT_POOL_STORAGE = { 0 };
173
173
  rbs_constant_pool_t *RBS_GLOBAL_CONSTANT_POOL = &RBS_GLOBAL_CONSTANT_POOL_STORAGE;
174
174
 
175
175
  /**
@@ -931,6 +931,11 @@ class CGI
931
931
  #
932
932
  def escapeURIComponent: (string) -> String
933
933
 
934
+ # <!-- rdoc-file=ext/cgi/escape/escape.c -->
935
+ # Returns URL-escaped string following RFC 3986.
936
+ #
937
+ alias escape_uri_component escapeURIComponent
938
+
934
939
  # <!--
935
940
  # rdoc-file=ext/cgi/escape/escape.c
936
941
  # - CGI.unescape(string, encoding=@@accept_charset) -> string
@@ -954,6 +959,11 @@ class CGI
954
959
  # Returns URL-unescaped string following RFC 3986.
955
960
  #
956
961
  def unescapeURIComponent: (string) -> String
962
+
963
+ # <!-- rdoc-file=ext/cgi/escape/escape.c -->
964
+ # Returns URL-unescaped string following RFC 3986.
965
+ #
966
+ alias unescape_uri_component unescapeURIComponent
957
967
  end
958
968
 
959
969
  # <!-- rdoc-file=lib/cgi/core.rb -->
@@ -276,6 +276,14 @@ class IPAddr
276
276
  #
277
277
  def native: () -> IPAddr
278
278
 
279
+ # <!--
280
+ # rdoc-file=lib/ipaddr.rb
281
+ # - netmask()
282
+ # -->
283
+ # Returns the netmask in string format e.g. 255.255.0.0
284
+ #
285
+ def netmask: () -> String
286
+
279
287
  # <!--
280
288
  # rdoc-file=lib/ipaddr.rb
281
289
  # - prefix()
@@ -2404,7 +2404,7 @@ module Net
2404
2404
  alias length size
2405
2405
 
2406
2406
  # A previous incarnation of `interned` for backward-compatibility (see #1499)
2407
- %a{steep:deprecated}
2407
+ %a{deprecated: Use `interned` instead}
2408
2408
  type key = interned
2409
2409
 
2410
2410
  # <!--