rbs 3.7.0.dev.1 → 3.7.0.pre.1
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 +1 -1
- data/.github/workflows/windows.yml +5 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +47 -0
- data/Rakefile +23 -0
- data/config.yml +311 -0
- data/core/dir.rbs +1 -1
- data/core/kernel.rbs +2 -2
- data/core/process.rbs +1 -1
- data/core/set.rbs +1 -1
- data/docs/syntax.md +6 -4
- data/ext/rbs_extension/extconf.rb +10 -0
- data/ext/rbs_extension/parser.c +103 -110
- data/ext/rbs_extension/rbs_extension.h +1 -2
- data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +34 -5
- data/lib/rbs/collection/config.rb +2 -2
- data/lib/rbs/environment_loader.rb +5 -0
- data/lib/rbs/prototype/rb.rb +7 -3
- data/lib/rbs/types.rb +10 -3
- data/lib/rbs/version.rb +1 -1
- data/sig/ancestor_graph.rbs +1 -1
- data/sig/collection/config/lockfile_generator.rbs +9 -1
- data/sig/definition.rbs +1 -1
- data/sig/definition_builder.rbs +1 -1
- data/sig/environment.rbs +1 -1
- data/sig/prototype/rb.rbs +1 -1
- data/sig/type_alias_dependency.rbs +2 -2
- data/sig/type_alias_regularity.rbs +1 -1
- data/sig/type_param.rbs +3 -3
- data/sig/vendorer.rbs +1 -1
- data/{ext/rbs_extension → src}/constants.c +35 -36
- data/src/ruby_objs.c +793 -0
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/csv/0/manifest.yaml +1 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
- data/stdlib/json/0/json.rbs +1 -1
- data/stdlib/minitest/0/kernel.rbs +2 -2
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
- data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
- data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/mock.rbs +9 -5
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
- data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
- data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
- data/stdlib/minitest/0/minitest/spec.rbs +1 -1
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
- data/stdlib/minitest/0/minitest/test.rbs +7 -14
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit.rbs +1 -2
- data/stdlib/minitest/0/minitest.rbs +41 -892
- data/stdlib/open-uri/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/openssl.rbs +26 -1
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/templates/include/rbs/constants.h.erb +20 -0
- data/templates/include/rbs/ruby_objs.h.erb +10 -0
- data/templates/src/constants.c.erb +36 -0
- data/templates/src/ruby_objs.c.erb +27 -0
- data/templates/template.rb +122 -0
- metadata +19 -9
- data/ext/rbs_extension/ruby_objs.c +0 -602
- data/ext/rbs_extension/ruby_objs.h +0 -51
- data/stdlib/minitest/0/manifest.yaml +0 -2
- /data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +0 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
/*----------------------------------------------------------------------------*/
|
2
|
+
/* This file is generated by the templates/template.rb script and should not */
|
3
|
+
/* be modified manually. */
|
4
|
+
/* To change the template see */
|
5
|
+
/* templates/include/rbs/ruby_objs.h.erb */
|
6
|
+
/*----------------------------------------------------------------------------*/
|
7
|
+
|
8
|
+
#ifndef RBS__RUBY_OBJS_H
|
9
|
+
#define RBS__RUBY_OBJS_H
|
10
|
+
|
11
|
+
#include "ruby.h"
|
12
|
+
|
13
|
+
VALUE rbs_ast_annotation(VALUE string, VALUE location);
|
14
|
+
VALUE rbs_ast_comment(VALUE string, VALUE location);
|
15
|
+
VALUE rbs_ast_decl_class(VALUE name, VALUE type_params, VALUE super_class, VALUE members, VALUE annotations, VALUE location, VALUE comment);
|
16
|
+
VALUE rbs_ast_decl_class_super(VALUE name, VALUE args, VALUE location);
|
17
|
+
VALUE rbs_ast_decl_class_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment);
|
18
|
+
VALUE rbs_ast_decl_constant(VALUE name, VALUE type, VALUE location, VALUE comment);
|
19
|
+
VALUE rbs_ast_decl_global(VALUE name, VALUE type, VALUE location, VALUE comment);
|
20
|
+
VALUE rbs_ast_decl_interface(VALUE name, VALUE type_params, VALUE members, VALUE annotations, VALUE location, VALUE comment);
|
21
|
+
VALUE rbs_ast_decl_module(VALUE name, VALUE type_params, VALUE self_types, VALUE members, VALUE annotations, VALUE location, VALUE comment);
|
22
|
+
VALUE rbs_ast_decl_module_self(VALUE name, VALUE args, VALUE location);
|
23
|
+
VALUE rbs_ast_decl_module_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment);
|
24
|
+
VALUE rbs_ast_decl_type_alias(VALUE name, VALUE type_params, VALUE type, VALUE annotations, VALUE location, VALUE comment);
|
25
|
+
VALUE rbs_ast_directives_use(VALUE clauses, VALUE location);
|
26
|
+
VALUE rbs_ast_directives_use_single_clause(VALUE type_name, VALUE new_name, VALUE location);
|
27
|
+
VALUE rbs_ast_directives_use_wildcard_clause(VALUE namespace, VALUE location);
|
28
|
+
VALUE rbs_ast_members_alias(VALUE new_name, VALUE old_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment);
|
29
|
+
VALUE rbs_ast_members_attr_accessor(VALUE name, VALUE type, VALUE ivar_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment, VALUE visibility);
|
30
|
+
VALUE rbs_ast_members_attr_reader(VALUE name, VALUE type, VALUE ivar_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment, VALUE visibility);
|
31
|
+
VALUE rbs_ast_members_attr_writer(VALUE name, VALUE type, VALUE ivar_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment, VALUE visibility);
|
32
|
+
VALUE rbs_ast_members_class_instance_variable(VALUE name, VALUE type, VALUE location, VALUE comment);
|
33
|
+
VALUE rbs_ast_members_class_variable(VALUE name, VALUE type, VALUE location, VALUE comment);
|
34
|
+
VALUE rbs_ast_members_extend(VALUE name, VALUE args, VALUE annotations, VALUE location, VALUE comment);
|
35
|
+
VALUE rbs_ast_members_include(VALUE name, VALUE args, VALUE annotations, VALUE location, VALUE comment);
|
36
|
+
VALUE rbs_ast_members_instance_variable(VALUE name, VALUE type, VALUE location, VALUE comment);
|
37
|
+
VALUE rbs_ast_members_method_definition(VALUE name, VALUE kind, VALUE overloads, VALUE annotations, VALUE location, VALUE comment, VALUE overloading, VALUE visibility);
|
38
|
+
VALUE rbs_ast_members_method_definition_overload(VALUE annotations, VALUE method_type);
|
39
|
+
VALUE rbs_ast_members_prepend(VALUE name, VALUE args, VALUE annotations, VALUE location, VALUE comment);
|
40
|
+
VALUE rbs_ast_members_private(VALUE location);
|
41
|
+
VALUE rbs_ast_members_public(VALUE location);
|
42
|
+
VALUE rbs_ast_type_param(VALUE name, VALUE variance, VALUE upper_bound, VALUE default_type, VALUE location);
|
43
|
+
VALUE rbs_method_type(VALUE type_params, VALUE type, VALUE block, VALUE location);
|
44
|
+
VALUE rbs_namespace(VALUE path, VALUE absolute);
|
45
|
+
VALUE rbs_type_name(VALUE namespace, VALUE name);
|
46
|
+
VALUE rbs_alias(VALUE name, VALUE args, VALUE location);
|
47
|
+
VALUE rbs_bases_any(VALUE location);
|
48
|
+
VALUE rbs_bases_bool(VALUE location);
|
49
|
+
VALUE rbs_bases_bottom(VALUE location);
|
50
|
+
VALUE rbs_bases_class(VALUE location);
|
51
|
+
VALUE rbs_bases_instance(VALUE location);
|
52
|
+
VALUE rbs_bases_nil(VALUE location);
|
53
|
+
VALUE rbs_bases_self(VALUE location);
|
54
|
+
VALUE rbs_bases_top(VALUE location);
|
55
|
+
VALUE rbs_bases_void(VALUE location);
|
56
|
+
VALUE rbs_block(VALUE type, VALUE required, VALUE self_type);
|
57
|
+
VALUE rbs_class_instance(VALUE name, VALUE args, VALUE location);
|
58
|
+
VALUE rbs_class_singleton(VALUE name, VALUE location);
|
59
|
+
VALUE rbs_function(VALUE required_positionals, VALUE optional_positionals, VALUE rest_positionals, VALUE trailing_positionals, VALUE required_keywords, VALUE optional_keywords, VALUE rest_keywords, VALUE return_type);
|
60
|
+
VALUE rbs_function_param(VALUE type, VALUE name, VALUE location);
|
61
|
+
VALUE rbs_interface(VALUE name, VALUE args, VALUE location);
|
62
|
+
VALUE rbs_intersection(VALUE types, VALUE location);
|
63
|
+
VALUE rbs_literal(VALUE literal, VALUE location);
|
64
|
+
VALUE rbs_optional(VALUE type, VALUE location);
|
65
|
+
VALUE rbs_proc(VALUE type, VALUE block, VALUE location, VALUE self_type);
|
66
|
+
VALUE rbs_record(VALUE all_fields, VALUE location);
|
67
|
+
VALUE rbs_tuple(VALUE types, VALUE location);
|
68
|
+
VALUE rbs_union(VALUE types, VALUE location);
|
69
|
+
VALUE rbs_untyped_function(VALUE return_type);
|
70
|
+
VALUE rbs_variable(VALUE name, VALUE location);
|
71
|
+
|
72
|
+
#endif
|
data/include/rbs.h
ADDED
@@ -4,6 +4,8 @@ module RBS
|
|
4
4
|
module Collection
|
5
5
|
class Config
|
6
6
|
class LockfileGenerator
|
7
|
+
ALUMNI_STDLIBS = { "mutex_m" => ">= 0.3.0" }
|
8
|
+
|
7
9
|
class GemfileLockMismatchError < StandardError
|
8
10
|
def initialize(expected:, actual:)
|
9
11
|
@expected = expected
|
@@ -58,9 +60,10 @@ module RBS
|
|
58
60
|
|
59
61
|
def generate
|
60
62
|
config.gems.each do |gem|
|
61
|
-
|
63
|
+
case
|
64
|
+
when gem.dig("source", "type") == "stdlib"
|
62
65
|
unless gem.fetch("ignore", false)
|
63
|
-
assign_stdlib(name: gem["name"]
|
66
|
+
assign_stdlib(name: gem["name"])
|
64
67
|
end
|
65
68
|
else
|
66
69
|
assign_gem(name: gem["name"], version: gem["version"])
|
@@ -113,6 +116,11 @@ module RBS
|
|
113
116
|
find_source(name: name)
|
114
117
|
end
|
115
118
|
|
119
|
+
if source.is_a?(Sources::Stdlib)
|
120
|
+
assign_stdlib(name: name)
|
121
|
+
return
|
122
|
+
end
|
123
|
+
|
116
124
|
if source
|
117
125
|
installed_version = version
|
118
126
|
best_version = find_best_version(version: installed_version, versions: source.versions(name))
|
@@ -149,16 +157,37 @@ module RBS
|
|
149
157
|
end
|
150
158
|
end
|
151
159
|
|
152
|
-
private def assign_stdlib(name:, from_gem:)
|
160
|
+
private def assign_stdlib(name:, from_gem: nil)
|
153
161
|
return if lockfile.gems.key?(name)
|
154
162
|
|
155
163
|
case name
|
156
164
|
when 'rubygems', 'set'
|
157
165
|
msg = "`#{name}` has been moved to core library, so it is always loaded. Remove explicit loading `#{name}`"
|
158
166
|
msg << " from `#{from_gem}`" if from_gem
|
159
|
-
|
160
|
-
|
167
|
+
msg << "."
|
161
168
|
return
|
169
|
+
when *ALUMNI_STDLIBS.keys
|
170
|
+
version = ALUMNI_STDLIBS.fetch(name)
|
171
|
+
if from_gem
|
172
|
+
# From `dependencies:` of a `manifest.yaml` of a gem
|
173
|
+
source = find_source(name: name) or raise
|
174
|
+
if source.is_a?(Sources::Stdlib)
|
175
|
+
RBS.logger.warn {
|
176
|
+
"`#{name}` is included in the RBS dependencies of `#{from_gem}`, but the type definition as a stdlib in rbs-gem is deprecated. Add `#{name}` (#{version}) to the dependency of your Ruby program to use the gem-bundled type definition."
|
177
|
+
}
|
178
|
+
else
|
179
|
+
RBS.logger.info {
|
180
|
+
"`#{name}` is included in the RBS dependencies of `#{from_gem}`, but the type definition as a stdlib in rbs-gem is deprecated. Delete `#{name}` from the RBS dependencies of `#{from_gem}`."
|
181
|
+
}
|
182
|
+
assign_gem(name: name, version: nil)
|
183
|
+
return
|
184
|
+
end
|
185
|
+
else
|
186
|
+
# From `gems:` of a `rbs_collection.yaml`
|
187
|
+
RBS.logger.warn {
|
188
|
+
"`#{name}` as a stdlib in rbs-gem is deprecated. Add `#{name}` (#{version}) to the dependency of your Ruby program to use the gem-bundled type definition."
|
189
|
+
}
|
190
|
+
end
|
162
191
|
end
|
163
192
|
|
164
193
|
source = Sources::Stdlib.instance
|
@@ -66,8 +66,8 @@ module RBS
|
|
66
66
|
def sources
|
67
67
|
@sources ||= [
|
68
68
|
Sources::Rubygems.instance,
|
69
|
-
Sources
|
70
|
-
|
69
|
+
*@data['sources'].map { |c| Sources.from_config_entry(c, base_directory: @config_path.dirname) },
|
70
|
+
Sources::Stdlib.instance
|
71
71
|
]
|
72
72
|
end
|
73
73
|
|
@@ -113,6 +113,11 @@ module RBS
|
|
113
113
|
# @type var loaded: Array[[AST::Declarations::t, Pathname, source]]
|
114
114
|
loaded = []
|
115
115
|
|
116
|
+
# For migrating stringio to stdlib
|
117
|
+
if @core_root && libs.none? { |lib| lib.name == 'stringio' }
|
118
|
+
add(library: 'stringio', version: nil)
|
119
|
+
end
|
120
|
+
|
116
121
|
each_signature do |source, path, buffer, decls, dirs|
|
117
122
|
decls.each do |decl|
|
118
123
|
loaded << [decl, path, source]
|
data/lib/rbs/prototype/rb.rb
CHANGED
@@ -368,7 +368,7 @@ module RBS
|
|
368
368
|
when node.children[0].is_a?(Symbol)
|
369
369
|
TypeName.new(name: node.children[0], namespace: Namespace.empty)
|
370
370
|
else
|
371
|
-
const_to_name!(node.children[0])
|
371
|
+
const_to_name!(node.children[0], context: context)
|
372
372
|
end
|
373
373
|
|
374
374
|
value_node = node.children.last
|
@@ -429,13 +429,13 @@ module RBS
|
|
429
429
|
end
|
430
430
|
end
|
431
431
|
|
432
|
-
def const_to_name!(node)
|
432
|
+
def const_to_name!(node, context: nil)
|
433
433
|
case node.type
|
434
434
|
when :CONST
|
435
435
|
TypeName.new(name: node.children[0], namespace: Namespace.empty)
|
436
436
|
when :COLON2
|
437
437
|
if node.children[0]
|
438
|
-
namespace = const_to_name!(node.children[0]).to_namespace
|
438
|
+
namespace = const_to_name!(node.children[0], context: context).to_namespace
|
439
439
|
else
|
440
440
|
namespace = Namespace.empty
|
441
441
|
end
|
@@ -443,6 +443,10 @@ module RBS
|
|
443
443
|
TypeName.new(name: node.children[1], namespace: namespace)
|
444
444
|
when :COLON3
|
445
445
|
TypeName.new(name: node.children[0], namespace: Namespace.root)
|
446
|
+
when :SELF
|
447
|
+
raise if context.nil?
|
448
|
+
|
449
|
+
context.namespace.to_type_name
|
446
450
|
else
|
447
451
|
raise
|
448
452
|
end
|
data/lib/rbs/types.rb
CHANGED
@@ -521,13 +521,20 @@ module RBS
|
|
521
521
|
def initialize(all_fields: nil, fields: nil, location:)
|
522
522
|
case
|
523
523
|
when fields && all_fields.nil?
|
524
|
-
@all_fields = fields.
|
524
|
+
@all_fields = fields.transform_values { |v| [v, true] }
|
525
525
|
@fields = fields
|
526
526
|
@optional_fields = {}
|
527
527
|
when all_fields && fields.nil?
|
528
528
|
@all_fields = all_fields
|
529
|
-
@fields =
|
530
|
-
@optional_fields =
|
529
|
+
@fields = {}
|
530
|
+
@optional_fields = {}
|
531
|
+
all_fields.each do |(k, (v, required))|
|
532
|
+
if required
|
533
|
+
@fields[k] = v
|
534
|
+
else
|
535
|
+
@optional_fields[k] = v
|
536
|
+
end
|
537
|
+
end
|
531
538
|
else
|
532
539
|
raise ArgumentError, "only one of `:fields` or `:all_fields` is requireds"
|
533
540
|
end
|
data/lib/rbs/version.rb
CHANGED
data/sig/ancestor_graph.rbs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module RBS
|
2
|
-
# AncestorGraph is a utility class that helps iterating through ancestors and
|
2
|
+
# AncestorGraph is a utility class that helps iterating through ancestors and descendants of a class/module
|
3
3
|
#
|
4
4
|
# ```ruby
|
5
5
|
# graph = AncestorGraph.new(env: env, ancestor_builder: ancestor_builder)
|
@@ -2,6 +2,10 @@ module RBS
|
|
2
2
|
module Collection
|
3
3
|
class Config
|
4
4
|
class LockfileGenerator
|
5
|
+
# Name of stdlibs that was rbs-bundled stdlib but is now a gem.
|
6
|
+
#
|
7
|
+
ALUMNI_STDLIBS: Hash[String, String]
|
8
|
+
|
5
9
|
class GemfileLockMismatchError < StandardError
|
6
10
|
@expected: Pathname
|
7
11
|
|
@@ -43,7 +47,11 @@ module RBS
|
|
43
47
|
#
|
44
48
|
def assign_gem: (name: String, version: String?, ?skip: bool) -> void
|
45
49
|
|
46
|
-
|
50
|
+
# Assign a gem from stdlib to lockfile
|
51
|
+
#
|
52
|
+
# `from_gem` is a String when the stdlib is assigned through the `dependencies:` in `manifest.yaml` of a gem.
|
53
|
+
#
|
54
|
+
def assign_stdlib: (name: String, ?from_gem: String) -> void
|
47
55
|
|
48
56
|
# Find a source of a gem from ones registered in `config.sources`
|
49
57
|
#
|
data/sig/definition.rbs
CHANGED
@@ -27,7 +27,7 @@ module RBS
|
|
27
27
|
# Annotations given to the overload associated to the method type
|
28
28
|
attr_reader overload_annotations: Array[AST::Annotation]
|
29
29
|
|
30
|
-
#
|
30
|
+
# Concatenation of `member_annotations` and `overload_annotations`
|
31
31
|
attr_reader annotations: Array[AST::Annotation]
|
32
32
|
|
33
33
|
def initialize: (type: MethodType, member: method_member, defined_in: TypeName, implemented_in: TypeName?, ?overload_annotations: Array[AST::Annotation]) -> void
|
data/sig/definition_builder.rbs
CHANGED
@@ -157,7 +157,7 @@ module RBS
|
|
157
157
|
# Returns a substitution that corresponds to type application
|
158
158
|
#
|
159
159
|
# ```
|
160
|
-
# tapp_subst(`::Array`, [`::Integer`]) # =>
|
160
|
+
# tapp_subst(`::Array`, [`::Integer`]) # => Substitution.build([:Elem], [`::Integer`])
|
161
161
|
# ```
|
162
162
|
#
|
163
163
|
def tapp_subst: (TypeName, Array[Types::t]) -> Substitution
|
data/sig/environment.rbs
CHANGED
@@ -233,7 +233,7 @@ module RBS
|
|
233
233
|
def normalize_type_name?: (TypeName) -> (TypeName | nil | false)
|
234
234
|
|
235
235
|
# Normalize the type name or raises an error
|
236
|
-
#
|
236
|
+
#
|
237
237
|
def normalize_type_name!: (TypeName) -> TypeName
|
238
238
|
|
239
239
|
# Returns a normalized module/class name or a type name with a normalized namespace
|
data/sig/prototype/rb.rbs
CHANGED
@@ -44,7 +44,7 @@ module RBS
|
|
44
44
|
# Returns a type name that represents the name of the constant.
|
45
45
|
# `node` must be _constant_ node, `CONST`, `COLON2`, or `COLON3` node.
|
46
46
|
#
|
47
|
-
def const_to_name!: (RubyVM::AbstractSyntaxTree::Node node) -> TypeName
|
47
|
+
def const_to_name!: (RubyVM::AbstractSyntaxTree::Node node, ?context: Context?) -> TypeName
|
48
48
|
|
49
49
|
# Returns a type name that represents the name of the constant.
|
50
50
|
# `node` can be `SELF` for `extend self` pattern.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RBS
|
2
|
-
# TypeAliasDependency calculates the
|
2
|
+
# TypeAliasDependency calculates the dependencies between type aliases
|
3
3
|
#
|
4
4
|
# The dependencies are normalized automatically.
|
5
5
|
#
|
@@ -12,7 +12,7 @@ module RBS
|
|
12
12
|
#
|
13
13
|
attr_reader direct_dependencies: Hash[TypeName, Set[TypeName]]
|
14
14
|
|
15
|
-
# A hash table from type alias name to a hash name with keys of transitive
|
15
|
+
# A hash table from type alias name to a hash name with keys of transitive dependencies
|
16
16
|
#
|
17
17
|
# The source type name and dependencies are normalized.
|
18
18
|
#
|
@@ -71,7 +71,7 @@ module RBS
|
|
71
71
|
def initialize: (env: Environment) -> void
|
72
72
|
|
73
73
|
# Returns `Diagnostic` instance if the alias type is nonregular.
|
74
|
-
#
|
74
|
+
# Returns `nil` if the alias type is regular.
|
75
75
|
#
|
76
76
|
# Normalizes the given type name automatically.
|
77
77
|
#
|
data/sig/type_param.rbs
CHANGED
@@ -75,7 +75,7 @@ module RBS
|
|
75
75
|
|
76
76
|
def to_s: () -> String
|
77
77
|
|
78
|
-
# Validates TypeParams if it refers another
|
78
|
+
# Validates TypeParams if it refers another optional type params
|
79
79
|
#
|
80
80
|
# * Returns array of TypeParam objects that refers other optional type params
|
81
81
|
# * Returns `nil` if all type params are valid
|
@@ -86,7 +86,7 @@ module RBS
|
|
86
86
|
#
|
87
87
|
def self.application: (Array[TypeParam], Array[Types::t]) -> Substitution?
|
88
88
|
|
89
|
-
# Returns an array of type args, that fills
|
89
|
+
# Returns an array of type args, that fills omitted types with the defaults
|
90
90
|
#
|
91
91
|
# ```rbs
|
92
92
|
# interface _Foo[T, S = untyped]
|
@@ -102,7 +102,7 @@ module RBS
|
|
102
102
|
# _Foo[String, Integer, untyped] # => _Foo[String, Integer, untyped] (Keeping extra args)
|
103
103
|
# ```
|
104
104
|
#
|
105
|
-
# Note that it allows
|
105
|
+
# Note that it allows invalid arities, returning the `args` immediately.
|
106
106
|
#
|
107
107
|
def self.normalize_args: (Array[TypeParam], Array[Types::t]) -> Array[Types::t]
|
108
108
|
end
|
data/sig/vendorer.rbs
CHANGED
@@ -24,7 +24,7 @@ module RBS
|
|
24
24
|
# vendor/rbs/minitest-1.2.3 => Will include `minitest` library RBSs.
|
25
25
|
# ```
|
26
26
|
#
|
27
|
-
# The
|
27
|
+
# The vendored RBSs will be loaded through :dir source.
|
28
28
|
#
|
29
29
|
# ```rb
|
30
30
|
# loader = RBS::EnvironmentLoader.new(core_root: nil, repository: RBS::Repository.new(no_stdlib: true))
|
@@ -1,32 +1,38 @@
|
|
1
|
+
/*----------------------------------------------------------------------------*/
|
2
|
+
/* This file is generated by the templates/template.rb script and should not */
|
3
|
+
/* be modified manually. */
|
4
|
+
/* To change the template see */
|
5
|
+
/* templates/src/constants.c.erb */
|
6
|
+
/*----------------------------------------------------------------------------*/
|
7
|
+
|
1
8
|
#include "rbs_extension.h"
|
2
9
|
|
3
10
|
VALUE RBS_Parser;
|
4
11
|
|
5
12
|
VALUE RBS;
|
6
13
|
VALUE RBS_AST;
|
7
|
-
VALUE RBS_AST_Comment;
|
8
|
-
VALUE RBS_AST_Annotation;
|
9
|
-
VALUE RBS_AST_TypeParam;
|
10
|
-
|
11
14
|
VALUE RBS_AST_Declarations;
|
15
|
+
VALUE RBS_AST_Directives;
|
16
|
+
VALUE RBS_AST_Members;
|
17
|
+
VALUE RBS_Parser;
|
18
|
+
VALUE RBS_Types;
|
19
|
+
VALUE RBS_Types_Bases;
|
12
20
|
|
13
|
-
VALUE
|
21
|
+
VALUE RBS_AST_Annotation;
|
22
|
+
VALUE RBS_AST_Comment;
|
23
|
+
VALUE RBS_AST_Declarations_Class;
|
24
|
+
VALUE RBS_AST_Declarations_Class_Super;
|
25
|
+
VALUE RBS_AST_Declarations_ClassAlias;
|
14
26
|
VALUE RBS_AST_Declarations_Constant;
|
15
27
|
VALUE RBS_AST_Declarations_Global;
|
16
28
|
VALUE RBS_AST_Declarations_Interface;
|
17
29
|
VALUE RBS_AST_Declarations_Module;
|
18
30
|
VALUE RBS_AST_Declarations_Module_Self;
|
19
|
-
VALUE RBS_AST_Declarations_Class;
|
20
|
-
VALUE RBS_AST_Declarations_Class_Super;
|
21
31
|
VALUE RBS_AST_Declarations_ModuleAlias;
|
22
|
-
VALUE
|
23
|
-
|
24
|
-
VALUE RBS_AST_Directives;
|
32
|
+
VALUE RBS_AST_Declarations_TypeAlias;
|
25
33
|
VALUE RBS_AST_Directives_Use;
|
26
34
|
VALUE RBS_AST_Directives_Use_SingleClause;
|
27
35
|
VALUE RBS_AST_Directives_Use_WildcardClause;
|
28
|
-
|
29
|
-
VALUE RBS_AST_Members;
|
30
36
|
VALUE RBS_AST_Members_Alias;
|
31
37
|
VALUE RBS_AST_Members_AttrAccessor;
|
32
38
|
VALUE RBS_AST_Members_AttrReader;
|
@@ -41,10 +47,10 @@ VALUE RBS_AST_Members_MethodDefinition_Overload;
|
|
41
47
|
VALUE RBS_AST_Members_Prepend;
|
42
48
|
VALUE RBS_AST_Members_Private;
|
43
49
|
VALUE RBS_AST_Members_Public;
|
44
|
-
|
50
|
+
VALUE RBS_AST_TypeParam;
|
51
|
+
VALUE RBS_MethodType;
|
45
52
|
VALUE RBS_Namespace;
|
46
53
|
VALUE RBS_TypeName;
|
47
|
-
|
48
54
|
VALUE RBS_Types_Alias;
|
49
55
|
VALUE RBS_Types_Bases_Any;
|
50
56
|
VALUE RBS_Types_Bases_Bool;
|
@@ -55,13 +61,11 @@ VALUE RBS_Types_Bases_Nil;
|
|
55
61
|
VALUE RBS_Types_Bases_Self;
|
56
62
|
VALUE RBS_Types_Bases_Top;
|
57
63
|
VALUE RBS_Types_Bases_Void;
|
58
|
-
VALUE RBS_Types_Bases;
|
59
64
|
VALUE RBS_Types_Block;
|
60
65
|
VALUE RBS_Types_ClassInstance;
|
61
66
|
VALUE RBS_Types_ClassSingleton;
|
62
|
-
VALUE RBS_Types_Function_Param;
|
63
67
|
VALUE RBS_Types_Function;
|
64
|
-
VALUE
|
68
|
+
VALUE RBS_Types_Function_Param;
|
65
69
|
VALUE RBS_Types_Interface;
|
66
70
|
VALUE RBS_Types_Intersection;
|
67
71
|
VALUE RBS_Types_Literal;
|
@@ -70,9 +74,8 @@ VALUE RBS_Types_Proc;
|
|
70
74
|
VALUE RBS_Types_Record;
|
71
75
|
VALUE RBS_Types_Tuple;
|
72
76
|
VALUE RBS_Types_Union;
|
77
|
+
VALUE RBS_Types_UntypedFunction;
|
73
78
|
VALUE RBS_Types_Variable;
|
74
|
-
VALUE RBS_Types;
|
75
|
-
VALUE RBS_MethodType;
|
76
79
|
|
77
80
|
VALUE RBS_ParsingError;
|
78
81
|
|
@@ -83,29 +86,27 @@ void rbs__init_constants(void) {
|
|
83
86
|
IMPORT_CONSTANT(RBS_ParsingError, RBS, "ParsingError");
|
84
87
|
|
85
88
|
IMPORT_CONSTANT(RBS_AST, RBS, "AST");
|
86
|
-
IMPORT_CONSTANT(RBS_AST_Comment, RBS_AST, "Comment");
|
87
|
-
IMPORT_CONSTANT(RBS_AST_Annotation, RBS_AST, "Annotation");
|
88
|
-
IMPORT_CONSTANT(RBS_AST_TypeParam, RBS_AST, "TypeParam");
|
89
|
-
|
90
89
|
IMPORT_CONSTANT(RBS_AST_Declarations, RBS_AST, "Declarations");
|
90
|
+
IMPORT_CONSTANT(RBS_AST_Directives, RBS_AST, "Directives");
|
91
|
+
IMPORT_CONSTANT(RBS_AST_Members, RBS_AST, "Members");
|
92
|
+
IMPORT_CONSTANT(RBS_Types, RBS, "Types");
|
93
|
+
IMPORT_CONSTANT(RBS_Types_Bases, RBS_Types, "Bases");
|
91
94
|
|
92
|
-
IMPORT_CONSTANT(
|
95
|
+
IMPORT_CONSTANT(RBS_AST_Annotation, RBS_AST, "Annotation");
|
96
|
+
IMPORT_CONSTANT(RBS_AST_Comment, RBS_AST, "Comment");
|
97
|
+
IMPORT_CONSTANT(RBS_AST_Declarations_Class, RBS_AST_Declarations, "Class");
|
98
|
+
IMPORT_CONSTANT(RBS_AST_Declarations_Class_Super, RBS_AST_Declarations_Class, "Super");
|
99
|
+
IMPORT_CONSTANT(RBS_AST_Declarations_ClassAlias, RBS_AST_Declarations, "ClassAlias");
|
93
100
|
IMPORT_CONSTANT(RBS_AST_Declarations_Constant, RBS_AST_Declarations, "Constant");
|
94
101
|
IMPORT_CONSTANT(RBS_AST_Declarations_Global, RBS_AST_Declarations, "Global");
|
95
102
|
IMPORT_CONSTANT(RBS_AST_Declarations_Interface, RBS_AST_Declarations, "Interface");
|
96
103
|
IMPORT_CONSTANT(RBS_AST_Declarations_Module, RBS_AST_Declarations, "Module");
|
97
104
|
IMPORT_CONSTANT(RBS_AST_Declarations_Module_Self, RBS_AST_Declarations_Module, "Self");
|
98
|
-
IMPORT_CONSTANT(RBS_AST_Declarations_Class, RBS_AST_Declarations, "Class");
|
99
|
-
IMPORT_CONSTANT(RBS_AST_Declarations_Class_Super, RBS_AST_Declarations_Class, "Super");
|
100
|
-
IMPORT_CONSTANT(RBS_AST_Declarations_ClassAlias, RBS_AST_Declarations, "ClassAlias");
|
101
105
|
IMPORT_CONSTANT(RBS_AST_Declarations_ModuleAlias, RBS_AST_Declarations, "ModuleAlias");
|
102
|
-
|
103
|
-
IMPORT_CONSTANT(RBS_AST_Directives, RBS_AST, "Directives");
|
106
|
+
IMPORT_CONSTANT(RBS_AST_Declarations_TypeAlias, RBS_AST_Declarations, "TypeAlias");
|
104
107
|
IMPORT_CONSTANT(RBS_AST_Directives_Use, RBS_AST_Directives, "Use");
|
105
108
|
IMPORT_CONSTANT(RBS_AST_Directives_Use_SingleClause, RBS_AST_Directives_Use, "SingleClause");
|
106
109
|
IMPORT_CONSTANT(RBS_AST_Directives_Use_WildcardClause, RBS_AST_Directives_Use, "WildcardClause");
|
107
|
-
|
108
|
-
IMPORT_CONSTANT(RBS_AST_Members, RBS_AST, "Members");
|
109
110
|
IMPORT_CONSTANT(RBS_AST_Members_Alias, RBS_AST_Members, "Alias");
|
110
111
|
IMPORT_CONSTANT(RBS_AST_Members_AttrAccessor, RBS_AST_Members, "AttrAccessor");
|
111
112
|
IMPORT_CONSTANT(RBS_AST_Members_AttrReader, RBS_AST_Members, "AttrReader");
|
@@ -120,12 +121,11 @@ void rbs__init_constants(void) {
|
|
120
121
|
IMPORT_CONSTANT(RBS_AST_Members_Prepend, RBS_AST_Members, "Prepend");
|
121
122
|
IMPORT_CONSTANT(RBS_AST_Members_Private, RBS_AST_Members, "Private");
|
122
123
|
IMPORT_CONSTANT(RBS_AST_Members_Public, RBS_AST_Members, "Public");
|
123
|
-
|
124
|
+
IMPORT_CONSTANT(RBS_AST_TypeParam, RBS_AST, "TypeParam");
|
125
|
+
IMPORT_CONSTANT(RBS_MethodType, RBS, "MethodType");
|
124
126
|
IMPORT_CONSTANT(RBS_Namespace, RBS, "Namespace");
|
125
127
|
IMPORT_CONSTANT(RBS_TypeName, RBS, "TypeName");
|
126
|
-
IMPORT_CONSTANT(RBS_Types, RBS, "Types");
|
127
128
|
IMPORT_CONSTANT(RBS_Types_Alias, RBS_Types, "Alias");
|
128
|
-
IMPORT_CONSTANT(RBS_Types_Bases, RBS_Types, "Bases");
|
129
129
|
IMPORT_CONSTANT(RBS_Types_Bases_Any, RBS_Types_Bases, "Any");
|
130
130
|
IMPORT_CONSTANT(RBS_Types_Bases_Bool, RBS_Types_Bases, "Bool");
|
131
131
|
IMPORT_CONSTANT(RBS_Types_Bases_Bottom, RBS_Types_Bases, "Bottom");
|
@@ -139,7 +139,6 @@ void rbs__init_constants(void) {
|
|
139
139
|
IMPORT_CONSTANT(RBS_Types_ClassInstance, RBS_Types, "ClassInstance");
|
140
140
|
IMPORT_CONSTANT(RBS_Types_ClassSingleton, RBS_Types, "ClassSingleton");
|
141
141
|
IMPORT_CONSTANT(RBS_Types_Function, RBS_Types, "Function");
|
142
|
-
IMPORT_CONSTANT(RBS_Types_UntypedFunction, RBS_Types, "UntypedFunction");
|
143
142
|
IMPORT_CONSTANT(RBS_Types_Function_Param, RBS_Types_Function, "Param");
|
144
143
|
IMPORT_CONSTANT(RBS_Types_Interface, RBS_Types, "Interface");
|
145
144
|
IMPORT_CONSTANT(RBS_Types_Intersection, RBS_Types, "Intersection");
|
@@ -149,6 +148,6 @@ void rbs__init_constants(void) {
|
|
149
148
|
IMPORT_CONSTANT(RBS_Types_Record, RBS_Types, "Record");
|
150
149
|
IMPORT_CONSTANT(RBS_Types_Tuple, RBS_Types, "Tuple");
|
151
150
|
IMPORT_CONSTANT(RBS_Types_Union, RBS_Types, "Union");
|
151
|
+
IMPORT_CONSTANT(RBS_Types_UntypedFunction, RBS_Types, "UntypedFunction");
|
152
152
|
IMPORT_CONSTANT(RBS_Types_Variable, RBS_Types, "Variable");
|
153
|
-
IMPORT_CONSTANT(RBS_MethodType, RBS, "MethodType");
|
154
153
|
}
|