steep 0.44.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 +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +3 -2
- data/.gitignore +0 -1
- data/CHANGELOG.md +42 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +75 -0
- data/README.md +2 -1
- data/lib/steep/annotation_parser.rb +1 -1
- data/lib/steep/ast/builtin.rb +7 -1
- data/lib/steep/ast/types/factory.rb +19 -25
- data/lib/steep/cli.rb +7 -1
- data/lib/steep/diagnostic/lsp_formatter.rb +59 -6
- data/lib/steep/diagnostic/ruby.rb +188 -60
- data/lib/steep/diagnostic/signature.rb +38 -15
- data/lib/steep/drivers/check.rb +3 -0
- data/lib/steep/drivers/init.rb +10 -3
- data/lib/steep/drivers/utils/driver_helper.rb +15 -0
- data/lib/steep/drivers/validate.rb +1 -1
- data/lib/steep/drivers/watch.rb +3 -0
- data/lib/steep/equatable.rb +21 -0
- data/lib/steep/interface/function.rb +798 -579
- data/lib/steep/project/dsl.rb +135 -36
- data/lib/steep/project/options.rb +13 -53
- data/lib/steep/project/target.rb +22 -8
- data/lib/steep/server/interaction_worker.rb +245 -26
- data/lib/steep/server/master.rb +2 -2
- data/lib/steep/server/type_check_worker.rb +6 -9
- data/lib/steep/services/file_loader.rb +26 -19
- data/lib/steep/services/goto_service.rb +1 -0
- data/lib/steep/services/hover_content.rb +135 -80
- data/lib/steep/source.rb +12 -11
- data/lib/steep/type_construction.rb +435 -502
- data/lib/steep/type_inference/block_params.rb +3 -6
- data/lib/steep/type_inference/method_params.rb +483 -0
- data/lib/steep/type_inference/send_args.rb +599 -128
- data/lib/steep/typing.rb +46 -21
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +4 -2
- data/sample/Steepfile +10 -3
- data/smoke/alias/Steepfile +2 -1
- data/smoke/and/Steepfile +2 -1
- data/smoke/array/Steepfile +2 -1
- data/smoke/array/test_expectations.yml +3 -3
- data/smoke/block/Steepfile +2 -2
- data/smoke/block/c.rb +0 -1
- data/smoke/case/Steepfile +2 -1
- data/smoke/class/Steepfile +2 -1
- data/smoke/class/test_expectations.yml +12 -15
- data/smoke/const/Steepfile +2 -1
- data/smoke/diagnostics/Steepfile +2 -1
- data/smoke/diagnostics/different_method_parameter_kind.rb +9 -0
- data/smoke/diagnostics/method_arity_mismatch.rb +2 -2
- data/smoke/diagnostics/method_parameter_mismatch.rb +10 -0
- data/smoke/diagnostics/test_expectations.yml +108 -31
- data/smoke/diagnostics-rbs/Steepfile +1 -1
- data/smoke/diagnostics-rbs/mixin-class-error.rbs +6 -0
- data/smoke/diagnostics-rbs/test_expectations.yml +12 -0
- data/smoke/diagnostics-rbs-duplicated/Steepfile +2 -1
- data/smoke/diagnostics-ruby-unsat/Steepfile +2 -1
- data/smoke/dstr/Steepfile +2 -1
- data/smoke/ensure/Steepfile +2 -1
- data/smoke/ensure/test_expectations.yml +3 -3
- data/smoke/enumerator/Steepfile +2 -1
- data/smoke/enumerator/test_expectations.yml +1 -1
- data/smoke/extension/Steepfile +2 -1
- data/smoke/extension/e.rbs +1 -1
- data/smoke/hash/Steepfile +2 -1
- data/smoke/hello/Steepfile +2 -1
- data/smoke/if/Steepfile +2 -1
- data/smoke/implements/Steepfile +2 -1
- data/smoke/initialize/Steepfile +2 -1
- data/smoke/integer/Steepfile +2 -1
- data/smoke/interface/Steepfile +2 -1
- data/smoke/kwbegin/Steepfile +2 -1
- data/smoke/lambda/Steepfile +2 -1
- data/smoke/literal/Steepfile +2 -1
- data/smoke/literal/test_expectations.yml +2 -2
- data/smoke/map/Steepfile +2 -1
- data/smoke/method/Steepfile +2 -1
- data/smoke/method/test_expectations.yml +11 -10
- data/smoke/module/Steepfile +2 -1
- data/smoke/regexp/Steepfile +2 -1
- data/smoke/regression/Steepfile +2 -1
- data/smoke/rescue/Steepfile +2 -1
- data/smoke/rescue/test_expectations.yml +3 -3
- data/smoke/self/Steepfile +2 -1
- data/smoke/skip/Steepfile +2 -1
- data/smoke/stdout/Steepfile +2 -1
- data/smoke/super/Steepfile +2 -1
- data/smoke/toplevel/Steepfile +2 -1
- data/smoke/toplevel/test_expectations.yml +3 -3
- data/smoke/tsort/Steepfile +4 -5
- data/smoke/tsort/test_expectations.yml +2 -2
- data/smoke/type_case/Steepfile +2 -1
- data/smoke/unexpected/Steepfile +2 -1
- data/smoke/yield/Steepfile +2 -1
- data/steep.gemspec +2 -2
- metadata +16 -10
- data/sig/project.rbi +0 -109
data/smoke/initialize/Steepfile
CHANGED
data/smoke/integer/Steepfile
CHANGED
data/smoke/interface/Steepfile
CHANGED
data/smoke/kwbegin/Steepfile
CHANGED
data/smoke/lambda/Steepfile
CHANGED
data/smoke/literal/Steepfile
CHANGED
@@ -101,6 +101,6 @@
|
|
101
101
|
character: 15
|
102
102
|
severity: ERROR
|
103
103
|
message: |-
|
104
|
-
Cannot
|
104
|
+
Cannot pass a value of type `::Symbol` as an argument of type `:foo`
|
105
105
|
::Symbol <: :foo
|
106
|
-
code: Ruby::
|
106
|
+
code: Ruby::ArgumentTypeMismatch
|
data/smoke/map/Steepfile
CHANGED
data/smoke/method/Steepfile
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
- range:
|
5
5
|
start:
|
6
6
|
line: 3
|
7
|
-
character:
|
7
|
+
character: 4
|
8
8
|
end:
|
9
|
-
line:
|
10
|
-
character:
|
9
|
+
line: 3
|
10
|
+
character: 7
|
11
11
|
severity: ERROR
|
12
12
|
message: |-
|
13
13
|
Cannot allow method body have type `::Integer` because declared as type `::String`
|
@@ -49,13 +49,14 @@
|
|
49
49
|
- range:
|
50
50
|
start:
|
51
51
|
line: 15
|
52
|
-
character:
|
52
|
+
character: 11
|
53
53
|
end:
|
54
54
|
line: 15
|
55
|
-
character:
|
55
|
+
character: 12
|
56
56
|
severity: ERROR
|
57
|
-
message:
|
58
|
-
|
57
|
+
message: The method parameter is incompatible with the declaration `(::Integer)
|
58
|
+
-> ::String`
|
59
|
+
code: Ruby::MethodParameterMismatch
|
59
60
|
- range:
|
60
61
|
start:
|
61
62
|
line: 18
|
@@ -76,10 +77,10 @@
|
|
76
77
|
- range:
|
77
78
|
start:
|
78
79
|
line: 4
|
79
|
-
character:
|
80
|
+
character: 6
|
80
81
|
end:
|
81
|
-
line:
|
82
|
-
character:
|
82
|
+
line: 4
|
83
|
+
character: 9
|
83
84
|
severity: ERROR
|
84
85
|
message: |-
|
85
86
|
Cannot allow method body have type `::Symbol` because declared as type `(::Integer | ::String)`
|
data/smoke/module/Steepfile
CHANGED
data/smoke/regexp/Steepfile
CHANGED
data/smoke/regression/Steepfile
CHANGED
data/smoke/rescue/Steepfile
CHANGED
@@ -64,10 +64,10 @@
|
|
64
64
|
- range:
|
65
65
|
start:
|
66
66
|
line: 37
|
67
|
-
character:
|
67
|
+
character: 4
|
68
68
|
end:
|
69
|
-
line:
|
70
|
-
character:
|
69
|
+
line: 37
|
70
|
+
character: 7
|
71
71
|
severity: ERROR
|
72
72
|
message: |-
|
73
73
|
Cannot allow method body have type `(::Integer | ::String)` because declared as type `::String`
|
data/smoke/self/Steepfile
CHANGED
data/smoke/skip/Steepfile
CHANGED
data/smoke/stdout/Steepfile
CHANGED
data/smoke/super/Steepfile
CHANGED
data/smoke/toplevel/Steepfile
CHANGED
data/smoke/tsort/Steepfile
CHANGED
@@ -32,8 +32,8 @@
|
|
32
32
|
character: 41
|
33
33
|
severity: ERROR
|
34
34
|
message: |-
|
35
|
-
Cannot assign a value of type `^(::Integer) -> ::Array[::Integer]` to a variable of type `^(::Integer) { (::Integer) -> void } -> void`
|
36
|
-
^(::Integer) -> ::Array[::Integer] <: ^(::Integer) { (::Integer) -> void } -> void
|
35
|
+
Cannot assign a value of type `^(::Integer) -> ::Enumerator[::Integer, ::Array[::Integer]]` to a variable of type `^(::Integer) { (::Integer) -> void } -> void`
|
36
|
+
^(::Integer) -> ::Enumerator[::Integer, ::Array[::Integer]] <: ^(::Integer) { (::Integer) -> void } -> void
|
37
37
|
code: Ruby::IncompatibleAssignment
|
38
38
|
- range:
|
39
39
|
start:
|
data/smoke/type_case/Steepfile
CHANGED
data/smoke/unexpected/Steepfile
CHANGED
data/smoke/yield/Steepfile
CHANGED
data/steep.gemspec
CHANGED
@@ -28,12 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.required_ruby_version = '>= 2.6.0'
|
30
30
|
|
31
|
-
spec.add_runtime_dependency "parser", ">=
|
31
|
+
spec.add_runtime_dependency "parser", ">= 3.0"
|
32
32
|
spec.add_runtime_dependency "activesupport", ">= 5.1"
|
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", "
|
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.
|
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-
|
11
|
+
date: 2021-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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.
|
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.
|
108
|
+
version: 1.7.0
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: parallel
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,11 +148,13 @@ executables:
|
|
148
148
|
extensions: []
|
149
149
|
extra_rdoc_files: []
|
150
150
|
files:
|
151
|
+
- ".github/dependabot.yml"
|
151
152
|
- ".github/workflows/ruby.yml"
|
152
153
|
- ".gitignore"
|
153
154
|
- ".gitmodules"
|
154
155
|
- CHANGELOG.md
|
155
156
|
- Gemfile
|
157
|
+
- Gemfile.lock
|
156
158
|
- LICENSE
|
157
159
|
- README.md
|
158
160
|
- Rakefile
|
@@ -209,6 +211,7 @@ files:
|
|
209
211
|
- lib/steep/drivers/vendor.rb
|
210
212
|
- lib/steep/drivers/watch.rb
|
211
213
|
- lib/steep/drivers/worker.rb
|
214
|
+
- lib/steep/equatable.rb
|
212
215
|
- lib/steep/expectations.rb
|
213
216
|
- lib/steep/index/rbs_index.rb
|
214
217
|
- lib/steep/index/signature_symbol_provider.rb
|
@@ -260,6 +263,7 @@ files:
|
|
260
263
|
- lib/steep/type_inference/logic.rb
|
261
264
|
- lib/steep/type_inference/logic_type_interpreter.rb
|
262
265
|
- lib/steep/type_inference/method_call.rb
|
266
|
+
- lib/steep/type_inference/method_params.rb
|
263
267
|
- lib/steep/type_inference/send_args.rb
|
264
268
|
- lib/steep/type_inference/type_env.rb
|
265
269
|
- lib/steep/typing.rb
|
@@ -268,7 +272,6 @@ files:
|
|
268
272
|
- sample/Steepfile
|
269
273
|
- sample/lib/conference.rb
|
270
274
|
- sample/sig/conference.rbs
|
271
|
-
- sig/project.rbi
|
272
275
|
- smoke/alias/Steepfile
|
273
276
|
- smoke/alias/a.rb
|
274
277
|
- smoke/alias/a.rbs
|
@@ -320,6 +323,7 @@ files:
|
|
320
323
|
- smoke/diagnostics-rbs/invalid-method-overload.rbs
|
321
324
|
- smoke/diagnostics-rbs/invalid-type-application.rbs
|
322
325
|
- smoke/diagnostics-rbs/invalid_variance_annotation.rbs
|
326
|
+
- smoke/diagnostics-rbs/mixin-class-error.rbs
|
323
327
|
- smoke/diagnostics-rbs/recursive-alias.rbs
|
324
328
|
- smoke/diagnostics-rbs/recursive-class.rbs
|
325
329
|
- smoke/diagnostics-rbs/superclass-mismatch.rbs
|
@@ -337,6 +341,7 @@ files:
|
|
337
341
|
- smoke/diagnostics/block_body_type_mismatch.rb
|
338
342
|
- smoke/diagnostics/block_type_mismatch.rb
|
339
343
|
- smoke/diagnostics/break_type_mismatch.rb
|
344
|
+
- smoke/diagnostics/different_method_parameter_kind.rb
|
340
345
|
- smoke/diagnostics/else_on_exhaustive_case.rb
|
341
346
|
- smoke/diagnostics/incompatible_annotation.rb
|
342
347
|
- smoke/diagnostics/incompatible_argument.rb
|
@@ -344,6 +349,7 @@ files:
|
|
344
349
|
- smoke/diagnostics/method_arity_mismatch.rb
|
345
350
|
- smoke/diagnostics/method_body_type_mismatch.rb
|
346
351
|
- smoke/diagnostics/method_definition_missing.rb
|
352
|
+
- smoke/diagnostics/method_parameter_mismatch.rb
|
347
353
|
- smoke/diagnostics/method_return_type_annotation_mismatch.rb
|
348
354
|
- smoke/diagnostics/missing_keyword.rb
|
349
355
|
- smoke/diagnostics/no_method.rb
|
@@ -527,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
527
533
|
- !ruby/object:Gem::Version
|
528
534
|
version: '0'
|
529
535
|
requirements: []
|
530
|
-
rubygems_version: 3.2.
|
536
|
+
rubygems_version: 3.2.22
|
531
537
|
signing_key:
|
532
538
|
specification_version: 4
|
533
539
|
summary: Gradual Typing for Ruby
|
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
|