steep 0.46.0 → 0.47.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e43c16938ef0238a9b3e44934a3e183ec663722b4c1161f9bd016dfcd2442b9b
4
- data.tar.gz: 20168ebc69417b83c9eff010d44aac53ac43f47c572c8acc99d52d08ec11866d
3
+ metadata.gz: dcd473b07b749d136220c73d4434747c909fc516b5d14332590a5e46abed65f9
4
+ data.tar.gz: c652c1608f635556d3c6704746c901b97047b5f2fc670ea563f50aa30d198210
5
5
  SHA512:
6
- metadata.gz: 33c2bd116ea87f549ffb29fbc2382e7c000405a74280fcc4a1a8553ae52e6b7af3d5611a150c828d494fe50f37e120e58e45f286bd374bbd35958ee0c760c872
7
- data.tar.gz: 0466f3f59d18bf0ba34ce522bc6a1cceed85c1f6ca4df66b6647a557bec165c64dd9d594f673833dc24a0b5a9d0eb04795bff37dc391e22cf560b566c6f08319
6
+ metadata.gz: 9a540a74cb3d514500a5d57d7111ce45b16cafde7855aa182d0a6a188edf74d7203b17368cc275aa574aaa16f5a7f265eb0a95c1fa9c0a524e42fb78b67bffdc
7
+ data.tar.gz: eac07db23cad1f7eeb697d4f27e4548c45174e23d7552e7bd4246494efb25d8a967c10d6f00c112a1b3070b1a86e0131a4e3f0b95af8bf66f65747ba4e57f16b
@@ -12,7 +12,6 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  container_tag:
15
- - "2.6"
16
15
  - "2.7"
17
16
  - "3.0"
18
17
  - "master-nightly-focal"
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.47.0 (2021-11-30)
6
+
7
+ This update contains update for RBS 1.7.
8
+
9
+ * RBS 1.7 ([#455](https://github.com/soutaro/steep/pull/455))
10
+ * Bug fixes related to `SendArgs` ([#444](https://github.com/soutaro/steep/pull/444), [#449](https://github.com/soutaro/steep/pull/449), [#451](https://github.com/soutaro/steep/pull/451))
11
+ * LSP completion item formatting improvement ([#442](https://github.com/soutaro/steep/pull/442))
12
+
5
13
  ## 0.46.0 (2021-08-30)
6
14
 
7
15
  This release updates Steepfile DSL syntax, introducing `stdlib_path` and `configure_code_diagnostics` syntax (methods).
data/Gemfile CHANGED
@@ -8,6 +8,5 @@ gem "without_steep_types", path: "test/gems/without_steep_types"
8
8
 
9
9
  gem "rake"
10
10
  gem "minitest", "~> 5.0"
11
- gem "racc", "~> 1.4"
12
11
  gem "minitest-hooks"
13
12
  gem "stackprof"
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steep (0.46.0)
4
+ steep (0.47.0)
5
5
  activesupport (>= 5.1)
6
6
  language_server-protocol (>= 3.15, < 4.0)
7
7
  listen (~> 3.0)
8
8
  parallel (>= 1.0.0)
9
9
  parser (>= 3.0)
10
10
  rainbow (>= 2.2.2, < 4.0)
11
- rbs (>= 1.2.0)
11
+ rbs (~> 1.7.0)
12
12
  terminal-table (>= 2, < 4)
13
13
 
14
14
  PATH
@@ -32,33 +32,32 @@ GEM
32
32
  zeitwerk (~> 2.3)
33
33
  ast (2.4.2)
34
34
  concurrent-ruby (1.1.9)
35
- ffi (1.15.3)
36
- i18n (1.8.10)
35
+ ffi (1.15.4)
36
+ i18n (1.8.11)
37
37
  concurrent-ruby (~> 1.0)
38
- language_server-protocol (3.16.0.2)
38
+ language_server-protocol (3.16.0.3)
39
39
  listen (3.7.0)
40
40
  rb-fsevent (~> 0.10, >= 0.10.3)
41
41
  rb-inotify (~> 0.9, >= 0.9.10)
42
42
  minitest (5.14.4)
43
43
  minitest-hooks (1.5.0)
44
44
  minitest (> 5.3)
45
- parallel (1.20.1)
46
- parser (3.0.2.0)
45
+ parallel (1.21.0)
46
+ parser (3.0.3.1)
47
47
  ast (~> 2.4.1)
48
- racc (1.5.2)
49
48
  rainbow (3.0.0)
50
49
  rake (13.0.6)
51
50
  rb-fsevent (0.11.0)
52
51
  rb-inotify (0.10.1)
53
52
  ffi (~> 1.0)
54
- rbs (1.5.1)
53
+ rbs (1.7.1)
55
54
  stackprof (0.2.17)
56
- terminal-table (3.0.1)
55
+ terminal-table (3.0.2)
57
56
  unicode-display_width (>= 1.1.1, < 3)
58
57
  tzinfo (2.0.4)
59
58
  concurrent-ruby (~> 1.0)
60
- unicode-display_width (2.0.0)
61
- zeitwerk (2.4.2)
59
+ unicode-display_width (2.1.0)
60
+ zeitwerk (2.5.1)
62
61
 
63
62
  PLATFORMS
64
63
  ruby
@@ -66,7 +65,6 @@ PLATFORMS
66
65
  DEPENDENCIES
67
66
  minitest (~> 5.0)
68
67
  minitest-hooks
69
- racc (~> 1.4)
70
68
  rake
71
69
  stackprof
72
70
  steep!
@@ -74,4 +72,4 @@ DEPENDENCIES
74
72
  without_steep_types!
75
73
 
76
74
  BUNDLED WITH
77
- 2.2.22
75
+ 2.2.27
data/README.md CHANGED
@@ -8,7 +8,7 @@ Install via RubyGems.
8
8
 
9
9
  ### Requirements
10
10
 
11
- Steep requires Ruby 2.6.
11
+ Steep requires Ruby 2.6 or later.
12
12
 
13
13
  ## Usage
14
14
 
@@ -126,6 +126,7 @@ end
126
126
 
127
127
  class Phone
128
128
  # @dynamic country, number
129
+ attr_reader :country, :number
129
130
 
130
131
  def initialize(country:, number:)
131
132
  @country = country
@@ -25,7 +25,7 @@ module Steep
25
25
  @location = location
26
26
 
27
27
  message = case exn
28
- when RBS::Parser::SyntaxError
28
+ when RBS::ParsingError
29
29
  Diagnostic::Signature::SyntaxError.parser_syntax_error_message(exn)
30
30
  else
31
31
  exn.message
@@ -38,25 +38,16 @@ module Steep
38
38
  end
39
39
 
40
40
  def self.parser_syntax_error_message(exception)
41
- value = if exception.error_value.is_a?(RBS::Parser::LocatedValue)
42
- exception.error_value.value
43
- else
44
- exception.error_value
45
- end
46
- string = value.to_s
41
+ string = exception.location.source.to_s
47
42
  unless string.empty?
48
43
  string = " (#{string})"
49
44
  end
50
45
 
51
- "Syntax error caused by token `#{exception.token_str}`#{string}"
46
+ "Syntax error caused by token `#{exception.token_type}`#{string}"
52
47
  end
53
48
 
54
49
  def header_line
55
- if exception.is_a?(RBS::Parser::SyntaxError)
56
- SyntaxError.parser_syntax_error_message(exception)
57
- else
58
- exception.message
59
- end
50
+ exception.message
60
51
  end
61
52
  end
62
53
 
@@ -318,10 +309,8 @@ module Steep
318
309
 
319
310
  def self.from_rbs_error(error, factory:)
320
311
  case error
321
- when RBS::Parser::SemanticsError, RBS::Parser::LexerError
312
+ when RBS::ParsingError
322
313
  Diagnostic::Signature::SyntaxError.new(error, location: error.location)
323
- when RBS::Parser::SyntaxError
324
- Diagnostic::Signature::SyntaxError.new(error, location: error.error_value.location)
325
314
  when RBS::DuplicatedDeclarationError
326
315
  Diagnostic::Signature::DuplicatedDeclaration.new(
327
316
  type_name: error.name,
@@ -11,8 +11,12 @@ module Steep
11
11
  attr_reader :core_root
12
12
  attr_reader :repo_paths
13
13
  attr_reader :code_diagnostics_config
14
+ attr_reader :project
15
+ attr_reader :collection_config_path
14
16
 
15
- def initialize(name, sources: [], libraries: [], signatures: [], ignored_sources: [], repo_paths: [], code_diagnostics_config: {})
17
+ NONE = Object.new.freeze
18
+
19
+ def initialize(name, sources: [], libraries: [], signatures: [], ignored_sources: [], repo_paths: [], code_diagnostics_config: {}, project: nil, collection_config_path: NONE)
16
20
  @name = name
17
21
  @sources = sources
18
22
  @libraries = libraries
@@ -22,6 +26,15 @@ module Steep
22
26
  @stdlib_root = nil
23
27
  @repo_paths = []
24
28
  @code_diagnostics_config = code_diagnostics_config
29
+ @project = project
30
+ @collection_config_path =
31
+ case collection_config_path
32
+ when NONE
33
+ path = project&.absolute_path(RBS::Collection::Config::PATH)
34
+ path&.exist? ? path : nil
35
+ else
36
+ collection_config_path
37
+ end
25
38
  end
26
39
 
27
40
  def initialize_copy(other)
@@ -34,6 +47,8 @@ module Steep
34
47
  @core_root = other.core_root
35
48
  @stdlib_root = other.stdlib_root
36
49
  @code_diagnostics_config = other.code_diagnostics_config.dup
50
+ @project = other.project
51
+ @collection_config_path = other.collection_config_path
37
52
  end
38
53
 
39
54
  def check(*args)
@@ -100,13 +115,14 @@ module Steep
100
115
  signatures.push(*args)
101
116
  end
102
117
 
103
- def update(name: self.name, sources: self.sources, libraries: self.libraries, ignored_sources: self.ignored_sources, signatures: self.signatures)
118
+ def update(name: self.name, sources: self.sources, libraries: self.libraries, ignored_sources: self.ignored_sources, signatures: self.signatures, project: self.project)
104
119
  self.class.new(
105
120
  name,
106
121
  sources: sources,
107
122
  libraries: libraries,
108
123
  signatures: signatures,
109
- ignored_sources: ignored_sources
124
+ ignored_sources: ignored_sources,
125
+ project: project,
110
126
  )
111
127
  end
112
128
 
@@ -155,6 +171,14 @@ module Steep
155
171
 
156
172
  yield code_diagnostics_config if block_given?
157
173
  end
174
+
175
+ def collection_config(path)
176
+ @collection_config_path = project.absolute_path(path)
177
+ end
178
+
179
+ def disable_collection
180
+ @collection_config_path = nil
181
+ end
158
182
  end
159
183
 
160
184
  attr_reader :project
@@ -187,10 +211,10 @@ module Steep
187
211
 
188
212
  def target(name, template: nil, &block)
189
213
  target = if template
190
- self.class.templates[template]&.dup&.update(name: name) or
214
+ self.class.templates[template]&.dup&.update(name: name, project: project) or
191
215
  raise "Unknown template: #{template}, available templates: #{@@templates.keys.join(", ")}"
192
216
  else
193
- TargetDSL.new(name, code_diagnostics_config: Diagnostic::Ruby.default.dup)
217
+ TargetDSL.new(name, code_diagnostics_config: Diagnostic::Ruby.default.dup, project: project)
194
218
  end
195
219
 
196
220
  Steep.logger.tagged "target=#{name}" do
@@ -200,6 +224,8 @@ module Steep
200
224
  source_pattern = Pattern.new(patterns: target.sources, ignores: target.ignored_sources, ext: ".rb")
201
225
  signature_pattern = Pattern.new(patterns: target.signatures, ext: ".rbs")
202
226
 
227
+ collection_lock = target.collection_config_path&.then { |p| RBS::Collection::Config.lockfile_of(p) }
228
+
203
229
  Project::Target.new(
204
230
  name: target.name,
205
231
  source_pattern: source_pattern,
@@ -211,6 +237,7 @@ module Steep
211
237
  stdlib_root: target.stdlib_root,
212
238
  repo_paths: target.repo_paths
213
239
  )
240
+ options.collection_lock = collection_lock
214
241
  end,
215
242
  code_diagnostics_config: target.code_diagnostics_config
216
243
  ).tap do |target|
@@ -13,6 +13,7 @@ module Steep
13
13
 
14
14
  attr_reader :libraries
15
15
  attr_accessor :paths
16
+ attr_accessor :collection_lock
16
17
 
17
18
  def initialize
18
19
  @paths = PathOptions.new(repo_paths: [])
@@ -57,6 +57,7 @@ module Steep
57
57
  name, version = lib.split(/:/, 2)
58
58
  loader.add(library: name, version: version)
59
59
  end
60
+ loader.add_collection(options.collection_lock) if options.collection_lock
60
61
 
61
62
  loader
62
63
  end
@@ -383,7 +383,7 @@ HOVER
383
383
  when RBS::AST::Declarations::Interface
384
384
  "interface #{name_and_params(decl.name, decl.type_params)}"
385
385
  end
386
- end
386
+ end
387
387
 
388
388
  def format_completion_item(item)
389
389
  range = LanguageServer::Protocol::Interface::Range.new(
@@ -402,18 +402,18 @@ HOVER
402
402
  LanguageServer::Protocol::Interface::CompletionItem.new(
403
403
  label: item.identifier,
404
404
  kind: LanguageServer::Protocol::Constant::CompletionItemKind::VARIABLE,
405
- detail: "#{item.identifier}: #{item.type}",
405
+ detail: item.type.to_s,
406
406
  text_edit: LanguageServer::Protocol::Interface::TextEdit.new(
407
407
  range: range,
408
- new_text: "#{item.identifier}"
408
+ new_text: item.identifier
409
409
  )
410
410
  )
411
411
  when Services::CompletionProvider::MethodNameItem
412
- label = "def #{item.identifier}: #{item.method_type}"
413
412
  method_type_snippet = method_type_to_snippet(item.method_type)
414
413
  LanguageServer::Protocol::Interface::CompletionItem.new(
415
- label: label,
414
+ label: item.identifier,
416
415
  kind: LanguageServer::Protocol::Constant::CompletionItemKind::METHOD,
416
+ detail: item.method_type.to_s,
417
417
  text_edit: LanguageServer::Protocol::Interface::TextEdit.new(
418
418
  new_text: "#{item.identifier}#{method_type_snippet}",
419
419
  range: range
@@ -423,14 +423,14 @@ HOVER
423
423
  sort_text: item.inherited? ? 'z' : 'a' # Ensure language server puts non-inherited methods before inherited methods
424
424
  )
425
425
  when Services::CompletionProvider::InstanceVariableItem
426
- label = "#{item.identifier}: #{item.type}"
427
426
  LanguageServer::Protocol::Interface::CompletionItem.new(
428
- label: label,
427
+ label: item.identifier,
429
428
  kind: LanguageServer::Protocol::Constant::CompletionItemKind::FIELD,
429
+ detail: item.type.to_s,
430
430
  text_edit: LanguageServer::Protocol::Interface::TextEdit.new(
431
431
  range: range,
432
432
  new_text: item.identifier,
433
- ),
433
+ ),
434
434
  insert_text_format: LanguageServer::Protocol::Constant::InsertTextFormat::SNIPPET
435
435
  )
436
436
  end
@@ -74,6 +74,9 @@ module Steep
74
74
  locator = RBS::Locator.new(decls: decls)
75
75
  hd, tail = locator.find2(line: line, column: column)
76
76
 
77
+ # Maybe hover on comment
78
+ return if tail.nil?
79
+
77
80
  case type = tail[0]
78
81
  when RBS::Types::Alias
79
82
  alias_decl = service.latest_env.alias_decls[type.name]&.decl or raise
data/lib/steep/source.rb CHANGED
@@ -71,7 +71,11 @@ module Steep
71
71
 
72
72
  mapping = {}.compare_by_identity
73
73
 
74
- construct_mapping(node: node, annotations: annotations, mapping: mapping)
74
+ if node
75
+ construct_mapping(node: node, annotations: annotations, mapping: mapping)
76
+ else
77
+ Steep.logger.fatal { "#{path} is empty source code" }
78
+ end
75
79
 
76
80
  annotations.each do |annot|
77
81
  mapping[node] ||= []
@@ -3798,7 +3798,7 @@ module Steep
3798
3798
  # `record_type` can be nil when the keys are not specified.
3799
3799
  #
3800
3800
  def type_hash_record(hash_node, record_type)
3801
- raise unless hash_node.type == :hash
3801
+ raise unless hash_node.type == :hash || hash_node.type == :kwargs
3802
3802
 
3803
3803
  constr = self
3804
3804
 
@@ -131,7 +131,7 @@ module Steep
131
131
  else
132
132
  leadings = leading_params.map {|param| param.type || AST::Types::Any.new }
133
133
  optionals = optional_params.map {|param| param.type || AST::Types::Any.new }
134
- rest = rest_param&.yield_self {|param| param.type.args[0] }
134
+ rest = rest_param&.yield_self {|param| param.type&.args&.[](0) || AST::Types::Any.new }
135
135
  end
136
136
 
137
137
  Interface::Function::Params.build(
@@ -99,19 +99,7 @@ module Steep
99
99
  PositionalArgs.new(args: args, index: index, positional_params: positional_params, uniform: uniform)
100
100
  end
101
101
 
102
- def uniform!
103
- update(uniform: true)
104
- end
105
-
106
102
  def next()
107
- if uniform
108
- if node
109
- return [node, uniform_type, update(index: index+1)]
110
- else
111
- return
112
- end
113
- end
114
-
115
103
  case
116
104
  when !node && param.is_a?(Interface::Function::Params::PositionalParams::Required)
117
105
  [
@@ -153,6 +141,7 @@ module Steep
153
141
  end
154
142
 
155
143
  def uniform_type
144
+ return nil unless positional_params
156
145
  if positional_params.each.any? {|param| param.is_a?(Interface::Function::Params::PositionalParams::Rest) }
157
146
  AST::Types::Intersection.build(types: positional_params.each.map(&:type))
158
147
  end
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "0.46.0"
2
+ VERSION = "0.47.0"
3
3
  end
data/lib/steep.rb CHANGED
@@ -213,7 +213,7 @@ module Steep
213
213
  end
214
214
 
215
215
  def percentile(p)
216
- slowests(count - count * p / 100r).last&.last || 0
216
+ slowests([count * p / 100r, 1].max).last&.last || 0
217
217
  end
218
218
  end
219
219
 
@@ -95,8 +95,8 @@
95
95
  line: 7
96
96
  character: 21
97
97
  severity: ERROR
98
- message: 'The method parameter has different kind from the declaration `(size:
99
- ::Integer, name: ::String) -> void`'
98
+ message: 'The method parameter has different kind from the declaration `(name:
99
+ ::String, size: ::Integer) -> void`'
100
100
  code: Ruby::DifferentMethodParameterKind
101
101
  - range:
102
102
  start:
@@ -106,8 +106,8 @@
106
106
  line: 7
107
107
  character: 29
108
108
  severity: ERROR
109
- message: 'The method parameter has different kind from the declaration `(size:
110
- ::Integer, name: ::String) -> void`'
109
+ message: 'The method parameter has different kind from the declaration `(name:
110
+ ::String, size: ::Integer) -> void`'
111
111
  code: Ruby::DifferentMethodParameterKind
112
112
  - file: else_on_exhaustive_case.rb
113
113
  diagnostics:
@@ -3,5 +3,5 @@ class NumberLike
3
3
  end
4
4
 
5
5
  class Integer
6
- overload def `+`: (NumberLike) -> NumberLike
6
+ def `+`: (NumberLike) -> NumberLike | ...
7
7
  end
data/steep.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
34
34
  spec.add_runtime_dependency "listen", "~> 3.0"
35
35
  spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
36
- spec.add_runtime_dependency "rbs", ">= 1.2.0"
36
+ spec.add_runtime_dependency "rbs", "~> 1.7.0"
37
37
  spec.add_runtime_dependency "parallel", ">= 1.0.0"
38
38
  spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
39
39
  end
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: 0.46.0
4
+ version: 0.47.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-30 00:00:00.000000000 Z
11
+ date: 2021-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -96,16 +96,16 @@ dependencies:
96
96
  name: rbs
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">="
99
+ - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: 1.2.0
101
+ version: 1.7.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ">="
106
+ - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: 1.2.0
108
+ version: 1.7.0
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: parallel
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -272,8 +272,6 @@ files:
272
272
  - sample/Steepfile
273
273
  - sample/lib/conference.rb
274
274
  - sample/sig/conference.rbs
275
- - sig/project.rbi
276
- - sig/steep/type_inference/send_args.rbs
277
275
  - smoke/alias/Steepfile
278
276
  - smoke/alias/a.rb
279
277
  - smoke/alias/a.rbs
data/sig/project.rbi DELETED
@@ -1,109 +0,0 @@
1
- class Pathname
2
- end
3
-
4
- class Time
5
- def self.now: -> instance
6
- def < : (Time) -> bool
7
- def >=: (Time) -> bool
8
- end
9
-
10
- type annotation = any
11
-
12
- class Steep::Source
13
- def self.parse: (String, path: String, labeling: any) -> instance
14
- def annotations: (block: any, builder: any, current_module: any) -> Array<annotation>
15
- def node: -> any
16
- def find_node: (line: Integer, column: Integer) -> any
17
- end
18
-
19
- class Steep::Typing
20
- attr_reader errors: Array<type_error>
21
- attr_reader nodes: any
22
- end
23
-
24
- type type_error = any
25
-
26
- class Steep::Project::Options
27
- attr_accessor fallback_any_is_error: bool
28
- attr_accessor allow_missing_definitions: bool
29
- end
30
-
31
- class Parser::SyntaxError
32
- end
33
-
34
- class Steep::Project::SourceFile
35
- attr_reader options: Options
36
- attr_reader path: Pathname
37
- attr_accessor content: String
38
- attr_reader content_updated_at: Time
39
-
40
- attr_reader source: (Source | Parser::SyntaxError | nil)
41
- attr_reader typing: Typing?
42
- attr_reader last_type_checked_at: Time?
43
-
44
- def initialize: (path: Pathname, options: Options) -> any
45
- def requires_type_check?: -> bool
46
- def invalidate: -> void
47
- def parse: -> (Source | Parser::SyntaxError)
48
- def errors: -> Array<type_error>?
49
- def type_check: (any) -> void
50
- end
51
-
52
- class Steep::Project::SignatureFile
53
- attr_reader path: Pathname
54
- attr_accessor content: String
55
- attr_reader content_updated_at: Time
56
-
57
- def parse: -> Array<any>
58
- end
59
-
60
- interface Steep::Project::_Listener
61
- def parse_signature: <'x> (project: Project, file: SignatureFile) { -> 'x } -> 'x
62
- def parse_source: <'x> (project: Project, file: SourceFile) { -> 'x } -> 'x
63
- def check: <'x> (project: Project) { -> 'x } -> 'x
64
- def load_signature: <'x> (project: Project) { -> 'x } -> 'x
65
- def validate_signature: <'x> (project: Project) { -> 'x } -> 'x
66
- def type_check_source: <'x> (project: Project, file: SourceFile) { -> 'x } -> 'x
67
- def clear_project: <'x> (project: Project) { -> 'x } -> 'x
68
- end
69
-
70
- class Steep::Project::SignatureLoaded
71
- attr_reader check: any
72
- attr_reader loaded_at: Time
73
- attr_reader file_paths: Array<Pathname>
74
-
75
- def initialize: (check: any, loaded_at: Time, file_paths: Array<Pathname>) -> any
76
- end
77
-
78
- class Steep::Project::SignatureHasSyntaxError
79
- attr_reader errors: Hash<Pathname, any>
80
- def initialize: (errors: Hash<Pathname, any>) -> any
81
- end
82
-
83
- class Steep::Project::SignatureHasError
84
- attr_reader errors: Array<any>
85
- def initialize: (errors: Array<any>) -> any
86
- end
87
-
88
- class Steep::Project
89
- attr_reader listener: _Listener
90
- attr_reader source_files: Hash<Pathname, SourceFile>
91
- attr_reader signature_files: Hash<Pathname, SignatureFile>
92
-
93
- attr_reader signature: (SignatureLoaded | SignatureHasError | SignatureHasSyntaxError | nil)
94
-
95
- def initialize: (?_Listener?) -> any
96
- def clear: -> void
97
- def type_check: (?force_signatures: bool, ?force_sources: bool) -> void
98
-
99
- def success?: -> bool
100
- def has_type_error?: -> bool
101
- def errors: -> Array<type_error>
102
- def each_updated_source: (?force: bool) { (SourceFile) -> void } -> void
103
- | (?force: bool) -> Enumerator<SourceFile, void>
104
- def signature_updated?: -> bool
105
- def reload_signature: -> void
106
- def validate_signature: (any) -> Array<any>
107
-
108
- def type_of: (path: Pathname, line: Integer, column: Integer) -> any
109
- end
@@ -1,42 +0,0 @@
1
- module Steep
2
- type node = untyped
3
-
4
- module TypeInference
5
- class SendArgs
6
- class PositionalArgs
7
- end
8
-
9
- class KeywordArgs
10
- type value = ArgTypePairs | UnexpectedKeyword | MissingKeyword
11
-
12
- class ArgTypePairs
13
- end
14
-
15
- class UnexpectedKeyword
16
- end
17
-
18
- class MissingKeyword
19
- end
20
-
21
- def consume: () -> [value, self]?
22
-
23
- def consume_keys: (Array[Symbol], node: node) -> [AST::Types::t | UnexpectedKeyword, self]
24
- end
25
-
26
-
27
- type error = Diagnostics::Ruby::IncompatibleArguments
28
- | Diagnostics::Ruby::UnexpectedBlockGiven
29
- | Diagnostics::Ruby::RequiredBlockMissing
30
-
31
- type arg = PositionalArgs::NodeParamPair
32
- | PositionalArgs::NodeTypePair
33
- | PositionalArgs::SplatArg
34
- | PositionalArgs::UnexpectedArg
35
- | KeywordArgs::ArgTypePairs
36
- | KeywordArgs::SplatArg
37
- | KeywordArgs::UnexpectedKeyword
38
-
39
- def each_arg: (TypeConstruction) { (arg, TypeConstruction) -> TypeConstruction } -> Array[error]
40
- end
41
- end
42
- end