Skip to content

Commit 4fc6e4d

Browse files
bump tapioca to latest and fix type checking in extended AR compilers
1 parent 0af0803 commit 4fc6e4d

File tree

12 files changed

+7363
-3430
lines changed

12 files changed

+7363
-3430
lines changed

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AllCops:
1111
NewCops: disable
1212
Exclude:
1313
- "vendor/**/*"
14+
- "sorbet/rbi/**/*"
1415
Include:
1516
- "sorbet/rbi/shims/**/*.rbi"
1617

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ group :development do
1111
gem "minitest-reporters"
1212

1313
gem "attr_json"
14+
gem "graphql"
1415
gem "kaminari-activerecord"
1516
gem "money-rails"
1617
gem "paperclip"

Gemfile.lock

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PATH
33
specs:
44
boba (0.0.17)
55
sorbet-static-and-runtime (~> 0.5)
6-
tapioca (<= 0.16.9)
6+
tapioca (<= 0.16.11)
77

88
GEM
99
remote: https://rubygems.org/
@@ -93,8 +93,13 @@ GEM
9393
date (3.3.4)
9494
drb (2.2.1)
9595
erubi (1.13.1)
96+
fiber-storage (1.0.0)
9697
globalid (1.2.1)
9798
activesupport (>= 6.1)
99+
graphql (2.4.10)
100+
base64
101+
fiber-storage
102+
logger
98103
i18n (1.14.6)
99104
concurrent-ruby (~> 1.0)
100105
io-console (0.7.2)
@@ -210,7 +215,7 @@ GEM
210215
zeitwerk (~> 2.6)
211216
rainbow (3.1.1)
212217
rake (13.2.1)
213-
rbi (0.2.2)
218+
rbi (0.2.4)
214219
prism (~> 1.0)
215220
sorbet-runtime (>= 0.5.9204)
216221
rdoc (6.7.0)
@@ -240,24 +245,25 @@ GEM
240245
rubocop (>= 1)
241246
ruby-progressbar (1.13.0)
242247
securerandom (0.3.1)
243-
sorbet (0.5.11742)
244-
sorbet-static (= 0.5.11742)
245-
sorbet-runtime (0.5.11742)
246-
sorbet-static (0.5.11742-universal-darwin)
247-
sorbet-static (0.5.11742-x86_64-linux)
248-
sorbet-static-and-runtime (0.5.11742)
249-
sorbet (= 0.5.11742)
250-
sorbet-runtime (= 0.5.11742)
251-
spoom (1.5.0)
248+
sorbet (0.5.11851)
249+
sorbet-static (= 0.5.11851)
250+
sorbet-runtime (0.5.11851)
251+
sorbet-static (0.5.11851-universal-darwin)
252+
sorbet-static (0.5.11851-x86_64-linux)
253+
sorbet-static-and-runtime (0.5.11851)
254+
sorbet (= 0.5.11851)
255+
sorbet-runtime (= 0.5.11851)
256+
spoom (1.5.4)
252257
erubi (>= 1.10.0)
253258
prism (>= 0.28.0)
259+
rbi (>= 0.2.3)
254260
sorbet-static-and-runtime (>= 0.5.10187)
255261
thor (>= 0.19.2)
256262
sqlite3 (2.3.1)
257263
mini_portile2 (~> 2.8.0)
258264
state_machines (0.6.0)
259265
stringio (3.1.1)
260-
tapioca (0.16.9)
266+
tapioca (0.16.11)
261267
benchmark
262268
bundler (>= 2.2.25)
263269
netrc (>= 0.11.0)
@@ -292,6 +298,7 @@ PLATFORMS
292298
DEPENDENCIES
293299
attr_json
294300
boba!
301+
graphql
295302
kaminari-activerecord
296303
minitest
297304
minitest-hooks

boba.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
2828
spec.required_ruby_version = ">= 3.0.0"
2929

3030
spec.add_dependency("sorbet-static-and-runtime", "~> 0.5")
31-
spec.add_dependency("tapioca", "<= 0.16.9")
31+
spec.add_dependency("tapioca", "<= 0.16.11")
3232
end

lib/tapioca/dsl/compilers/active_record_associations_persisted.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: ignore
1+
# typed: strict
22
# frozen_string_literal: true
33

44
require "tapioca/dsl/compilers/active_record_associations"
@@ -54,6 +54,8 @@ module Compilers
5454
class ActiveRecordAssociationsPersisted < ::Tapioca::Dsl::Compilers::ActiveRecordAssociations
5555
extend T::Sig
5656

57+
ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
58+
5759
private
5860

5961
sig { returns(Boba::Options::AssociationTypeOption) }

lib/tapioca/dsl/compilers/active_record_columns_persisted.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: ignore
1+
# typed: strict
22
# frozen_string_literal: true
33

44
require "tapioca/dsl/compilers/active_record_columns"
@@ -128,8 +128,11 @@ module Compilers
128128
class ActiveRecordColumnsPersisted < ::Tapioca::Dsl::Compilers::ActiveRecordColumns
129129
extend T::Sig
130130

131+
ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
132+
131133
private
132134

135+
sig { returns(::Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper) }
133136
def column_type_helper
134137
::Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper.new(
135138
constant,
@@ -153,9 +156,9 @@ def type_for(attribute_name, column_name = attribute_name)
153156
def column_type_for(column_name)
154157
return ["T.untyped", "T.untyped"] if column_type_option.untyped?
155158

156-
nilable_column = Boba::ActiveRecord::AttributeService.nilable_attribute?(@constant, column_name)
159+
nilable_column = Boba::ActiveRecord::AttributeService.nilable_attribute?(constant, column_name)
157160

158-
column_type = @constant.attribute_types[column_name]
161+
column_type = constant.attribute_types[column_name]
159162
getter_type = column_type_helper.send(
160163
:type_for_activerecord_value,
161164
column_type,
@@ -169,7 +172,7 @@ def column_type_for(column_name)
169172
getter_type
170173
end
171174

172-
virtual_attribute = Boba::ActiveRecord::AttributeService.virtual_attribute?(@constant, column_name)
175+
virtual_attribute = Boba::ActiveRecord::AttributeService.virtual_attribute?(constant, column_name)
173176
if column_type_option.persisted? && (virtual_attribute || !nilable_column)
174177
[getter_type, setter_type]
175178
else

sorbet/rbi/gems/fiber-storage@1.0.0.rbi

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)