tapioca 0.11.12 → 0.11.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/tapioca/dsl/compiler.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_job.rb +29 -4
- data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +6 -1
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +16 -3
- data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +35 -24
- data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -1
- data/lib/tapioca/dsl/compilers/graphql_mutation.rb +9 -4
- data/lib/tapioca/dsl/helpers/graphql_type_helper.rb +33 -7
- data/lib/tapioca/dsl/pipeline.rb +7 -3
- data/lib/tapioca/gem/listeners/methods.rb +1 -2
- data/lib/tapioca/gem/listeners/sorbet_signatures.rb +3 -2
- data/lib/tapioca/helpers/env_helper.rb +1 -1
- data/lib/tapioca/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52388d4c8afe40a2b6807e54bf1dd09701cb016ca1fed7ce5d3a691c3f93e0e5
|
4
|
+
data.tar.gz: 18550aa93626f63257b387154585dc2ae9e74c5aa17c7d4e2b82702bf5ce5b2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0be5c5d8108519bbda67d2498ff032273ad855a45c464a5a0acf0780412e7f4d3ee706322ef287fd2882ee0083f3c3fe1ab67611a16a6f45f5aa5a7aeb1a709
|
7
|
+
data.tar.gz: 6a87ab2319905c976cfb0b6a004c12d613a9200269268c6c452f8f7ba9175a1b7fd29c5d32de945a04614aff1de037463ad3c0fd090f883770a7f72d7f2f1476
|
data/README.md
CHANGED
@@ -86,6 +86,7 @@ Options:
|
|
86
86
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
87
87
|
# Default: sorbet/tapioca/config.yml
|
88
88
|
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
|
89
|
+
# Default: false
|
89
90
|
|
90
91
|
```
|
91
92
|
<!-- END_HELP -->
|
@@ -119,6 +120,7 @@ Options:
|
|
119
120
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
120
121
|
# Default: sorbet/tapioca/config.yml
|
121
122
|
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
|
123
|
+
# Default: false
|
122
124
|
|
123
125
|
Get project ready for type checking
|
124
126
|
```
|
@@ -167,14 +169,17 @@ Options:
|
|
167
169
|
[--file-header], [--no-file-header] # Add a "This file is generated" header on top of each generated RBI file
|
168
170
|
# Default: true
|
169
171
|
[--all], [--no-all] # Regenerate RBI files for all gems
|
172
|
+
# Default: false
|
170
173
|
--pre, -b, [--prerequire=file] # A file to be required before Bundler.require is called
|
171
174
|
--post, -a, [--postrequire=file] # A file to be required after Bundler.require is called
|
172
175
|
# Default: sorbet/tapioca/require.rb
|
173
176
|
-x, [--exclude=gem [gem ...]] # Exclude the given gem(s) from RBI generation
|
174
177
|
[--include-dependencies], [--no-include-dependencies] # Generate RBI files for dependencies of the given gem(s)
|
178
|
+
# Default: false
|
175
179
|
--typed, -t, [--typed-overrides=gem:level [gem:level ...]] # Override for typed sigils for generated gem RBIs
|
176
180
|
# Default: {"activesupport"=>"false"}
|
177
181
|
[--verify], [--no-verify] # Verify RBIs are up-to-date
|
182
|
+
# Default: false
|
178
183
|
[--doc], [--no-doc] # Include YARD documentation from sources when generating RBIs. Warning: this might be slow
|
179
184
|
# Default: true
|
180
185
|
[--loc], [--no-loc] # Include comments with source location when generating RBIs
|
@@ -195,6 +200,7 @@ Options:
|
|
195
200
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
196
201
|
# Default: sorbet/tapioca/config.yml
|
197
202
|
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
|
203
|
+
# Default: false
|
198
204
|
|
199
205
|
Generate RBIs from gems
|
200
206
|
```
|
@@ -350,7 +356,7 @@ Usage:
|
|
350
356
|
|
351
357
|
Options:
|
352
358
|
[--sources=one two three] # URIs of the sources to pull gem RBI annotations from
|
353
|
-
# Default:
|
359
|
+
# Default: "https://raw.githubusercontent.com/Shopify/rbi-central/main"
|
354
360
|
[--netrc], [--no-netrc] # Use .netrc to authenticate to private sources
|
355
361
|
# Default: true
|
356
362
|
[--netrc-file=NETRC_FILE] # Path to .netrc file
|
@@ -359,6 +365,7 @@ Options:
|
|
359
365
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
360
366
|
# Default: sorbet/tapioca/config.yml
|
361
367
|
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
|
368
|
+
# Default: false
|
362
369
|
|
363
370
|
Pull gem RBI annotations from remote sources
|
364
371
|
```
|
@@ -467,7 +474,9 @@ Options:
|
|
467
474
|
[--only=compiler [compiler ...]] # Only run supplied DSL compiler(s)
|
468
475
|
[--exclude=compiler [compiler ...]] # Exclude supplied DSL compiler(s)
|
469
476
|
[--verify], [--no-verify] # Verifies RBIs are up-to-date
|
477
|
+
# Default: false
|
470
478
|
-q, [--quiet], [--no-quiet] # Suppresses file creation output
|
479
|
+
# Default: false
|
471
480
|
-w, [--workers=N] # Number of parallel workers to use when generating RBIs (default: 2)
|
472
481
|
# Default: 2
|
473
482
|
[--rbi-max-line-length=N] # Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped
|
@@ -475,6 +484,7 @@ Options:
|
|
475
484
|
-e, [--environment=ENVIRONMENT] # The Rack/Rails environment to use when generating RBIs
|
476
485
|
# Default: development
|
477
486
|
-l, [--list-compilers], [--no-list-compilers] # List all loaded compilers
|
487
|
+
# Default: false
|
478
488
|
[--app-root=APP_ROOT] # The path to the Rails application
|
479
489
|
# Default: .
|
480
490
|
[--halt-upon-load-error], [--no-halt-upon-load-error] # Halt upon a load error while loading the Rails application
|
@@ -482,6 +492,7 @@ Options:
|
|
482
492
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
483
493
|
# Default: sorbet/tapioca/config.yml
|
484
494
|
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
|
495
|
+
# Default: false
|
485
496
|
|
486
497
|
Generate RBIs for dynamic methods
|
487
498
|
```
|
@@ -845,6 +856,7 @@ Options:
|
|
845
856
|
-c, [--config=<config file path>] # Path to the Tapioca configuration file
|
846
857
|
# Default: sorbet/tapioca/config.yml
|
847
858
|
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
|
859
|
+
# Default: false
|
848
860
|
|
849
861
|
Check duplicated definitions in shim RBIs
|
850
862
|
```
|
data/lib/tapioca/dsl/compiler.rb
CHANGED
@@ -36,7 +36,7 @@ module Tapioca
|
|
36
36
|
sig { returns(T::Set[Module]) }
|
37
37
|
def processable_constants
|
38
38
|
@processable_constants ||= T.let(
|
39
|
-
T::Set[Module].new(gather_constants)
|
39
|
+
T::Set[Module].new.compare_by_identity.merge(gather_constants),
|
40
40
|
T.nilable(T::Set[Module]),
|
41
41
|
)
|
42
42
|
end
|
@@ -30,8 +30,13 @@ module Tapioca
|
|
30
30
|
# # notify_user_job.rbi
|
31
31
|
# # typed: true
|
32
32
|
# class NotifyUserJob
|
33
|
-
# sig
|
34
|
-
#
|
33
|
+
# sig do
|
34
|
+
# params(
|
35
|
+
# user: User,
|
36
|
+
# block: T.nilable(T.proc.params(job: NotifyUserJob).void),
|
37
|
+
# ).returns(T.any(NotifyUserJob, FalseClass))
|
38
|
+
# end
|
39
|
+
# def self.perform_later(user, &block); end
|
35
40
|
#
|
36
41
|
# sig { params(user: User).returns(Mail) }
|
37
42
|
# def self.perform_now(user); end
|
@@ -48,13 +53,14 @@ module Tapioca
|
|
48
53
|
|
49
54
|
root.create_path(constant) do |job|
|
50
55
|
method = constant.instance_method(:perform)
|
56
|
+
constant_name = name_of(constant)
|
51
57
|
parameters = compile_method_parameters_to_rbi(method)
|
52
58
|
return_type = compile_method_return_type_to_rbi(method)
|
53
59
|
|
54
60
|
job.create_method(
|
55
61
|
"perform_later",
|
56
|
-
parameters: parameters,
|
57
|
-
return_type: "T.any(#{
|
62
|
+
parameters: perform_later_parameters(parameters, constant_name),
|
63
|
+
return_type: "T.any(#{constant_name}, FalseClass)",
|
58
64
|
class_method: true,
|
59
65
|
)
|
60
66
|
|
@@ -67,6 +73,25 @@ module Tapioca
|
|
67
73
|
end
|
68
74
|
end
|
69
75
|
|
76
|
+
private
|
77
|
+
|
78
|
+
sig do
|
79
|
+
params(
|
80
|
+
parameters: T::Array[RBI::TypedParam],
|
81
|
+
constant_name: T.nilable(String),
|
82
|
+
).returns(T::Array[RBI::TypedParam])
|
83
|
+
end
|
84
|
+
def perform_later_parameters(parameters, constant_name)
|
85
|
+
if ::Gem::Requirement.new(">= 7.0").satisfied_by?(::ActiveJob.gem_version)
|
86
|
+
parameters + [create_block_param(
|
87
|
+
"block",
|
88
|
+
type: "T.nilable(T.proc.params(job: #{constant_name}).void)",
|
89
|
+
)]
|
90
|
+
else
|
91
|
+
parameters
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
70
95
|
class << self
|
71
96
|
extend T::Sig
|
72
97
|
|
@@ -76,7 +76,12 @@ module Tapioca
|
|
76
76
|
Class.new do
|
77
77
|
T.unsafe(self).include(ActiveRecord::TestFixtures)
|
78
78
|
|
79
|
-
|
79
|
+
if respond_to?(:fixture_paths=)
|
80
|
+
T.unsafe(self).fixture_paths = [Rails.root.join("test", "fixtures")]
|
81
|
+
else
|
82
|
+
T.unsafe(self).fixture_path = Rails.root.join("test", "fixtures")
|
83
|
+
end
|
84
|
+
|
80
85
|
# https://github.com/rails/rails/blob/7c70791470fc517deb7c640bead9f1b47efb5539/activerecord/lib/active_record/test_fixtures.rb#L46
|
81
86
|
singleton_class.define_method(:file_fixture_path) do
|
82
87
|
Rails.root.join("test", "fixtures", "files")
|
@@ -126,6 +126,9 @@ module Tapioca
|
|
126
126
|
# include GeneratedAssociationRelationMethods
|
127
127
|
#
|
128
128
|
# sig { returns(T::Array[::Post]) }
|
129
|
+
# def to_a; end
|
130
|
+
#
|
131
|
+
# sig { returns(T::Array[::Post]) }
|
129
132
|
# def to_ary; end
|
130
133
|
#
|
131
134
|
# Elem = type_member { { fixed: ::Post } }
|
@@ -149,6 +152,9 @@ module Tapioca
|
|
149
152
|
# include GeneratedRelationMethods
|
150
153
|
#
|
151
154
|
# sig { returns(T::Array[::Post]) }
|
155
|
+
# def to_a; end
|
156
|
+
#
|
157
|
+
# sig { returns(T::Array[::Post]) }
|
152
158
|
# def to_ary; end
|
153
159
|
#
|
154
160
|
# Elem = type_member { { fixed: ::Post } }
|
@@ -226,6 +232,7 @@ module Tapioca
|
|
226
232
|
T::Array[Symbol],
|
227
233
|
)
|
228
234
|
BUILDER_METHODS = T.let([:new, :build, :create, :create!], T::Array[Symbol])
|
235
|
+
TO_ARRAY_METHODS = T.let([:to_ary, :to_a], T::Array[Symbol])
|
229
236
|
|
230
237
|
private
|
231
238
|
|
@@ -296,7 +303,9 @@ module Tapioca
|
|
296
303
|
klass.create_include(RelationMethodsModuleName)
|
297
304
|
klass.create_type_variable("Elem", type: "type_member", fixed: constant_name)
|
298
305
|
|
299
|
-
|
306
|
+
TO_ARRAY_METHODS.each do |method_name|
|
307
|
+
klass.create_method(method_name.to_s, return_type: "T::Array[#{constant_name}]")
|
308
|
+
end
|
300
309
|
end
|
301
310
|
|
302
311
|
create_relation_where_chain_class
|
@@ -312,7 +321,9 @@ module Tapioca
|
|
312
321
|
klass.create_include(AssociationRelationMethodsModuleName)
|
313
322
|
klass.create_type_variable("Elem", type: "type_member", fixed: constant_name)
|
314
323
|
|
315
|
-
|
324
|
+
TO_ARRAY_METHODS.each do |method_name|
|
325
|
+
klass.create_method(method_name.to_s, return_type: "T::Array[#{constant_name}]")
|
326
|
+
end
|
316
327
|
end
|
317
328
|
|
318
329
|
create_association_relation_where_chain_class
|
@@ -372,7 +383,9 @@ module Tapioca
|
|
372
383
|
klass.create_include(AssociationRelationMethodsModuleName)
|
373
384
|
klass.create_type_variable("Elem", type: "type_member", fixed: constant_name)
|
374
385
|
|
375
|
-
|
386
|
+
TO_ARRAY_METHODS.each do |method_name|
|
387
|
+
klass.create_method(method_name.to_s, return_type: "T::Array[#{constant_name}]")
|
388
|
+
end
|
376
389
|
create_collection_proxy_methods(klass)
|
377
390
|
end
|
378
391
|
end
|
@@ -40,23 +40,29 @@ module Tapioca
|
|
40
40
|
# # typed: true
|
41
41
|
#
|
42
42
|
# class Current
|
43
|
-
#
|
44
|
-
# def self.account; end
|
43
|
+
# include GeneratedAttributeMethods
|
45
44
|
#
|
46
|
-
#
|
47
|
-
#
|
45
|
+
# class << self
|
46
|
+
# sig { returns(T.untyped) }
|
47
|
+
# def account; end
|
48
48
|
#
|
49
|
-
#
|
50
|
-
#
|
49
|
+
# sig { params(account: T.untyped).returns(T.untyped) }
|
50
|
+
# def account=(account); end
|
51
51
|
#
|
52
|
-
#
|
53
|
-
#
|
52
|
+
# sig { params(user_id: Integer).void }
|
53
|
+
# def authenticate(user_id); end
|
54
54
|
#
|
55
|
-
#
|
56
|
-
#
|
55
|
+
# sig { returns(T.untyped) }
|
56
|
+
# def helper; end
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# module GeneratedAttributeMethods
|
60
|
+
# sig { returns(T.untyped) }
|
61
|
+
# def account; end
|
57
62
|
#
|
58
|
-
#
|
59
|
-
#
|
63
|
+
# sig { params(account: T.untyped).returns(T.untyped) }
|
64
|
+
# def account=(account); end
|
65
|
+
# end
|
60
66
|
# end
|
61
67
|
# ~~~
|
62
68
|
class ActiveSupportCurrentAttributes < Compiler
|
@@ -71,20 +77,25 @@ module Tapioca
|
|
71
77
|
return if dynamic_methods.empty? && instance_methods.empty?
|
72
78
|
|
73
79
|
root.create_path(constant) do |current_attributes|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
80
|
+
current_attributes_methods_name = "GeneratedAttributeMethods"
|
81
|
+
current_attributes.create_module(current_attributes_methods_name) do |generated_attribute_methods|
|
82
|
+
dynamic_methods.each do |method|
|
83
|
+
method = method.to_s
|
84
|
+
# We want to generate each method both on the class
|
85
|
+
generate_method(current_attributes, method, class_method: true)
|
86
|
+
# and on the instance
|
87
|
+
generate_method(generated_attribute_methods, method, class_method: false)
|
88
|
+
end
|
81
89
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
90
|
+
instance_methods.each do |method|
|
91
|
+
# instance methods are only elevated to class methods
|
92
|
+
# no need to add separate instance methods for them
|
93
|
+
method = constant.instance_method(method)
|
94
|
+
create_method_from_def(current_attributes, method, class_method: true)
|
95
|
+
end
|
87
96
|
end
|
97
|
+
|
98
|
+
current_attributes.create_include(current_attributes_methods_name)
|
88
99
|
end
|
89
100
|
end
|
90
101
|
|
@@ -55,7 +55,7 @@ module Tapioca
|
|
55
55
|
root.create_path(constant) do |input_object|
|
56
56
|
arguments.each do |argument|
|
57
57
|
name = argument.keyword.to_s
|
58
|
-
input_object.create_method(name, return_type: Helpers::GraphqlTypeHelper.type_for(argument))
|
58
|
+
input_object.create_method(name, return_type: Helpers::GraphqlTypeHelper.type_for(argument, constant))
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -59,7 +59,7 @@ module Tapioca
|
|
59
59
|
params = compile_method_parameters_to_rbi(method_def).map do |param|
|
60
60
|
name = param.param.name
|
61
61
|
argument = arguments_by_name.fetch(name, nil)
|
62
|
-
create_typed_param(param.param, argument_type(argument))
|
62
|
+
create_typed_param(param.param, argument_type(argument, constant))
|
63
63
|
end
|
64
64
|
|
65
65
|
root.create_path(constant) do |mutation|
|
@@ -67,11 +67,16 @@ module Tapioca
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
sig
|
71
|
-
|
70
|
+
sig do
|
71
|
+
params(
|
72
|
+
argument: T.nilable(GraphQL::Schema::Argument),
|
73
|
+
constant: T.class_of(GraphQL::Schema::Mutation),
|
74
|
+
).returns(String)
|
75
|
+
end
|
76
|
+
def argument_type(argument, constant)
|
72
77
|
return "T.untyped" unless argument
|
73
78
|
|
74
|
-
Helpers::GraphqlTypeHelper.type_for(argument)
|
79
|
+
Helpers::GraphqlTypeHelper.type_for(argument, constant)
|
75
80
|
end
|
76
81
|
|
77
82
|
class << self
|
@@ -9,8 +9,13 @@ module Tapioca
|
|
9
9
|
|
10
10
|
extend T::Sig
|
11
11
|
|
12
|
-
sig
|
13
|
-
|
12
|
+
sig do
|
13
|
+
params(
|
14
|
+
argument: GraphQL::Schema::Argument,
|
15
|
+
constant: T.any(T.class_of(GraphQL::Schema::Mutation), T.class_of(GraphQL::Schema::InputObject)),
|
16
|
+
).returns(String)
|
17
|
+
end
|
18
|
+
def type_for(argument, constant)
|
14
19
|
type = if argument.loads
|
15
20
|
loads_type = ::GraphQL::Schema::Wrapper.new(argument.loads)
|
16
21
|
loads_type = loads_type.to_list_type if argument.type.list?
|
@@ -19,6 +24,7 @@ module Tapioca
|
|
19
24
|
else
|
20
25
|
argument.type
|
21
26
|
end
|
27
|
+
|
22
28
|
unwrapped_type = type.unwrap
|
23
29
|
|
24
30
|
parsed_type = case unwrapped_type
|
@@ -50,11 +56,7 @@ module Tapioca
|
|
50
56
|
signature = Runtime::Reflection.signature_of(method)
|
51
57
|
return_type = signature&.return_type
|
52
58
|
|
53
|
-
|
54
|
-
return_type.to_s
|
55
|
-
else
|
56
|
-
"T.untyped"
|
57
|
-
end
|
59
|
+
valid_return_type?(return_type) ? return_type.to_s : "T.untyped"
|
58
60
|
when GraphQL::Schema::InputObject.singleton_class
|
59
61
|
type_for_constant(unwrapped_type)
|
60
62
|
when Module
|
@@ -63,6 +65,17 @@ module Tapioca
|
|
63
65
|
"T.untyped"
|
64
66
|
end
|
65
67
|
|
68
|
+
if argument.prepare.is_a?(Symbol) || argument.prepare.is_a?(String)
|
69
|
+
if constant.respond_to?(argument.prepare)
|
70
|
+
prepare_method = constant.method(argument.prepare)
|
71
|
+
prepare_signature = Runtime::Reflection.signature_of(prepare_method)
|
72
|
+
|
73
|
+
if valid_return_type?(prepare_signature&.return_type)
|
74
|
+
parsed_type = prepare_signature.return_type&.to_s
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
66
79
|
if type.list?
|
67
80
|
parsed_type = "T::Array[#{parsed_type}]"
|
68
81
|
end
|
@@ -78,6 +91,14 @@ module Tapioca
|
|
78
91
|
|
79
92
|
sig { params(constant: Module).returns(String) }
|
80
93
|
def type_for_constant(constant)
|
94
|
+
if constant.instance_methods.include?(:prepare)
|
95
|
+
prepare_method = constant.instance_method(:prepare)
|
96
|
+
|
97
|
+
prepare_signature = Runtime::Reflection.signature_of(prepare_method)
|
98
|
+
|
99
|
+
return prepare_signature.return_type&.to_s if valid_return_type?(prepare_signature&.return_type)
|
100
|
+
end
|
101
|
+
|
81
102
|
Runtime::Reflection.qualified_name_of(constant) || "T.untyped"
|
82
103
|
end
|
83
104
|
|
@@ -85,6 +106,11 @@ module Tapioca
|
|
85
106
|
def has_replaceable_default?(argument)
|
86
107
|
!!argument.replace_null_with_default? && !argument.default_value.nil?
|
87
108
|
end
|
109
|
+
|
110
|
+
sig { params(return_type: T.nilable(T::Types::Base)).returns(T::Boolean) }
|
111
|
+
def valid_return_type?(return_type)
|
112
|
+
!!return_type && !(T::Private::Types::Void === return_type || T::Private::Types::NotTyped === return_type)
|
113
|
+
end
|
88
114
|
end
|
89
115
|
end
|
90
116
|
end
|
data/lib/tapioca/dsl/pipeline.rb
CHANGED
@@ -130,7 +130,10 @@ module Tapioca
|
|
130
130
|
|
131
131
|
sig { params(requested_constants: T::Array[Module], requested_paths: T::Array[Pathname]).returns(T::Set[Module]) }
|
132
132
|
def gather_constants(requested_constants, requested_paths)
|
133
|
-
constants =
|
133
|
+
constants = Set.new.compare_by_identity
|
134
|
+
active_compilers.each do |compiler|
|
135
|
+
constants.merge(compiler.processable_constants)
|
136
|
+
end
|
134
137
|
constants = filter_anonymous_and_reloaded_constants(constants)
|
135
138
|
|
136
139
|
constants &= requested_constants unless requested_constants.empty? && requested_paths.empty?
|
@@ -158,11 +161,12 @@ module Tapioca
|
|
158
161
|
|
159
162
|
# Look up all the constants back from their names. The resulting constant set will be the
|
160
163
|
# set of constants that are actually in memory with those names.
|
161
|
-
constants_by_name
|
164
|
+
filtered_constants = constants_by_name
|
162
165
|
.keys
|
163
166
|
.map { |name| T.cast(Runtime::Reflection.constantize(name), Module) }
|
164
167
|
.select { |mod| Runtime::Reflection.constant_defined?(mod) }
|
165
|
-
|
168
|
+
|
169
|
+
Set.new.compare_by_identity.merge(filtered_constants)
|
166
170
|
end
|
167
171
|
|
168
172
|
sig { params(constant: Module).returns(T.nilable(RBI::File)) }
|
@@ -97,12 +97,11 @@ module Tapioca
|
|
97
97
|
# method and the parameter is required and there is a single
|
98
98
|
# parameter and the signature also defines a single parameter and
|
99
99
|
# the name of the method ends with a = character.
|
100
|
-
writer_method_with_sig =
|
100
|
+
writer_method_with_sig =
|
101
101
|
signature && type == :req &&
|
102
102
|
parameters.size == 1 &&
|
103
103
|
signature.arg_types.size == 1 &&
|
104
104
|
method_name[-1] == "="
|
105
|
-
)
|
106
105
|
|
107
106
|
if writer_method_with_sig
|
108
107
|
method_name.delete_suffix("=")
|
@@ -67,8 +67,9 @@ module Tapioca
|
|
67
67
|
sig { params(signature: T.untyped).returns(T::Boolean) }
|
68
68
|
def signature_final?(signature)
|
69
69
|
modules_with_final = T::Private::Methods.instance_variable_get(:@modules_with_final)
|
70
|
-
|
71
|
-
|
70
|
+
# In https://github.com/sorbet/sorbet/pull/7531, Sorbet changed internal hashes to be compared by identity,
|
71
|
+
# starting on version 0.5.11155
|
72
|
+
final_methods = modules_with_final[signature.owner] || modules_with_final[signature.owner.object_id]
|
72
73
|
return false unless final_methods
|
73
74
|
|
74
75
|
final_methods.include?(signature.method_name)
|
@@ -11,7 +11,7 @@ module Tapioca
|
|
11
11
|
sig { params(options: T::Hash[Symbol, T.untyped]).void }
|
12
12
|
def set_environment(options) # rubocop:disable Naming/AccessorMethodName
|
13
13
|
ENV["RAILS_ENV"] = ENV["RACK_ENV"] = options[:environment]
|
14
|
-
ENV["
|
14
|
+
ENV["RUBY_DEBUG_LAZY"] = "1"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/tapioca/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapioca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ufuk Kayserilioglu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2023-
|
14
|
+
date: 2023-12-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: '0'
|
295
295
|
requirements: []
|
296
|
-
rubygems_version: 3.4.
|
296
|
+
rubygems_version: 3.4.22
|
297
297
|
signing_key:
|
298
298
|
specification_version: 4
|
299
299
|
summary: A Ruby Interface file generator for gems, core types and the Ruby standard
|