tapioca 0.17.3 → 0.17.7

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/exe/tapioca +6 -1
  3. data/lib/ruby_lsp/tapioca/addon.rb +1 -1
  4. data/lib/ruby_lsp/tapioca/server_addon.rb +10 -7
  5. data/lib/tapioca/bundler_ext/auto_require_hook.rb +1 -4
  6. data/lib/tapioca/cli.rb +3 -3
  7. data/lib/tapioca/commands/abstract_dsl.rb +3 -4
  8. data/lib/tapioca/commands/abstract_gem.rb +2 -3
  9. data/lib/tapioca/commands/annotations.rb +2 -2
  10. data/lib/tapioca/commands/check_shims.rb +2 -2
  11. data/lib/tapioca/commands/command.rb +4 -6
  12. data/lib/tapioca/commands/command_without_tracker.rb +1 -4
  13. data/lib/tapioca/commands/gem_generate.rb +1 -1
  14. data/lib/tapioca/dsl/compiler.rb +8 -10
  15. data/lib/tapioca/dsl/compilers/aasm.rb +1 -2
  16. data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +1 -2
  17. data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -2
  18. data/lib/tapioca/dsl/compilers/action_text.rb +1 -2
  19. data/lib/tapioca/dsl/compilers/active_job.rb +1 -2
  20. data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -4
  21. data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +1 -4
  22. data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +1 -10
  23. data/lib/tapioca/dsl/compilers/active_record_associations.rb +1 -2
  24. data/lib/tapioca/dsl/compilers/active_record_columns.rb +1 -2
  25. data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +2 -3
  26. data/lib/tapioca/dsl/compilers/active_record_enum.rb +1 -2
  27. data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -1
  28. data/lib/tapioca/dsl/compilers/active_record_relations.rb +63 -91
  29. data/lib/tapioca/dsl/compilers/active_record_scope.rb +1 -2
  30. data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +1 -2
  31. data/lib/tapioca/dsl/compilers/active_record_store.rb +1 -2
  32. data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +1 -2
  33. data/lib/tapioca/dsl/compilers/active_resource.rb +1 -2
  34. data/lib/tapioca/dsl/compilers/active_storage.rb +1 -9
  35. data/lib/tapioca/dsl/compilers/active_support_concern.rb +1 -2
  36. data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +1 -2
  37. data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +1 -2
  38. data/lib/tapioca/dsl/compilers/config.rb +1 -2
  39. data/lib/tapioca/dsl/compilers/frozen_record.rb +1 -2
  40. data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -2
  41. data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -2
  42. data/lib/tapioca/dsl/compilers/identity_cache.rb +1 -2
  43. data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +1 -2
  44. data/lib/tapioca/dsl/compilers/kredis.rb +1 -4
  45. data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +1 -2
  46. data/lib/tapioca/dsl/compilers/protobuf.rb +1 -2
  47. data/lib/tapioca/dsl/compilers/rails_generators.rb +1 -2
  48. data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -2
  49. data/lib/tapioca/dsl/compilers/smart_properties.rb +21 -18
  50. data/lib/tapioca/dsl/compilers/state_machines.rb +1 -2
  51. data/lib/tapioca/dsl/compilers/url_helpers.rb +1 -2
  52. data/lib/tapioca/dsl/pipeline.rb +2 -2
  53. data/lib/tapioca/gem/events.rb +2 -6
  54. data/lib/tapioca/gem/listeners/base.rb +1 -4
  55. data/lib/tapioca/helpers/cli_helper.rb +1 -4
  56. data/lib/tapioca/helpers/config_helper.rb +2 -5
  57. data/lib/tapioca/helpers/env_helper.rb +1 -4
  58. data/lib/tapioca/helpers/rbi_files_helper.rb +3 -6
  59. data/lib/tapioca/helpers/test/content.rb +1 -4
  60. data/lib/tapioca/helpers/test/dsl_compiler.rb +1 -4
  61. data/lib/tapioca/helpers/test/isolation.rb +2 -7
  62. data/lib/tapioca/helpers/test/template.rb +1 -4
  63. data/lib/tapioca/loaders/loader.rb +4 -6
  64. data/lib/tapioca/rbs/rewriter.rb +1 -1
  65. data/lib/tapioca/repo_index.rb +0 -2
  66. data/lib/tapioca/runtime/attached_class_of_legacy.rb +1 -4
  67. data/lib/tapioca/runtime/trackers/method_definition.rb +2 -2
  68. data/lib/tapioca/runtime/trackers/tracker.rb +1 -4
  69. data/lib/tapioca/sorbet_ext/name_patch.rb +1 -1
  70. data/lib/tapioca/version.rb +1 -1
  71. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e446027e2b7e92d0a593cab8758e2c4ea86914b4e92af06c5ef4f9d102740a4e
4
- data.tar.gz: 688fb813c21f03b6d9536829d712b064fa8296ff6ccce973d4655c6f576fe37f
3
+ metadata.gz: d003e839857cc260e7b1ab86fd4a48d93efc53e4a43ac9ccac6c85d9a89e63a1
4
+ data.tar.gz: 900f2d0369802b0fac34f60c04e3c238cd68e439c1d6d60f4b9ed5d8c82770f0
5
5
  SHA512:
6
- metadata.gz: '08aaa410199a74707132460863b0cdc7396f5c62c12e8cfd700b6e9bf66aae2df2e77b5bc4818626380c7cfbfa61adeccca1deba7c66547a91e8047b4e65ccb3'
7
- data.tar.gz: 59e4b41df9b651a33eb66968d11813a563e29e9a0e43ab73566f33d3de1305be5be20386d1227f95596ebf9c67a4bef82d71dc327952a9e166f7674ff0212218
6
+ metadata.gz: b2f68a283b2499203877730fb5f981ed1e6c09c686a6c3e59297bea18361b5dd2d1831581f7b3edce6cf38936819544feeeebe59b1747520738542b0ae606ffe
7
+ data.tar.gz: '09769a8ab2aac1763cadecd013c9979c58d750c052f94c26eccfcbbd0a7ca07e0cb027c18e3737e90b90e85d4bebfca2fb4e8e559fdd9c4a0dd472ce5e59ee77'
data/exe/tapioca CHANGED
@@ -27,4 +27,9 @@ end
27
27
 
28
28
  require_relative "../lib/tapioca/internal"
29
29
 
30
- Tapioca::Cli.start(ARGV)
30
+ begin
31
+ Tapioca::Cli.start(ARGV)
32
+ rescue Tapioca::Error => e
33
+ warn(e.message)
34
+ exit(1)
35
+ end
@@ -1,7 +1,7 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.10", "< 0.25")
4
+ RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.10", "< 0.27")
5
5
 
6
6
  begin
7
7
  # The Tapioca add-on depends on the Rails add-on to add a runtime component to the runtime server. We can allow the
@@ -19,13 +19,16 @@ module RubyLsp
19
19
  when "load_compilers_and_extensions"
20
20
  # Load DSL extensions and compilers ahead of time, so that we don't have to pay the price of invoking
21
21
  # `Gem.find_files` on every execution, which is quite expensive
22
- @loader = ::Tapioca::Loaders::Dsl.new(
23
- tapioca_path: ::Tapioca::TAPIOCA_DIR,
24
- eager_load: false,
25
- app_root: params[:workspace_path],
26
- halt_upon_load_error: false,
27
- )
28
- @loader.load_dsl_extensions_and_compilers
22
+ with_notification_wrapper("load_compilers_and_extensions", "Loading DSL compilers") do
23
+ ::Tapioca::Dsl::Compiler.extend(T::Generic)
24
+ @loader = ::Tapioca::Loaders::Dsl.new(
25
+ tapioca_path: ::Tapioca::TAPIOCA_DIR,
26
+ eager_load: false,
27
+ app_root: params[:workspace_path],
28
+ halt_upon_load_error: false,
29
+ )
30
+ @loader.load_dsl_extensions_and_compilers
31
+ end
29
32
  when "dsl"
30
33
  fork do
31
34
  with_notification_wrapper("dsl", "Generating DSL RBIs") do
@@ -6,12 +6,9 @@ module Tapioca
6
6
  # This is a module that gets prepended to `Bundler::Dependency` and
7
7
  # makes sure even gems marked as `require: false` are required during
8
8
  # `Bundler.require`.
9
+ # @requires_ancestor: ::Bundler::Dependency
9
10
  module AutoRequireHook
10
11
  extend T::Sig
11
- extend T::Helpers
12
-
13
- requires_ancestor { ::Bundler::Dependency }
14
-
15
12
  @exclude = [] #: Array[String]
16
13
  @enabled = false #: bool
17
14
 
data/lib/tapioca/cli.rb CHANGED
@@ -353,7 +353,7 @@ module Tapioca
353
353
  default: {}
354
354
  def annotations
355
355
  if !options[:netrc] && options[:netrc_file]
356
- raise Thor::Error, set_color("Options `--no-netrc` and `--netrc-file` can't be used together", :bold, :red)
356
+ raise Tapioca::Error, set_color("Options `--no-netrc` and `--netrc-file` can't be used together", :bold, :red)
357
357
  end
358
358
 
359
359
  command = Commands::Annotations.new(
@@ -382,12 +382,12 @@ module Tapioca
382
382
  # Indicates that we are running from the LSP, set using the `addon_mode!` method
383
383
  attr_reader :addon_mode
384
384
 
385
- sig { void }
385
+ #: -> void
386
386
  def addon_mode!
387
387
  @addon_mode = true
388
388
  end
389
389
 
390
- sig { returns(T::Boolean) }
390
+ #: -> bool
391
391
  def exit_on_failure?
392
392
  !@addon_mode
393
393
  end
@@ -3,12 +3,11 @@
3
3
 
4
4
  module Tapioca
5
5
  module Commands
6
+ # @abstract
6
7
  class AbstractDsl < CommandWithoutTracker
7
8
  include SorbetHelper
8
9
  include RBIFilesHelper
9
10
 
10
- abstract!
11
-
12
11
  #: (requested_constants: Array[String], requested_paths: Array[Pathname], outpath: Pathname, only: Array[String], exclude: Array[String], file_header: bool, tapioca_path: String, ?skip_constant: Array[String], ?quiet: bool, ?verbose: bool, ?number_of_workers: Integer?, ?auto_strictness: bool, ?gem_dir: String, ?rbi_formatter: RBIFormatter, ?app_root: String, ?halt_upon_load_error: bool, ?compiler_options: Hash[String, untyped], ?lsp_addon: bool) -> void
13
12
  def initialize(
14
13
  requested_constants:,
@@ -161,7 +160,7 @@ module Tapioca
161
160
  remove_file(filename) if File.file?(filename)
162
161
  end
163
162
 
164
- raise Thor::Error, ""
163
+ raise Tapioca::Error, ""
165
164
  end
166
165
 
167
166
  processable_constants
@@ -296,7 +295,7 @@ module Tapioca
296
295
  build_error_for_files(cause, diff_for_cause.map(&:first))
297
296
  end.join("\n")
298
297
 
299
- raise Thor::Error, <<~ERROR
298
+ raise Tapioca::Error, <<~ERROR
300
299
  #{set_color("RBI files are out-of-date. In your development environment, please run:", :green)}
301
300
  #{set_color("`#{default_command(command)}`", :green, :bold)}
302
301
  #{set_color("Once it is complete, be sure to commit and push any changes", :green)}
@@ -3,12 +3,11 @@
3
3
 
4
4
  module Tapioca
5
5
  module Commands
6
+ # @abstract
6
7
  class AbstractGem < Command
7
8
  include SorbetHelper
8
9
  include RBIFilesHelper
9
10
 
10
- abstract!
11
-
12
11
  #: (gem_names: Array[String], exclude: Array[String], include_dependencies: bool, prerequire: String?, postrequire: String, typed_overrides: Hash[String, String], outpath: Pathname, file_header: bool, include_doc: bool, include_loc: bool, include_exported_rbis: bool, ?number_of_workers: Integer?, ?auto_strictness: bool, ?dsl_dir: String, ?rbi_formatter: RBIFormatter, ?halt_upon_load_error: bool, ?lsp_addon: bool?) -> void
13
12
  def initialize(
14
13
  gem_names:,
@@ -202,7 +201,7 @@ module Tapioca
202
201
  build_error_for_files(cause, diff_for_cause.map(&:first))
203
202
  end.join("\n")
204
203
 
205
- raise Thor::Error, <<~ERROR
204
+ raise Tapioca::Error, <<~ERROR
206
205
  #{set_color("RBI files are out-of-date. In your development environment, please run:", :green)}
207
206
  #{set_color("`#{default_command(command)}`", :green, :bold)}
208
207
  #{set_color("Once it is complete, be sure to commit and push any changes", :green)}
@@ -85,7 +85,7 @@ module Tapioca
85
85
  end
86
86
 
87
87
  if indexes.empty?
88
- raise Thor::Error, set_color("Can't fetch annotations without sources (no index fetched)", :bold, :red)
88
+ raise Tapioca::Error, set_color("Can't fetch annotations without sources (no index fetched)", :bold, :red)
89
89
  end
90
90
 
91
91
  indexes
@@ -125,7 +125,7 @@ module Tapioca
125
125
  fetched_gems.keys.map(&:name).sort
126
126
  end
127
127
 
128
- sig { params(repo_uris: T::Array[String], gem_info: GemInfo).returns(T::Boolean) }
128
+ #: (Array[String] repo_uris, GemInfo gem_info) -> bool
129
129
  def fetch_annotation(repo_uris, gem_info)
130
130
  gem_name = gem_info.name
131
131
  gem_version = gem_info.version
@@ -49,7 +49,7 @@ module Tapioca
49
49
  result = sorbet("--no-config --print=payload-sources:#{payload_path}")
50
50
 
51
51
  unless result.status
52
- raise Thor::Error, <<~ERROR
52
+ raise Tapioca::Error, <<~ERROR
53
53
  "Sorbet failed to dump payload"
54
54
  #{result.err}
55
55
  ERROR
@@ -87,7 +87,7 @@ module Tapioca
87
87
  "\nPlease remove the duplicated definitions from #{@shim_rbi_dir} and #{@todo_rbi_file}", :red
88
88
  )
89
89
 
90
- raise Thor::Error, messages.join("\n")
90
+ raise Tapioca::Error, messages.join("\n")
91
91
  end
92
92
 
93
93
  say("\nNo duplicates found in shim RBIs", :green)
@@ -3,10 +3,9 @@
3
3
 
4
4
  module Tapioca
5
5
  module Commands
6
+ # @abstract
6
7
  class Command
7
8
  extend T::Sig
8
- extend T::Helpers
9
-
10
9
  class FileWriter < Thor
11
10
  include Thor::Actions
12
11
  end
@@ -14,8 +13,6 @@ module Tapioca
14
13
  include Thor::Base
15
14
  include CliHelper
16
15
 
17
- abstract!
18
-
19
16
  #: -> void
20
17
  def initialize
21
18
  @file_writer = FileWriter.new #: Thor::Actions
@@ -31,8 +28,9 @@ module Tapioca
31
28
 
32
29
  private
33
30
 
34
- sig { abstract.void }
35
- def execute; end
31
+ # @abstract
32
+ #: -> void
33
+ def execute = raise NotImplementedError, "Abstract method called"
36
34
 
37
35
  #: (Symbol command, *String args) -> String
38
36
  def default_command(command, *args)
@@ -3,11 +3,8 @@
3
3
 
4
4
  module Tapioca
5
5
  module Commands
6
+ # @abstract
6
7
  class CommandWithoutTracker < Command
7
- extend T::Helpers
8
-
9
- abstract!
10
-
11
8
  #: -> void
12
9
  def initialize
13
10
  Tapioca::Runtime::Trackers.disable_all!
@@ -58,7 +58,7 @@ module Tapioca
58
58
  if gem.nil?
59
59
  next if @lsp_addon
60
60
 
61
- raise Thor::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
61
+ raise Tapioca::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
62
62
  end
63
63
 
64
64
  gems.concat(gem_dependencies(gem)) if @include_dependencies
@@ -3,19 +3,15 @@
3
3
 
4
4
  module Tapioca
5
5
  module Dsl
6
+ # @abstract
7
+ #: [ConstantType < Module]
6
8
  class Compiler
7
9
  extend T::Sig
8
- extend T::Helpers
9
- extend T::Generic
10
10
 
11
11
  include RBIHelper
12
12
  include Runtime::Reflection
13
13
  extend Runtime::Reflection
14
14
 
15
- ConstantType = type_member { { upper: Module } }
16
-
17
- abstract!
18
-
19
15
  #: ConstantType
20
16
  attr_reader :constant
21
17
 
@@ -35,8 +31,9 @@ module Tapioca
35
31
  processable_constants.include?(constant)
36
32
  end
37
33
 
38
- sig { abstract.returns(T::Enumerable[Module]) }
39
- def gather_constants; end
34
+ # @abstract
35
+ #: -> T::Enumerable[Module]
36
+ def gather_constants = raise NotImplementedError, "Abstract method called"
40
37
 
41
38
  #: -> Set[Module]
42
39
  def processable_constants
@@ -100,8 +97,9 @@ module Tapioca
100
97
  @pipeline.compiler_enabled?(compiler_name)
101
98
  end
102
99
 
103
- sig { abstract.void }
104
- def decorate; end
100
+ # @abstract
101
+ #: -> void
102
+ def decorate = raise NotImplementedError, "Abstract method called"
105
103
 
106
104
  # NOTE: This should eventually accept an `Error` object or `Exception` rather than simply a `String`.
107
105
  #: (String error) -> void
@@ -32,6 +32,7 @@ module Tapioca
32
32
  # sleeping?, running?, cleaning?
33
33
  # run, run!, run_without_validation!, may_run?
34
34
  #
35
+ #: [ConstantType = (Class[::AASM] & ::AASM::ClassMethods)]
35
36
  class AASM < Compiler
36
37
  extend T::Sig
37
38
 
@@ -68,8 +69,6 @@ module Tapioca
68
69
  "success",
69
70
  ].freeze #: Array[String]
70
71
 
71
- ConstantType = type_member { { fixed: T.all(T::Class[::AASM], ::AASM::ClassMethods) } }
72
-
73
72
  # @override
74
73
  #: -> void
75
74
  def decorate
@@ -61,11 +61,10 @@ module Tapioca
61
61
  # def helpers; end
62
62
  # end
63
63
  # ~~~
64
+ #: [ConstantType = singleton(::ActionController::Base)]
64
65
  class ActionControllerHelpers < Compiler
65
66
  extend T::Sig
66
67
 
67
- ConstantType = type_member { { fixed: T.class_of(::ActionController::Base) } }
68
-
69
68
  # @override
70
69
  #: -> void
71
70
  def decorate
@@ -29,11 +29,10 @@ module Tapioca
29
29
  # def self.notify_customer(customer_id); end
30
30
  # end
31
31
  # ~~~
32
+ #: [ConstantType = singleton(::ActionMailer::Base)]
32
33
  class ActionMailer < Compiler
33
34
  extend T::Sig
34
35
 
35
- ConstantType = type_member { { fixed: T.class_of(::ActionMailer::Base) } }
36
-
37
36
  # @override
38
37
  #: -> void
39
38
  def decorate
@@ -43,11 +43,10 @@ module Tapioca
43
43
  # def title?; end
44
44
  # end
45
45
  # ~~~
46
+ #: [ConstantType = singleton(::ActiveRecord::Base)]
46
47
  class ActionText < Compiler
47
48
  extend T::Sig
48
49
 
49
- ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
50
-
51
50
  # @override
52
51
  #: -> void
53
52
  def decorate
@@ -38,11 +38,10 @@ module Tapioca
38
38
  # def self.perform_now(user); end
39
39
  # end
40
40
  # ~~~
41
+ #: [ConstantType = singleton(::ActiveJob::Base)]
41
42
  class ActiveJob < Compiler
42
43
  extend T::Sig
43
44
 
44
- ConstantType = type_member { { fixed: T.class_of(::ActiveJob::Base) } }
45
-
46
45
  # @override
47
46
  #: -> void
48
47
  def decorate
@@ -34,13 +34,10 @@ module Tapioca
34
34
  # def name=(name); end
35
35
  # end
36
36
  # ~~~
37
+ #: [ConstantType = (Class[::ActiveModel::Attributes] & ::ActiveModel::Attributes::ClassMethods)]
37
38
  class ActiveModelAttributes < Compiler
38
39
  extend T::Sig
39
40
 
40
- ConstantType = type_member do
41
- { fixed: T.all(T::Class[::ActiveModel::Attributes], ::ActiveModel::Attributes::ClassMethods) }
42
- end
43
-
44
41
  # @override
45
42
  #: -> void
46
43
  def decorate
@@ -53,13 +53,10 @@ module Tapioca
53
53
  # def token_confirmation=(unencrypted_password); end
54
54
  # end
55
55
  # ~~~
56
+ #: [ConstantType = (Class[::ActiveModel::SecurePassword] & ::ActiveModel::SecurePassword::ClassMethods)]
56
57
  class ActiveModelSecurePassword < Compiler
57
58
  extend T::Sig
58
59
 
59
- ConstantType = type_member do
60
- { fixed: T.all(T::Class[::ActiveModel::SecurePassword], ::ActiveModel::SecurePassword::ClassMethods) }
61
- end
62
-
63
60
  # @override
64
61
  #: -> void
65
62
  def decorate
@@ -40,19 +40,10 @@ module Tapioca
40
40
  # def password_confirmation=(password_confirmation); end
41
41
  # end
42
42
  # ~~~
43
+ #: [ConstantType = (Class[ActiveModel::Validations] & ActiveModel::Validations::HelperMethods & ActiveModel::Validations::ClassMethods)]
43
44
  class ActiveModelValidationsConfirmation < Compiler
44
45
  extend T::Sig
45
46
 
46
- ConstantType = type_member do
47
- {
48
- fixed: T.all(
49
- T::Class[ActiveModel::Validations],
50
- ActiveModel::Validations::HelperMethods,
51
- ActiveModel::Validations::ClassMethods,
52
- ),
53
- }
54
- end
55
-
56
47
  class << self
57
48
  # @override
58
49
  #: -> T::Enumerable[Module]
@@ -101,6 +101,7 @@ module Tapioca
101
101
  # end
102
102
  # end
103
103
  # ~~~
104
+ #: [ConstantType = singleton(ActiveRecord::Base)]
104
105
  class ActiveRecordAssociations < Compiler
105
106
  extend T::Sig
106
107
  include Helpers::ActiveRecordConstantsHelper
@@ -121,8 +122,6 @@ module Tapioca
121
122
  end
122
123
  end
123
124
 
124
- ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
125
-
126
125
  # @override
127
126
  #: -> void
128
127
  def decorate
@@ -120,12 +120,11 @@ module Tapioca
120
120
  # sig { returns(T.untyped) }
121
121
  # def title; end
122
122
  # ~~~
123
+ #: [ConstantType = singleton(ActiveRecord::Base)]
123
124
  class ActiveRecordColumns < Compiler
124
125
  extend T::Sig
125
126
  include Helpers::ActiveRecordConstantsHelper
126
127
 
127
- ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
128
-
129
128
  # @override
130
129
  #: -> void
131
130
  def decorate
@@ -63,12 +63,11 @@ module Tapioca
63
63
  # end
64
64
  #
65
65
  # ~~~
66
+ #: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
66
67
  class ActiveRecordDelegatedTypes < Compiler
67
68
  extend T::Sig
68
69
  include Helpers::ActiveRecordConstantsHelper
69
70
 
70
- ConstantType = type_member { { fixed: T.all(T.class_of(ActiveRecord::Base), Extensions::ActiveRecord) } }
71
-
72
71
  # @override
73
72
  #: -> void
74
73
  def decorate
@@ -117,7 +116,7 @@ module Tapioca
117
116
  mod.create_method(
118
117
  "build_#{role}",
119
118
  parameters: [create_rest_param("args", type: "T.untyped")],
120
- return_type: "T.any(#{types.join(", ")})",
119
+ return_type: types.size == 1 ? types.first : "T.any(#{types.join(", ")})",
121
120
  )
122
121
  end
123
122
 
@@ -49,11 +49,10 @@ module Tapioca
49
49
  # end
50
50
  # end
51
51
  # ~~~
52
+ #: [ConstantType = singleton(::ActiveRecord::Base)]
52
53
  class ActiveRecordEnum < Compiler
53
54
  extend T::Sig
54
55
 
55
- ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
56
-
57
56
  # @override
58
57
  #: -> void
59
58
  def decorate
@@ -33,10 +33,10 @@ module Tapioca
33
33
  # def posts(fixture_name = nil, *other_fixtures); end
34
34
  # end
35
35
  # ~~~
36
+ #: [ConstantType = singleton(ActiveSupport::TestCase)]
36
37
  class ActiveRecordFixtures < Compiler
37
38
  extend T::Sig
38
39
 
39
- ConstantType = type_member { { fixed: T.class_of(ActiveSupport::TestCase) } }
40
40
  MISSING = Object.new
41
41
 
42
42
  # @override