steep 1.3.0.pre.1 → 1.3.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +1 -1
  4. data/bin/steep-prof +1 -1
  5. data/lib/steep/ast/types/helper.rb +4 -3
  6. data/lib/steep/ast/types/logic.rb +4 -0
  7. data/lib/steep/drivers/check.rb +1 -1
  8. data/lib/steep/drivers/checkfile.rb +1 -1
  9. data/lib/steep/drivers/langserver.rb +2 -2
  10. data/lib/steep/drivers/stats.rb +1 -1
  11. data/lib/steep/drivers/utils/jobs_option.rb +0 -4
  12. data/lib/steep/drivers/watch.rb +1 -1
  13. data/lib/steep/server/worker_process.rb +16 -11
  14. data/lib/steep/services/completion_provider.rb +2 -1
  15. data/lib/steep/services/goto_service.rb +2 -1
  16. data/lib/steep/services/hover_provider/ruby.rb +2 -1
  17. data/lib/steep/services/signature_service.rb +16 -0
  18. data/lib/steep/services/type_check_service.rb +4 -4
  19. data/lib/steep/type_construction.rb +25 -20
  20. data/lib/steep/version.rb +1 -1
  21. data/sig/steep/ast/types/any.rbs +1 -1
  22. data/sig/steep/ast/types/boolean.rbs +1 -1
  23. data/sig/steep/ast/types/bot.rbs +1 -1
  24. data/sig/steep/ast/types/class.rbs +1 -1
  25. data/sig/steep/ast/types/helper.rbs +6 -3
  26. data/sig/steep/ast/types/instance.rbs +1 -1
  27. data/sig/steep/ast/types/intersection.rbs +1 -1
  28. data/sig/steep/ast/types/logic.rbs +2 -0
  29. data/sig/steep/ast/types/name.rbs +2 -2
  30. data/sig/steep/ast/types/nil.rbs +1 -1
  31. data/sig/steep/ast/types/record.rbs +1 -1
  32. data/sig/steep/ast/types/self.rbs +1 -1
  33. data/sig/steep/ast/types/top.rbs +2 -2
  34. data/sig/steep/ast/types/tuple.rbs +1 -1
  35. data/sig/steep/ast/types/union.rbs +1 -1
  36. data/sig/steep/ast/types/var.rbs +2 -2
  37. data/sig/steep/ast/types/void.rbs +1 -1
  38. data/sig/steep/drivers/utils/jobs_option.rbs +0 -2
  39. data/sig/steep/server/worker_process.rbs +2 -2
  40. data/sig/steep/services/signature_service.rbs +14 -0
  41. data/sig/steep/services/type_check_service.rbs +2 -2
  42. data/sig/steep.rbs +2 -0
  43. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f43e7d3a3abaa803d24bb2ef587d495e1d000380e9a4de2318d6371403a70238
4
- data.tar.gz: d5fd761223ef4dcc6dcc4e76f3eb952a5dab19a5713e73e024871043ae6fbab8
3
+ metadata.gz: 639a97319d661c777702365209eaf5a6ea2632723a509331a03f6f1ef3926148
4
+ data.tar.gz: fb6061b52a09fb97c907abff4f69d6c9267eef1c9a3af52fa87fffda9de5d1f0
5
5
  SHA512:
6
- metadata.gz: 243b110b292f2da9dbde2f348aa9dd23353da8dc0854776cb10f74f21e97103af23f868eff56b48a78c9e400399858062b2d07a72ddb78493abcc33f8bd2fe1d
7
- data.tar.gz: 36e71cdf0113ff3b4d3946cf44befd945e8304b0deb16478762f90aa4f7f6a58bca28cc0f09f70155196fc116ea39164543b254a870b4e8c81cb203b6980cbfd
6
+ metadata.gz: 232ec5b779c018aa9824318e003cd60e3ec3691297903337bb414fff87e757daaacfda2d94fb0c751538dcad194763ad6cb5b072156686bd450d5292d490a2e6
7
+ data.tar.gz: b322f5568a1fe5cbc0693a01a7be50d9860e056a9f69325e6c55a9322f2d32f7d1d0889d19e45576ca6f3f9afde9649747d9d02a0e251702f94cd27bf5fae27c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.3.0.pre.2 (2022-11-23)
6
+
7
+ ### Type checker core
8
+
9
+ * Add missing `#level` method ([\#671](https://github.com/soutaro/steep/pull/671))
10
+ * Cache `constant_resolver` among files in a target([\#673](https://github.com/soutaro/steep/pull/673))
11
+ * Early return from type checking overloads ([\#674](https://github.com/soutaro/steep/pull/674))
12
+
13
+ ### Commandline tool
14
+
15
+ * Spawn worker processes if `--steep-command` is specified ([\#672](https://github.com/soutaro/steep/pull/672))
16
+
5
17
  ## 1.3.0.pre.1 (2022-11-22)
6
18
 
7
19
  ### 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.pre.1)
4
+ steep (1.3.0.pre.2)
5
5
  activesupport (>= 5.1)
6
6
  csv (>= 3.0.9)
7
7
  fileutils (>= 1.1.0)
data/bin/steep-prof CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "stackprof"
4
4
 
5
- mode = (ENV["STEEP_STACKPROF_MODE"] || :wall).to_sym
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
 
@@ -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).sort {|a, b| b.size <=> a.size }.inject() do |a, b|
8
- a.zip(b).map do |(x, y)|
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 || []
@@ -28,6 +28,10 @@ module Steep
28
28
  def to_s
29
29
  "<% #{self.class} %>"
30
30
  end
31
+
32
+ def level
33
+ [0]
34
+ end
31
35
  end
32
36
 
33
37
  class Not < Base
@@ -40,7 +40,7 @@ module Steep
40
40
  steepfile: project.steepfile_path,
41
41
  args: command_line_patterns,
42
42
  delay_shutdown: true,
43
- steep_command: jobs_option.steep_command_value,
43
+ steep_command: jobs_option.steep_command,
44
44
  count: jobs_option.jobs_count_value
45
45
  )
46
46
 
@@ -105,7 +105,7 @@ module Steep
105
105
  steepfile: project.steepfile_path,
106
106
  args: [],
107
107
  delay_shutdown: true,
108
- steep_command: jobs_option.steep_command_value,
108
+ steep_command: jobs_option.steep_command,
109
109
  count: count
110
110
  )
111
111
 
@@ -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.steep_command_value)
39
- typecheck_workers = Server::WorkerProcess.start_typecheck_workers(steepfile: project.steepfile_path, args: [], steep_command: jobs_option.steep_command_value, count: jobs_option.jobs_count_value)
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,
@@ -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.steep_command_value,
133
+ steep_command: jobs_option.steep_command,
134
134
  count: jobs_option.jobs_count_value
135
135
  )
136
136
 
@@ -17,10 +17,6 @@ module Steep
17
17
  def jobs_count_value
18
18
  jobs_count || default_jobs_count
19
19
  end
20
-
21
- def steep_command_value
22
- steep_command || "steep"
23
- end
24
20
  end
25
21
  end
26
22
  end
@@ -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.steep_command_value, count: jobs_option.jobs_count_value)
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,
@@ -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: "steep", index: nil, delay_shutdown: false, patterns: [])
21
+ def self.start_worker(type, name:, steepfile:, steep_command:, index: nil, delay_shutdown: false, patterns: [])
22
22
  begin
23
- fork_worker(
24
- type,
25
- name: name,
26
- steepfile: steepfile,
27
- index: index,
28
- delay_shutdown: delay_shutdown,
29
- patterns: patterns
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: "steep", count: [Etc.nprocessors - 1, 1].max, delay_shutdown: false)
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
- @typing = TypeCheckService.type_check(source: source, subtyping: subtyping)
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
- Services::TypeCheckService.type_check(source: source, subtyping: subtyping)
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
@@ -19,6 +19,10 @@ module Steep
19
19
  builder.env(last_builder.env)
20
20
  end
21
21
  end
22
+
23
+ def constant_resolver
24
+ @constant_resolver ||= RBS::Resolver::ConstantResolver.new(builder: last_builder)
25
+ end
22
26
  end
23
27
 
24
28
  class AncestorErrorStatus
@@ -37,6 +41,10 @@ module Steep
37
41
  builder.env(last_builder.env)
38
42
  end
39
43
  end
44
+
45
+ def constant_resolver
46
+ @constant_resolver ||= RBS::Resolver::ConstantResolver.new(builder: last_builder)
47
+ end
40
48
  end
41
49
 
42
50
  class LoadedStatus
@@ -61,6 +69,10 @@ module Steep
61
69
  builder.env(self.builder.env)
62
70
  end
63
71
  end
72
+
73
+ def constant_resolver
74
+ @constant_resolver ||= RBS::Resolver::ConstantResolver.new(builder: builder)
75
+ end
64
76
  end
65
77
 
66
78
  FileStatus = _ = Struct.new(:path, :content, :decls, keyword_init: true)
@@ -125,6 +137,10 @@ module Steep
125
137
  status.rbs_index
126
138
  end
127
139
 
140
+ def latest_constant_resolver
141
+ status.constant_resolver
142
+ end
143
+
128
144
  def current_subtyping
129
145
  if status.is_a?(LoadedStatus)
130
146
  status.subtyping
@@ -280,7 +280,7 @@ module Steep
280
280
 
281
281
  if subtyping
282
282
  text = source_files[path].content
283
- file = type_check_file(target: target, subtyping: subtyping, path: path, text: text)
283
+ file = type_check_file(target: target, subtyping: subtyping, path: path, text: text) { signature_service.latest_constant_resolver }
284
284
  yield [file.path, file.diagnostics]
285
285
  source_files[path] = file
286
286
  end
@@ -326,7 +326,7 @@ module Steep
326
326
  def type_check_file(target:, subtyping:, path:, text:)
327
327
  Steep.logger.tagged "#type_check_file(#{path}@#{target.name})" do
328
328
  source = Source.parse(text, path: path, factory: subtyping.factory)
329
- typing = TypeCheckService.type_check(source: source, subtyping: subtyping)
329
+ typing = TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: yield)
330
330
  SourceFile.with_typing(path: path, content: text, node: source.node, typing: typing)
331
331
  end
332
332
  rescue AnnotationParser::SyntaxError => exn
@@ -342,7 +342,7 @@ module Steep
342
342
  SourceFile.no_data(path: path, content: text)
343
343
  end
344
344
 
345
- def self.type_check(source:, subtyping:)
345
+ def self.type_check(source:, subtyping:, constant_resolver:)
346
346
  annotations = source.annotations(block: source.node, factory: subtyping.factory, context: nil)
347
347
 
348
348
  definition = subtyping.factory.definition_builder.build_instance(AST::Builtin::Object.module_name)
@@ -350,7 +350,7 @@ module Steep
350
350
  const_env = TypeInference::ConstantEnv.new(
351
351
  factory: subtyping.factory,
352
352
  context: nil,
353
- resolver: RBS::Resolver::ConstantResolver.new(builder: subtyping.factory.definition_builder)
353
+ resolver: constant_resolver
354
354
  )
355
355
  type_env = TypeInference::TypeEnv.new(const_env)
356
356
  type_env = TypeInference::TypeEnvBuilder.new(
@@ -3216,12 +3216,15 @@ module Steep
3216
3216
  def type_method_call(node, method_name:, receiver_type:, method:, arguments:, block_params:, block_body:, tapp:)
3217
3217
  node_range = node.loc.expression.yield_self {|l| l.begin_pos..l.end_pos }
3218
3218
 
3219
- results = method.method_types.map do |method_type|
3219
+ # @type var fails: Array[[TypeInference::MethodCall::t, TypeConstruction]]
3220
+ fails = []
3221
+
3222
+ method.method_types.each do |method_type|
3220
3223
  Steep.logger.tagged method_type.to_s do
3221
3224
  typing.new_child(node_range) do |child_typing|
3222
3225
  constr = self.with_new_typing(child_typing)
3223
3226
 
3224
- constr.try_special_method(
3227
+ call, constr = constr.try_special_method(
3225
3228
  node,
3226
3229
  receiver_type: receiver_type,
3227
3230
  method_name: method_name,
@@ -3239,30 +3242,32 @@ module Steep
3239
3242
  block_body: block_body,
3240
3243
  tapp: tapp
3241
3244
  )
3245
+
3246
+ if call.is_a?(TypeInference::MethodCall::Typed)
3247
+ constr.typing.save!
3248
+ return [
3249
+ call,
3250
+ update_type_env { constr.context.type_env }
3251
+ ]
3252
+ else
3253
+ fails << [call, constr]
3254
+ end
3242
3255
  end
3243
3256
  end
3244
3257
  end
3245
3258
 
3246
- case
3247
- when results.one?
3248
- # There is only one overload, use the type checking result
3249
- call, constr = results[0]
3250
- when (call, constr = results.find {|call, _| call.is_a?(TypeInference::MethodCall::Typed) })
3251
- # Successfully type checked with one of the overloads
3252
- else
3253
- # No suitable overload, more than one overlodas
3254
- return
3255
- end
3256
-
3257
- constr or raise
3258
- call or raise
3259
+ if fails.one?
3260
+ call, constr = fails[0]
3259
3261
 
3260
- constr.typing.save!
3262
+ constr.typing.save!
3261
3263
 
3262
- [
3263
- call,
3264
- update_type_env { constr.context.type_env }
3265
- ]
3264
+ [
3265
+ call,
3266
+ update_type_env { constr.context.type_env }
3267
+ ]
3268
+ else
3269
+ nil
3270
+ end
3266
3271
  end
3267
3272
 
3268
3273
  def inspect
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.3.0.pre.1"
2
+ VERSION = "1.3.0.pre.2"
3
3
  end
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  include Helper::NoChild
22
22
 
23
- def level: () -> ::Array[1]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
  end
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  include Helper::NoChild
22
22
 
23
- def level: () -> ::Array[0]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
 
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  include Helper::NoChild
22
22
 
23
- def level: () -> ::Array[2]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
  end
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  include Helper::NoChild
22
22
 
23
- def level: () -> ::Array[0]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
 
@@ -3,15 +3,18 @@ module Steep
3
3
  module Types
4
4
  module Helper
5
5
  module ChildrenLevel
6
- def level_of_children: (untyped children) -> untyped
6
+ def level_of_children: (Array[t] children) -> Array[Integer]
7
7
  end
8
8
 
9
9
  module NoFreeVariables
10
- def free_variables: () -> untyped
10
+ @fvs: Set[Symbol]
11
+
12
+ def free_variables: () -> Set[Symbol]
11
13
  end
12
14
 
13
15
  module NoChild
14
- def each_child: () ?{ () -> untyped } -> (untyped | nil)
16
+ def each_child: () { (t) -> void } -> void
17
+ | () -> Enumerator[t, void]
15
18
  end
16
19
  end
17
20
  end
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  def to_s: () -> "instance"
22
22
 
23
- def level: () -> ::Array[0]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
 
@@ -26,7 +26,7 @@ module Steep
26
26
 
27
27
  def each_child: () ?{ () -> untyped } -> untyped
28
28
 
29
- def level: () -> untyped
29
+ def level: () -> Array[Integer]
30
30
 
31
31
  def with_location: (untyped new_location) -> untyped
32
32
  end
@@ -20,6 +20,8 @@ module Steep
20
20
  alias eql? ==
21
21
 
22
22
  def to_s: () -> ::String
23
+
24
+ def level: () -> Array[Integer]
23
25
  end
24
26
 
25
27
  # A type for `!` (not) operator results.
@@ -13,7 +13,7 @@ module Steep
13
13
 
14
14
  def subst: (Steep::Interface::Substitution s) -> self
15
15
 
16
- def level: () -> ::Array[0]
16
+ def level: () -> Array[Integer]
17
17
  end
18
18
 
19
19
  class Applying < Base
@@ -40,7 +40,7 @@ module Steep
40
40
 
41
41
  include Helper::ChildrenLevel
42
42
 
43
- def level: () -> untyped
43
+ def level: () -> Array[Integer]
44
44
  end
45
45
 
46
46
  class Singleton < Base
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  include Helper::NoChild
22
22
 
23
- def level: () -> ::Array[0]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
 
@@ -29,7 +29,7 @@ module Steep
29
29
  def each_child: () { (t) -> void } -> void
30
30
  | () -> Enumerator[t, void]
31
31
 
32
- def level: () -> Integer
32
+ def level: () -> Array[Integer]
33
33
 
34
34
  def with_location: (loc new_location) -> self
35
35
  end
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  def free_variables: () -> untyped
22
22
 
23
- def level: () -> ::Array[0]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
 
@@ -20,8 +20,8 @@ module Steep
20
20
 
21
21
  include Helper::NoChild
22
22
 
23
- def level: () -> ::Array[2]
24
-
23
+ def level: () -> Array[Integer]
24
+
25
25
  def with_location: (untyped new_location) -> untyped
26
26
  end
27
27
  end
@@ -25,7 +25,7 @@ module Steep
25
25
  def each_child: () { (t) -> void } -> void
26
26
  | () -> Enumerator[t, void]
27
27
 
28
- def level: () -> untyped
28
+ def level: () -> Array[Integer]
29
29
 
30
30
  def with_location: (RBS::Location[untyped, untyped] new_location) -> Tuple
31
31
  end
@@ -29,7 +29,7 @@ module Steep
29
29
 
30
30
  include Helper::ChildrenLevel
31
31
 
32
- def level: () -> Integer
32
+ def level: () -> Array[Integer]
33
33
 
34
34
  def with_location: (loc new_location) -> Union
35
35
  end
@@ -26,8 +26,8 @@ module Steep
26
26
 
27
27
  include Helper::NoChild
28
28
 
29
- def level: () -> ::Array[0]
30
-
29
+ def level: () -> Array[Integer]
30
+
31
31
  def update: (?name: untyped, ?location: untyped) -> untyped
32
32
 
33
33
  def with_location: (untyped new_location) -> untyped
@@ -20,7 +20,7 @@ module Steep
20
20
 
21
21
  include Helper::NoChild
22
22
 
23
- def level: () -> ::Array[0]
23
+ def level: () -> Array[Integer]
24
24
 
25
25
  def with_location: (untyped new_location) -> untyped
26
26
  end
@@ -15,8 +15,6 @@ module Steep
15
15
  def default_jobs_count: () -> Integer
16
16
 
17
17
  def jobs_count_value: () -> Integer
18
-
19
- def steep_command_value: () -> String
20
18
  end
21
19
  end
22
20
  end
@@ -48,7 +48,7 @@ module Steep
48
48
  worker_type `type`,
49
49
  name: String,
50
50
  steepfile: Pathname,
51
- ?steep_command: ::String,
51
+ steep_command: String?,
52
52
  ?patterns: Array[String],
53
53
  ?delay_shutdown: bool,
54
54
  ?index: [Integer, Integer]?
@@ -76,7 +76,7 @@ module Steep
76
76
  def self.start_typecheck_workers: (
77
77
  steepfile: Pathname,
78
78
  args: Array[String],
79
- ?steep_command: ::String,
79
+ steep_command: ::String?,
80
80
  ?count: Integer,
81
81
  ?delay_shutdown: bool
82
82
  ) -> Array[WorkerProcess]
@@ -16,9 +16,13 @@ module Steep
16
16
 
17
17
  @rbs_index: Index::RBSIndex?
18
18
 
19
+ @constant_resolver: RBS::Resolver::ConstantResolver?
20
+
19
21
  def initialize: (files: Hash[Pathname, FileStatus], changed_paths: Set[Pathname], diagnostics: Array[Diagnostic::Signature::Base], last_builder: RBS::DefinitionBuilder) -> void
20
22
 
21
23
  def rbs_index: () -> Index::RBSIndex
24
+
25
+ def constant_resolver: () -> RBS::Resolver::ConstantResolver
22
26
  end
23
27
 
24
28
  class AncestorErrorStatus
@@ -32,9 +36,13 @@ module Steep
32
36
 
33
37
  @rbs_index: Index::RBSIndex?
34
38
 
39
+ @constant_resolver: RBS::Resolver::ConstantResolver?
40
+
35
41
  def initialize: (files: Hash[Pathname, FileStatus], changed_paths: Set[Pathname], diagnostics: Array[Diagnostic::Signature::Base], last_builder: RBS::DefinitionBuilder) -> void
36
42
 
37
43
  def rbs_index: () -> Index::RBSIndex
44
+
45
+ def constant_resolver: () -> RBS::Resolver::ConstantResolver
38
46
  end
39
47
 
40
48
  class LoadedStatus
@@ -46,11 +54,15 @@ module Steep
46
54
 
47
55
  @subtyping: Subtyping::Check?
48
56
 
57
+ @constant_resolver: RBS::Resolver::ConstantResolver?
58
+
49
59
  def initialize: (files: Hash[Pathname, FileStatus], builder: RBS::DefinitionBuilder) -> void
50
60
 
51
61
  def subtyping: () -> Subtyping::Check
52
62
 
53
63
  def rbs_index: () -> Index::RBSIndex
64
+
65
+ def constant_resolver: () -> RBS::Resolver::ConstantResolver
54
66
  end
55
67
 
56
68
  class FileStatus
@@ -88,6 +100,8 @@ module Steep
88
100
 
89
101
  def latest_rbs_index: () -> Index::RBSIndex
90
102
 
103
+ def latest_constant_resolver: () -> RBS::Resolver::ConstantResolver
104
+
91
105
  def current_subtyping: () -> Subtyping::Check?
92
106
 
93
107
  def apply_changes: (Hash[Pathname, FileStatus] files, Server::ChangeBuffer::changes changes) -> Hash[Pathname, FileStatus]
@@ -91,9 +91,9 @@ module Steep
91
91
 
92
92
  def update_sources: (changes: Server::ChangeBuffer::changes, requests: Hash[Project::Target, TargetRequest]) -> void
93
93
 
94
- def type_check_file: (target: Project::Target, subtyping: Subtyping::Check, path: Pathname, text: String) -> SourceFile
94
+ def type_check_file: (target: Project::Target, subtyping: Subtyping::Check, path: Pathname, text: String) { () -> RBS::Resolver::ConstantResolver } -> SourceFile
95
95
 
96
- def self.type_check: (source: Source, subtyping: Subtyping::Check) -> Typing
96
+ def self.type_check: (source: Source, subtyping: Subtyping::Check, constant_resolver: RBS::Resolver::ConstantResolver) -> Typing
97
97
 
98
98
  def source_file?: (Pathname path) -> Project::Target?
99
99
 
data/sig/steep.rbs CHANGED
@@ -1,4 +1,6 @@
1
1
  module Steep
2
+ VERSION: String
3
+
2
4
  def self.logger: () -> (Logger & ActiveSupport::TaggedLogging)
3
5
 
4
6
  def self.new_logger: (untyped output, untyped prev_level) -> untyped
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.pre.1
4
+ version: 1.3.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-22 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser