tapioca 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/lib/tapioca/cli.rb +9 -10
  4. data/lib/tapioca/commands/annotations.rb +2 -2
  5. data/lib/tapioca/commands/check_shims.rb +2 -2
  6. data/lib/tapioca/commands/command.rb +2 -2
  7. data/lib/tapioca/commands/command_without_tracker.rb +18 -0
  8. data/lib/tapioca/commands/configure.rb +3 -3
  9. data/lib/tapioca/commands/dsl.rb +10 -10
  10. data/lib/tapioca/commands/gem.rb +5 -5
  11. data/lib/tapioca/commands/require.rb +2 -2
  12. data/lib/tapioca/commands/todo.rb +2 -2
  13. data/lib/tapioca/commands.rb +1 -0
  14. data/lib/tapioca/dsl/compiler.rb +3 -3
  15. data/lib/tapioca/dsl/compilers/aasm.rb +4 -4
  16. data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +1 -1
  17. data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -1
  18. data/lib/tapioca/dsl/compilers/active_job.rb +2 -2
  19. data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -1
  20. data/lib/tapioca/dsl/compilers/active_record_associations.rb +13 -13
  21. data/lib/tapioca/dsl/compilers/active_record_columns.rb +22 -22
  22. data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -1
  23. data/lib/tapioca/dsl/compilers/active_record_relations.rb +49 -39
  24. data/lib/tapioca/dsl/compilers/active_record_scope.rb +3 -3
  25. data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +2 -2
  26. data/lib/tapioca/dsl/compilers/active_storage.rb +2 -2
  27. data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +1 -1
  28. data/lib/tapioca/dsl/compilers/config.rb +2 -2
  29. data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -0
  30. data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -0
  31. data/lib/tapioca/dsl/compilers/identity_cache.rb +12 -12
  32. data/lib/tapioca/dsl/compilers/protobuf.rb +9 -9
  33. data/lib/tapioca/dsl/compilers/rails_generators.rb +2 -2
  34. data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -1
  35. data/lib/tapioca/dsl/compilers/smart_properties.rb +2 -2
  36. data/lib/tapioca/dsl/compilers/state_machines.rb +24 -24
  37. data/lib/tapioca/dsl/compilers/url_helpers.rb +1 -1
  38. data/lib/tapioca/dsl/compilers.rb +1 -1
  39. data/lib/tapioca/dsl/pipeline.rb +5 -4
  40. data/lib/tapioca/executor.rb +2 -2
  41. data/lib/tapioca/gem/events.rb +1 -1
  42. data/lib/tapioca/gem/listeners/foreign_constants.rb +3 -2
  43. data/lib/tapioca/gem/listeners/methods.rb +3 -3
  44. data/lib/tapioca/gem/listeners/mixins.rb +3 -7
  45. data/lib/tapioca/gem/listeners/source_location.rb +1 -1
  46. data/lib/tapioca/gem/listeners/subconstants.rb +1 -1
  47. data/lib/tapioca/gem/listeners/yard_doc.rb +1 -1
  48. data/lib/tapioca/gem/pipeline.rb +7 -3
  49. data/lib/tapioca/gemfile.rb +4 -4
  50. data/lib/tapioca/helpers/config_helper.rb +4 -4
  51. data/lib/tapioca/helpers/env_helper.rb +1 -0
  52. data/lib/tapioca/helpers/gem_helper.rb +17 -5
  53. data/lib/tapioca/helpers/rbi_files_helper.rb +3 -3
  54. data/lib/tapioca/helpers/rbi_helper.rb +1 -1
  55. data/lib/tapioca/helpers/sorbet_helper.rb +2 -2
  56. data/lib/tapioca/helpers/source_uri.rb +1 -1
  57. data/lib/tapioca/helpers/test/dsl_compiler.rb +1 -1
  58. data/lib/tapioca/loaders/dsl.rb +1 -1
  59. data/lib/tapioca/loaders/gem.rb +2 -2
  60. data/lib/tapioca/loaders/loader.rb +1 -1
  61. data/lib/tapioca/rbi_ext/model.rb +3 -3
  62. data/lib/tapioca/rbi_formatter.rb +2 -2
  63. data/lib/tapioca/runtime/generic_type_registry.rb +22 -2
  64. data/lib/tapioca/runtime/reflection.rb +8 -2
  65. data/lib/tapioca/runtime/trackers/autoload.rb +3 -0
  66. data/lib/tapioca/runtime/trackers/constant_definition.rb +13 -5
  67. data/lib/tapioca/runtime/trackers/mixin.rb +37 -36
  68. data/lib/tapioca/runtime/trackers/required_ancestor.rb +17 -4
  69. data/lib/tapioca/runtime/trackers/tracker.rb +45 -0
  70. data/lib/tapioca/runtime/trackers.rb +27 -1
  71. data/lib/tapioca/sorbet_ext/generic_name_patch.rb +17 -6
  72. data/lib/tapioca/version.rb +1 -1
  73. data/lib/tapioca.rb +0 -10
  74. metadata +4 -2
@@ -28,7 +28,7 @@ module T
28
28
  fixed,
29
29
  lower,
30
30
  upper,
31
- bounds_proc
31
+ bounds_proc,
32
32
  ).tap do |type_variable|
33
33
  Tapioca::Runtime::GenericTypeRegistry.register_type_variable(self, type_variable)
34
34
  end
@@ -44,7 +44,7 @@ module T
44
44
  fixed,
45
45
  lower,
46
46
  upper,
47
- bounds_proc
47
+ bounds_proc,
48
48
  ).tap do |type_variable|
49
49
  Tapioca::Runtime::GenericTypeRegistry.register_type_variable(self, type_variable)
50
50
  end
@@ -82,6 +82,8 @@ module T
82
82
  def coerce(val)
83
83
  if val.is_a?(Tapioca::TypeVariableModule)
84
84
  val.coerce_to_type_variable
85
+ elsif val.respond_to?(:__tapioca_override_type)
86
+ val.__tapioca_override_type
85
87
  else
86
88
  super
87
89
  end
@@ -128,7 +130,7 @@ module Tapioca
128
130
  fixed: T.untyped,
129
131
  lower: T.untyped,
130
132
  upper: T.untyped,
131
- bounds_proc: T.nilable(T.proc.returns(T::Hash[Symbol, T.untyped]))
133
+ bounds_proc: T.nilable(T.proc.returns(T::Hash[Symbol, T.untyped])),
132
134
  ).void
133
135
  end
134
136
  def initialize(context, type, variance, fixed, lower, upper, bounds_proc)
@@ -164,10 +166,14 @@ module Tapioca
164
166
  constant_name&.split("::")&.last
165
167
  end
166
168
 
169
+ sig { returns(T::Boolean) }
170
+ def fixed?
171
+ bounds.key?(:fixed)
172
+ end
173
+
167
174
  sig { returns(String) }
168
175
  def serialize
169
- bounds = @bounds_proc.call
170
- fixed = bounds[:fixed].to_s if bounds.key?(:fixed)
176
+ fixed = bounds[:fixed].to_s if fixed?
171
177
  lower = bounds[:lower].to_s if bounds.key?(:lower)
172
178
  upper = bounds[:upper].to_s if bounds.key?(:upper)
173
179
 
@@ -176,7 +182,7 @@ module Tapioca
176
182
  @variance,
177
183
  fixed,
178
184
  upper,
179
- lower
185
+ lower,
180
186
  )
181
187
  end
182
188
 
@@ -213,5 +219,10 @@ module Tapioca
213
219
  ensure
214
220
  self.class.send(:remove_const, temp_name) if temp_name
215
221
  end
222
+
223
+ sig { returns(T::Hash[Symbol, T.untyped]) }
224
+ def bounds
225
+ @bounds ||= @bounds_proc.call
226
+ end
216
227
  end
217
228
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.10.1"
5
+ VERSION = "0.10.2"
6
6
  end
data/lib/tapioca.rb CHANGED
@@ -11,16 +11,6 @@ module Tapioca
11
11
  class << self
12
12
  extend T::Sig
13
13
 
14
- sig { params(trace_name: Symbol, block: T.proc.params(arg0: TracePoint).void).void }
15
- def register_trace(trace_name, &block)
16
- @traces << TracePoint.trace(trace_name, &block)
17
- end
18
-
19
- sig { void }
20
- def disable_traces
21
- @traces.each(&:disable)
22
- end
23
-
24
14
  sig do
25
15
  type_parameters(:Result)
26
16
  .params(blk: T.proc.returns(T.type_parameter(:Result)))
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.10.1
4
+ version: 0.10.2
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: 2022-09-14 00:00:00.000000000 Z
14
+ date: 2022-09-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -168,6 +168,7 @@ files:
168
168
  - lib/tapioca/commands/annotations.rb
169
169
  - lib/tapioca/commands/check_shims.rb
170
170
  - lib/tapioca/commands/command.rb
171
+ - lib/tapioca/commands/command_without_tracker.rb
171
172
  - lib/tapioca/commands/configure.rb
172
173
  - lib/tapioca/commands/dsl.rb
173
174
  - lib/tapioca/commands/gem.rb
@@ -258,6 +259,7 @@ files:
258
259
  - lib/tapioca/runtime/trackers/constant_definition.rb
259
260
  - lib/tapioca/runtime/trackers/mixin.rb
260
261
  - lib/tapioca/runtime/trackers/required_ancestor.rb
262
+ - lib/tapioca/runtime/trackers/tracker.rb
261
263
  - lib/tapioca/sorbet_ext/fixed_hash_patch.rb
262
264
  - lib/tapioca/sorbet_ext/generic_name_patch.rb
263
265
  - lib/tapioca/sorbet_ext/name_patch.rb