tapioca 0.17.10 → 0.19.0

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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/lib/tapioca/bundler_ext/auto_require_hook.rb +0 -3
  4. data/lib/tapioca/cli.rb +1 -3
  5. data/lib/tapioca/commands/annotations.rb +0 -2
  6. data/lib/tapioca/commands/check_shims.rb +0 -1
  7. data/lib/tapioca/commands/command.rb +0 -1
  8. data/lib/tapioca/dsl/compiler.rb +7 -6
  9. data/lib/tapioca/dsl/compilers/aasm.rb +4 -5
  10. data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +0 -4
  11. data/lib/tapioca/dsl/compilers/action_mailer.rb +0 -4
  12. data/lib/tapioca/dsl/compilers/action_text.rb +0 -4
  13. data/lib/tapioca/dsl/compilers/active_job.rb +0 -4
  14. data/lib/tapioca/dsl/compilers/active_model_attributes.rb +0 -4
  15. data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +0 -4
  16. data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +0 -2
  17. data/lib/tapioca/dsl/compilers/active_record_associations.rb +0 -5
  18. data/lib/tapioca/dsl/compilers/active_record_columns.rb +0 -3
  19. data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +0 -3
  20. data/lib/tapioca/dsl/compilers/active_record_enum.rb +0 -4
  21. data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +0 -4
  22. data/lib/tapioca/dsl/compilers/active_record_relations.rb +33 -6
  23. data/lib/tapioca/dsl/compilers/active_record_scope.rb +0 -1
  24. data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +0 -3
  25. data/lib/tapioca/dsl/compilers/active_record_store.rb +0 -3
  26. data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +0 -4
  27. data/lib/tapioca/dsl/compilers/active_resource.rb +0 -4
  28. data/lib/tapioca/dsl/compilers/active_storage.rb +0 -4
  29. data/lib/tapioca/dsl/compilers/active_support_concern.rb +0 -4
  30. data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +3 -18
  31. data/lib/tapioca/dsl/compilers/active_support_environment_inquirer.rb +60 -0
  32. data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +0 -4
  33. data/lib/tapioca/dsl/compilers/config.rb +0 -4
  34. data/lib/tapioca/dsl/compilers/frozen_record.rb +0 -4
  35. data/lib/tapioca/dsl/compilers/graphql_input_object.rb +0 -4
  36. data/lib/tapioca/dsl/compilers/graphql_mutation.rb +0 -4
  37. data/lib/tapioca/dsl/compilers/identity_cache.rb +0 -4
  38. data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +3 -17
  39. data/lib/tapioca/dsl/compilers/kredis.rb +0 -4
  40. data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +0 -4
  41. data/lib/tapioca/dsl/compilers/protobuf.rb +0 -4
  42. data/lib/tapioca/dsl/compilers/rails_generators.rb +0 -4
  43. data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +0 -4
  44. data/lib/tapioca/dsl/compilers/smart_properties.rb +0 -4
  45. data/lib/tapioca/dsl/compilers/state_machines.rb +0 -4
  46. data/lib/tapioca/dsl/compilers/url_helpers.rb +0 -3
  47. data/lib/tapioca/dsl/helpers/active_model_type_helper.rb +0 -2
  48. data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +0 -5
  49. data/lib/tapioca/dsl/helpers/active_record_constants_helper.rb +0 -2
  50. data/lib/tapioca/dsl/helpers/graphql_type_helper.rb +0 -2
  51. data/lib/tapioca/dsl/pipeline.rb +0 -2
  52. data/lib/tapioca/executor.rb +0 -2
  53. data/lib/tapioca/gem/events.rb +0 -15
  54. data/lib/tapioca/gem/listeners/base.rb +0 -1
  55. data/lib/tapioca/gem/listeners/documentation.rb +94 -0
  56. data/lib/tapioca/gem/listeners/dynamic_mixins.rb +0 -2
  57. data/lib/tapioca/gem/listeners/foreign_constants.rb +0 -2
  58. data/lib/tapioca/gem/listeners/methods.rb +0 -2
  59. data/lib/tapioca/gem/listeners/mixins.rb +0 -2
  60. data/lib/tapioca/gem/listeners/remove_empty_payload_scopes.rb +0 -2
  61. data/lib/tapioca/gem/listeners/sorbet_enums.rb +0 -2
  62. data/lib/tapioca/gem/listeners/sorbet_helpers.rb +0 -2
  63. data/lib/tapioca/gem/listeners/sorbet_props.rb +0 -1
  64. data/lib/tapioca/gem/listeners/sorbet_required_ancestors.rb +0 -2
  65. data/lib/tapioca/gem/listeners/sorbet_signatures.rb +1 -7
  66. data/lib/tapioca/gem/listeners/sorbet_type_variables.rb +0 -2
  67. data/lib/tapioca/gem/listeners/source_location.rb +6 -7
  68. data/lib/tapioca/gem/listeners/subconstants.rb +0 -2
  69. data/lib/tapioca/gem/listeners.rb +1 -1
  70. data/lib/tapioca/gem/pipeline.rb +2 -4
  71. data/lib/tapioca/gemfile.rb +0 -18
  72. data/lib/tapioca/helpers/cli_helper.rb +0 -1
  73. data/lib/tapioca/helpers/config_helper.rb +0 -1
  74. data/lib/tapioca/helpers/env_helper.rb +0 -1
  75. data/lib/tapioca/helpers/gem_helper.rb +0 -2
  76. data/lib/tapioca/helpers/git_attributes.rb +0 -2
  77. data/lib/tapioca/helpers/package_url.rb +416 -0
  78. data/lib/tapioca/helpers/rbi_files_helper.rb +0 -1
  79. data/lib/tapioca/helpers/rbi_helper.rb +7 -3
  80. data/lib/tapioca/helpers/sorbet_helper.rb +0 -2
  81. data/lib/tapioca/helpers/test/content.rb +0 -1
  82. data/lib/tapioca/helpers/test/dsl_compiler.rb +0 -3
  83. data/lib/tapioca/helpers/test/isolation.rb +0 -6
  84. data/lib/tapioca/helpers/test/template.rb +1 -9
  85. data/lib/tapioca/internal.rb +2 -2
  86. data/lib/tapioca/loaders/dsl.rb +0 -4
  87. data/lib/tapioca/loaders/gem.rb +0 -4
  88. data/lib/tapioca/loaders/loader.rb +0 -1
  89. data/lib/tapioca/rbi_ext/model.rb +4 -5
  90. data/lib/tapioca/rbi_formatter.rb +0 -2
  91. data/lib/tapioca/repo_index.rb +0 -3
  92. data/lib/tapioca/runtime/dynamic_mixin_compiler.rb +0 -3
  93. data/lib/tapioca/runtime/generic_type_registry.rb +0 -4
  94. data/lib/tapioca/runtime/reflection.rb +14 -13
  95. data/lib/tapioca/runtime/trackers/autoload.rb +0 -3
  96. data/lib/tapioca/runtime/trackers/constant_definition.rb +27 -5
  97. data/lib/tapioca/runtime/trackers/method_definition.rb +0 -1
  98. data/lib/tapioca/runtime/trackers/mixin.rb +0 -3
  99. data/lib/tapioca/runtime/trackers/required_ancestor.rb +0 -2
  100. data/lib/tapioca/runtime/trackers/tracker.rb +0 -3
  101. data/lib/tapioca/runtime/trackers.rb +0 -4
  102. data/lib/tapioca/sorbet_ext/generic_name_patch.rb +0 -2
  103. data/lib/tapioca/static/requires_compiler.rb +0 -2
  104. data/lib/tapioca/static/symbol_loader.rb +13 -6
  105. data/lib/tapioca/static/symbol_table_parser.rb +0 -4
  106. data/lib/tapioca/version.rb +1 -1
  107. data/lib/tapioca.rb +0 -2
  108. metadata +28 -15
  109. data/lib/tapioca/gem/listeners/yard_doc.rb +0 -112
  110. data/lib/tapioca/helpers/source_uri.rb +0 -84
  111. data/lib/tapioca/runtime/attached_class_of_32.rb +0 -20
  112. data/lib/tapioca/runtime/attached_class_of_legacy.rb +0 -24
@@ -6,7 +6,6 @@ module Tapioca
6
6
  module Test
7
7
  # @requires_ancestor: Kernel
8
8
  module Content
9
- extend T::Sig
10
9
  #: -> void
11
10
  def teardown
12
11
  super
@@ -12,7 +12,6 @@ module Tapioca
12
12
  module Test
13
13
  # @requires_ancestor: Kernel
14
14
  module DslCompiler
15
- extend T::Sig
16
15
  include Isolation
17
16
  include Content
18
17
  include Template
@@ -50,8 +49,6 @@ module Tapioca
50
49
  end
51
50
 
52
51
  class CompilerContext
53
- extend T::Sig
54
-
55
52
  include SorbetHelper
56
53
 
57
54
  #: singleton(Tapioca::Dsl::Compiler)
@@ -7,12 +7,9 @@ module Tapioca
7
7
  # Copied from ActiveSupport::Testing::Isolation since we cannot require
8
8
  # constants from ActiveSupport without polluting the global namespace.
9
9
  module Isolation
10
- extend T::Sig
11
10
  require "thread"
12
11
 
13
12
  class << self
14
- extend T::Sig
15
-
16
13
  #: -> bool
17
14
  def forking_env?
18
15
  !ENV["NO_FORK"] && Process.respond_to?(:fork)
@@ -30,7 +27,6 @@ module Tapioca
30
27
 
31
28
  # @requires_ancestor: Kernel
32
29
  module Forking
33
- extend T::Sig
34
30
  #: ?{ (?) -> untyped } -> String
35
31
  def run_in_isolation(&_blk)
36
32
  read, write = IO.pipe
@@ -72,8 +68,6 @@ module Tapioca
72
68
 
73
69
  # @requires_ancestor: Kernel
74
70
  module Subprocess
75
- extend T::Sig
76
-
77
71
  ORIG_ARGV = ARGV.dup #: Array[String]
78
72
 
79
73
  # Crazy H4X to get this working in windows / jruby with
@@ -6,9 +6,6 @@ module Tapioca
6
6
  module Test
7
7
  # @requires_ancestor: Kernel
8
8
  module Template
9
- extend T::Sig
10
- ERB_SUPPORTS_KVARGS = ::ERB.instance_method(:initialize).parameters.assoc(:key) #: [Symbol, Symbol]?
11
-
12
9
  #: (String selector) -> bool
13
10
  def ruby_version(selector)
14
11
  ::Gem::Requirement.new(selector).satisfied_by?(::Gem::Version.new(RUBY_VERSION))
@@ -21,12 +18,7 @@ module Tapioca
21
18
 
22
19
  #: (String src, ?trim_mode: String) -> String
23
20
  def template(src, trim_mode: ">")
24
- erb = if ERB_SUPPORTS_KVARGS
25
- ::ERB.new(src, trim_mode: trim_mode)
26
- else
27
- ::ERB.new(src, nil, trim_mode)
28
- end
29
-
21
+ erb = ::ERB.new(src, trim_mode: trim_mode)
30
22
  erb.result(binding)
31
23
  end
32
24
 
@@ -41,7 +41,7 @@ require "shellwords"
41
41
  require "tempfile"
42
42
  require "thor"
43
43
  require "yaml"
44
- require "yard-sorbet"
44
+ require "rubydex"
45
45
  require "prism"
46
46
 
47
47
  require "tapioca/helpers/gem_helper"
@@ -49,7 +49,7 @@ require "tapioca/helpers/git_attributes"
49
49
  require "tapioca/helpers/sorbet_helper"
50
50
  require "tapioca/helpers/rbi_helper"
51
51
 
52
- require "tapioca/helpers/source_uri"
52
+ require "tapioca/helpers/package_url"
53
53
  require "tapioca/helpers/cli_helper"
54
54
  require "tapioca/helpers/config_helper"
55
55
  require "tapioca/helpers/rbi_files_helper"
@@ -4,11 +4,7 @@
4
4
  module Tapioca
5
5
  module Loaders
6
6
  class Dsl < Loader
7
- extend T::Sig
8
-
9
7
  class << self
10
- extend T::Sig
11
-
12
8
  #: (tapioca_path: String, ?eager_load: bool, ?app_root: String, ?halt_upon_load_error: bool) -> void
13
9
  def load_application(
14
10
  tapioca_path:,
@@ -4,11 +4,7 @@
4
4
  module Tapioca
5
5
  module Loaders
6
6
  class Gem < Loader
7
- extend T::Sig
8
-
9
7
  class << self
10
- extend T::Sig
11
-
12
8
  #: (
13
9
  #| bundle: Gemfile,
14
10
  #| prerequire: String?,
@@ -5,7 +5,6 @@ module Tapioca
5
5
  module Loaders
6
6
  # @abstract
7
7
  class Loader
8
- extend T::Sig
9
8
  include Thor::Base
10
9
  include CliHelper
11
10
  include Tapioca::GemHelper
@@ -3,8 +3,6 @@
3
3
 
4
4
  module RBI
5
5
  class Tree
6
- extend T::Sig
7
-
8
6
  #: (T::Module[top] constant) ?{ (Scope scope) -> void } -> Scope
9
7
  def create_path(constant, &block)
10
8
  constant_name = Tapioca::Runtime::Reflection.name_of(constant)
@@ -67,10 +65,11 @@ module RBI
67
65
  #| ?return_type: String?,
68
66
  #| ?class_method: bool,
69
67
  #| ?visibility: RBI::Visibility,
70
- #| ?comments: Array[RBI::Comment]
68
+ #| ?comments: Array[RBI::Comment],
69
+ #| ?type_params: Array[String]
71
70
  #| ) ?{ (RBI::Method node) -> void } -> void
72
71
  def create_method(name, parameters: [], return_type: nil, class_method: false, visibility: RBI::Public.new,
73
- comments: [], &block)
72
+ comments: [], type_params: [], &block)
74
73
  return unless Tapioca::RBIHelper.valid_method_name?(name)
75
74
 
76
75
  sigs = []
@@ -79,7 +78,7 @@ module RBI
79
78
  # If there is no block, and the params and return type have not been supplied, then
80
79
  # we create a single signature with the given parameters and return type
81
80
  params = parameters.map { |param| RBI::SigParam.new(param.param.name.to_s, param.type) }
82
- sigs << RBI::Sig.new(params: params, return_type: return_type || "T.untyped")
81
+ sigs << RBI::Sig.new(params: params, return_type: return_type || "T.untyped", type_params: type_params)
83
82
  end
84
83
 
85
84
  method = RBI::Method.new(
@@ -3,8 +3,6 @@
3
3
 
4
4
  module Tapioca
5
5
  class RBIFormatter < RBI::Formatter
6
- extend T::Sig
7
-
8
6
  #: (RBI::File file, String command, ?reason: String?) -> void
9
7
  def write_header!(file, command, reason: nil)
10
8
  file.comments << RBI::Comment.new("DO NOT EDIT MANUALLY")
@@ -3,10 +3,7 @@
3
3
 
4
4
  module Tapioca
5
5
  class RepoIndex
6
- extend T::Sig
7
6
  class << self
8
- extend T::Sig
9
-
10
7
  #: (String json) -> RepoIndex
11
8
  def from_json(json)
12
9
  RepoIndex.from_hash(JSON.parse(json))
@@ -4,7 +4,6 @@
4
4
  module Tapioca
5
5
  module Runtime
6
6
  class DynamicMixinCompiler
7
- extend T::Sig
8
7
  include Runtime::Reflection
9
8
 
10
9
  #: Array[T::Module[top]]
@@ -95,8 +94,6 @@ module Tapioca
95
94
  end
96
95
 
97
96
  class << self
98
- extend T::Sig
99
-
100
97
  T::Sig::WithoutRuntime.sig { params(symbol: Symbol, args: T.untyped).returns(T.untyped) }
101
98
  def method_missing(symbol, *args)
102
99
  # Similarly, we need this here so that we can handle any
@@ -26,8 +26,6 @@ module Tapioca
26
26
  @type_variables = {}.compare_by_identity #: Hash[T::Module[top], Array[TypeVariableModule]]
27
27
 
28
28
  class GenericType < T::Types::Simple
29
- extend T::Sig
30
-
31
29
  #: (T::Module[top] raw_type, T::Module[top] underlying_type) -> void
32
30
  def initialize(raw_type, underlying_type)
33
31
  super(raw_type)
@@ -43,8 +41,6 @@ module Tapioca
43
41
  end
44
42
 
45
43
  class << self
46
- extend T::Sig
47
-
48
44
  # This method is responsible for building the name of the instantiated concrete type
49
45
  # and cloning the given constant so that we can return a type that is the same
50
46
  # as the current type but is a different instance and has a different name method.
@@ -3,21 +3,9 @@
3
3
 
4
4
  require "tapioca/runtime/source_location"
5
5
 
6
- # On Ruby 3.2 or newer, Class defines an attached_object method that returns the
7
- # attached class of a singleton class without iterating ObjectSpace. On older
8
- # versions of Ruby, we fall back to iterating ObjectSpace.
9
- if Class.method_defined?(:attached_object)
10
- require "tapioca/runtime/attached_class_of_32"
11
- else
12
- require "tapioca/runtime/attached_class_of_legacy"
13
- end
14
-
15
6
  module Tapioca
16
7
  module Runtime
17
8
  module Reflection
18
- include AttachedClassOf
19
-
20
- extend T::Sig
21
9
  extend self
22
10
 
23
11
  CLASS_METHOD = Kernel.instance_method(:class) #: UnboundMethod
@@ -81,6 +69,12 @@ module Tapioca
81
69
  SUPERCLASS_METHOD.bind_call(constant)
82
70
  end
83
71
 
72
+ #: (Class[top] singleton_class) -> T::Module[top]?
73
+ def attached_class_of(singleton_class)
74
+ result = singleton_class.attached_object
75
+ Module === result ? result : nil
76
+ end
77
+
84
78
  #: (BasicObject object) -> Integer
85
79
  def object_id_of(object)
86
80
  OBJECT_ID_METHOD.bind_call(object)
@@ -219,9 +213,16 @@ module Tapioca
219
213
 
220
214
  #: (T::Module[top] constant) -> Set[String]
221
215
  def file_candidates_for(constant)
222
- relevant_methods_for(constant).filter_map do |method|
216
+ # Grab all source files for (relevant) methods defined on the constant
217
+ candidates = relevant_methods_for(constant).filter_map do |method|
223
218
  method.source_location&.first
224
219
  end.to_set
220
+
221
+ # Add the source file for the constant definition itself, if available.
222
+ source_location_candidate = const_source_location(name_of(constant).to_s)&.file
223
+ candidates.add(source_location_candidate) if source_location_candidate
224
+
225
+ candidates
225
226
  end
226
227
 
227
228
  #: (T::Module[top] constant) -> untyped
@@ -6,13 +6,10 @@ module Tapioca
6
6
  module Trackers
7
7
  module Autoload
8
8
  extend Tracker
9
- extend T::Sig
10
9
 
11
10
  @constant_names_registered_for_autoload = [] #: Array[String]
12
11
 
13
12
  class << self
14
- extend T::Sig
15
-
16
13
  #: -> void
17
14
  def eager_load_all!
18
15
  Runtime.with_disabled_exits do
@@ -11,7 +11,6 @@ module Tapioca
11
11
  module ConstantDefinition
12
12
  extend Tracker
13
13
  extend Reflection
14
- extend T::Sig
15
14
 
16
15
  @class_files = {}.compare_by_identity #: Hash[T::Module[top], Set[SourceLocation]]
17
16
 
@@ -36,7 +35,7 @@ module Tapioca
36
35
  ])
37
36
  end
38
37
 
39
- (@class_files[key] ||= Set.new) << loc
38
+ ConstantDefinition.register(key, loc)
40
39
  end
41
40
 
42
41
  @creturn_tracepoint = TracePoint.trace(:c_return) do |tp|
@@ -46,12 +45,10 @@ module Tapioca
46
45
  next unless Module === key
47
46
 
48
47
  loc = build_source_location(tp, caller_locations)
49
- (@class_files[key] ||= Set.new) << loc
48
+ ConstantDefinition.register(key, loc)
50
49
  end
51
50
 
52
51
  class << self
53
- extend T::Sig
54
-
55
52
  def disable!
56
53
  @class_tracepoint.disable
57
54
  @creturn_tracepoint.disable
@@ -67,6 +64,22 @@ module Tapioca
67
64
  SourceLocation.from_loc([file || "", lineno])
68
65
  end
69
66
 
67
+ def register(constant, loc)
68
+ return unless loc
69
+
70
+ (@class_files[constant] ||= Set.new) << loc
71
+ end
72
+
73
+ def register_cname(cname, namespace, locations)
74
+ return if namespace.autoload?(cname)
75
+
76
+ key = Reflection.constantize(cname, namespace: namespace, inherit: true)
77
+ return unless Module === key
78
+
79
+ loc = Reflection.resolve_loc(locations)
80
+ ConstantDefinition.register(key, loc)
81
+ end
82
+
70
83
  # Returns the files in which this class or module was opened. Doesn't know
71
84
  # about situations where the class was opened prior to +require+ing,
72
85
  # or where metaprogramming was used via +eval+, etc.
@@ -84,3 +97,12 @@ module Tapioca
84
97
  end
85
98
  end
86
99
  end
100
+
101
+ class Module
102
+ prepend(::Module.new do
103
+ def const_added(cname)
104
+ ::Tapioca::Runtime::Trackers::ConstantDefinition.register_cname(cname, self, Kernel.caller_locations)
105
+ super(cname)
106
+ end
107
+ end)
108
+ end
@@ -6,7 +6,6 @@ module Tapioca
6
6
  module Trackers
7
7
  module MethodDefinition
8
8
  extend Tracker
9
- extend T::Sig
10
9
 
11
10
  @method_definitions = {}.compare_by_identity #: Hash[T::Module[top], Hash[Symbol, Array[SourceLocation]]]
12
11
 
@@ -6,7 +6,6 @@ module Tapioca
6
6
  module Trackers
7
7
  module Mixin
8
8
  extend Tracker
9
- extend T::Sig
10
9
 
11
10
  @constants_to_mixin_locations = {}.compare_by_identity
12
11
  @mixins_to_constants = {}.compare_by_identity
@@ -20,8 +19,6 @@ module Tapioca
20
19
  end
21
20
 
22
21
  class << self
23
- extend T::Sig
24
-
25
22
  #: [Result] { -> Result } -> Result
26
23
  def with_disabled_registration(&block)
27
24
  with_disabled_tracker(&block)
@@ -9,8 +9,6 @@ module Tapioca
9
9
  @required_ancestors_map = {}.compare_by_identity
10
10
 
11
11
  class << self
12
- extend T::Sig
13
-
14
12
  #: (T::Helpers requiring, ^-> void block) -> void
15
13
  def register(requiring, block)
16
14
  return unless enabled?
@@ -6,10 +6,7 @@ module Tapioca
6
6
  module Trackers
7
7
  # @abstract
8
8
  module Tracker
9
- extend T::Sig
10
9
  class << self
11
- extend T::Sig
12
-
13
10
  #: ((Tracker & T::Module[top]) base) -> void
14
11
  def extended(base)
15
12
  Trackers.register_tracker(base)
@@ -6,13 +6,9 @@ require "tapioca/runtime/trackers/tracker"
6
6
  module Tapioca
7
7
  module Runtime
8
8
  module Trackers
9
- extend T::Sig
10
-
11
9
  @trackers = [] #: Array[Tracker]
12
10
 
13
11
  class << self
14
- extend T::Sig
15
-
16
12
  #: [Return] { -> Return } -> Return
17
13
  def with_trackers_enabled(&blk)
18
14
  # Currently this is a dirty hack to ensure disabling trackers
@@ -120,8 +120,6 @@ module Tapioca
120
120
  # need to do any matching of constants to type variables to bind their names, Ruby will
121
121
  # do that automatically for us and we get the `name` method for free from `Module`.
122
122
  class TypeVariableModule < Module
123
- extend T::Sig
124
-
125
123
  class Type < T::Enum
126
124
  enums do
127
125
  Member = new("type_member")
@@ -4,8 +4,6 @@
4
4
  module Tapioca
5
5
  module Static
6
6
  class RequiresCompiler
7
- extend T::Sig
8
-
9
7
  #: (String sorbet_path) -> void
10
8
  def initialize(sorbet_path)
11
9
  @sorbet_path = sorbet_path
@@ -5,7 +5,6 @@ module Tapioca
5
5
  module Static
6
6
  module SymbolLoader
7
7
  class << self
8
- extend T::Sig
9
8
  include SorbetHelper
10
9
  include Runtime::Reflection
11
10
 
@@ -19,6 +18,19 @@ module Tapioca
19
18
  T.must(@payload_symbols)
20
19
  end
21
20
 
21
+ #: (Array[Pathname] paths) -> Rubydex::Graph
22
+ def graph_from_paths(paths)
23
+ graph = Rubydex::Graph.new
24
+ graph.index_all(paths.map(&:to_s))
25
+ graph.resolve
26
+ graph
27
+ end
28
+
29
+ #: (Gemfile::GemSpec gem) -> Set[String]
30
+ def gem_symbols(gem)
31
+ symbols_from_paths(gem.files)
32
+ end
33
+
22
34
  #: (Gemfile::GemSpec gem) -> Set[String]
23
35
  def engine_symbols(gem)
24
36
  gem_engine = engines.find do |engine|
@@ -44,11 +56,6 @@ module Tapioca
44
56
  Set.new
45
57
  end
46
58
 
47
- #: (Gemfile::GemSpec gem) -> Set[String]
48
- def gem_symbols(gem)
49
- symbols_from_paths(gem.files)
50
- end
51
-
52
59
  #: (Array[Pathname] paths) -> Set[String]
53
60
  def symbols_from_paths(paths)
54
61
  return Set.new if paths.empty?
@@ -4,13 +4,9 @@
4
4
  module Tapioca
5
5
  module Static
6
6
  class SymbolTableParser
7
- extend T::Sig
8
-
9
7
  SKIP_PARSE_KINDS = ["CLASS_OR_MODULE", "STATIC_FIELD"].freeze #: Array[String]
10
8
 
11
9
  class << self
12
- extend T::Sig
13
-
14
10
  #: (String json_string) -> Set[String]
15
11
  def parse_json(json_string)
16
12
  obj = JSON.parse(json_string)
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.17.10"
5
+ VERSION = "0.19.0"
6
6
  end
data/lib/tapioca.rb CHANGED
@@ -5,8 +5,6 @@ require "sorbet-runtime"
5
5
  require "rubygems/user_interaction"
6
6
 
7
7
  module Tapioca
8
- extend T::Sig
9
-
10
8
  @traces = [] #: Array[TracePoint]
11
9
 
12
10
  class Error < StandardError; end
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.17.10
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu
@@ -83,47 +83,47 @@ dependencies:
83
83
  - !ruby/object:Gem::Version
84
84
  version: 0.2.2
85
85
  - !ruby/object:Gem::Dependency
86
- name: sorbet-static-and-runtime
86
+ name: rubydex
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 0.5.11087
91
+ version: 0.1.0.beta10
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: 0.5.11087
98
+ version: 0.1.0.beta10
99
99
  - !ruby/object:Gem::Dependency
100
- name: thor
100
+ name: sorbet-static-and-runtime
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: 1.2.0
105
+ version: 0.5.11087
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 1.2.0
112
+ version: 0.5.11087
113
113
  - !ruby/object:Gem::Dependency
114
- name: yard-sorbet
114
+ name: thor
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: '0'
119
+ version: 1.2.0
120
120
  type: :runtime
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: '0'
126
+ version: 1.2.0
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: rbi
129
129
  requirement: !ruby/object:Gem::Requirement
@@ -152,6 +152,20 @@ dependencies:
152
152
  - - ">="
153
153
  - !ruby/object:Gem::Version
154
154
  version: 1.7.9
155
+ - !ruby/object:Gem::Dependency
156
+ name: tsort
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ type: :runtime
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
155
169
  email:
156
170
  - ruby@shopify.com
157
171
  executables:
@@ -210,6 +224,7 @@ files:
210
224
  - lib/tapioca/dsl/compilers/active_storage.rb
211
225
  - lib/tapioca/dsl/compilers/active_support_concern.rb
212
226
  - lib/tapioca/dsl/compilers/active_support_current_attributes.rb
227
+ - lib/tapioca/dsl/compilers/active_support_environment_inquirer.rb
213
228
  - lib/tapioca/dsl/compilers/active_support_time_ext.rb
214
229
  - lib/tapioca/dsl/compilers/config.rb
215
230
  - lib/tapioca/dsl/compilers/frozen_record.rb
@@ -238,6 +253,7 @@ files:
238
253
  - lib/tapioca/gem/events.rb
239
254
  - lib/tapioca/gem/listeners.rb
240
255
  - lib/tapioca/gem/listeners/base.rb
256
+ - lib/tapioca/gem/listeners/documentation.rb
241
257
  - lib/tapioca/gem/listeners/dynamic_mixins.rb
242
258
  - lib/tapioca/gem/listeners/foreign_constants.rb
243
259
  - lib/tapioca/gem/listeners/methods.rb
@@ -251,7 +267,6 @@ files:
251
267
  - lib/tapioca/gem/listeners/sorbet_type_variables.rb
252
268
  - lib/tapioca/gem/listeners/source_location.rb
253
269
  - lib/tapioca/gem/listeners/subconstants.rb
254
- - lib/tapioca/gem/listeners/yard_doc.rb
255
270
  - lib/tapioca/gem/pipeline.rb
256
271
  - lib/tapioca/gem_info.rb
257
272
  - lib/tapioca/gemfile.rb
@@ -260,10 +275,10 @@ files:
260
275
  - lib/tapioca/helpers/env_helper.rb
261
276
  - lib/tapioca/helpers/gem_helper.rb
262
277
  - lib/tapioca/helpers/git_attributes.rb
278
+ - lib/tapioca/helpers/package_url.rb
263
279
  - lib/tapioca/helpers/rbi_files_helper.rb
264
280
  - lib/tapioca/helpers/rbi_helper.rb
265
281
  - lib/tapioca/helpers/sorbet_helper.rb
266
- - lib/tapioca/helpers/source_uri.rb
267
282
  - lib/tapioca/helpers/test/content.rb
268
283
  - lib/tapioca/helpers/test/dsl_compiler.rb
269
284
  - lib/tapioca/helpers/test/isolation.rb
@@ -276,8 +291,6 @@ files:
276
291
  - lib/tapioca/rbi_formatter.rb
277
292
  - lib/tapioca/rbs/rewriter.rb
278
293
  - lib/tapioca/repo_index.rb
279
- - lib/tapioca/runtime/attached_class_of_32.rb
280
- - lib/tapioca/runtime/attached_class_of_legacy.rb
281
294
  - lib/tapioca/runtime/dynamic_mixin_compiler.rb
282
295
  - lib/tapioca/runtime/generic_type_registry.rb
283
296
  - lib/tapioca/runtime/helpers.rb
@@ -317,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
330
  - !ruby/object:Gem::Version
318
331
  version: '0'
319
332
  requirements: []
320
- rubygems_version: 3.7.2
333
+ rubygems_version: 4.0.3
321
334
  specification_version: 4
322
335
  summary: A Ruby Interface file generator for gems, core types and the Ruby standard
323
336
  library