tapioca 0.17.9 → 0.17.10

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/tapioca/commands/abstract_dsl.rb +21 -2
  4. data/lib/tapioca/commands/abstract_gem.rb +20 -1
  5. data/lib/tapioca/commands/annotations.rb +7 -1
  6. data/lib/tapioca/commands/check_shims.rb +9 -1
  7. data/lib/tapioca/dsl/compiler.rb +17 -12
  8. data/lib/tapioca/dsl/compilers/aasm.rb +2 -2
  9. data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +2 -2
  10. data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -1
  11. data/lib/tapioca/dsl/compilers/action_text.rb +1 -1
  12. data/lib/tapioca/dsl/compilers/active_job.rb +1 -1
  13. data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -1
  14. data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +1 -1
  15. data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +1 -1
  16. data/lib/tapioca/dsl/compilers/active_record_associations.rb +1 -1
  17. data/lib/tapioca/dsl/compilers/active_record_columns.rb +8 -2
  18. data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +1 -1
  19. data/lib/tapioca/dsl/compilers/active_record_enum.rb +1 -1
  20. data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -1
  21. data/lib/tapioca/dsl/compilers/active_record_relations.rb +12 -81
  22. data/lib/tapioca/dsl/compilers/active_record_scope.rb +1 -1
  23. data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +1 -1
  24. data/lib/tapioca/dsl/compilers/active_record_store.rb +1 -1
  25. data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +1 -1
  26. data/lib/tapioca/dsl/compilers/active_resource.rb +1 -1
  27. data/lib/tapioca/dsl/compilers/active_storage.rb +2 -2
  28. data/lib/tapioca/dsl/compilers/active_support_concern.rb +6 -6
  29. data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +1 -1
  30. data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +1 -1
  31. data/lib/tapioca/dsl/compilers/config.rb +2 -2
  32. data/lib/tapioca/dsl/compilers/frozen_record.rb +1 -1
  33. data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -1
  34. data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -1
  35. data/lib/tapioca/dsl/compilers/identity_cache.rb +2 -2
  36. data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +1 -1
  37. data/lib/tapioca/dsl/compilers/kredis.rb +1 -1
  38. data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +2 -2
  39. data/lib/tapioca/dsl/compilers/protobuf.rb +2 -2
  40. data/lib/tapioca/dsl/compilers/rails_generators.rb +1 -1
  41. data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -1
  42. data/lib/tapioca/dsl/compilers/smart_properties.rb +1 -1
  43. data/lib/tapioca/dsl/compilers/state_machines.rb +2 -2
  44. data/lib/tapioca/dsl/compilers/url_helpers.rb +7 -7
  45. data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +3 -1
  46. data/lib/tapioca/dsl/helpers/graphql_type_helper.rb +18 -3
  47. data/lib/tapioca/dsl/pipeline.rb +25 -11
  48. data/lib/tapioca/gem/events.rb +15 -8
  49. data/lib/tapioca/gem/listeners/methods.rb +19 -7
  50. data/lib/tapioca/gem/listeners/mixins.rb +3 -3
  51. data/lib/tapioca/gem/listeners/sorbet_type_variables.rb +1 -1
  52. data/lib/tapioca/gem/pipeline.rb +25 -18
  53. data/lib/tapioca/gemfile.rb +1 -1
  54. data/lib/tapioca/helpers/config_helper.rb +5 -1
  55. data/lib/tapioca/helpers/rbi_files_helper.rb +8 -1
  56. data/lib/tapioca/loaders/gem.rb +14 -2
  57. data/lib/tapioca/rbi_ext/model.rb +9 -2
  58. data/lib/tapioca/repo_index.rb +1 -1
  59. data/lib/tapioca/runtime/attached_class_of_32.rb +1 -1
  60. data/lib/tapioca/runtime/attached_class_of_legacy.rb +1 -1
  61. data/lib/tapioca/runtime/dynamic_mixin_compiler.rb +6 -6
  62. data/lib/tapioca/runtime/generic_type_registry.rb +8 -8
  63. data/lib/tapioca/runtime/reflection.rb +19 -19
  64. data/lib/tapioca/runtime/trackers/constant_definition.rb +3 -3
  65. data/lib/tapioca/runtime/trackers/method_definition.rb +4 -4
  66. data/lib/tapioca/runtime/trackers/mixin.rb +5 -5
  67. data/lib/tapioca/runtime/trackers/required_ancestor.rb +2 -2
  68. data/lib/tapioca/runtime/trackers/tracker.rb +1 -1
  69. data/lib/tapioca/sorbet_ext/generic_name_patch.rb +1 -1
  70. data/lib/tapioca/static/requires_compiler.rb +1 -1
  71. data/lib/tapioca/version.rb +1 -1
  72. metadata +1 -1
@@ -77,7 +77,7 @@ module Tapioca
77
77
  extend T::Sig
78
78
 
79
79
  # @override
80
- #: -> T::Enumerable[Module]
80
+ #: -> Enumerable[T::Module[top]]
81
81
  def gather_constants
82
82
  all_classes.select { |c| GraphQL::Schema::InputObject > c }
83
83
  end
@@ -74,7 +74,7 @@ module Tapioca
74
74
  extend T::Sig
75
75
 
76
76
  # @override
77
- #: -> T::Enumerable[Module]
77
+ #: -> Enumerable[T::Module[top]]
78
78
  def gather_constants
79
79
  all_classes.select { |c| GraphQL::Schema::Mutation > c && GraphQL::Schema::RelayClassicMutation != c }
80
80
  end
@@ -59,7 +59,7 @@ module Tapioca
59
59
  class IdentityCache < Compiler
60
60
  extend T::Sig
61
61
 
62
- COLLECTION_TYPE = ->(type) { "T::Array[::#{type}]" } #: ^((Module | String) type) -> String
62
+ COLLECTION_TYPE = ->(type) { "T::Array[::#{type}]" } #: ^((T::Module[top] | String) type) -> String
63
63
 
64
64
  # @override
65
65
  #: -> void
@@ -95,7 +95,7 @@ module Tapioca
95
95
  extend T::Sig
96
96
 
97
97
  # @override
98
- #: -> T::Enumerable[Module]
98
+ #: -> Enumerable[T::Module[top]]
99
99
  def gather_constants
100
100
  descendants_of(::ActiveRecord::Base).select do |klass|
101
101
  ::IdentityCache::WithoutPrimaryIndex > klass
@@ -109,7 +109,7 @@ module Tapioca
109
109
  extend T::Sig
110
110
 
111
111
  # @override
112
- #: -> T::Enumerable[Module]
112
+ #: -> Enumerable[T::Module[top]]
113
113
  def gather_constants
114
114
  all_modules.select do |c|
115
115
  name_of(c) && ::JsonApiClient::Resource > c
@@ -88,7 +88,7 @@ module Tapioca
88
88
  extend T::Sig
89
89
 
90
90
  # @override
91
- #: -> T::Enumerable[Module]
91
+ #: -> Enumerable[T::Module[top]]
92
92
  def gather_constants
93
93
  all_classes
94
94
  .grep(::Kredis::Attributes::ClassMethods)
@@ -44,7 +44,7 @@ module Tapioca
44
44
  # end
45
45
  # end
46
46
  # ~~~
47
- #: [ConstantType = Module]
47
+ #: [ConstantType = T::Module[top]]
48
48
  class MixedInClassAttributes < Compiler
49
49
  extend T::Sig
50
50
 
@@ -63,7 +63,7 @@ module Tapioca
63
63
  extend T::Sig
64
64
 
65
65
  # @override
66
- #: -> T::Enumerable[Module]
66
+ #: -> Enumerable[T::Module[top]]
67
67
  def gather_constants
68
68
  # Select all non-anonymous modules that have overridden Module.included
69
69
  all_modules.select do |mod|
@@ -156,7 +156,7 @@ module Tapioca
156
156
  extend T::Sig
157
157
 
158
158
  # @override
159
- #: -> T::Enumerable[Module]
159
+ #: -> Enumerable[T::Module[top]]
160
160
  def gather_constants
161
161
  marker = Google::Protobuf::MessageExts::ClassMethods
162
162
 
@@ -168,7 +168,7 @@ module Tapioca
168
168
  else
169
169
  T.cast(
170
170
  ObjectSpace.each_object(marker).to_a,
171
- T::Array[Module],
171
+ T::Array[T::Module[T.anything]],
172
172
  )
173
173
  end
174
174
 
@@ -60,7 +60,7 @@ module Tapioca
60
60
  extend T::Sig
61
61
 
62
62
  # @override
63
- #: -> T::Enumerable[Module]
63
+ #: -> Enumerable[T::Module[top]]
64
64
  def gather_constants
65
65
  all_classes.select do |const|
66
66
  name = qualified_name_of(const)
@@ -87,7 +87,7 @@ module Tapioca
87
87
  extend T::Sig
88
88
 
89
89
  # @override
90
- #: -> T::Enumerable[Module]
90
+ #: -> Enumerable[T::Module[top]]
91
91
  def gather_constants
92
92
  all_classes.select { |c| Sidekiq::Worker > c }
93
93
  end
@@ -84,7 +84,7 @@ module Tapioca
84
84
  extend T::Sig
85
85
 
86
86
  # @override
87
- #: -> T::Enumerable[Module]
87
+ #: -> Enumerable[T::Module[top]]
88
88
  def gather_constants
89
89
  all_modules.select do |c|
90
90
  name_of(c) &&
@@ -109,7 +109,7 @@ module Tapioca
109
109
  # end
110
110
  # end
111
111
  # ~~~
112
- #: [ConstantType = (Module & ::StateMachines::ClassMethods)]
112
+ #: [ConstantType = (T::Module[top] & ::StateMachines::ClassMethods)]
113
113
  class StateMachines < Compiler
114
114
  extend T::Sig
115
115
 
@@ -158,7 +158,7 @@ module Tapioca
158
158
  extend T::Sig
159
159
 
160
160
  # @override
161
- #: -> T::Enumerable[Module]
161
+ #: -> Enumerable[T::Module[top]]
162
162
  def gather_constants
163
163
  all_classes.select { |mod| ::StateMachines::InstanceMethods > mod }
164
164
  end
@@ -78,7 +78,7 @@ module Tapioca
78
78
  # include GeneratedUrlHelpersModule
79
79
  # end
80
80
  # ~~~
81
- #: [ConstantType = Module]
81
+ #: [ConstantType = T::Module[top]]
82
82
  class UrlHelpers < Compiler
83
83
  extend T::Sig
84
84
 
@@ -99,7 +99,7 @@ module Tapioca
99
99
  class << self
100
100
  extend T::Sig
101
101
  # @override
102
- #: -> T::Enumerable[Module]
102
+ #: -> Enumerable[T::Module[top]]
103
103
  def gather_constants
104
104
  return [] unless defined?(Rails.application) && Rails.application
105
105
 
@@ -131,7 +131,7 @@ module Tapioca
131
131
  constants.concat(NON_DISCOVERABLE_INCLUDERS).push(GeneratedUrlHelpersModule, GeneratedPathHelpersModule)
132
132
  end
133
133
 
134
- #: -> Array[Module]
134
+ #: -> Array[T::Module[top]]
135
135
  def gather_non_discoverable_includers
136
136
  [].tap do |includers|
137
137
  if defined?(ActionController::TemplateAssertions) && defined?(ActionDispatch::IntegrationTest)
@@ -146,7 +146,7 @@ module Tapioca
146
146
 
147
147
  # Returns `true` if `mod` "directly" includes `helper`.
148
148
  # For classes, this method will return false if the `helper` is included only by a superclass
149
- #: (Module mod, Module helper) -> bool
149
+ #: (T::Module[top] mod, T::Module[top] helper) -> bool
150
150
  private def includes_helper?(mod, helper)
151
151
  ancestors = ancestors_of(mod)
152
152
 
@@ -161,11 +161,11 @@ module Tapioca
161
161
  end
162
162
  end
163
163
 
164
- NON_DISCOVERABLE_INCLUDERS = gather_non_discoverable_includers #: Array[Module]
164
+ NON_DISCOVERABLE_INCLUDERS = gather_non_discoverable_includers #: Array[T::Module[top]]
165
165
 
166
166
  private
167
167
 
168
- #: (RBI::Tree root, Module constant) -> void
168
+ #: (RBI::Tree root, T::Module[top] constant) -> void
169
169
  def generate_module_for(root, constant)
170
170
  root.create_module(T.must(constant.name)) do |mod|
171
171
  mod.create_include("::ActionDispatch::Routing::UrlFor")
@@ -181,7 +181,7 @@ module Tapioca
181
181
  end
182
182
  end
183
183
 
184
- #: (RBI::Scope mod, Module helper_module) -> void
184
+ #: (RBI::Scope mod, T::Module[top] helper_module) -> void
185
185
  def create_mixins_for(mod, helper_module)
186
186
  include_helper = constant.ancestors.include?(helper_module) || NON_DISCOVERABLE_INCLUDERS.include?(constant)
187
187
  extend_helper = constant.singleton_class.ancestors.include?(helper_module)
@@ -22,7 +22,9 @@ module Tapioca
22
22
  class << self
23
23
  extend T::Sig
24
24
 
25
- #: (Hash[String, untyped] options) { (String value, ColumnTypeOption default_column_type_option) -> void } -> ColumnTypeOption
25
+ #: (
26
+ #| Hash[String, untyped] options,
27
+ #| ) { (String value, ColumnTypeOption default_column_type_option) -> void } -> ColumnTypeOption
26
28
  def from_options(options, &block)
27
29
  column_type_option = Persisted
28
30
  value = options["ActiveRecordColumnTypes"]
@@ -9,7 +9,10 @@ module Tapioca
9
9
 
10
10
  extend T::Sig
11
11
 
12
- #: (GraphQL::Schema::Argument argument, (singleton(GraphQL::Schema::Mutation) | singleton(GraphQL::Schema::InputObject)) constant) -> String
12
+ #: (
13
+ #| GraphQL::Schema::Argument argument,
14
+ #| (singleton(GraphQL::Schema::Mutation) | singleton(GraphQL::Schema::InputObject)) constant
15
+ #| ) -> String
13
16
  def type_for_argument(argument, constant)
14
17
  type = if argument.loads
15
18
  loads_type = ::GraphQL::Schema::Wrapper.new(argument.loads)
@@ -34,7 +37,19 @@ module Tapioca
34
37
  )
35
38
  end
36
39
 
37
- #: ((GraphQL::Schema::Wrapper | singleton(GraphQL::Schema::Scalar) | singleton(GraphQL::Schema::Enum) | singleton(GraphQL::Schema::Union) | singleton(GraphQL::Schema::Object) | singleton(GraphQL::Schema::Interface) | singleton(GraphQL::Schema::InputObject)) type, ?ignore_nilable_wrapper: bool, ?prepare_method: Method?) -> String
40
+ #: (
41
+ #| (
42
+ #| GraphQL::Schema::Wrapper |
43
+ #| singleton(GraphQL::Schema::Scalar) |
44
+ #| singleton(GraphQL::Schema::Enum) |
45
+ #| singleton(GraphQL::Schema::Union) |
46
+ #| singleton(GraphQL::Schema::Object) |
47
+ #| singleton(GraphQL::Schema::Interface) |
48
+ #| singleton(GraphQL::Schema::InputObject)
49
+ #| ) type,
50
+ #| ?ignore_nilable_wrapper: bool,
51
+ #| ?prepare_method: Method?
52
+ #| ) -> String
38
53
  def type_for(type, ignore_nilable_wrapper: false, prepare_method: nil)
39
54
  unwrapped_type = type.unwrap
40
55
 
@@ -97,7 +112,7 @@ module Tapioca
97
112
 
98
113
  private
99
114
 
100
- #: (Module constant) -> String
115
+ #: (T::Module[top] constant) -> String
101
116
  def type_for_constant(constant)
102
117
  if constant.instance_methods.include?(:prepare)
103
118
  prepare_method = constant.instance_method(:prepare)
@@ -6,16 +6,16 @@ module Tapioca
6
6
  class Pipeline
7
7
  extend T::Sig
8
8
 
9
- #: T::Enumerable[singleton(Compiler)]
9
+ #: Enumerable[singleton(Compiler)]
10
10
  attr_reader :active_compilers
11
11
 
12
- #: Array[Module]
12
+ #: Array[T::Module[top]]
13
13
  attr_reader :requested_constants
14
14
 
15
15
  #: Array[Pathname]
16
16
  attr_reader :requested_paths
17
17
 
18
- #: Array[Module]
18
+ #: Array[T::Module[top]]
19
19
  attr_reader :skipped_constants
20
20
 
21
21
  #: ^(String error) -> void
@@ -24,7 +24,17 @@ module Tapioca
24
24
  #: Array[String]
25
25
  attr_reader :errors
26
26
 
27
- #: (requested_constants: Array[Module], ?requested_paths: Array[Pathname], ?requested_compilers: Array[singleton(Compiler)], ?excluded_compilers: Array[singleton(Compiler)], ?error_handler: ^(String error) -> void, ?skipped_constants: Array[Module], ?number_of_workers: Integer?, ?compiler_options: Hash[String, untyped], ?lsp_addon: bool) -> void
27
+ #: (
28
+ #| requested_constants: Array[T::Module[top]],
29
+ #| ?requested_paths: Array[Pathname],
30
+ #| ?requested_compilers: Array[singleton(Compiler)],
31
+ #| ?excluded_compilers: Array[singleton(Compiler)],
32
+ #| ?error_handler: ^(String error) -> void,
33
+ #| ?skipped_constants: Array[T::Module[top]],
34
+ #| ?number_of_workers: Integer?,
35
+ #| ?compiler_options: Hash[String, untyped],
36
+ #| ?lsp_addon: bool
37
+ #| ) -> void
28
38
  def initialize(
29
39
  requested_constants:,
30
40
  requested_paths: [],
@@ -48,7 +58,7 @@ module Tapioca
48
58
  @errors = [] #: Array[String]
49
59
  end
50
60
 
51
- #: [T] { (Module constant, RBI::File rbi) -> T } -> Array[T]
61
+ #: [R] { (T::Module[top] constant, RBI::File rbi) -> R } -> Array[R]
52
62
  def run(&blk)
53
63
  constants_to_process = gather_constants(requested_constants, requested_paths, skipped_constants)
54
64
  .select { |c| Module === c } # Filter value constants out
@@ -111,7 +121,7 @@ module Tapioca
111
121
 
112
122
  private
113
123
 
114
- #: (Array[singleton(Compiler)] requested_compilers, Array[singleton(Compiler)] excluded_compilers) -> T::Enumerable[singleton(Compiler)]
124
+ #: (Array[singleton(Compiler)] requested_compilers, Array[singleton(Compiler)] excluded_compilers) -> Enumerable[singleton(Compiler)]
115
125
  def gather_active_compilers(requested_compilers, excluded_compilers)
116
126
  active_compilers = compilers
117
127
  active_compilers -= excluded_compilers
@@ -119,7 +129,11 @@ module Tapioca
119
129
  active_compilers
120
130
  end
121
131
 
122
- #: (Array[Module] requested_constants, Array[Pathname] requested_paths, Array[Module] skipped_constants) -> Set[Module]
132
+ #: (
133
+ #| Array[T::Module[top]] requested_constants,
134
+ #| Array[Pathname] requested_paths,
135
+ #| Array[T::Module[top]] skipped_constants
136
+ #| ) -> Set[T::Module[top]]
123
137
  def gather_constants(requested_constants, requested_paths, skipped_constants)
124
138
  Compiler.requested_constants = requested_constants
125
139
  constants = Set.new.compare_by_identity
@@ -141,14 +155,14 @@ module Tapioca
141
155
  constants
142
156
  end
143
157
 
144
- #: (Set[Module] constants) -> Set[Module]
158
+ #: (Set[T::Module[top]] constants) -> Set[T::Module[top]]
145
159
  def filter_anonymous_and_reloaded_constants(constants)
146
160
  # Group constants by their names
147
161
  constants_by_name = constants
148
162
  .group_by { |c| Runtime::Reflection.name_of(c) }
149
163
  .select { |name, _| !name.nil? }
150
164
 
151
- constants_by_name = T.cast(constants_by_name, T::Hash[String, T::Array[Module]])
165
+ constants_by_name = T.cast(constants_by_name, T::Hash[String, T::Array[T::Module[T.anything]]])
152
166
 
153
167
  # Find the constants that have been reloaded
154
168
  reloaded_constants = constants_by_name.select { |_, constants| constants.size > 1 }.keys
@@ -164,13 +178,13 @@ module Tapioca
164
178
  # set of constants that are actually in memory with those names.
165
179
  filtered_constants = constants_by_name
166
180
  .keys
167
- .map { |name| T.cast(Runtime::Reflection.constantize(name), Module) }
181
+ .map { |name| T.cast(Runtime::Reflection.constantize(name), T::Module[T.anything]) }
168
182
  .select { |mod| Runtime::Reflection.constant_defined?(mod) }
169
183
 
170
184
  Set.new.compare_by_identity.merge(filtered_constants)
171
185
  end
172
186
 
173
- #: (Module constant) -> RBI::File?
187
+ #: (T::Module[top] constant) -> RBI::File?
174
188
  def rbi_for_constant(constant)
175
189
  file = RBI::File.new(strictness: "true")
176
190
 
@@ -44,12 +44,12 @@ module Tapioca
44
44
  extend T::Sig
45
45
 
46
46
  # @override
47
- #: -> Module
47
+ #: -> T::Module[top]
48
48
  def constant
49
- T.cast(@constant, Module)
49
+ T.cast(@constant, T::Module[T.anything])
50
50
  end
51
51
 
52
- #: (String symbol, Module constant) -> void
52
+ #: (String symbol, T::Module[top] constant) -> void
53
53
  def initialize(symbol, constant)
54
54
  super
55
55
  end
@@ -62,10 +62,10 @@ module Tapioca
62
62
  #: String
63
63
  attr_reader :symbol
64
64
 
65
- #: Module
65
+ #: T::Module[top]
66
66
  attr_reader :constant
67
67
 
68
- #: (String symbol, Module constant) -> void
68
+ #: (String symbol, T::Module[top] constant) -> void
69
69
  def initialize(symbol, constant)
70
70
  super()
71
71
  @symbol = symbol
@@ -79,7 +79,7 @@ module Tapioca
79
79
  #: RBI::Const
80
80
  attr_reader :node
81
81
 
82
- #: (String symbol, Module constant, RBI::Const node) -> void
82
+ #: (String symbol, T::Module[top] constant, RBI::Const node) -> void
83
83
  def initialize(symbol, constant, node)
84
84
  super(symbol, constant)
85
85
  @node = node
@@ -92,7 +92,7 @@ module Tapioca
92
92
  #: RBI::Scope
93
93
  attr_reader :node
94
94
 
95
- #: (String symbol, Module constant, RBI::Scope node) -> void
95
+ #: (String symbol, T::Module[top] constant, RBI::Scope node) -> void
96
96
  def initialize(symbol, constant, node)
97
97
  super(symbol, constant)
98
98
  @node = node
@@ -116,7 +116,14 @@ module Tapioca
116
116
  #: Array[[Symbol, String]]
117
117
  attr_reader :parameters
118
118
 
119
- #: (String symbol, Module constant, UnboundMethod method, RBI::Method node, untyped signature, Array[[Symbol, String]] parameters) -> void
119
+ #: (
120
+ #| String symbol,
121
+ #| T::Module[top] constant,
122
+ #| UnboundMethod method,
123
+ #| RBI::Method node,
124
+ #| untyped signature,
125
+ #| Array[[Symbol, String]] parameters
126
+ #| ) -> void
120
127
  def initialize(symbol, constant, method, node, signature, parameters) # rubocop:disable Metrics/ParameterLists
121
128
  super(symbol, constant)
122
129
  @node = node
@@ -24,7 +24,13 @@ module Tapioca
24
24
  compile_directly_owned_methods(node, symbol, singleton_class_of(constant), attached_class: constant)
25
25
  end
26
26
 
27
- #: (RBI::Tree tree, String module_name, Module mod, ?Array[Symbol] for_visibility, ?attached_class: Module?) -> void
27
+ #: (
28
+ #| RBI::Tree tree,
29
+ #| String module_name,
30
+ #| T::Module[top] mod,
31
+ #| ?Array[Symbol] for_visibility,
32
+ #| ?attached_class: T::Module[top]?
33
+ #| ) -> void
28
34
  def compile_directly_owned_methods(
29
35
  tree,
30
36
  module_name,
@@ -52,7 +58,13 @@ module Tapioca
52
58
  end
53
59
  end
54
60
 
55
- #: (RBI::Tree tree, String symbol_name, Module constant, UnboundMethod? method, ?RBI::Visibility visibility) -> void
61
+ #: (
62
+ #| RBI::Tree tree,
63
+ #| String symbol_name,
64
+ #| T::Module[top] constant,
65
+ #| UnboundMethod? method,
66
+ #| ?RBI::Visibility visibility
67
+ #| ) -> void
56
68
  def compile_method(tree, symbol_name, constant, method, visibility = RBI::Public.new)
57
69
  return unless method
58
70
  return unless method_owned_by_constant?(method, constant)
@@ -159,7 +171,7 @@ module Tapioca
159
171
  # This method implements a better way of checking whether a constant defines a method.
160
172
  # It walks up the ancestor tree via the `super_method` method; if any of the super
161
173
  # methods are owned by the constant, it means that the constant declares the method.
162
- #: (UnboundMethod method, Module constant) -> bool
174
+ #: (UnboundMethod method, T::Module[top] constant) -> bool
163
175
  def method_owned_by_constant?(method, constant)
164
176
  # Widen the type of `method` to be nilable
165
177
  method = method #: UnboundMethod?
@@ -173,7 +185,7 @@ module Tapioca
173
185
  false
174
186
  end
175
187
 
176
- #: (Module mod) -> Hash[Symbol, Array[Symbol]]
188
+ #: (T::Module[top] mod) -> Hash[Symbol, Array[Symbol]]
177
189
  def method_names_by_visibility(mod)
178
190
  {
179
191
  public: public_instance_methods_of(mod),
@@ -182,7 +194,7 @@ module Tapioca
182
194
  }
183
195
  end
184
196
 
185
- #: (Module constant, String method_name) -> bool
197
+ #: (T::Module[top] constant, String method_name) -> bool
186
198
  def struct_method?(constant, method_name)
187
199
  return false unless T::Props::ClassMethods === constant
188
200
 
@@ -192,7 +204,7 @@ module Tapioca
192
204
  .include?(method_name.gsub(/=$/, "").to_sym)
193
205
  end
194
206
 
195
- #: (Module? attached_class, Symbol method_name) -> bool?
207
+ #: (T::Module[top]? attached_class, Symbol method_name) -> bool?
196
208
  def method_new_in_abstract_class?(attached_class, method_name)
197
209
  attached_class &&
198
210
  method_name == :new &&
@@ -200,7 +212,7 @@ module Tapioca
200
212
  Class === attached_class.singleton_class
201
213
  end
202
214
 
203
- #: (Module constant) -> UnboundMethod?
215
+ #: (T::Module[top] constant) -> UnboundMethod?
204
216
  def initialize_method_for(constant)
205
217
  constant.instance_method(:initialize)
206
218
  rescue
@@ -32,7 +32,7 @@ module Tapioca
32
32
  add_mixins(node, constant, extends.reverse, Runtime::Trackers::Mixin::Type::Extend)
33
33
  end
34
34
 
35
- #: (RBI::Tree tree, Module constant, Array[Module] mods, Runtime::Trackers::Mixin::Type mixin_type) -> void
35
+ #: (RBI::Tree tree, T::Module[top] constant, Array[T::Module[top]] mods, Runtime::Trackers::Mixin::Type mixin_type) -> void
36
36
  def add_mixins(tree, constant, mods, mixin_type)
37
37
  mods
38
38
  .select do |mod|
@@ -59,7 +59,7 @@ module Tapioca
59
59
  end
60
60
  end
61
61
 
62
- #: (Module constant, Module mixin, Runtime::Trackers::Mixin::Type mixin_type) -> bool
62
+ #: (T::Module[top] constant, T::Module[top] mixin, Runtime::Trackers::Mixin::Type mixin_type) -> bool
63
63
  def mixed_in_by_gem?(constant, mixin, mixin_type)
64
64
  mixin_location = Runtime::Trackers::Mixin.mixin_location(mixin, mixin_type, constant)
65
65
 
@@ -75,7 +75,7 @@ module Tapioca
75
75
  mixin_name.start_with?("T::") && !mixin_name.start_with?("T::Props")
76
76
  end
77
77
 
78
- #: (Module constant) -> Array[Module]
78
+ #: (T::Module[top] constant) -> Array[T::Module[top]]
79
79
  def interesting_ancestors_of(constant)
80
80
  inherited_ancestors = Set.new.compare_by_identity.merge(inherited_ancestors_of(constant))
81
81
 
@@ -24,7 +24,7 @@ module Tapioca
24
24
  node << sclass if sclass.nodes.length > 1
25
25
  end
26
26
 
27
- #: (RBI::Tree tree, Module constant) -> void
27
+ #: (RBI::Tree tree, T::Module[top] constant) -> void
28
28
  def compile_type_variable_declarations(tree, constant)
29
29
  # Try to find the type variables defined on this constant, bail if we can't
30
30
  type_variables = Runtime::GenericTypeRegistry.lookup_type_variables(constant)