rigortype 0.0.3 → 0.0.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 +24 -7
- data/data/builtins/ruby_core/hash.yml +936 -0
- data/data/builtins/ruby_core/range.yml +389 -0
- data/data/builtins/ruby_core/set.yml +594 -0
- data/data/builtins/ruby_core/time.yml +750 -0
- data/lib/rigor/analysis/check_rules.rb +11 -3
- data/lib/rigor/builtins/imported_refinements.rb +192 -10
- data/lib/rigor/inference/acceptance.rb +181 -12
- data/lib/rigor/inference/builtins/hash_catalog.rb +40 -0
- data/lib/rigor/inference/builtins/range_catalog.rb +46 -0
- data/lib/rigor/inference/builtins/set_catalog.rb +54 -0
- data/lib/rigor/inference/builtins/time_catalog.rb +64 -0
- data/lib/rigor/inference/method_dispatcher/constant_folding.rb +28 -8
- data/lib/rigor/inference/method_dispatcher/iterator_dispatch.rb +103 -1
- data/lib/rigor/inference/method_dispatcher/overload_selector.rb +23 -7
- data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +135 -6
- data/lib/rigor/inference/method_parameter_binder.rb +29 -4
- data/lib/rigor/inference/narrowing.rb +2 -0
- data/lib/rigor/inference/statement_evaluator.rb +2 -0
- data/lib/rigor/rbs_extended.rb +167 -16
- data/lib/rigor/type/combinator.rb +90 -0
- data/lib/rigor/type/intersection.rb +135 -0
- data/lib/rigor/type/refined.rb +174 -0
- data/lib/rigor/type.rb +2 -0
- data/lib/rigor/version.rb +1 -1
- data/sig/rigor/rbs_extended.rbs +11 -0
- data/sig/rigor/type.rbs +40 -0
- metadata +11 -1
data/lib/rigor/version.rb
CHANGED
data/sig/rigor/rbs_extended.rbs
CHANGED
|
@@ -42,5 +42,16 @@ module Rigor
|
|
|
42
42
|
|
|
43
43
|
def self?.read_return_type_override: (untyped method_def) -> Type::t?
|
|
44
44
|
def self?.parse_return_type_override: (String string) -> Type::t?
|
|
45
|
+
|
|
46
|
+
class ParamOverride
|
|
47
|
+
attr_reader param_name: Symbol
|
|
48
|
+
attr_reader type: Type::t
|
|
49
|
+
|
|
50
|
+
def self.new: (param_name: Symbol, type: Type::t) -> ParamOverride
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self?.read_param_type_overrides: (untyped method_def) -> Array[ParamOverride]
|
|
54
|
+
def self?.param_type_override_map: (untyped method_def) -> Hash[Symbol, Type::t]
|
|
55
|
+
def self?.parse_param_annotation: (String string) -> ParamOverride?
|
|
45
56
|
end
|
|
46
57
|
end
|
data/sig/rigor/type.rbs
CHANGED
|
@@ -140,6 +140,36 @@ module Rigor
|
|
|
140
140
|
def inspect: () -> String
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
+
class Refined
|
|
144
|
+
attr_reader base: Type::t
|
|
145
|
+
attr_reader predicate_id: Symbol
|
|
146
|
+
def initialize: (Type::t base, Symbol predicate_id) -> void
|
|
147
|
+
def describe: (?Symbol verbosity) -> String
|
|
148
|
+
def erase_to_rbs: () -> String
|
|
149
|
+
def top: () -> Top
|
|
150
|
+
def bot: () -> Bot
|
|
151
|
+
def dynamic: () -> Dynamic
|
|
152
|
+
def accepts: (Type::t other, ?mode: accepts_mode) -> AcceptsResult
|
|
153
|
+
def matches?: (untyped value) -> bool?
|
|
154
|
+
def ==: (untyped other) -> bool
|
|
155
|
+
def hash: () -> Integer
|
|
156
|
+
def inspect: () -> String
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
class Intersection
|
|
160
|
+
attr_reader members: Array[Type::t]
|
|
161
|
+
def initialize: (Array[Type::t] members) -> void
|
|
162
|
+
def describe: (?Symbol verbosity) -> String
|
|
163
|
+
def erase_to_rbs: () -> String
|
|
164
|
+
def top: () -> Top
|
|
165
|
+
def bot: () -> Bot
|
|
166
|
+
def dynamic: () -> Dynamic
|
|
167
|
+
def accepts: (Type::t other, ?mode: accepts_mode) -> AcceptsResult
|
|
168
|
+
def ==: (untyped other) -> bool
|
|
169
|
+
def hash: () -> Integer
|
|
170
|
+
def inspect: () -> String
|
|
171
|
+
end
|
|
172
|
+
|
|
143
173
|
class Tuple
|
|
144
174
|
attr_reader elements: Array[Type::t]
|
|
145
175
|
def initialize: (Array[Type::t] elements) -> void
|
|
@@ -207,6 +237,16 @@ module Rigor
|
|
|
207
237
|
def self?.non_zero_int: () -> Difference
|
|
208
238
|
def self?.non_empty_array: (?Type::t element) -> Difference
|
|
209
239
|
def self?.non_empty_hash: (?Type::t key, ?Type::t value) -> Difference
|
|
240
|
+
def self?.refined: (Type::t base, Symbol predicate_id) -> Refined
|
|
241
|
+
def self?.lowercase_string: () -> Refined
|
|
242
|
+
def self?.uppercase_string: () -> Refined
|
|
243
|
+
def self?.numeric_string: () -> Refined
|
|
244
|
+
def self?.decimal_int_string: () -> Refined
|
|
245
|
+
def self?.octal_int_string: () -> Refined
|
|
246
|
+
def self?.hex_int_string: () -> Refined
|
|
247
|
+
def self?.intersection: (*Type::t members) -> Type::t
|
|
248
|
+
def self?.non_empty_lowercase_string: () -> Type::t
|
|
249
|
+
def self?.non_empty_uppercase_string: () -> Type::t
|
|
210
250
|
def self?.integer_range: ((Integer | Symbol) min, (Integer | Symbol) max) -> IntegerRange
|
|
211
251
|
def self?.positive_int: () -> IntegerRange
|
|
212
252
|
def self?.non_negative_int: () -> IntegerRange
|
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.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rigor contributors
|
|
@@ -162,9 +162,13 @@ files:
|
|
|
162
162
|
- README.md
|
|
163
163
|
- data/builtins/ruby_core/array.yml
|
|
164
164
|
- data/builtins/ruby_core/file.yml
|
|
165
|
+
- data/builtins/ruby_core/hash.yml
|
|
165
166
|
- data/builtins/ruby_core/io.yml
|
|
166
167
|
- data/builtins/ruby_core/numeric.yml
|
|
168
|
+
- data/builtins/ruby_core/range.yml
|
|
169
|
+
- data/builtins/ruby_core/set.yml
|
|
167
170
|
- data/builtins/ruby_core/string.yml
|
|
171
|
+
- data/builtins/ruby_core/time.yml
|
|
168
172
|
- exe/rigor
|
|
169
173
|
- lib/rigor.rb
|
|
170
174
|
- lib/rigor/analysis/check_rules.rb
|
|
@@ -189,9 +193,13 @@ files:
|
|
|
189
193
|
- lib/rigor/inference/acceptance.rb
|
|
190
194
|
- lib/rigor/inference/block_parameter_binder.rb
|
|
191
195
|
- lib/rigor/inference/builtins/array_catalog.rb
|
|
196
|
+
- lib/rigor/inference/builtins/hash_catalog.rb
|
|
192
197
|
- lib/rigor/inference/builtins/method_catalog.rb
|
|
193
198
|
- lib/rigor/inference/builtins/numeric_catalog.rb
|
|
199
|
+
- lib/rigor/inference/builtins/range_catalog.rb
|
|
200
|
+
- lib/rigor/inference/builtins/set_catalog.rb
|
|
194
201
|
- lib/rigor/inference/builtins/string_catalog.rb
|
|
202
|
+
- lib/rigor/inference/builtins/time_catalog.rb
|
|
195
203
|
- lib/rigor/inference/closure_escape_analyzer.rb
|
|
196
204
|
- lib/rigor/inference/coverage_scanner.rb
|
|
197
205
|
- lib/rigor/inference/expression_typer.rb
|
|
@@ -226,7 +234,9 @@ files:
|
|
|
226
234
|
- lib/rigor/type/dynamic.rb
|
|
227
235
|
- lib/rigor/type/hash_shape.rb
|
|
228
236
|
- lib/rigor/type/integer_range.rb
|
|
237
|
+
- lib/rigor/type/intersection.rb
|
|
229
238
|
- lib/rigor/type/nominal.rb
|
|
239
|
+
- lib/rigor/type/refined.rb
|
|
230
240
|
- lib/rigor/type/singleton.rb
|
|
231
241
|
- lib/rigor/type/top.rb
|
|
232
242
|
- lib/rigor/type/tuple.rb
|