rigortype 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/README.md +125 -31
- data/lib/rigor/analysis/check_rules.rb +10 -18
- data/lib/rigor/analysis/dependency_source_inference/boundary_cross_reporter.rb +75 -0
- data/lib/rigor/analysis/dependency_source_inference/builder.rb +47 -21
- data/lib/rigor/analysis/dependency_source_inference/gem_resolver.rb +1 -1
- data/lib/rigor/analysis/dependency_source_inference/index.rb +32 -3
- data/lib/rigor/analysis/dependency_source_inference/walker.rb +1 -1
- data/lib/rigor/analysis/dependency_source_inference.rb +1 -0
- data/lib/rigor/analysis/diagnostic.rb +0 -2
- data/lib/rigor/analysis/fact_store.rb +11 -3
- data/lib/rigor/analysis/rule_catalog.rb +2 -2
- data/lib/rigor/analysis/runner.rb +114 -3
- data/lib/rigor/builtins/imported_refinements.rb +360 -55
- data/lib/rigor/cache/descriptor.rb +1 -1
- data/lib/rigor/cache/store.rb +1 -1
- data/lib/rigor/cli/diff_command.rb +1 -1
- data/lib/rigor/cli/sig_gen_command.rb +173 -0
- data/lib/rigor/cli/type_of_command.rb +1 -1
- data/lib/rigor/cli/type_scan_renderer.rb +1 -1
- data/lib/rigor/cli/type_scan_report.rb +2 -2
- data/lib/rigor/cli.rb +9 -1
- data/lib/rigor/configuration/dependencies.rb +2 -2
- data/lib/rigor/configuration.rb +2 -2
- data/lib/rigor/environment.rb +35 -4
- data/lib/rigor/flow_contribution/conflict.rb +2 -2
- data/lib/rigor/flow_contribution/element.rb +1 -1
- data/lib/rigor/flow_contribution/fact.rb +1 -1
- data/lib/rigor/flow_contribution/merge_result.rb +1 -1
- data/lib/rigor/flow_contribution/merger.rb +3 -3
- data/lib/rigor/flow_contribution.rb +2 -2
- data/lib/rigor/inference/block_parameter_binder.rb +0 -2
- data/lib/rigor/inference/coverage_scanner.rb +1 -1
- data/lib/rigor/inference/expression_typer.rb +67 -11
- data/lib/rigor/inference/fallback.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/block_folding.rb +3 -5
- data/lib/rigor/inference/method_dispatcher/constant_folding.rb +0 -12
- data/lib/rigor/inference/method_dispatcher/iterator_dispatch.rb +1 -3
- data/lib/rigor/inference/method_dispatcher/literal_string_folding.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/method_folding.rb +118 -0
- data/lib/rigor/inference/method_dispatcher/overload_selector.rb +6 -11
- data/lib/rigor/inference/method_dispatcher/rbs_dispatch.rb +27 -11
- data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +0 -4
- data/lib/rigor/inference/method_dispatcher.rb +146 -2
- data/lib/rigor/inference/method_parameter_binder.rb +1 -3
- data/lib/rigor/inference/narrowing.rb +2 -4
- data/lib/rigor/inference/rbs_type_translator.rb +0 -2
- data/lib/rigor/inference/scope_indexer.rb +14 -9
- data/lib/rigor/inference/statement_evaluator.rb +7 -7
- data/lib/rigor/plugin/io_boundary.rb +0 -2
- data/lib/rigor/plugin/loader.rb +2 -2
- data/lib/rigor/plugin/manifest.rb +30 -9
- data/lib/rigor/plugin/registry.rb +11 -0
- data/lib/rigor/plugin/services.rb +1 -1
- data/lib/rigor/plugin/type_node_resolver.rb +52 -0
- data/lib/rigor/plugin.rb +1 -0
- data/lib/rigor/rbs_extended/reporter.rb +91 -0
- data/lib/rigor/rbs_extended.rb +131 -32
- data/lib/rigor/scope.rb +25 -8
- data/lib/rigor/sig_gen/classification.rb +36 -0
- data/lib/rigor/sig_gen/generator.rb +1048 -0
- data/lib/rigor/sig_gen/layout_index.rb +108 -0
- data/lib/rigor/sig_gen/method_candidate.rb +62 -0
- data/lib/rigor/sig_gen/observation_collector.rb +391 -0
- data/lib/rigor/sig_gen/observed_call.rb +62 -0
- data/lib/rigor/sig_gen/path_mapper.rb +116 -0
- data/lib/rigor/sig_gen/renderer.rb +157 -0
- data/lib/rigor/sig_gen/type_elaborator.rb +92 -0
- data/lib/rigor/sig_gen/write_result.rb +48 -0
- data/lib/rigor/sig_gen/writer.rb +530 -0
- data/lib/rigor/sig_gen.rb +25 -0
- data/lib/rigor/type/bound_method.rb +79 -0
- data/lib/rigor/type/combinator.rb +195 -2
- data/lib/rigor/type/constant.rb +13 -0
- data/lib/rigor/type/hash_shape.rb +0 -2
- data/lib/rigor/type/union.rb +20 -1
- data/lib/rigor/type.rb +1 -0
- data/lib/rigor/type_node/generic.rb +62 -0
- data/lib/rigor/type_node/identifier.rb +30 -0
- data/lib/rigor/type_node/indexed_access.rb +41 -0
- data/lib/rigor/type_node/integer_literal.rb +29 -0
- data/lib/rigor/type_node/name_scope.rb +52 -0
- data/lib/rigor/type_node/resolver_chain.rb +56 -0
- data/lib/rigor/type_node/string_literal.rb +29 -0
- data/lib/rigor/type_node/symbol_literal.rb +28 -0
- data/lib/rigor/type_node/union.rb +42 -0
- data/lib/rigor/type_node.rb +29 -0
- data/lib/rigor/version.rb +1 -1
- data/lib/rigor.rb +2 -0
- data/sig/rigor/analysis/check_rules/always_truthy_condition_collector.rbs +10 -0
- data/sig/rigor/analysis/check_rules/dead_assignment_collector.rbs +10 -0
- data/sig/rigor/analysis/dependency_source_inference/gem_resolver.rbs +25 -0
- data/sig/rigor/analysis/dependency_source_inference/index.rbs +9 -0
- data/sig/rigor/cli/diff_command.rbs +4 -0
- data/sig/rigor/cli/explain_command.rbs +4 -0
- data/sig/rigor/cli/sig_gen_command.rbs +4 -0
- data/sig/rigor/cli/type_scan_command.rbs +3 -0
- data/sig/rigor/environment.rbs +5 -2
- data/sig/rigor/inference/builtins/method_catalog.rbs +4 -0
- data/sig/rigor/inference/builtins/numeric_catalog.rbs +3 -0
- data/sig/rigor/inference/builtins.rbs +2 -0
- data/sig/rigor/plugin/access_denied_error.rbs +3 -0
- data/sig/rigor/plugin/base.rbs +6 -0
- data/sig/rigor/plugin/fact_store.rbs +11 -0
- data/sig/rigor/plugin/io_boundary.rbs +4 -0
- data/sig/rigor/plugin/load_error.rbs +6 -0
- data/sig/rigor/plugin/loader.rbs +20 -0
- data/sig/rigor/plugin/manifest.rbs +9 -0
- data/sig/rigor/plugin/registry.rbs +3 -0
- data/sig/rigor/plugin/services.rbs +3 -0
- data/sig/rigor/plugin/trust_policy.rbs +4 -0
- data/sig/rigor/plugin/type_node_resolver.rbs +3 -0
- data/sig/rigor/plugin.rbs +8 -0
- data/sig/rigor/scope.rbs +4 -2
- data/sig/rigor/type.rbs +28 -6
- metadata +52 -1
|
@@ -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
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,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
|
data/sig/rigor/environment.rbs
CHANGED
|
@@ -8,11 +8,14 @@ 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?
|
|
11
14
|
|
|
12
15
|
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
|
|
16
|
+
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?) -> Environment
|
|
14
17
|
|
|
15
|
-
def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?) -> void
|
|
18
|
+
def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?, ?rbs_extended_reporter: untyped?, ?boundary_cross_reporter: untyped?) -> void
|
|
16
19
|
def nominal_for_name: (String | Symbol name) -> Type::Nominal?
|
|
17
20
|
def singleton_for_name: (String | Symbol name) -> Type::Singleton?
|
|
18
21
|
def constant_for_name: (String | Symbol name) -> Type::t?
|
|
@@ -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,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) -> void
|
|
7
|
+
def validate_config: (untyped) -> Array[String]
|
|
8
|
+
def to_h: () -> Hash[String, untyped]
|
|
9
|
+
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: () ->
|
|
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: () ->
|
|
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: () ->
|
|
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: () ->
|
|
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: () ->
|
|
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: () ->
|
|
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
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rigortype
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rigor contributors
|
|
@@ -188,6 +188,7 @@ files:
|
|
|
188
188
|
- lib/rigor/analysis/check_rules/dead_assignment_collector.rb
|
|
189
189
|
- lib/rigor/analysis/check_rules/ivar_write_collector.rb
|
|
190
190
|
- lib/rigor/analysis/dependency_source_inference.rb
|
|
191
|
+
- lib/rigor/analysis/dependency_source_inference/boundary_cross_reporter.rb
|
|
191
192
|
- lib/rigor/analysis/dependency_source_inference/builder.rb
|
|
192
193
|
- lib/rigor/analysis/dependency_source_inference/gem_resolver.rb
|
|
193
194
|
- lib/rigor/analysis/dependency_source_inference/index.rb
|
|
@@ -214,6 +215,7 @@ files:
|
|
|
214
215
|
- lib/rigor/cli.rb
|
|
215
216
|
- lib/rigor/cli/diff_command.rb
|
|
216
217
|
- lib/rigor/cli/explain_command.rb
|
|
218
|
+
- lib/rigor/cli/sig_gen_command.rb
|
|
217
219
|
- lib/rigor/cli/type_of_command.rb
|
|
218
220
|
- lib/rigor/cli/type_of_renderer.rb
|
|
219
221
|
- lib/rigor/cli/type_scan_command.rb
|
|
@@ -266,6 +268,7 @@ files:
|
|
|
266
268
|
- lib/rigor/inference/method_dispatcher/iterator_dispatch.rb
|
|
267
269
|
- lib/rigor/inference/method_dispatcher/kernel_dispatch.rb
|
|
268
270
|
- lib/rigor/inference/method_dispatcher/literal_string_folding.rb
|
|
271
|
+
- lib/rigor/inference/method_dispatcher/method_folding.rb
|
|
269
272
|
- lib/rigor/inference/method_dispatcher/overload_selector.rb
|
|
270
273
|
- lib/rigor/inference/method_dispatcher/rbs_dispatch.rb
|
|
271
274
|
- lib/rigor/inference/method_dispatcher/shape_dispatch.rb
|
|
@@ -286,9 +289,23 @@ files:
|
|
|
286
289
|
- lib/rigor/plugin/registry.rb
|
|
287
290
|
- lib/rigor/plugin/services.rb
|
|
288
291
|
- lib/rigor/plugin/trust_policy.rb
|
|
292
|
+
- lib/rigor/plugin/type_node_resolver.rb
|
|
289
293
|
- lib/rigor/rbs_extended.rb
|
|
294
|
+
- lib/rigor/rbs_extended/reporter.rb
|
|
290
295
|
- lib/rigor/reflection.rb
|
|
291
296
|
- lib/rigor/scope.rb
|
|
297
|
+
- lib/rigor/sig_gen.rb
|
|
298
|
+
- lib/rigor/sig_gen/classification.rb
|
|
299
|
+
- lib/rigor/sig_gen/generator.rb
|
|
300
|
+
- lib/rigor/sig_gen/layout_index.rb
|
|
301
|
+
- lib/rigor/sig_gen/method_candidate.rb
|
|
302
|
+
- lib/rigor/sig_gen/observation_collector.rb
|
|
303
|
+
- lib/rigor/sig_gen/observed_call.rb
|
|
304
|
+
- lib/rigor/sig_gen/path_mapper.rb
|
|
305
|
+
- lib/rigor/sig_gen/renderer.rb
|
|
306
|
+
- lib/rigor/sig_gen/type_elaborator.rb
|
|
307
|
+
- lib/rigor/sig_gen/write_result.rb
|
|
308
|
+
- lib/rigor/sig_gen/writer.rb
|
|
292
309
|
- lib/rigor/source.rb
|
|
293
310
|
- lib/rigor/source/node_locator.rb
|
|
294
311
|
- lib/rigor/source/node_walker.rb
|
|
@@ -297,6 +314,7 @@ files:
|
|
|
297
314
|
- lib/rigor/type.rb
|
|
298
315
|
- lib/rigor/type/accepts_result.rb
|
|
299
316
|
- lib/rigor/type/bot.rb
|
|
317
|
+
- lib/rigor/type/bound_method.rb
|
|
300
318
|
- lib/rigor/type/combinator.rb
|
|
301
319
|
- lib/rigor/type/constant.rb
|
|
302
320
|
- lib/rigor/type/difference.rb
|
|
@@ -310,12 +328,45 @@ files:
|
|
|
310
328
|
- lib/rigor/type/top.rb
|
|
311
329
|
- lib/rigor/type/tuple.rb
|
|
312
330
|
- lib/rigor/type/union.rb
|
|
331
|
+
- lib/rigor/type_node.rb
|
|
332
|
+
- lib/rigor/type_node/generic.rb
|
|
333
|
+
- lib/rigor/type_node/identifier.rb
|
|
334
|
+
- lib/rigor/type_node/indexed_access.rb
|
|
335
|
+
- lib/rigor/type_node/integer_literal.rb
|
|
336
|
+
- lib/rigor/type_node/name_scope.rb
|
|
337
|
+
- lib/rigor/type_node/resolver_chain.rb
|
|
338
|
+
- lib/rigor/type_node/string_literal.rb
|
|
339
|
+
- lib/rigor/type_node/symbol_literal.rb
|
|
340
|
+
- lib/rigor/type_node/union.rb
|
|
313
341
|
- lib/rigor/version.rb
|
|
314
342
|
- sig/rigor.rbs
|
|
343
|
+
- sig/rigor/analysis/check_rules/always_truthy_condition_collector.rbs
|
|
344
|
+
- sig/rigor/analysis/check_rules/dead_assignment_collector.rbs
|
|
345
|
+
- sig/rigor/analysis/dependency_source_inference/gem_resolver.rbs
|
|
346
|
+
- sig/rigor/analysis/dependency_source_inference/index.rbs
|
|
315
347
|
- sig/rigor/analysis/fact_store.rbs
|
|
316
348
|
- sig/rigor/ast.rbs
|
|
349
|
+
- sig/rigor/cli/diff_command.rbs
|
|
350
|
+
- sig/rigor/cli/explain_command.rbs
|
|
351
|
+
- sig/rigor/cli/sig_gen_command.rbs
|
|
352
|
+
- sig/rigor/cli/type_scan_command.rbs
|
|
317
353
|
- sig/rigor/environment.rbs
|
|
318
354
|
- sig/rigor/inference.rbs
|
|
355
|
+
- sig/rigor/inference/builtins.rbs
|
|
356
|
+
- sig/rigor/inference/builtins/method_catalog.rbs
|
|
357
|
+
- sig/rigor/inference/builtins/numeric_catalog.rbs
|
|
358
|
+
- sig/rigor/plugin.rbs
|
|
359
|
+
- sig/rigor/plugin/access_denied_error.rbs
|
|
360
|
+
- sig/rigor/plugin/base.rbs
|
|
361
|
+
- sig/rigor/plugin/fact_store.rbs
|
|
362
|
+
- sig/rigor/plugin/io_boundary.rbs
|
|
363
|
+
- sig/rigor/plugin/load_error.rbs
|
|
364
|
+
- sig/rigor/plugin/loader.rbs
|
|
365
|
+
- sig/rigor/plugin/manifest.rbs
|
|
366
|
+
- sig/rigor/plugin/registry.rbs
|
|
367
|
+
- sig/rigor/plugin/services.rbs
|
|
368
|
+
- sig/rigor/plugin/trust_policy.rbs
|
|
369
|
+
- sig/rigor/plugin/type_node_resolver.rbs
|
|
319
370
|
- sig/rigor/rbs_extended.rbs
|
|
320
371
|
- sig/rigor/reflection.rbs
|
|
321
372
|
- sig/rigor/scope.rbs
|