steep 1.3.0.pre.1 → 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 +18 -0
- data/Gemfile.lock +3 -3
- data/Gemfile.steep +1 -2
- data/Gemfile.steep.lock +4 -5
- data/bin/steep-prof +1 -1
- data/lib/steep/ast/types/class.rb +9 -3
- data/lib/steep/ast/types/factory.rb +9 -2
- data/lib/steep/ast/types/helper.rb +4 -3
- 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 +5 -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/drivers/check.rb +1 -1
- data/lib/steep/drivers/checkfile.rb +1 -1
- data/lib/steep/drivers/langserver.rb +2 -2
- data/lib/steep/drivers/stats.rb +1 -1
- data/lib/steep/drivers/utils/jobs_option.rb +0 -4
- data/lib/steep/drivers/watch.rb +1 -1
- data/lib/steep/interface/substitution.rb +11 -10
- data/lib/steep/server/worker_process.rb +16 -11
- data/lib/steep/services/completion_provider.rb +2 -1
- data/lib/steep/services/goto_service.rb +2 -1
- data/lib/steep/services/hover_provider/ruby.rb +2 -1
- data/lib/steep/services/signature_service.rb +16 -0
- data/lib/steep/services/type_check_service.rb +4 -4
- data/lib/steep/signature/validator.rb +13 -13
- data/lib/steep/type_construction.rb +25 -20
- 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 +6 -6
- data/sig/steep/ast/types/boolean.rbs +7 -7
- data/sig/steep/ast/types/bot.rbs +6 -6
- data/sig/steep/ast/types/class.rbs +8 -7
- data/sig/steep/ast/types/helper.rbs +6 -3
- data/sig/steep/ast/types/instance.rbs +7 -6
- data/sig/steep/ast/types/intersection.rbs +13 -10
- data/sig/steep/ast/types/literal.rbs +6 -4
- data/sig/steep/ast/types/logic.rbs +9 -9
- data/sig/steep/ast/types/name.rbs +9 -5
- data/sig/steep/ast/types/nil.rbs +7 -7
- data/sig/steep/ast/types/proc.rbs +8 -3
- data/sig/steep/ast/types/record.rbs +8 -9
- data/sig/steep/ast/types/self.rbs +8 -7
- data/sig/steep/ast/types/top.rbs +6 -6
- data/sig/steep/ast/types/tuple.rbs +6 -5
- data/sig/steep/ast/types/union.rbs +9 -9
- data/sig/steep/ast/types/var.rbs +16 -11
- data/sig/steep/ast/types/void.rbs +6 -6
- data/sig/steep/ast/types.rbs +5 -26
- data/sig/steep/drivers/utils/jobs_option.rbs +0 -2
- data/sig/steep/interface/substitution.rbs +9 -9
- data/sig/steep/server/worker_process.rbs +2 -2
- data/sig/steep/services/signature_service.rbs +14 -0
- data/sig/steep/services/type_check_service.rbs +2 -2
- data/sig/steep.rbs +2 -0
- data/steep.gemspec +1 -1
- metadata +6 -7
- data/lib/steep/ast/types.rb +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f878620b37610ff6bb38ba9f71c8275ebebf1a119969acca92dae226e9e82371
|
4
|
+
data.tar.gz: e5cfe0950b4cfe16d3ac2aeb0992601b5a0b43315736b637cae05792b0774bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c81207ff4dd7893ccc4680b4d6bc1c74b36a59badbfac8c08f02f7ecb6e17f887bc440f40c2dcfe840f219df003c384d0365f54b55340c2ddce771492945b232
|
7
|
+
data.tar.gz: bca9c65b22080f4d8e4f8cf162146a7868f520f4f13e34c22e79a95e5ba81f186b914f422afb89918c6d095d896badcd07832a731d8dd0cd152a908a6f7a71ad
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.3.0 (2022-11-25)
|
6
|
+
|
7
|
+
### Type checker core
|
8
|
+
|
9
|
+
* Type check types ([#676](https://github.com/soutaro/steep/pull/676))
|
10
|
+
|
11
|
+
## 1.3.0.pre.2 (2022-11-23)
|
12
|
+
|
13
|
+
### Type checker core
|
14
|
+
|
15
|
+
* Add missing `#level` method ([\#671](https://github.com/soutaro/steep/pull/671))
|
16
|
+
* Cache `constant_resolver` among files in a target([\#673](https://github.com/soutaro/steep/pull/673))
|
17
|
+
* Early return from type checking overloads ([\#674](https://github.com/soutaro/steep/pull/674))
|
18
|
+
|
19
|
+
### Commandline tool
|
20
|
+
|
21
|
+
* Spawn worker processes if `--steep-command` is specified ([\#672](https://github.com/soutaro/steep/pull/672))
|
22
|
+
|
5
23
|
## 1.3.0.pre.1 (2022-11-22)
|
6
24
|
|
7
25
|
### Type checker core
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
steep (1.3.0
|
4
|
+
steep (1.3.0)
|
5
5
|
activesupport (>= 5.1)
|
6
6
|
csv (>= 3.0.9)
|
7
7
|
fileutils (>= 1.1.0)
|
@@ -12,7 +12,7 @@ PATH
|
|
12
12
|
parallel (>= 1.0.0)
|
13
13
|
parser (>= 3.1)
|
14
14
|
rainbow (>= 2.2.2, < 4.0)
|
15
|
-
rbs (>= 2.8.0
|
15
|
+
rbs (>= 2.8.0)
|
16
16
|
securerandom (>= 0.1)
|
17
17
|
strscan (>= 1.0.0)
|
18
18
|
terminal-table (>= 2, < 4)
|
@@ -54,7 +54,7 @@ GEM
|
|
54
54
|
rb-fsevent (0.11.2)
|
55
55
|
rb-inotify (0.10.1)
|
56
56
|
ffi (~> 1.0)
|
57
|
-
rbs (2.8.0
|
57
|
+
rbs (2.8.0)
|
58
58
|
ruby-debug-ide (0.7.3)
|
59
59
|
rake (>= 0.8.1)
|
60
60
|
securerandom (0.2.0)
|
data/Gemfile.steep
CHANGED
data/Gemfile.steep.lock
CHANGED
@@ -27,9 +27,9 @@ GEM
|
|
27
27
|
rb-fsevent (0.11.2)
|
28
28
|
rb-inotify (0.10.1)
|
29
29
|
ffi (~> 1.0)
|
30
|
-
rbs (2.8.0
|
30
|
+
rbs (2.8.0)
|
31
31
|
securerandom (0.2.0)
|
32
|
-
steep (1.2
|
32
|
+
steep (1.3.0.pre.2)
|
33
33
|
activesupport (>= 5.1)
|
34
34
|
csv (>= 3.0.9)
|
35
35
|
fileutils (>= 1.1.0)
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
parallel (>= 1.0.0)
|
41
41
|
parser (>= 3.1)
|
42
42
|
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
rbs (>= 2.
|
43
|
+
rbs (>= 2.8.0.pre)
|
44
44
|
securerandom (>= 0.1)
|
45
45
|
strscan (>= 1.0.0)
|
46
46
|
terminal-table (>= 2, < 4)
|
@@ -55,8 +55,7 @@ PLATFORMS
|
|
55
55
|
arm64-darwin-21
|
56
56
|
|
57
57
|
DEPENDENCIES
|
58
|
-
|
59
|
-
steep (~> 1.2.0)
|
58
|
+
steep (~> 1.3.0.pre)
|
60
59
|
|
61
60
|
BUNDLED WITH
|
62
61
|
2.3.15
|
data/bin/steep-prof
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "stackprof"
|
4
4
|
|
5
|
-
mode = (ENV["STEEP_STACKPROF_MODE"] || :
|
5
|
+
mode = (ENV["STEEP_STACKPROF_MODE"] || :cpu).to_sym
|
6
6
|
out = ENV["STEEP_STACKPROF_OUT"] || "tmp/stackprof-#{mode}-steep.dump"
|
7
7
|
interval = ENV["STEEP_STACKPROF_INTERVAL"]&.to_i || 1000
|
8
8
|
|
@@ -27,11 +27,17 @@ module Steep
|
|
27
27
|
alias eql? ==
|
28
28
|
|
29
29
|
def subst(s)
|
30
|
-
s.module_type
|
30
|
+
if s.module_type
|
31
|
+
s.module_type
|
32
|
+
else
|
33
|
+
self
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
|
-
|
34
|
-
|
37
|
+
@@fvs = Set[instance]
|
38
|
+
|
39
|
+
def free_variables
|
40
|
+
@@fvs
|
35
41
|
end
|
36
42
|
|
37
43
|
include Helper::NoChild
|
@@ -204,7 +204,7 @@ module Steep
|
|
204
204
|
when Logic::Base
|
205
205
|
RBS::Types::Bases::Bool.new(location: type.location)
|
206
206
|
else
|
207
|
-
raise "Unexpected type given: #{type} (#{type.class})"
|
207
|
+
__skip__ = raise "Unexpected type given: #{type} (#{type.class})"
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
@@ -248,7 +248,14 @@ module Steep
|
|
248
248
|
RBS::AST::TypeParam.new(
|
249
249
|
name: type_param.name,
|
250
250
|
variance: type_param.variance,
|
251
|
-
upper_bound: type_param.upper_bound&.yield_self {|u|
|
251
|
+
upper_bound: type_param.upper_bound&.yield_self {|u|
|
252
|
+
case u_ = type_1(u)
|
253
|
+
when RBS::Types::ClassInstance, RBS::Types::ClassSingleton, RBS::Types::Interface
|
254
|
+
u_
|
255
|
+
else
|
256
|
+
raise "`#{u_}` cannot be type parameter upper bound"
|
257
|
+
end
|
258
|
+
},
|
252
259
|
location: type_param.location
|
253
260
|
).unchecked!(type_param.unchecked)
|
254
261
|
end
|
@@ -4,12 +4,13 @@ module Steep
|
|
4
4
|
module Helper
|
5
5
|
module ChildrenLevel
|
6
6
|
def level_of_children(children)
|
7
|
-
children.map(&:level)
|
8
|
-
|
7
|
+
levels = children.map(&:level)
|
8
|
+
children.map(&:level).sort {|a, b| (b.size <=> a.size) || 0 }.inject() do |a, b|
|
9
|
+
a.zip(b).map do |x, y|
|
9
10
|
if x && y
|
10
11
|
x + y
|
11
12
|
else
|
12
|
-
x || y
|
13
|
+
x || y || raise
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end || []
|
@@ -23,11 +23,16 @@ module Steep
|
|
23
23
|
alias eql? ==
|
24
24
|
|
25
25
|
def subst(s)
|
26
|
-
s.instance_type
|
26
|
+
if s.instance_type
|
27
|
+
s.instance_type
|
28
|
+
else
|
29
|
+
self
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
|
-
|
30
|
-
|
33
|
+
@@fvs = Set[instance]
|
34
|
+
def free_variables
|
35
|
+
@@fvs
|
31
36
|
end
|
32
37
|
|
33
38
|
include Helper::NoChild
|
@@ -35,7 +35,7 @@ module Steep
|
|
35
35
|
when 0
|
36
36
|
AST::Types::Top.new(location: location)
|
37
37
|
when 1
|
38
|
-
tys.first
|
38
|
+
tys.first || raise
|
39
39
|
else
|
40
40
|
new(types: dups.to_a, location: location)
|
41
41
|
end
|
@@ -73,7 +73,11 @@ module Steep
|
|
73
73
|
include Helper::ChildrenLevel
|
74
74
|
|
75
75
|
def each_child(&block)
|
76
|
-
|
76
|
+
if block
|
77
|
+
types.each(&block)
|
78
|
+
else
|
79
|
+
types.each
|
80
|
+
end
|
77
81
|
end
|
78
82
|
|
79
83
|
def level
|
@@ -9,9 +9,7 @@ module Steep
|
|
9
9
|
self
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
@fvs ||= Set[]
|
14
|
-
end
|
12
|
+
include Helper::NoFreeVariables
|
15
13
|
|
16
14
|
include Helper::NoChild
|
17
15
|
|
@@ -28,6 +26,10 @@ module Steep
|
|
28
26
|
def to_s
|
29
27
|
"<% #{self.class} %>"
|
30
28
|
end
|
29
|
+
|
30
|
+
def level
|
31
|
+
[0]
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
class Not < Base
|
data/lib/steep/ast/types/name.rb
CHANGED
@@ -51,14 +51,16 @@ module Steep
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def with_location(new_location)
|
54
|
-
self.class.new(name: name, args: args, location: new_location)
|
54
|
+
_ = self.class.new(name: name, args: args, location: new_location)
|
55
55
|
end
|
56
56
|
|
57
57
|
def subst(s)
|
58
58
|
if free_variables.intersect?(s.domain)
|
59
|
-
self.class.new(
|
60
|
-
|
61
|
-
|
59
|
+
_ = self.class.new(
|
60
|
+
location: location,
|
61
|
+
name: name,
|
62
|
+
args: args.map {|a| a.subst(s) }
|
63
|
+
)
|
62
64
|
else
|
63
65
|
self
|
64
66
|
end
|
@@ -73,7 +75,11 @@ module Steep
|
|
73
75
|
end
|
74
76
|
|
75
77
|
def each_child(&block)
|
76
|
-
|
78
|
+
if block
|
79
|
+
args.each(&block)
|
80
|
+
else
|
81
|
+
args.each
|
82
|
+
end
|
77
83
|
end
|
78
84
|
|
79
85
|
include Helper::ChildrenLevel
|
data/lib/steep/ast/types/proc.rb
CHANGED
@@ -68,10 +68,6 @@ module Steep
|
|
68
68
|
[0] + level_of_children(children)
|
69
69
|
end
|
70
70
|
|
71
|
-
def closed?
|
72
|
-
type.closed? && (block.nil? || block.closed?) && (self_type ? self_type.closed? : false)
|
73
|
-
end
|
74
|
-
|
75
71
|
def with_location(new_location)
|
76
72
|
self.class.new(location: new_location, block: block, type: type, self_type: self_type)
|
77
73
|
end
|
@@ -103,7 +99,11 @@ module Steep
|
|
103
99
|
end
|
104
100
|
|
105
101
|
def block_required?
|
106
|
-
|
102
|
+
if block
|
103
|
+
!block.optional?
|
104
|
+
else
|
105
|
+
false
|
106
|
+
end
|
107
107
|
end
|
108
108
|
|
109
109
|
def each_child(&block)
|
data/lib/steep/ast/types/self.rb
CHANGED
@@ -29,11 +29,17 @@ module Steep
|
|
29
29
|
include Helper::NoChild
|
30
30
|
|
31
31
|
def subst(s)
|
32
|
-
s.self_type
|
32
|
+
if s.self_type
|
33
|
+
s.self_type
|
34
|
+
else
|
35
|
+
self
|
36
|
+
end
|
33
37
|
end
|
34
38
|
|
39
|
+
@@fvs = Set[instance]
|
40
|
+
|
35
41
|
def free_variables
|
36
|
-
|
42
|
+
@@fvs
|
37
43
|
end
|
38
44
|
|
39
45
|
def level
|
@@ -31,17 +31,19 @@ module Steep
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def free_variables()
|
34
|
-
@fvs ||= Set
|
35
|
-
|
36
|
-
set.merge(type.free_variables)
|
37
|
-
end
|
34
|
+
@fvs ||= each_child.with_object(Set[]) do |type, set| #$ Set[variable]
|
35
|
+
set.merge(type.free_variables)
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
41
39
|
include Helper::ChildrenLevel
|
42
40
|
|
43
41
|
def each_child(&block)
|
44
|
-
|
42
|
+
if block
|
43
|
+
types.each(&block)
|
44
|
+
else
|
45
|
+
types.each
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
49
|
def level
|
@@ -12,7 +12,9 @@ module Steep
|
|
12
12
|
|
13
13
|
def self.build(types:, location: nil)
|
14
14
|
return AST::Types::Bot.new if types.empty?
|
15
|
-
|
15
|
+
if types.size == 1
|
16
|
+
return types.first || raise
|
17
|
+
end
|
16
18
|
|
17
19
|
types.flat_map do |type|
|
18
20
|
if type.is_a?(Union)
|
@@ -36,7 +38,7 @@ module Steep
|
|
36
38
|
when 0
|
37
39
|
AST::Types::Bot.new
|
38
40
|
when 1
|
39
|
-
tys.first
|
41
|
+
tys.first || raise
|
40
42
|
else
|
41
43
|
new(types: tys, location: location)
|
42
44
|
end
|
@@ -49,7 +51,7 @@ module Steep
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def hash
|
52
|
-
@hash ||= types.inject(self.class.hash) {|c, type| type.hash ^ c }
|
54
|
+
@hash ||= types.inject(self.class.hash) {|c, type| type.hash ^ c } #$ Integer
|
53
55
|
end
|
54
56
|
|
55
57
|
alias eql? ==
|
@@ -71,7 +73,11 @@ module Steep
|
|
71
73
|
end
|
72
74
|
|
73
75
|
def each_child(&block)
|
74
|
-
|
76
|
+
if block
|
77
|
+
types.each(&block)
|
78
|
+
else
|
79
|
+
types.each
|
80
|
+
end
|
75
81
|
end
|
76
82
|
|
77
83
|
include Helper::ChildrenLevel
|
data/lib/steep/ast/types/var.rb
CHANGED
data/lib/steep/drivers/check.rb
CHANGED
@@ -35,8 +35,8 @@ module Steep
|
|
35
35
|
def run
|
36
36
|
@project = load_config()
|
37
37
|
|
38
|
-
interaction_worker = Server::WorkerProcess.start_worker(:interaction, name: "interaction", steepfile: project.steepfile_path, steep_command: jobs_option.
|
39
|
-
typecheck_workers = Server::WorkerProcess.start_typecheck_workers(steepfile: project.steepfile_path, args: [], steep_command: jobs_option.
|
38
|
+
interaction_worker = Server::WorkerProcess.start_worker(:interaction, name: "interaction", steepfile: project.steepfile_path, steep_command: jobs_option.steep_command)
|
39
|
+
typecheck_workers = Server::WorkerProcess.start_typecheck_workers(steepfile: project.steepfile_path, args: [], steep_command: jobs_option.steep_command, count: jobs_option.jobs_count_value)
|
40
40
|
|
41
41
|
master = Server::Master.new(
|
42
42
|
project: project,
|
data/lib/steep/drivers/stats.rb
CHANGED
@@ -130,7 +130,7 @@ module Steep
|
|
130
130
|
steepfile: project.steepfile_path,
|
131
131
|
delay_shutdown: true,
|
132
132
|
args: command_line_patterns,
|
133
|
-
steep_command: jobs_option.
|
133
|
+
steep_command: jobs_option.steep_command,
|
134
134
|
count: jobs_option.jobs_count_value
|
135
135
|
)
|
136
136
|
|
data/lib/steep/drivers/watch.rb
CHANGED
@@ -42,7 +42,7 @@ module Steep
|
|
42
42
|
server_reader = LanguageServer::Protocol::Transport::Io::Reader.new(server_read)
|
43
43
|
server_writer = LanguageServer::Protocol::Transport::Io::Writer.new(server_write)
|
44
44
|
|
45
|
-
typecheck_workers = Server::WorkerProcess.start_typecheck_workers(steepfile: project.steepfile_path, args: dirs.map(&:to_s), steep_command: jobs_option.
|
45
|
+
typecheck_workers = Server::WorkerProcess.start_typecheck_workers(steepfile: project.steepfile_path, args: dirs.map(&:to_s), steep_command: jobs_option.steep_command, count: jobs_option.jobs_count_value)
|
46
46
|
|
47
47
|
master = Server::Master.new(
|
48
48
|
project: project,
|
@@ -6,7 +6,7 @@ module Steep
|
|
6
6
|
attr_reader :types_size
|
7
7
|
|
8
8
|
def initialize(vars_size:, types_size:)
|
9
|
-
@
|
9
|
+
@vars_size = vars_size
|
10
10
|
@types_size = types_size
|
11
11
|
|
12
12
|
super "Invalid substitution: vars.size=#{vars_size}, types.size=#{types_size}"
|
@@ -43,15 +43,15 @@ module Steep
|
|
43
43
|
set = Set.new
|
44
44
|
|
45
45
|
set.merge(dictionary.keys)
|
46
|
-
set << AST::Types::
|
47
|
-
set << AST::Types::Class.instance
|
48
|
-
set << AST::Types::Instance.instance
|
46
|
+
set << AST::Types::Self.instance if self_type
|
47
|
+
set << AST::Types::Class.instance if module_type
|
48
|
+
set << AST::Types::Instance.instance if instance_type
|
49
49
|
|
50
50
|
set
|
51
51
|
end
|
52
52
|
|
53
53
|
def to_s
|
54
|
-
a = []
|
54
|
+
a = [] #: Array[String]
|
55
55
|
|
56
56
|
dictionary.each do |x, ty|
|
57
57
|
a << "#{x} -> #{ty}"
|
@@ -87,12 +87,13 @@ module Steep
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
def self.build(vars, types = nil, instance_type:
|
90
|
+
def self.build(vars, types = nil, instance_type: nil, module_type: nil, self_type: nil)
|
91
91
|
types ||= vars.map {|var| AST::Types::Var.fresh(var) }
|
92
92
|
|
93
93
|
raise InvalidSubstitutionError.new(vars_size: vars.size, types_size: types.size) unless vars.size == types.size
|
94
94
|
|
95
|
-
dic = vars.zip(types).each.with_object({}) do |(var, type), d|
|
95
|
+
dic = vars.zip(types).each.with_object({}) do |(var, type), d| #$ Hash[Symbol, AST::Types::t]
|
96
|
+
type or raise
|
96
97
|
d[var] = type
|
97
98
|
end
|
98
99
|
|
@@ -130,9 +131,9 @@ module Steep
|
|
130
131
|
end
|
131
132
|
end
|
132
133
|
|
133
|
-
@instance_type = instance_type.subst(s)
|
134
|
-
@module_type = module_type.subst(s)
|
135
|
-
@self_type = self_type.subst(s)
|
134
|
+
@instance_type = instance_type.subst(s) if instance_type
|
135
|
+
@module_type = module_type.subst(s) if module_type
|
136
|
+
@self_type = self_type.subst(s) if self_type
|
136
137
|
|
137
138
|
self
|
138
139
|
end
|
@@ -18,22 +18,27 @@ module Steep
|
|
18
18
|
@index = index
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.start_worker(type, name:, steepfile:, steep_command
|
21
|
+
def self.start_worker(type, name:, steepfile:, steep_command:, index: nil, delay_shutdown: false, patterns: [])
|
22
22
|
begin
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
unless steep_command
|
24
|
+
fork_worker(
|
25
|
+
type,
|
26
|
+
name: name,
|
27
|
+
steepfile: steepfile,
|
28
|
+
index: index,
|
29
|
+
delay_shutdown: delay_shutdown,
|
30
|
+
patterns: patterns
|
31
|
+
)
|
32
|
+
else
|
33
|
+
# Use `#spawn_worker`
|
34
|
+
raise NotImplementedError
|
35
|
+
end
|
31
36
|
rescue NotImplementedError
|
32
37
|
spawn_worker(
|
33
38
|
type,
|
34
39
|
name: name,
|
35
40
|
steepfile: steepfile,
|
36
|
-
steep_command: steep_command,
|
41
|
+
steep_command: steep_command || "steep",
|
37
42
|
index: index,
|
38
43
|
delay_shutdown: delay_shutdown,
|
39
44
|
patterns: patterns
|
@@ -122,7 +127,7 @@ module Steep
|
|
122
127
|
new(reader: reader, writer: writer, stderr: stderr, wait_thread: thread, name: name, index: index&.[](1))
|
123
128
|
end
|
124
129
|
|
125
|
-
def self.start_typecheck_workers(steepfile:, args:, steep_command
|
130
|
+
def self.start_typecheck_workers(steepfile:, args:, steep_command:, count: [Etc.nprocessors - 1, 1].max, delay_shutdown: false)
|
126
131
|
count.times.map do |i|
|
127
132
|
start_worker(
|
128
133
|
:typecheck,
|
@@ -88,7 +88,8 @@ module Steep
|
|
88
88
|
end
|
89
89
|
|
90
90
|
Steep.measure "typechecking" do
|
91
|
-
|
91
|
+
resolver = RBS::Resolver::ConstantResolver.new(builder: subtyping.factory.definition_builder)
|
92
|
+
@typing = TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: resolver)
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
@@ -211,8 +211,9 @@ module Steep
|
|
211
211
|
subtyping = signature_service.current_subtyping or return
|
212
212
|
source = Source.parse(content, path: path, factory: subtyping.factory)
|
213
213
|
source = source.without_unrelated_defs(line: line, column: column)
|
214
|
+
resolver = RBS::Resolver::ConstantResolver.new(builder: subtyping.factory.definition_builder)
|
214
215
|
[
|
215
|
-
Services::TypeCheckService.type_check(source: source, subtyping: subtyping),
|
216
|
+
Services::TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: resolver),
|
216
217
|
signature_service
|
217
218
|
]
|
218
219
|
rescue
|
@@ -77,7 +77,8 @@ module Steep
|
|
77
77
|
subtyping = service.signature_services[target.name].current_subtyping or return
|
78
78
|
source = Source.parse(content, path: path, factory: subtyping.factory)
|
79
79
|
source = source.without_unrelated_defs(line: line, column: column)
|
80
|
-
|
80
|
+
resolver = ::RBS::Resolver::ConstantResolver.new(builder: subtyping.factory.definition_builder)
|
81
|
+
Services::TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: resolver)
|
81
82
|
rescue
|
82
83
|
nil
|
83
84
|
end
|