Skip to content

Commit 022a678

Browse files
committed
Translate generics to RBS comments
Signed-off-by: Alexandre Terrasa <[email protected]>
1 parent 2b116a2 commit 022a678

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+45
-111
lines changed

lib/tapioca/dsl/compiler.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33

44
module Tapioca
55
module Dsl
6+
#: [ConstantType < Module]
67
class Compiler
78
extend T::Sig
89
extend T::Helpers
9-
extend T::Generic
1010

1111
include RBIHelper
1212
include Runtime::Reflection
1313
extend Runtime::Reflection
1414

15-
ConstantType = type_member { { upper: Module } }
16-
1715
abstract!
1816

1917
#: ConstantType

lib/tapioca/dsl/compilers/aasm.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module Compilers
3232
# sleeping?, running?, cleaning?
3333
# run, run!, run_without_validation!, may_run?
3434
#
35+
#: [ConstantType = (Class[::AASM] & ::AASM::ClassMethods)]
3536
class AASM < Compiler
3637
extend T::Sig
3738

@@ -68,8 +69,6 @@ class AASM < Compiler
6869
"success",
6970
].freeze #: Array[String]
7071

71-
ConstantType = type_member { { fixed: T.all(T::Class[::AASM], ::AASM::ClassMethods) } }
72-
7372
# @override
7473
#: -> void
7574
def decorate

lib/tapioca/dsl/compilers/action_controller_helpers.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ module Compilers
6161
# def helpers; end
6262
# end
6363
# ~~~
64+
#: [ConstantType = singleton(::ActionController::Base)]
6465
class ActionControllerHelpers < Compiler
6566
extend T::Sig
6667

67-
ConstantType = type_member { { fixed: T.class_of(::ActionController::Base) } }
68-
6968
# @override
7069
#: -> void
7170
def decorate

lib/tapioca/dsl/compilers/action_mailer.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ module Compilers
2929
# def self.notify_customer(customer_id); end
3030
# end
3131
# ~~~
32+
#: [ConstantType = singleton(::ActionMailer::Base)]
3233
class ActionMailer < Compiler
3334
extend T::Sig
3435

35-
ConstantType = type_member { { fixed: T.class_of(::ActionMailer::Base) } }
36-
3736
# @override
3837
#: -> void
3938
def decorate

lib/tapioca/dsl/compilers/action_text.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ module Compilers
4343
# def title?; end
4444
# end
4545
# ~~~
46+
#: [ConstantType = singleton(::ActiveRecord::Base)]
4647
class ActionText < Compiler
4748
extend T::Sig
4849

49-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
50-
5150
# @override
5251
#: -> void
5352
def decorate

lib/tapioca/dsl/compilers/active_job.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ module Compilers
3838
# def self.perform_now(user); end
3939
# end
4040
# ~~~
41+
#: [ConstantType = singleton(::ActiveJob::Base)]
4142
class ActiveJob < Compiler
4243
extend T::Sig
4344

44-
ConstantType = type_member { { fixed: T.class_of(::ActiveJob::Base) } }
45-
4645
# @override
4746
#: -> void
4847
def decorate

lib/tapioca/dsl/compilers/active_model_attributes.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@ module Compilers
3434
# def name=(name); end
3535
# end
3636
# ~~~
37+
#: [ConstantType = (Class[::ActiveModel::Attributes] & ::ActiveModel::Attributes::ClassMethods)]
3738
class ActiveModelAttributes < Compiler
3839
extend T::Sig
3940

40-
ConstantType = type_member do
41-
{ fixed: T.all(T::Class[::ActiveModel::Attributes], ::ActiveModel::Attributes::ClassMethods) }
42-
end
43-
4441
# @override
4542
#: -> void
4643
def decorate

lib/tapioca/dsl/compilers/active_model_secure_password.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,10 @@ module Compilers
5353
# def token_confirmation=(unencrypted_password); end
5454
# end
5555
# ~~~
56+
#: [ConstantType = (Class[::ActiveModel::SecurePassword] & ::ActiveModel::SecurePassword::ClassMethods)]
5657
class ActiveModelSecurePassword < Compiler
5758
extend T::Sig
5859

59-
ConstantType = type_member do
60-
{ fixed: T.all(T::Class[::ActiveModel::SecurePassword], ::ActiveModel::SecurePassword::ClassMethods) }
61-
end
62-
6360
# @override
6461
#: -> void
6562
def decorate

lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,10 @@ module Compilers
4040
# def password_confirmation=(password_confirmation); end
4141
# end
4242
# ~~~
43+
#: [ConstantType = (Class[ActiveModel::Validations] & ActiveModel::Validations::HelperMethods & ActiveModel::Validations::ClassMethods)]
4344
class ActiveModelValidationsConfirmation < Compiler
4445
extend T::Sig
4546

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-
5647
class << self
5748
# @override
5849
#: -> T::Enumerable[Module]

lib/tapioca/dsl/compilers/active_record_associations.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ module Compilers
101101
# end
102102
# end
103103
# ~~~
104+
#: [ConstantType = singleton(ActiveRecord::Base)]
104105
class ActiveRecordAssociations < Compiler
105106
extend T::Sig
106107
include Helpers::ActiveRecordConstantsHelper
@@ -121,8 +122,6 @@ def initialize(class_name)
121122
end
122123
end
123124

124-
ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
125-
126125
# @override
127126
#: -> void
128127
def decorate

lib/tapioca/dsl/compilers/active_record_columns.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,11 @@ module Compilers
120120
# sig { returns(T.untyped) }
121121
# def title; end
122122
# ~~~
123+
#: [ConstantType = singleton(ActiveRecord::Base)]
123124
class ActiveRecordColumns < Compiler
124125
extend T::Sig
125126
include Helpers::ActiveRecordConstantsHelper
126127

127-
ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
128-
129128
# @override
130129
#: -> void
131130
def decorate

lib/tapioca/dsl/compilers/active_record_delegated_types.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ module Compilers
6363
# end
6464
#
6565
# ~~~
66+
#: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
6667
class ActiveRecordDelegatedTypes < Compiler
6768
extend T::Sig
6869
include Helpers::ActiveRecordConstantsHelper
6970

70-
ConstantType = type_member { { fixed: T.all(T.class_of(ActiveRecord::Base), Extensions::ActiveRecord) } }
71-
7271
# @override
7372
#: -> void
7473
def decorate

lib/tapioca/dsl/compilers/active_record_enum.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ module Compilers
4949
# end
5050
# end
5151
# ~~~
52+
#: [ConstantType = singleton(::ActiveRecord::Base)]
5253
class ActiveRecordEnum < Compiler
5354
extend T::Sig
5455

55-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
56-
5756
# @override
5857
#: -> void
5958
def decorate

lib/tapioca/dsl/compilers/active_record_fixtures.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ module Compilers
3333
# def posts(fixture_name = nil, *other_fixtures); end
3434
# end
3535
# ~~~
36+
#: [ConstantType = singleton(ActiveSupport::TestCase)]
3637
class ActiveRecordFixtures < Compiler
3738
extend T::Sig
3839

39-
ConstantType = type_member { { fixed: T.class_of(ActiveSupport::TestCase) } }
4040
MISSING = Object.new
4141

4242
# @override

lib/tapioca/dsl/compilers/active_record_relations.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,12 @@ module Compilers
148148
# end
149149
# end
150150
# ~~~
151+
#: [ConstantType = singleton(::ActiveRecord::Base)]
151152
class ActiveRecordRelations < Compiler
152153
extend T::Sig
153154
include Helpers::ActiveRecordConstantsHelper
154155
include SorbetHelper
155156

156-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
157-
158157
# From ActiveRecord::ConnectionAdapter::Quoting#quote, minus nil
159158
ID_TYPES = [
160159
"String",

lib/tapioca/dsl/compilers/active_record_scope.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ module Compilers
3838
# end
3939
# end
4040
# ~~~
41+
#: [ConstantType = singleton(::ActiveRecord::Base)]
4142
class ActiveRecordScope < Compiler
4243
extend T::Sig
4344
include Helpers::ActiveRecordConstantsHelper
4445

45-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
46-
4746
# @override
4847
#: -> void
4948
def decorate

lib/tapioca/dsl/compilers/active_record_secure_token.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ module Compilers
3232
# def regenerate_auth_token; end
3333
# end
3434
# ~~~
35+
#: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
3536
class ActiveRecordSecureToken < Compiler
3637
extend T::Sig
3738
include Helpers::ActiveRecordConstantsHelper
3839

39-
ConstantType = type_member { { fixed: T.all(T.class_of(ActiveRecord::Base), Extensions::ActiveRecord) } }
40-
4140
# @override
4241
#: -> void
4342
def decorate

lib/tapioca/dsl/compilers/active_record_store.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ module Compilers
7878
# end
7979
# end
8080
# ~~~
81+
#: [ConstantType = (singleton(ActiveRecord::Base) & Extensions::ActiveRecord)]
8182
class ActiveRecordStore < Compiler
8283
extend T::Sig
8384
include Helpers::ActiveRecordConstantsHelper
8485

85-
ConstantType = type_member { { fixed: T.all(T.class_of(ActiveRecord::Base), Extensions::ActiveRecord) } }
86-
8786
# @override
8887
#: -> void
8988
def decorate

lib/tapioca/dsl/compilers/active_record_typed_store.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ module Compilers
8181
# end
8282
# end
8383
# ~~~
84+
#: [ConstantType = singleton(::ActiveRecord::Base)]
8485
class ActiveRecordTypedStore < Compiler
8586
extend T::Sig
8687

87-
ConstantType = type_member { { fixed: T.class_of(::ActiveRecord::Base) } }
88-
8988
# @override
9089
#: -> void
9190
def decorate

lib/tapioca/dsl/compilers/active_resource.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ module Compilers
5454
# def year?; end
5555
# end
5656
# ~~~
57+
#: [ConstantType = singleton(::ActiveResource::Base)]
5758
class ActiveResource < Compiler
5859
extend T::Sig
5960

60-
ConstantType = type_member { { fixed: T.class_of(::ActiveResource::Base) } }
61-
6261
# @override
6362
#: -> void
6463
def decorate

lib/tapioca/dsl/compilers/active_storage.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,10 @@ module Compilers
3838
# def photo=(attachable); end
3939
# end
4040
# ~~~
41+
#: [ConstantType = (Module & ::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods)]
4142
class ActiveStorage < Compiler
4243
extend T::Sig
4344

44-
ConstantType = type_member do
45-
{
46-
fixed: T.all(
47-
Module,
48-
::ActiveStorage::Reflection::ActiveRecordExtensions::ClassMethods,
49-
),
50-
}
51-
end
52-
5345
# @override
5446
#: -> void
5547
def decorate

lib/tapioca/dsl/compilers/active_support_concern.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ module Compilers
3737
# mixes_in_class_methods(::Foo::ClassMethods)
3838
# end
3939
# ~~~
40+
#: [ConstantType = Module]
4041
class ActiveSupportConcern < Compiler
4142
extend T::Sig
4243

43-
ConstantType = type_member { { fixed: Module } }
44-
4544
# @override
4645
#: -> void
4746
def decorate

lib/tapioca/dsl/compilers/active_support_current_attributes.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ module Compilers
5959
# end
6060
# end
6161
# ~~~
62+
#: [ConstantType = singleton(::ActiveSupport::CurrentAttributes)]
6263
class ActiveSupportCurrentAttributes < Compiler
6364
extend T::Sig
6465

65-
ConstantType = type_member { { fixed: T.class_of(::ActiveSupport::CurrentAttributes) } }
66-
6766
# @override
6867
#: -> void
6968
def decorate

lib/tapioca/dsl/compilers/active_support_time_ext.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ module Compilers
3434
# end
3535
# end
3636
# ```
37+
#: [ConstantType = singleton(::Time)]
3738
class ActiveSupportTimeExt < Compiler
3839
extend T::Sig
3940

40-
ConstantType = type_member { { fixed: T.class_of(::Time) } }
41-
4241
# @override
4342
#: -> void
4443
def decorate

lib/tapioca/dsl/compilers/config.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ module Compilers
4040
# def github=(value); end
4141
# end
4242
# ```
43+
#: [ConstantType = Module]
4344
class Config < Compiler
4445
extend T::Sig
4546

4647
CONFIG_OPTIONS_SUFFIX = "ConfigOptions"
4748

48-
ConstantType = type_member { { fixed: Module } }
49-
5049
# @override
5150
#: -> void
5251
def decorate

lib/tapioca/dsl/compilers/frozen_record.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ module Compilers
5858
# end
5959
# end
6060
# ~~~
61+
#: [ConstantType = (singleton(::FrozenRecord::Base) & Extensions::FrozenRecord)]
6162
class FrozenRecord < Compiler
6263
extend T::Sig
6364

64-
ConstantType = type_member { { fixed: T.all(T.class_of(::FrozenRecord::Base), Extensions::FrozenRecord) } }
65-
6665
# @override
6766
#: -> void
6867
def decorate

lib/tapioca/dsl/compilers/graphql_input_object.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ module Compilers
3434
# def post_id; end
3535
# end
3636
# ~~~
37+
#: [ConstantType = singleton(GraphQL::Schema::InputObject)]
3738
class GraphqlInputObject < Compiler
3839
extend T::Sig
3940

40-
ConstantType = type_member { { fixed: T.class_of(GraphQL::Schema::InputObject) } }
41-
4241
# @override
4342
#: -> void
4443
def decorate

0 commit comments

Comments
 (0)