rigortype 0.1.3 → 0.1.5

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +154 -33
  3. data/lib/rigor/analysis/check_rules.rb +10 -18
  4. data/lib/rigor/analysis/dependency_source_inference/boundary_cross_reporter.rb +75 -0
  5. data/lib/rigor/analysis/dependency_source_inference/builder.rb +47 -21
  6. data/lib/rigor/analysis/dependency_source_inference/gem_resolver.rb +1 -1
  7. data/lib/rigor/analysis/dependency_source_inference/index.rb +32 -3
  8. data/lib/rigor/analysis/dependency_source_inference/walker.rb +1 -1
  9. data/lib/rigor/analysis/dependency_source_inference.rb +1 -0
  10. data/lib/rigor/analysis/diagnostic.rb +0 -2
  11. data/lib/rigor/analysis/fact_store.rb +26 -6
  12. data/lib/rigor/analysis/result.rb +11 -3
  13. data/lib/rigor/analysis/rule_catalog.rb +2 -2
  14. data/lib/rigor/analysis/run_stats.rb +193 -0
  15. data/lib/rigor/analysis/runner.rb +498 -12
  16. data/lib/rigor/analysis/worker_session.rb +327 -0
  17. data/lib/rigor/builtins/imported_refinements.rb +364 -55
  18. data/lib/rigor/builtins/regex_refinement.rb +17 -12
  19. data/lib/rigor/cache/descriptor.rb +1 -1
  20. data/lib/rigor/cache/rbs_descriptor.rb +3 -1
  21. data/lib/rigor/cache/store.rb +39 -6
  22. data/lib/rigor/cli/diff_command.rb +1 -1
  23. data/lib/rigor/cli/sig_gen_command.rb +173 -0
  24. data/lib/rigor/cli/type_of_command.rb +1 -1
  25. data/lib/rigor/cli/type_scan_renderer.rb +1 -1
  26. data/lib/rigor/cli/type_scan_report.rb +2 -2
  27. data/lib/rigor/cli.rb +61 -3
  28. data/lib/rigor/configuration/dependencies.rb +2 -2
  29. data/lib/rigor/configuration.rb +131 -6
  30. data/lib/rigor/environment/bundle_sig_discovery.rb +198 -0
  31. data/lib/rigor/environment/class_registry.rb +12 -3
  32. data/lib/rigor/environment/lockfile_resolver.rb +125 -0
  33. data/lib/rigor/environment/rbs_collection_discovery.rb +126 -0
  34. data/lib/rigor/environment/rbs_coverage_report.rb +112 -0
  35. data/lib/rigor/environment/rbs_loader.rb +194 -6
  36. data/lib/rigor/environment/reflection.rb +152 -0
  37. data/lib/rigor/environment.rb +109 -6
  38. data/lib/rigor/flow_contribution/conflict.rb +2 -2
  39. data/lib/rigor/flow_contribution/element.rb +1 -1
  40. data/lib/rigor/flow_contribution/fact.rb +1 -1
  41. data/lib/rigor/flow_contribution/merge_result.rb +1 -1
  42. data/lib/rigor/flow_contribution/merger.rb +3 -3
  43. data/lib/rigor/flow_contribution.rb +2 -2
  44. data/lib/rigor/inference/acceptance.rb +35 -1
  45. data/lib/rigor/inference/block_parameter_binder.rb +0 -2
  46. data/lib/rigor/inference/builtins/method_catalog.rb +12 -5
  47. data/lib/rigor/inference/builtins/numeric_catalog.rb +15 -4
  48. data/lib/rigor/inference/coverage_scanner.rb +1 -1
  49. data/lib/rigor/inference/expression_typer.rb +77 -11
  50. data/lib/rigor/inference/fallback.rb +1 -1
  51. data/lib/rigor/inference/macro_block_self_type.rb +96 -0
  52. data/lib/rigor/inference/method_dispatcher/block_folding.rb +3 -5
  53. data/lib/rigor/inference/method_dispatcher/constant_folding.rb +29 -41
  54. data/lib/rigor/inference/method_dispatcher/iterator_dispatch.rb +1 -3
  55. data/lib/rigor/inference/method_dispatcher/kernel_dispatch.rb +4 -4
  56. data/lib/rigor/inference/method_dispatcher/literal_string_folding.rb +1 -1
  57. data/lib/rigor/inference/method_dispatcher/method_folding.rb +135 -0
  58. data/lib/rigor/inference/method_dispatcher/overload_selector.rb +7 -12
  59. data/lib/rigor/inference/method_dispatcher/rbs_dispatch.rb +27 -11
  60. data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +46 -44
  61. data/lib/rigor/inference/method_dispatcher.rb +274 -5
  62. data/lib/rigor/inference/method_parameter_binder.rb +22 -14
  63. data/lib/rigor/inference/narrowing.rb +129 -12
  64. data/lib/rigor/inference/rbs_type_translator.rb +0 -2
  65. data/lib/rigor/inference/scope_indexer.rb +14 -9
  66. data/lib/rigor/inference/statement_evaluator.rb +7 -7
  67. data/lib/rigor/inference/synthetic_method.rb +86 -0
  68. data/lib/rigor/inference/synthetic_method_index.rb +82 -0
  69. data/lib/rigor/inference/synthetic_method_scanner.rb +521 -0
  70. data/lib/rigor/plugin/blueprint.rb +60 -0
  71. data/lib/rigor/plugin/io_boundary.rb +0 -2
  72. data/lib/rigor/plugin/loader.rb +5 -3
  73. data/lib/rigor/plugin/macro/block_as_method.rb +131 -0
  74. data/lib/rigor/plugin/macro/external_file.rb +143 -0
  75. data/lib/rigor/plugin/macro/heredoc_template.rb +201 -0
  76. data/lib/rigor/plugin/macro/trait_registry.rb +198 -0
  77. data/lib/rigor/plugin/macro.rb +31 -0
  78. data/lib/rigor/plugin/manifest.rb +102 -10
  79. data/lib/rigor/plugin/registry.rb +43 -2
  80. data/lib/rigor/plugin/services.rb +1 -1
  81. data/lib/rigor/plugin/type_node_resolver.rb +52 -0
  82. data/lib/rigor/plugin.rb +2 -0
  83. data/lib/rigor/rbs_extended/reporter.rb +91 -0
  84. data/lib/rigor/rbs_extended.rb +131 -32
  85. data/lib/rigor/scope.rb +25 -8
  86. data/lib/rigor/sig_gen/classification.rb +36 -0
  87. data/lib/rigor/sig_gen/generator.rb +1048 -0
  88. data/lib/rigor/sig_gen/layout_index.rb +108 -0
  89. data/lib/rigor/sig_gen/method_candidate.rb +62 -0
  90. data/lib/rigor/sig_gen/observation_collector.rb +391 -0
  91. data/lib/rigor/sig_gen/observed_call.rb +62 -0
  92. data/lib/rigor/sig_gen/path_mapper.rb +116 -0
  93. data/lib/rigor/sig_gen/renderer.rb +157 -0
  94. data/lib/rigor/sig_gen/type_elaborator.rb +92 -0
  95. data/lib/rigor/sig_gen/write_result.rb +48 -0
  96. data/lib/rigor/sig_gen/writer.rb +530 -0
  97. data/lib/rigor/sig_gen.rb +25 -0
  98. data/lib/rigor/trinary.rb +15 -11
  99. data/lib/rigor/type/bot.rb +6 -3
  100. data/lib/rigor/type/bound_method.rb +79 -0
  101. data/lib/rigor/type/combinator.rb +207 -3
  102. data/lib/rigor/type/constant.rb +13 -0
  103. data/lib/rigor/type/hash_shape.rb +0 -2
  104. data/lib/rigor/type/integer_range.rb +7 -7
  105. data/lib/rigor/type/refined.rb +18 -12
  106. data/lib/rigor/type/top.rb +4 -3
  107. data/lib/rigor/type/union.rb +20 -1
  108. data/lib/rigor/type.rb +1 -0
  109. data/lib/rigor/type_node/generic.rb +68 -0
  110. data/lib/rigor/type_node/identifier.rb +38 -0
  111. data/lib/rigor/type_node/indexed_access.rb +41 -0
  112. data/lib/rigor/type_node/integer_literal.rb +29 -0
  113. data/lib/rigor/type_node/name_scope.rb +52 -0
  114. data/lib/rigor/type_node/resolver_chain.rb +56 -0
  115. data/lib/rigor/type_node/string_literal.rb +32 -0
  116. data/lib/rigor/type_node/symbol_literal.rb +28 -0
  117. data/lib/rigor/type_node/union.rb +42 -0
  118. data/lib/rigor/type_node.rb +29 -0
  119. data/lib/rigor/version.rb +1 -1
  120. data/lib/rigor.rb +2 -0
  121. data/sig/rigor/analysis/check_rules/always_truthy_condition_collector.rbs +10 -0
  122. data/sig/rigor/analysis/check_rules/dead_assignment_collector.rbs +10 -0
  123. data/sig/rigor/analysis/dependency_source_inference/gem_resolver.rbs +25 -0
  124. data/sig/rigor/analysis/dependency_source_inference/index.rbs +9 -0
  125. data/sig/rigor/cli/diff_command.rbs +4 -0
  126. data/sig/rigor/cli/explain_command.rbs +4 -0
  127. data/sig/rigor/cli/sig_gen_command.rbs +4 -0
  128. data/sig/rigor/cli/type_scan_command.rbs +3 -0
  129. data/sig/rigor/environment.rbs +8 -2
  130. data/sig/rigor/inference/builtins/method_catalog.rbs +4 -0
  131. data/sig/rigor/inference/builtins/numeric_catalog.rbs +3 -0
  132. data/sig/rigor/inference/builtins.rbs +2 -0
  133. data/sig/rigor/plugin/access_denied_error.rbs +3 -0
  134. data/sig/rigor/plugin/base.rbs +6 -0
  135. data/sig/rigor/plugin/blueprint.rbs +7 -0
  136. data/sig/rigor/plugin/fact_store.rbs +11 -0
  137. data/sig/rigor/plugin/io_boundary.rbs +4 -0
  138. data/sig/rigor/plugin/load_error.rbs +6 -0
  139. data/sig/rigor/plugin/loader.rbs +20 -0
  140. data/sig/rigor/plugin/manifest.rbs +9 -0
  141. data/sig/rigor/plugin/registry.rbs +16 -0
  142. data/sig/rigor/plugin/services.rbs +3 -0
  143. data/sig/rigor/plugin/trust_policy.rbs +4 -0
  144. data/sig/rigor/plugin/type_node_resolver.rbs +3 -0
  145. data/sig/rigor/plugin.rbs +8 -0
  146. data/sig/rigor/scope.rbs +4 -2
  147. data/sig/rigor/type.rbs +28 -6
  148. data/sig/rigor.rbs +35 -2
  149. metadata +90 -1
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rigor
4
+ module TypeNode
5
+ # Walks an ordered list of {Rigor::Plugin::TypeNodeResolver}
6
+ # instances, returning the first non-nil `resolve(node, scope)`
7
+ # answer. ADR-13 § "`Plugin::TypeNodeResolver` shape" — first
8
+ # non-nil wins; registration order is the user's lever for
9
+ # shadowing per WD3 / WD5.
10
+ #
11
+ # The chain is itself a `TypeNodeResolver`-shaped object
12
+ # (`#resolve(node, scope)`) so it slots into a {NameScope} as
13
+ # the `resolver:` field without further indirection: a plugin
14
+ # resolver that wants to recursively resolve a nested argument
15
+ # calls `scope.resolver.resolve(arg, scope)` and reaches every
16
+ # resolver in the chain plus the built-in registry through the
17
+ # same entry point.
18
+ #
19
+ # Constructed once per `Analysis::Runner.run` from
20
+ # `Plugin::Registry#type_node_resolvers`. The chain is
21
+ # immutable and re-entrant; the parser may consult it many
22
+ # times for the same node.
23
+ class ResolverChain
24
+ def initialize(resolvers)
25
+ unless resolvers.is_a?(Array) && resolvers.all? { |r| r.respond_to?(:resolve) }
26
+ raise ArgumentError,
27
+ "TypeNode::ResolverChain expects an Array of resolvers " \
28
+ "responding to #resolve(node, scope), got #{resolvers.inspect}"
29
+ end
30
+
31
+ @resolvers = resolvers.dup.freeze
32
+ freeze
33
+ end
34
+
35
+ # @return [Array<Rigor::Plugin::TypeNodeResolver>] ordered
36
+ # resolver instances, in plugin-registration order.
37
+ attr_reader :resolvers
38
+
39
+ # First non-nil `resolve(node, scope)` answer from the chain;
40
+ # `nil` when every resolver declined.
41
+ def resolve(node, scope)
42
+ @resolvers.each do |resolver|
43
+ result = resolver.resolve(node, scope)
44
+ return result unless result.nil?
45
+ end
46
+ nil
47
+ end
48
+
49
+ # Shared empty chain — a `NameScope` constructed without any
50
+ # plugin-supplied resolvers can use this to satisfy the
51
+ # `responds_to?(:resolve)` contract without a per-call
52
+ # allocation.
53
+ EMPTY = new([]).freeze
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rigor
4
+ module TypeNode
5
+ # String-literal AST node. Used as a {Generic#args} entry for
6
+ # parametric forms whose argument is a String literal — namely
7
+ # `Pick[T, "name"]`, `pick_of[Shape, "a" | "b"]`, and downstream
8
+ # plugin resolvers that accept literal key selectors.
9
+ #
10
+ # ADR-13 follow-up (`docs/CURRENT_WORK.md` engineering item
11
+ # #2): the RBS::Extended grammar previously could not tokenise
12
+ # `"name"` inside a type-arg position. The resolver translates
13
+ # this node to a `Type::Constant` carrying the string value.
14
+ # Slice 1 supports double-quoted strings without escape
15
+ # sequences (the most common shape — TS-style key unions
16
+ # are bare identifier-ish names).
17
+ class StringLiteral < Data.define(:value)
18
+ def initialize(value:)
19
+ unless value.is_a?(String)
20
+ raise ArgumentError,
21
+ "TypeNode::StringLiteral value must be a String, " \
22
+ "got #{value.inspect}"
23
+ end
24
+
25
+ # Freeze the String field so the Data object is
26
+ # `Ractor.shareable?` regardless of caller frozen-
27
+ # string-literal state.
28
+ super(value: value.frozen? ? value : value.dup.freeze)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rigor
4
+ module TypeNode
5
+ # Symbol-literal AST node. Used as a {Generic#args} entry for
6
+ # parametric forms whose argument is a Symbol literal — namely
7
+ # `Pick[T, :name]`, `pick_of[Shape, :a | :b]`, and downstream
8
+ # plugin resolvers that accept literal key selectors.
9
+ #
10
+ # ADR-13 follow-up (`docs/CURRENT_WORK.md` engineering item
11
+ # #2): the RBS::Extended grammar previously could not tokenise
12
+ # `:name` inside a type-arg position; this addition closes the
13
+ # gap so `ImportedRefinements.parse` produces a uniform AST.
14
+ # The resolver translates this node to a `Type::Constant`
15
+ # carrying the symbol value.
16
+ class SymbolLiteral < Data.define(:value)
17
+ def initialize(value:)
18
+ unless value.is_a?(Symbol)
19
+ raise ArgumentError,
20
+ "TypeNode::SymbolLiteral value must be a Symbol, " \
21
+ "got #{value.inspect}"
22
+ end
23
+
24
+ super
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rigor
4
+ module TypeNode
5
+ # Union AST node. Carries the nodes of a `T1 | T2 | …` union
6
+ # expression authored at type-arg position.
7
+ #
8
+ # ADR-13 follow-up (`docs/CURRENT_WORK.md` engineering item
9
+ # #2): together with {SymbolLiteral} / {StringLiteral} this
10
+ # closes the parser-side gap that prevented `Pick[T, :a | :b]`
11
+ # / `Pick[T, "a" | "b"]` from tokenising. The resolver pass
12
+ # recurses through each node and folds them via
13
+ # `Type::Combinator.union`.
14
+ #
15
+ # The field is named `:nodes` (not `:members`) to avoid
16
+ # shadowing `Data#members`, which is the introspection method
17
+ # every `Data.define` mix-in inherits.
18
+ #
19
+ # Nodes are themselves any of the {TypeNode} carriers — the
20
+ # parser builds a flat list (left-associative); nested
21
+ # `Union` nodes are permitted but the parser does not
22
+ # synthesise them by itself.
23
+ class Union < Data.define(:nodes)
24
+ def initialize(nodes:)
25
+ unless nodes.is_a?(Array) && nodes.size >= 2 && nodes.all? { |m| valid_member?(m) }
26
+ raise ArgumentError,
27
+ "TypeNode::Union nodes must be an Array (size >= 2) of " \
28
+ "TypeNode carriers, got #{nodes.inspect}"
29
+ end
30
+
31
+ super(nodes: nodes.freeze)
32
+ end
33
+
34
+ private
35
+
36
+ def valid_member?(node)
37
+ node.is_a?(Identifier) || node.is_a?(Generic) || node.is_a?(IntegerLiteral) ||
38
+ node.is_a?(IndexedAccess) || node.is_a?(SymbolLiteral) || node.is_a?(StringLiteral)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rigor
4
+ # Mini-AST passed to plugin-supplied `TypeNode` resolvers (see
5
+ # [ADR-13](../../docs/adr/13-typenode-resolver-plugin.md)). The
6
+ # two leaf carriers — {Identifier} and {Generic} — describe a
7
+ # node in an `%a{rigor:v1:...}` payload at the point the
8
+ # built-in registry / `ImportedRefinements::Parser` failed to
9
+ # resolve it and the analyzer hands the node off to plugins.
10
+ #
11
+ # Slice 1 of the ADR-13 envelope ships these two value objects
12
+ # only. The `NameScope` companion + plugin manifest hook arrive
13
+ # in slice 2; the parser integration arrives in slice 3. Until
14
+ # those land, the carriers are reachable only through direct
15
+ # instantiation in tests — they are the stable data shape every
16
+ # later slice consumes.
17
+ module TypeNode
18
+ end
19
+ end
20
+
21
+ require_relative "type_node/identifier"
22
+ require_relative "type_node/integer_literal"
23
+ require_relative "type_node/symbol_literal"
24
+ require_relative "type_node/string_literal"
25
+ require_relative "type_node/generic"
26
+ require_relative "type_node/indexed_access"
27
+ require_relative "type_node/union"
28
+ require_relative "type_node/name_scope"
29
+ require_relative "type_node/resolver_chain"
data/lib/rigor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rigor
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/rigor.rb CHANGED
@@ -29,6 +29,7 @@ require_relative "rigor/cache/rbs_class_ancestor_table"
29
29
  require_relative "rigor/cache/rbs_class_type_param_names"
30
30
  require_relative "rigor/cache/rbs_environment"
31
31
  require_relative "rigor/cache/rbs_instance_definitions"
32
+ require_relative "rigor/type_node"
32
33
  require_relative "rigor/flow_contribution"
33
34
  require_relative "rigor/flow_contribution/fact"
34
35
  require_relative "rigor/flow_contribution/conflict"
@@ -43,4 +44,5 @@ require_relative "rigor/analysis/diagnostic"
43
44
  require_relative "rigor/analysis/result"
44
45
  require_relative "rigor/analysis/check_rules"
45
46
  require_relative "rigor/analysis/runner"
47
+ require_relative "rigor/sig_gen"
46
48
  require_relative "rigor/cli"
@@ -0,0 +1,10 @@
1
+ module Rigor
2
+ module Analysis
3
+ module CheckRules
4
+ class AlwaysTruthyConditionCollector
5
+ def initialize: (untyped) -> void
6
+ def collect: (untyped) -> Array[untyped]
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Rigor
2
+ module Analysis
3
+ module CheckRules
4
+ class DeadAssignmentCollector
5
+ def initialize: (untyped) -> void
6
+ def collect: (untyped) -> Array[untyped]
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ module Rigor
2
+ module Analysis
3
+ module DependencySourceInference
4
+ module GemResolver
5
+ class Resolved
6
+ def descriptor_key: () -> Array[untyped]
7
+ end
8
+
9
+ class Unresolvable
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ module Rigor
17
+ module Analysis
18
+ module DependencySourceInference
19
+ module GemResolver
20
+ def self?.resolve: (untyped) -> (Rigor::Analysis::DependencySourceInference::GemResolver::Resolved | Rigor::Analysis::DependencySourceInference::GemResolver::Unresolvable)
21
+ def self?.locate_gem_spec: (untyped) -> (Gem::BasicSpecification | Gem::Specification | nil)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ module Rigor
2
+ module Analysis
3
+ module DependencySourceInference
4
+ class Index
5
+ def initialize: (?resolved_gems: untyped, ?unresolvable: untyped, ?method_catalog: untyped, ?budget_exceeded: untyped, ?class_to_gem: untyped, ?budget_overrun_strategy: untyped) -> void
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ class Rigor::CLI::DiffCommand
2
+ def initialize: (argv: untyped, out: untyped, err: untyped) -> void
3
+ def run: () -> (0 | 1 | Integer)
4
+ end
@@ -0,0 +1,4 @@
1
+ class Rigor::CLI::ExplainCommand
2
+ def initialize: (argv: untyped, out: untyped, err: untyped) -> void
3
+ def run: () -> (0 | Integer)
4
+ end
@@ -0,0 +1,4 @@
1
+ class Rigor::CLI::SigGenCommand
2
+ def initialize: (argv: untyped, out: untyped, err: untyped) -> void
3
+ def run: () -> (0 | Integer)
4
+ end
@@ -0,0 +1,3 @@
1
+ class Rigor::CLI::TypeScanCommand::ScanAccumulator
2
+ def record_parse_error: (untyped, untyped) -> Array[untyped]
3
+ end
@@ -8,16 +8,21 @@ module Rigor
8
8
  attr_reader rbs_loader: RbsLoader?
9
9
  attr_reader plugin_registry: untyped?
10
10
  attr_reader dependency_source_index: untyped?
11
+ attr_reader rbs_extended_reporter: untyped?
12
+ attr_reader boundary_cross_reporter: untyped?
13
+ attr_reader name_scope: untyped?
14
+ attr_reader synthetic_method_index: untyped?
11
15
 
12
16
  def self.default: () -> Environment
13
- def self.for_project: (?root: String, ?libraries: Array[String], ?signature_paths: Array[String | _ToPath]?, ?cache_store: untyped?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?) -> Environment
17
+ def self.for_project: (?root: String, ?libraries: Array[String], ?signature_paths: Array[String | _ToPath]?, ?cache_store: untyped?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?, ?rbs_extended_reporter: untyped?, ?boundary_cross_reporter: untyped?, ?bundler_bundle_path: String?, ?bundler_auto_detect: bool, ?synthetic_method_index: untyped?) -> Environment
14
18
 
15
- def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?) -> void
19
+ def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?, ?rbs_extended_reporter: untyped?, ?boundary_cross_reporter: untyped?, ?synthetic_method_index: untyped?) -> void
16
20
  def nominal_for_name: (String | Symbol name) -> Type::Nominal?
17
21
  def singleton_for_name: (String | Symbol name) -> Type::Singleton?
18
22
  def constant_for_name: (String | Symbol name) -> Type::t?
19
23
  def class_known?: (String | Symbol name) -> bool
20
24
  def class_ordering: (String | Symbol lhs, String | Symbol rhs) -> ordering
25
+ def reflection: () -> untyped?
21
26
 
22
27
  class ClassRegistry
23
28
  def self.default: () -> ClassRegistry
@@ -39,6 +44,7 @@ module Rigor
39
44
  def self.default: () -> RbsLoader
40
45
  def self.reset_default!: () -> void
41
46
  def self.build_env_for: (libraries: Array[String], signature_paths: Array[String | _ToPath]) -> untyped
47
+ def self.vendored_gem_sig_paths: () -> Array[Pathname]
42
48
 
43
49
  def initialize: (?libraries: Array[String], ?signature_paths: Array[String | _ToPath], ?cache_store: untyped?) -> void
44
50
  def class_known?: (String | Symbol name) -> bool
@@ -0,0 +1,4 @@
1
+ class Rigor::Inference::Builtins::MethodCatalog
2
+ def initialize: (path: String, ?mutating_selectors: Hash[String, Set[untyped]]) -> void
3
+ def reset!: () -> nil
4
+ end
@@ -0,0 +1,3 @@
1
+ class Rigor::Inference::Builtins::NumericCatalog
2
+ def self.reset!: () -> nil
3
+ end
@@ -0,0 +1,2 @@
1
+ module Rigor::Inference::Builtins
2
+ end
@@ -0,0 +1,3 @@
1
+ class Rigor::Plugin::AccessDeniedError
2
+ def initialize: (untyped, reason: untyped, ?resource: untyped) -> void
3
+ end
@@ -0,0 +1,6 @@
1
+ class Rigor::Plugin::Base
2
+ def self.manifest: () -> Rigor::Plugin::Manifest
3
+ def initialize: (services: untyped, ?config: untyped) -> void
4
+ def init: (untyped) -> nil
5
+ def prepare: (untyped) -> nil
6
+ end
@@ -0,0 +1,7 @@
1
+ class Rigor::Plugin::Blueprint
2
+ attr_reader klass_name: String
3
+ attr_reader config: Hash[untyped, untyped]
4
+
5
+ def initialize: (klass_name: String | Module, ?config: Hash[untyped, untyped]) -> void
6
+ def materialize: (services: untyped) -> Rigor::Plugin::Base
7
+ end
@@ -0,0 +1,11 @@
1
+ class Rigor::Plugin::FactStore
2
+ def initialize: () -> void
3
+ def publish: (plugin_id: untyped, name: untyped, value: untyped) -> nil
4
+ def read: (plugin_id: untyped, name: untyped) -> untyped
5
+ def published?: (plugin_id: untyped, name: untyped) -> bool
6
+ def each_fact: () { (untyped) -> void } -> void
7
+ end
8
+
9
+ class Rigor::Plugin::FactStore::Conflict
10
+ def initialize: (plugin_id: untyped, name: untyped, existing: untyped, incoming: untyped) -> void
11
+ end
@@ -0,0 +1,4 @@
1
+ class Rigor::Plugin::IoBoundary
2
+ def initialize: (policy: untyped, plugin_id: untyped, ?http_client: untyped) -> void
3
+ def read_file: (untyped) -> String
4
+ end
@@ -0,0 +1,6 @@
1
+ class Rigor::Plugin::LoadError < StandardError
2
+ attr_reader plugin_ref: untyped
3
+ attr_reader cause: untyped
4
+ attr_reader reason: Symbol
5
+ def initialize: (untyped, plugin_ref: untyped, ?cause: untyped, ?reason: untyped) -> void
6
+ end
@@ -0,0 +1,20 @@
1
+ module Rigor
2
+ module Plugin
3
+ # Resolves the project's `.rigor.yml` `plugins:` entries into
4
+ # instantiated plugin instances. The other Plugin namespaces
5
+ # (`Services`, `Registry`, `Base`, etc.) are not yet
6
+ # sig-covered, so reference them as `untyped` for now. The
7
+ # critical declaration here is `self.load`: without it, Steep
8
+ # matches against `Kernel#load`'s `(::String, ?(::Module | bool)) -> bool`
9
+ # signature and reports `MethodParameterMismatch` for the
10
+ # keyword-only shape.
11
+ class Loader
12
+ attr_reader services: untyped
13
+ attr_reader requirer: ^(String) -> untyped
14
+
15
+ def self.load: (configuration: Configuration, services: untyped, ?requirer: ^(String) -> untyped) -> untyped
16
+ def initialize: (services: untyped, ?requirer: ^(String) -> untyped) -> void
17
+ def load: (Array[String | Hash[untyped, untyped]] entries) -> untyped
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,9 @@
1
+ class Rigor::Plugin::Manifest::Consumption
2
+ def initialize: (plugin_id: untyped, name: untyped, ?optional: untyped) -> void
3
+ end
4
+
5
+ class Rigor::Plugin::Manifest
6
+ def initialize: (id: untyped, version: untyped, ?description: untyped, ?protocols: untyped, ?config_schema: untyped, ?produces: untyped, ?consumes: untyped, ?owns_receivers: untyped, ?type_node_resolvers: untyped, ?block_as_methods: untyped, ?heredoc_templates: untyped, ?trait_registries: untyped, ?external_files: untyped) -> void
7
+ def validate_config: (untyped) -> Array[String]
8
+ def to_h: () -> Hash[String, untyped]
9
+ end
@@ -0,0 +1,16 @@
1
+ class Rigor::Plugin::Registry
2
+ attr_reader plugins: untyped
3
+ attr_reader load_errors: untyped
4
+ attr_reader blueprints: untyped
5
+
6
+ EMPTY: Rigor::Plugin::Registry
7
+
8
+ def self.materialize: (blueprints: untyped, services: untyped) -> Rigor::Plugin::Registry
9
+
10
+ def initialize: (?plugins: untyped, ?load_errors: untyped, ?blueprints: untyped) -> void
11
+ def find: (String | Symbol id) -> untyped
12
+ def ids: () -> Array[String]
13
+ def empty?: () -> bool
14
+ def any_load_errors?: () -> bool
15
+ def type_node_resolvers: () -> Array[untyped]
16
+ end
@@ -0,0 +1,3 @@
1
+ class Rigor::Plugin::Services
2
+ def initialize: (reflection: untyped, type: untyped, configuration: untyped, ?cache_store: untyped, ?trust_policy: untyped, ?fact_store: untyped) -> void
3
+ end
@@ -0,0 +1,4 @@
1
+ class Rigor::Plugin::TrustPolicy
2
+ def initialize: (?trusted_gems: untyped, ?allowed_read_roots: untyped, ?network_policy: untyped, ?allowed_url_hosts: untyped) -> void
3
+ def to_h: () -> Hash[String, untyped]
4
+ end
@@ -0,0 +1,3 @@
1
+ class Rigor::Plugin::TypeNodeResolver
2
+ def resolve: (untyped, untyped) -> nil
3
+ end
@@ -0,0 +1,8 @@
1
+ module Rigor
2
+ module Plugin
3
+ def self.register: (Class plugin_class) -> Class
4
+ def self.registered_for: (String | Symbol id) -> Class?
5
+ def self.registered: () -> Hash[String, Class]
6
+ def self.unregister!: (?(String | Symbol)? id) -> untyped
7
+ end
8
+ end
data/sig/rigor/scope.rbs CHANGED
@@ -16,10 +16,12 @@ module Rigor
16
16
  attr_reader discovered_methods: Hash[String, Hash[Symbol, Symbol]]
17
17
  attr_reader discovered_def_nodes: Hash[String, Hash[Symbol, untyped]]
18
18
  attr_reader discovered_method_visibilities: Hash[String, Hash[Symbol, Symbol]]
19
+ attr_reader source_path: String?
19
20
 
20
- def self.empty: (?environment: Environment) -> Scope
21
+ def self.empty: (?environment: Environment, ?source_path: String?) -> Scope
21
22
 
22
- def initialize: (environment: Environment, locals: Hash[Symbol, Type::t], ?fact_store: Analysis::FactStore, ?self_type: Type::t?, ?declared_types: Hash[untyped, Type::t], ?ivars: Hash[Symbol, Type::t], ?cvars: Hash[Symbol, Type::t], ?globals: Hash[Symbol, Type::t]) -> void
23
+ def initialize: (environment: Environment, locals: Hash[Symbol, Type::t], ?fact_store: Analysis::FactStore, ?self_type: Type::t?, ?declared_types: Hash[untyped, Type::t], ?ivars: Hash[Symbol, Type::t], ?cvars: Hash[Symbol, Type::t], ?globals: Hash[Symbol, Type::t], ?source_path: String?) -> void
24
+ def with_source_path: (String? path) -> Scope
23
25
  def local: (String | Symbol name) -> Type::t?
24
26
  def ivar: (String | Symbol name) -> Type::t?
25
27
  def cvar: (String | Symbol name) -> Type::t?
data/sig/rigor/type.rbs CHANGED
@@ -7,34 +7,34 @@ module Rigor
7
7
  class Top
8
8
  def self.instance: () -> Top
9
9
  def describe: (?Symbol verbosity) -> String
10
- def erase_to_rbs: () -> String
10
+ def erase_to_rbs: () -> "top"
11
11
  def top: () -> Trinary
12
12
  def bot: () -> Trinary
13
13
  def dynamic: () -> Trinary
14
14
  def accepts: (Type::t other, ?mode: accepts_mode) -> AcceptsResult
15
15
  def ==: (untyped other) -> bool
16
16
  def hash: () -> Integer
17
- def inspect: () -> String
17
+ def inspect: () -> "#<Rigor::Type::Top>"
18
18
  end
19
19
 
20
20
  class Bot
21
21
  def self.instance: () -> Bot
22
22
  def describe: (?Symbol verbosity) -> String
23
- def erase_to_rbs: () -> String
23
+ def erase_to_rbs: () -> "bot"
24
24
  def top: () -> Trinary
25
25
  def bot: () -> Trinary
26
26
  def dynamic: () -> Trinary
27
27
  def accepts: (Type::t other, ?mode: accepts_mode) -> AcceptsResult
28
28
  def ==: (untyped other) -> bool
29
29
  def hash: () -> Integer
30
- def inspect: () -> String
30
+ def inspect: () -> "#<Rigor::Type::Bot>"
31
31
  end
32
32
 
33
33
  class Dynamic
34
34
  attr_reader static_facet: Type::t
35
35
  def initialize: (Type::t static_facet) -> void
36
36
  def describe: (?Symbol verbosity) -> String
37
- def erase_to_rbs: () -> String
37
+ def erase_to_rbs: () -> "untyped"
38
38
  def top: () -> Trinary
39
39
  def bot: () -> Trinary
40
40
  def dynamic: () -> Trinary
@@ -72,7 +72,7 @@ module Rigor
72
72
  def upper: () -> (Integer | Float)
73
73
  def describe: (?Symbol verbosity) -> String
74
74
  def generic_description: () -> String
75
- def erase_to_rbs: () -> String
75
+ def erase_to_rbs: () -> "Integer"
76
76
  def top: () -> Trinary
77
77
  def bot: () -> Trinary
78
78
  def dynamic: () -> Trinary
@@ -156,6 +156,21 @@ module Rigor
156
156
  def inspect: () -> String
157
157
  end
158
158
 
159
+ class BoundMethod
160
+ attr_reader receiver_type: Type::t
161
+ attr_reader method_name: Symbol
162
+ def initialize: (receiver_type: Type::t, method_name: Symbol) -> void
163
+ def describe: (?Symbol verbosity) -> String
164
+ def erase_to_rbs: () -> String
165
+ def top: () -> Trinary
166
+ def bot: () -> Trinary
167
+ def dynamic: () -> Trinary
168
+ def accepts: (Type::t other, ?mode: accepts_mode) -> AcceptsResult
169
+ def ==: (untyped other) -> bool
170
+ def hash: () -> Integer
171
+ def inspect: () -> String
172
+ end
173
+
159
174
  class Intersection
160
175
  attr_reader members: Array[Type::t]
161
176
  def initialize: (Array[Type::t] members) -> void
@@ -232,6 +247,7 @@ module Rigor
232
247
  def self?.nominal_of: (Module | String class_name_or_object, ?type_args: Array[Type::t]) -> Nominal
233
248
  def self?.singleton_of: (Module | String class_name_or_object) -> Singleton
234
249
  def self?.constant_of: (untyped value) -> Constant
250
+ def self?.bound_method_of: (Type::t receiver_type, Symbol method_name) -> BoundMethod
235
251
  def self?.difference: (Type::t base, Type::t removed) -> Difference
236
252
  def self?.non_empty_string: () -> Difference
237
253
  def self?.non_zero_int: () -> Difference
@@ -268,6 +284,12 @@ module Rigor
268
284
  def self?.int_mask: (Array[Integer] flags) -> Type::t?
269
285
  def self?.int_mask_of: (Type::t type) -> Type::t?
270
286
  def self?.indexed_access: (Type::t type, Type::t key) -> Type::t
287
+ def self?.pick_of: (Type::t type, Type::t keys) -> Type::t
288
+ def self?.omit_of: (Type::t type, Type::t keys) -> Type::t
289
+ def self?.partial_of: (Type::t type) -> Type::t
290
+ def self?.required_of: (Type::t type) -> Type::t
291
+ def self?.readonly_of: (Type::t type) -> Type::t
292
+ def self?.shape_projection_lossy?: (Type::t type) -> bool
271
293
  end
272
294
  end
273
295
  end
data/sig/rigor.rbs CHANGED
@@ -54,13 +54,46 @@ module Rigor
54
54
 
55
55
  class Result
56
56
  attr_reader diagnostics: Array[Diagnostic]
57
+ attr_reader stats: RunStats?
57
58
 
58
- def initialize: (?diagnostics: Array[Diagnostic]) -> void
59
+ def initialize: (?diagnostics: Array[Diagnostic], ?stats: RunStats?) -> void
59
60
  def success?: () -> bool
60
61
  def error_count: () -> Integer
61
62
  def to_h: () -> Hash[String, untyped]
62
63
  end
63
64
 
65
+ class RunStats
66
+ attr_reader wall_seconds: Float
67
+ attr_reader peak_rss_bytes: Integer?
68
+ attr_reader target_files: Integer
69
+ attr_reader rbs_classes_total: Integer
70
+ attr_reader rbs_classes_project_sig: Integer
71
+ attr_reader rbs_classes_bundled: Integer
72
+ attr_reader gem_walk_classes: Integer
73
+ attr_reader gem_walk_gems: Integer
74
+ attr_reader rbs_attribution_available: bool
75
+
76
+ CACHED_SENTINEL: String
77
+
78
+ def self.peak_rss_bytes: () -> Integer?
79
+ def self.partition_classes: (class_decl_paths: Hash[String, String], signature_paths: Array[untyped]) -> [Integer, Integer]
80
+ def self.attribution_available?: (class_decl_paths: Hash[String, String]) -> bool
81
+
82
+ def initialize: (
83
+ wall_seconds: Float,
84
+ peak_rss_bytes: Integer?,
85
+ target_files: Integer,
86
+ rbs_classes_total: Integer,
87
+ rbs_classes_project_sig: Integer,
88
+ rbs_classes_bundled: Integer,
89
+ gem_walk_classes: Integer,
90
+ gem_walk_gems: Integer,
91
+ ?rbs_attribution_available: bool
92
+ ) -> void
93
+ def format: (untyped out, ?prefix: String) -> void
94
+ def to_h: () -> Hash[Symbol, untyped]
95
+ end
96
+
64
97
  class Runner
65
98
  RUBY_GLOB: String
66
99
  DEFAULT_CACHE_ROOT: String
@@ -71,7 +104,7 @@ module Rigor
71
104
  # otherwise raises `RBS::UnknownTypeName` for the named type.
72
105
  attr_reader cache_store: untyped
73
106
  attr_reader plugin_registry: untyped
74
- def initialize: (configuration: Configuration, ?explain: bool, ?cache_store: untyped, ?plugin_requirer: untyped) -> void
107
+ def initialize: (configuration: Configuration, ?explain: bool, ?cache_store: untyped, ?plugin_requirer: untyped, ?workers: Integer, ?collect_stats: bool) -> void
75
108
  def run: (?Array[String] paths) -> Result
76
109
  end
77
110
  end