Skip to content

Commit 39dd40f

Browse files
authored
Merge pull request #668 from Shopify/uk-remove-mixin-filtering
2 parents 5eaf50a + a0113b3 commit 39dd40f

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lib/tapioca/compilers/symbol_table/symbol_generator.rb

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,29 +375,24 @@ def compile_mixins(tree, constant)
375375
Module != class_of(mod) || are_equal?(mod, singleton_class)
376376
end
377377

378-
mixin_locations = Trackers::Mixin.mixin_locations_for(constant)
379-
380-
add_mixins(tree, prepends.reverse, Trackers::Mixin::Type::Prepend, mixin_locations)
381-
add_mixins(tree, includes.reverse, Trackers::Mixin::Type::Include, mixin_locations)
382-
add_mixins(tree, extends.reverse, Trackers::Mixin::Type::Extend, mixin_locations)
378+
add_mixins(tree, prepends.reverse, Trackers::Mixin::Type::Prepend)
379+
add_mixins(tree, includes.reverse, Trackers::Mixin::Type::Include)
380+
add_mixins(tree, extends.reverse, Trackers::Mixin::Type::Extend)
383381
end
384382

385383
sig do
386384
params(
387385
tree: RBI::Tree,
388386
mods: T::Array[Module],
389-
mixin_type: Trackers::Mixin::Type,
390-
mixin_locations: T::Hash[Trackers::Mixin::Type, T::Hash[Module, T::Array[String]]]
387+
mixin_type: Trackers::Mixin::Type
391388
).void
392389
end
393-
def add_mixins(tree, mods, mixin_type, mixin_locations)
390+
def add_mixins(tree, mods, mixin_type)
394391
mods
395392
.select do |mod|
396393
name = name_of(mod)
397394

398-
name &&
399-
!name.start_with?("T::") &&
400-
mixed_in_by_gem?(mod, mixin_type, mixin_locations)
395+
name && !name.start_with?("T::")
401396
end
402397
.map do |mod|
403398
add_to_symbol_queue(name_of(mod))

spec/tapioca/compilers/symbol_table_compiler_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ def hello; end
271271
RBI
272272

273273
compiled = compile
274+
.gsub(/^\s+include ::Minitest::Expectations\s/, "")
275+
.gsub(/^\s+include ::JSON::Ext::Generator::GeneratorMethods::Object\s/, "")
276+
.gsub(/^\s+include ::PP::ObjectMixin\s/, "")
274277

275278
assert_includes(compiled, basic_object_output)
276279
assert_includes(compiled, object_output)
@@ -395,6 +398,7 @@ def bar; end
395398
class Array
396399
include ::Foo::Bar
397400
include ::Enumerable
401+
include ::JSON::Ext::Generator::GeneratorMethods::Array
398402
399403
def foo_int; end
400404
end
@@ -408,6 +412,7 @@ module Foo::Bar; end
408412
409413
class Hash
410414
include ::Enumerable
415+
include ::JSON::Ext::Generator::GeneratorMethods::Hash
411416
extend ::Foo::Bar
412417
413418
def to_bar; end
@@ -419,7 +424,9 @@ def bar; end
419424
420425
class String
421426
include ::Comparable
427+
include ::JSON::Ext::Generator::GeneratorMethods::String
422428
include ::Foo::Bar
429+
extend ::JSON::Ext::Generator::GeneratorMethods::String::Extend
423430
424431
def to_foo(base = T.unsafe(nil)); end
425432
end

0 commit comments

Comments
 (0)