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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +24 -2
- data/.github/workflows/typecheck.yml +0 -2
- data/.github/workflows/windows.yml +1 -1
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +93 -0
- data/Rakefile +17 -2
- data/config.yml +4 -0
- data/core/data.rbs +1 -1
- data/core/enumerator.rbs +14 -2
- data/core/exception.rbs +1 -1
- data/core/hash.rbs +2 -2
- data/core/kernel.rbs +4 -4
- data/core/method.rbs +2 -2
- data/core/module.rbs +4 -4
- data/core/object.rbs +1 -1
- data/core/proc.rbs +2 -2
- data/core/rbs/unnamed/argf.rbs +3 -3
- data/core/rubygems/version.rbs +2 -2
- data/core/string.rbs +3 -3
- data/core/unbound_method.rbs +1 -1
- data/ext/rbs_extension/parser.c +59 -50
- data/ext/rbs_extension/parserstate.c +15 -1
- data/include/rbs/ruby_objs.h +4 -4
- data/lib/rbs/ast/declarations.rb +9 -4
- data/lib/rbs/ast/type_param.rb +0 -10
- data/lib/rbs/collection/config/lockfile_generator.rb +29 -3
- data/lib/rbs/definition.rb +40 -31
- data/lib/rbs/definition_builder/ancestor_builder.rb +2 -0
- data/lib/rbs/definition_builder.rb +86 -34
- data/lib/rbs/environment.rb +8 -4
- data/lib/rbs/errors.rb +10 -31
- data/lib/rbs/prototype/rb.rb +2 -1
- data/lib/rbs/prototype/rbi.rb +2 -1
- data/lib/rbs/prototype/runtime.rb +3 -0
- data/lib/rbs/types.rb +3 -7
- data/lib/rbs/unit_test/type_assertions.rb +2 -2
- data/lib/rbs/unit_test/with_aliases.rb +3 -1
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/rdoc_source.rbs +2 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/config/lockfile_generator.rbs +1 -1
- data/sig/declarations.rbs +10 -3
- data/sig/definition.rbs +67 -14
- data/sig/definition_builder.rbs +17 -3
- data/sig/errors.rbs +7 -10
- data/sig/namespace.rbs +1 -1
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +0 -3
- data/src/ruby_objs.c +8 -4
- data/src/util/rbs_constant_pool.c +1 -1
- data/stdlib/cgi/0/core.rbs +10 -0
- data/stdlib/ipaddr/0/ipaddr.rbs +8 -0
- data/stdlib/net-http/0/net-http.rbs +1 -1
- data/stdlib/openssl/0/openssl.rbs +67 -67
- data/stdlib/resolv/0/resolv.rbs +8 -8
- data/stdlib/socket/0/addrinfo.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +1 -1
- data/stdlib/uri/0/common.rbs +17 -0
- metadata +3 -6
data/sig/definition_builder.rbs
CHANGED
|
@@ -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
|
|
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: (
|
|
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
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
attr_reader type_name: TypeName
|
|
189
|
+
attr_reader variable_name: Symbol
|
|
190
|
+
attr_reader location: Location[untyped, untyped]?
|
|
191
191
|
|
|
192
|
-
def
|
|
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
|
|
197
|
+
def kind: () -> String
|
|
197
198
|
end
|
|
198
199
|
|
|
199
200
|
class ClassInstanceVariableDuplicationError < VariableDuplicationError
|
|
200
|
-
def
|
|
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
data/sig/typename.rbs
CHANGED
data/sig/types.rbs
CHANGED
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
|
/**
|
data/stdlib/cgi/0/core.rbs
CHANGED
|
@@ -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 -->
|
data/stdlib/ipaddr/0/ipaddr.rbs
CHANGED
|
@@ -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()
|