rigortype 0.3.2 → 0.3.3
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 +1 -1
- data/docs/manual/04-diagnostics.md +8 -0
- data/lib/rigor/analysis/check_rules/always_truthy_condition_collector.rb +8 -0
- data/lib/rigor/analysis/check_rules/declaration_sourced_guard.rb +53 -0
- data/lib/rigor/analysis/check_rules/rule_walk.rb +7 -0
- data/lib/rigor/analysis/check_rules.rb +62 -22
- data/lib/rigor/analysis/rule_catalog.rb +5 -1
- data/lib/rigor/analysis/severity_stamp.rb +2 -1
- data/lib/rigor/inference/anonymous_meta_class.rb +81 -0
- data/lib/rigor/inference/expression_typer.rb +56 -13
- data/lib/rigor/inference/fork_map.rb +45 -11
- data/lib/rigor/inference/method_dispatcher/rbs_dispatch.rb +147 -17
- data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +97 -2
- data/lib/rigor/inference/method_dispatcher.rb +41 -10
- data/lib/rigor/inference/optimistic_origin.rb +68 -3
- data/lib/rigor/inference/scope_indexer.rb +119 -28
- data/lib/rigor/inference/singleton_object_constant.rb +63 -0
- data/lib/rigor/inference/statement_evaluator.rb +25 -12
- data/lib/rigor/plugin/node_rule_walk.rb +6 -0
- data/lib/rigor/protection/closure_kill_oracle.rb +20 -1
- data/lib/rigor/scope.rb +62 -2
- data/lib/rigor/source/node_walker.rb +12 -0
- data/lib/rigor/type/anonymous_class_name.rb +40 -0
- data/lib/rigor/type/nominal.rb +5 -2
- data/lib/rigor/type/singleton.rb +4 -1
- data/lib/rigor/version.rb +1 -1
- data/sig/rigor/scope.rbs +4 -0
- data/sig/rigor.rbs +4 -0
- metadata +5 -1
data/lib/rigor/type/nominal.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require_relative "../trinary"
|
|
4
4
|
require_relative "../value_semantics"
|
|
5
5
|
require_relative "acceptance_router"
|
|
6
|
+
require_relative "anonymous_class_name"
|
|
6
7
|
require_relative "plain_lattice"
|
|
7
8
|
|
|
8
9
|
module Rigor
|
|
@@ -35,13 +36,15 @@ module Rigor
|
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def describe(verbosity = :short)
|
|
38
|
-
|
|
39
|
+
rendered_name = AnonymousClassName.display(class_name)
|
|
40
|
+
return rendered_name if type_args.empty?
|
|
39
41
|
|
|
40
42
|
rendered = type_args.map { |t| t.describe(verbosity) }.join(", ")
|
|
41
|
-
"#{
|
|
43
|
+
"#{rendered_name}[#{rendered}]"
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
def erase_to_rbs
|
|
47
|
+
return "untyped" if AnonymousClassName.match?(class_name)
|
|
45
48
|
return class_name if type_args.empty?
|
|
46
49
|
|
|
47
50
|
rendered = type_args.map(&:erase_to_rbs).join(", ")
|
data/lib/rigor/type/singleton.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require_relative "../trinary"
|
|
4
4
|
require_relative "../value_semantics"
|
|
5
5
|
require_relative "acceptance_router"
|
|
6
|
+
require_relative "anonymous_class_name"
|
|
6
7
|
require_relative "plain_lattice"
|
|
7
8
|
|
|
8
9
|
module Rigor
|
|
@@ -26,10 +27,12 @@ module Rigor
|
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def describe(_verbosity = :short)
|
|
29
|
-
"singleton(#{class_name})"
|
|
30
|
+
"singleton(#{AnonymousClassName.display(class_name)})"
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
def erase_to_rbs
|
|
34
|
+
return "untyped" if AnonymousClassName.match?(class_name)
|
|
35
|
+
|
|
33
36
|
"singleton(#{class_name})"
|
|
34
37
|
end
|
|
35
38
|
|
data/lib/rigor/version.rb
CHANGED
data/sig/rigor/scope.rbs
CHANGED
|
@@ -19,6 +19,7 @@ module Rigor
|
|
|
19
19
|
attr_reader method_chain_narrowings: Hash[ChainKey, Type::t]
|
|
20
20
|
attr_reader source_path: String?
|
|
21
21
|
attr_reader struct_fold_safe_locals: Set[Symbol]
|
|
22
|
+
attr_reader opaque_block_self: bool
|
|
22
23
|
|
|
23
24
|
# ADR-53 Track A — the seed-time discovery tables live on the
|
|
24
25
|
# DiscoveryIndex; Scope keeps per-table readers as delegates.
|
|
@@ -90,6 +91,8 @@ module Rigor
|
|
|
90
91
|
def with_source_path: (String? path) -> Scope
|
|
91
92
|
def with_struct_fold_safe: (Set[Symbol] locals) -> Scope
|
|
92
93
|
def struct_fold_safe?: (String | Symbol name) -> bool
|
|
94
|
+
def entering_opaque_block: () -> Scope
|
|
95
|
+
def opaque_block_self?: () -> bool
|
|
93
96
|
def with_discovery: (DiscoveryIndex index) -> Scope
|
|
94
97
|
def local: (String | Symbol name) -> Type::t?
|
|
95
98
|
def ivar: (String | Symbol name) -> Type::t?
|
|
@@ -123,6 +126,7 @@ module Rigor
|
|
|
123
126
|
def singleton_def_for: (String | Symbol class_name, String | Symbol method_name) -> untyped?
|
|
124
127
|
def user_def_site_for: (String | Symbol class_name, String | Symbol method_name) -> String?
|
|
125
128
|
def top_level_def_for: (String | Symbol method_name) -> untyped?
|
|
129
|
+
def bindable_top_level_def_for: (String | Symbol method_name) -> untyped?
|
|
126
130
|
def toplevel?: () -> bool
|
|
127
131
|
def discovered_method_visibility: (String | Symbol class_name, String | Symbol method_name) -> Symbol?
|
|
128
132
|
def superclass_of: (String | Symbol class_name) -> String?
|
data/sig/rigor.rbs
CHANGED
|
@@ -58,6 +58,10 @@ module Rigor
|
|
|
58
58
|
# `node` / `location` are Prism values, received as `untyped`).
|
|
59
59
|
def self.from_node: (untyped node, path: String, message: String, ?severity: Symbol, ?rule: String?, ?source_family: String, ?receiver_type: untyped, ?method_name: untyped, ?project_definition_site: untyped) -> Rigor::Analysis::Diagnostic
|
|
60
60
|
def self.from_location: (untyped location, path: String, message: String, ?severity: Symbol, ?rule: String?, ?source_family: String, ?receiver_type: untyped, ?method_name: untyped, ?project_definition_site: untyped) -> Rigor::Analysis::Diagnostic
|
|
61
|
+
# `from_message_loc` / `from_name_loc` forward `**` to `from_location`, so their keyword surface is
|
|
62
|
+
# `from_location`'s; only the positional node differs.
|
|
63
|
+
def self.from_message_loc: (untyped node, path: String, message: String, ?severity: Symbol, ?rule: String?, ?source_family: String, ?receiver_type: untyped, ?method_name: untyped, ?project_definition_site: untyped) -> Rigor::Analysis::Diagnostic
|
|
64
|
+
def self.from_name_loc: (untyped node, path: String, message: String, ?severity: Symbol, ?rule: String?, ?source_family: String, ?receiver_type: untyped, ?method_name: untyped, ?project_definition_site: untyped) -> Rigor::Analysis::Diagnostic
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
class Result
|
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.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rigor contributors
|
|
@@ -397,6 +397,7 @@ files:
|
|
|
397
397
|
- lib/rigor/analysis/check_rules.rb
|
|
398
398
|
- lib/rigor/analysis/check_rules/always_truthy_condition_collector.rb
|
|
399
399
|
- lib/rigor/analysis/check_rules/dead_assignment_collector.rb
|
|
400
|
+
- lib/rigor/analysis/check_rules/declaration_sourced_guard.rb
|
|
400
401
|
- lib/rigor/analysis/check_rules/duplicate_hash_key_collector.rb
|
|
401
402
|
- lib/rigor/analysis/check_rules/inferred_param_guard.rb
|
|
402
403
|
- lib/rigor/analysis/check_rules/ivar_write_collector.rb
|
|
@@ -534,6 +535,7 @@ files:
|
|
|
534
535
|
- lib/rigor/flow_contribution/merge_result.rb
|
|
535
536
|
- lib/rigor/flow_contribution/merger.rb
|
|
536
537
|
- lib/rigor/inference/acceptance.rb
|
|
538
|
+
- lib/rigor/inference/anonymous_meta_class.rb
|
|
537
539
|
- lib/rigor/inference/block_parameter_binder.rb
|
|
538
540
|
- lib/rigor/inference/body_fixpoint.rb
|
|
539
541
|
- lib/rigor/inference/budget_trace.rb
|
|
@@ -614,6 +616,7 @@ files:
|
|
|
614
616
|
- lib/rigor/inference/rbs_type_translator.rb
|
|
615
617
|
- lib/rigor/inference/receiver_alias.rb
|
|
616
618
|
- lib/rigor/inference/scope_indexer.rb
|
|
619
|
+
- lib/rigor/inference/singleton_object_constant.rb
|
|
617
620
|
- lib/rigor/inference/statement_evaluator.rb
|
|
618
621
|
- lib/rigor/inference/struct_fold_safety.rb
|
|
619
622
|
- lib/rigor/inference/synthetic_method.rb
|
|
@@ -715,6 +718,7 @@ files:
|
|
|
715
718
|
- lib/rigor/type.rb
|
|
716
719
|
- lib/rigor/type/acceptance_router.rb
|
|
717
720
|
- lib/rigor/type/accepts_result.rb
|
|
721
|
+
- lib/rigor/type/anonymous_class_name.rb
|
|
718
722
|
- lib/rigor/type/app.rb
|
|
719
723
|
- lib/rigor/type/bot.rb
|
|
720
724
|
- lib/rigor/type/bound_method.rb
|