steep 1.3.0.pre.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -3
- data/Gemfile.steep +1 -2
- data/Gemfile.steep.lock +4 -5
- data/lib/steep/ast/types/class.rb +9 -3
- data/lib/steep/ast/types/factory.rb +9 -2
- data/lib/steep/ast/types/instance.rb +8 -3
- data/lib/steep/ast/types/intersection.rb +6 -2
- data/lib/steep/ast/types/literal.rb +1 -1
- data/lib/steep/ast/types/logic.rb +1 -3
- data/lib/steep/ast/types/name.rb +11 -5
- data/lib/steep/ast/types/proc.rb +5 -5
- data/lib/steep/ast/types/record.rb +5 -1
- data/lib/steep/ast/types/self.rb +8 -2
- data/lib/steep/ast/types/tuple.rb +7 -5
- data/lib/steep/ast/types/union.rb +10 -4
- data/lib/steep/ast/types/var.rb +1 -1
- data/lib/steep/interface/substitution.rb +11 -10
- data/lib/steep/signature/validator.rb +13 -13
- data/lib/steep/type_inference/logic_type_interpreter.rb +2 -2
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +0 -1
- data/rbs_collection.steep.lock.yaml +1 -1
- data/sig/steep/ast/builtin.rbs +1 -1
- data/sig/steep/ast/types/any.rbs +5 -5
- data/sig/steep/ast/types/boolean.rbs +6 -6
- data/sig/steep/ast/types/bot.rbs +5 -5
- data/sig/steep/ast/types/class.rbs +7 -6
- data/sig/steep/ast/types/helper.rbs +2 -2
- data/sig/steep/ast/types/instance.rbs +6 -5
- data/sig/steep/ast/types/intersection.rbs +12 -9
- data/sig/steep/ast/types/literal.rbs +6 -4
- data/sig/steep/ast/types/logic.rbs +7 -9
- data/sig/steep/ast/types/name.rbs +7 -3
- data/sig/steep/ast/types/nil.rbs +6 -6
- data/sig/steep/ast/types/proc.rbs +8 -3
- data/sig/steep/ast/types/record.rbs +7 -8
- data/sig/steep/ast/types/self.rbs +7 -6
- data/sig/steep/ast/types/top.rbs +6 -6
- data/sig/steep/ast/types/tuple.rbs +5 -4
- data/sig/steep/ast/types/union.rbs +8 -8
- data/sig/steep/ast/types/var.rbs +16 -11
- data/sig/steep/ast/types/void.rbs +5 -5
- data/sig/steep/ast/types.rbs +5 -26
- data/sig/steep/interface/substitution.rbs +9 -9
- data/steep.gemspec +1 -1
- metadata +6 -7
- data/lib/steep/ast/types.rb +0 -62
data/lib/steep/ast/types.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
module Steep
|
2
|
-
module AST
|
3
|
-
module Types
|
4
|
-
class Masked
|
5
|
-
attr_reader :location
|
6
|
-
attr_reader :type
|
7
|
-
attr_reader :mask
|
8
|
-
|
9
|
-
def initialize(type:, mask:, location:)
|
10
|
-
@type = type
|
11
|
-
@mask = mask
|
12
|
-
@location = location
|
13
|
-
end
|
14
|
-
|
15
|
-
def ==(other)
|
16
|
-
other.is_a?(Masked) &&
|
17
|
-
other.type == type &&
|
18
|
-
other.mask == mask
|
19
|
-
end
|
20
|
-
|
21
|
-
alias eql? ==
|
22
|
-
|
23
|
-
def hash
|
24
|
-
self.class.hash ^ type.hash ^ mask.hash
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_json(*a)
|
28
|
-
{ class: :masked,
|
29
|
-
type: type,
|
30
|
-
mask: mask,
|
31
|
-
location: location }.to_json(*a)
|
32
|
-
end
|
33
|
-
|
34
|
-
def to_s(level = 0)
|
35
|
-
"masked(#{type}|#{mask})"
|
36
|
-
end
|
37
|
-
|
38
|
-
def free_variables
|
39
|
-
@fvs ||= Set.new.tap do |set|
|
40
|
-
set.merge(type.free_variables)
|
41
|
-
set.merge(mask.free_variables)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def each_type(&block)
|
46
|
-
if block_given?
|
47
|
-
yield type
|
48
|
-
yield mask
|
49
|
-
else
|
50
|
-
enum_for :each_type
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def sub(s)
|
55
|
-
self.class.new(type: type.sub(s),
|
56
|
-
mask: mask.sub(s),
|
57
|
-
location: location)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|