steep 0.37.0 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +34 -0
- data/Rakefile +5 -2
- data/bin/output_rebaseline.rb +34 -0
- data/bin/output_test.rb +53 -0
- data/lib/steep.rb +95 -14
- data/lib/steep/ast/types/bot.rb +1 -1
- data/lib/steep/ast/types/class.rb +4 -0
- data/lib/steep/ast/types/factory.rb +10 -0
- data/lib/steep/ast/types/logic.rb +16 -3
- data/lib/steep/ast/types/top.rb +1 -1
- data/lib/steep/cli.rb +31 -7
- data/lib/steep/diagnostic/helper.rb +17 -0
- data/lib/steep/diagnostic/lsp_formatter.rb +16 -0
- data/lib/steep/diagnostic/ruby.rb +619 -0
- data/lib/steep/diagnostic/signature.rb +357 -0
- data/lib/steep/drivers/annotations.rb +19 -28
- data/lib/steep/drivers/check.rb +182 -60
- data/lib/steep/drivers/diagnostic_printer.rb +99 -0
- data/lib/steep/drivers/langserver.rb +3 -8
- data/lib/steep/drivers/print_project.rb +10 -9
- data/lib/steep/drivers/stats.rb +124 -32
- data/lib/steep/drivers/trace_printer.rb +5 -1
- data/lib/steep/drivers/utils/jobs_count.rb +9 -0
- data/lib/steep/drivers/validate.rb +31 -13
- data/lib/steep/drivers/watch.rb +69 -48
- data/lib/steep/drivers/worker.rb +16 -8
- data/lib/steep/expectations.rb +159 -0
- data/lib/steep/index/rbs_index.rb +334 -0
- data/lib/steep/index/signature_symbol_provider.rb +162 -0
- data/lib/steep/index/source_index.rb +100 -0
- data/lib/steep/project.rb +0 -30
- data/lib/steep/project/dsl.rb +5 -3
- data/lib/steep/project/options.rb +4 -4
- data/lib/steep/project/pattern.rb +56 -0
- data/lib/steep/project/target.rb +9 -214
- data/lib/steep/range_extension.rb +29 -0
- data/lib/steep/server/base_worker.rb +43 -7
- data/lib/steep/server/change_buffer.rb +63 -0
- data/lib/steep/server/interaction_worker.rb +73 -56
- data/lib/steep/server/master.rb +245 -109
- data/lib/steep/server/type_check_worker.rb +122 -0
- data/lib/steep/server/worker_process.rb +17 -15
- data/lib/steep/{project → services}/completion_provider.rb +3 -3
- data/lib/steep/services/content_change.rb +61 -0
- data/lib/steep/services/file_loader.rb +48 -0
- data/lib/steep/{project → services}/hover_content.rb +14 -16
- data/lib/steep/services/path_assignment.rb +29 -0
- data/lib/steep/services/signature_service.rb +369 -0
- data/lib/steep/services/stats_calculator.rb +69 -0
- data/lib/steep/services/type_check_service.rb +342 -0
- data/lib/steep/signature/validator.rb +174 -32
- data/lib/steep/subtyping/check.rb +248 -47
- data/lib/steep/subtyping/constraints.rb +2 -2
- data/lib/steep/type_construction.rb +565 -295
- data/lib/steep/type_inference/constant_env.rb +5 -1
- data/lib/steep/type_inference/local_variable_type_env.rb +26 -12
- data/lib/steep/type_inference/logic_type_interpreter.rb +99 -26
- data/lib/steep/type_inference/type_env.rb +43 -17
- data/lib/steep/typing.rb +8 -2
- data/lib/steep/version.rb +1 -1
- data/smoke/alias/a.rb +0 -3
- data/smoke/alias/b.rb +0 -1
- data/smoke/alias/c.rb +0 -2
- data/smoke/alias/test_expectations.yml +96 -0
- data/smoke/and/a.rb +0 -3
- data/smoke/and/test_expectations.yml +31 -0
- data/smoke/array/a.rb +0 -3
- data/smoke/array/b.rb +0 -2
- data/smoke/array/c.rb +0 -1
- data/smoke/array/test_expectations.yml +103 -0
- data/smoke/block/a.rb +0 -2
- data/smoke/block/b.rb +0 -2
- data/smoke/block/d.rb +0 -4
- data/smoke/block/test_expectations.yml +125 -0
- data/smoke/case/a.rb +0 -3
- data/smoke/case/test_expectations.yml +47 -0
- data/smoke/class/a.rb +0 -3
- data/smoke/class/c.rb +0 -1
- data/smoke/class/f.rb +0 -1
- data/smoke/class/g.rb +0 -2
- data/smoke/class/i.rb +0 -2
- data/smoke/class/test_expectations.yml +120 -0
- data/smoke/const/a.rb +0 -3
- data/smoke/const/b.rb +7 -0
- data/smoke/const/b.rbs +5 -0
- data/smoke/const/test_expectations.yml +139 -0
- data/smoke/diagnostics-rbs-duplicated/Steepfile +5 -0
- data/smoke/diagnostics-rbs-duplicated/a.rbs +5 -0
- data/smoke/diagnostics-rbs-duplicated/test_expectations.yml +13 -0
- data/smoke/diagnostics-rbs/Steepfile +8 -0
- data/smoke/diagnostics-rbs/duplicated-method-definition.rbs +20 -0
- data/smoke/diagnostics-rbs/generic-parameter-mismatch.rbs +7 -0
- data/smoke/diagnostics-rbs/invalid-method-overload.rbs +3 -0
- data/smoke/diagnostics-rbs/invalid-type-application.rbs +7 -0
- data/smoke/diagnostics-rbs/invalid_variance_annotation.rbs +3 -0
- data/smoke/diagnostics-rbs/recursive-alias.rbs +5 -0
- data/smoke/diagnostics-rbs/recursive-class.rbs +8 -0
- data/smoke/diagnostics-rbs/superclass-mismatch.rbs +7 -0
- data/smoke/diagnostics-rbs/test_expectations.yml +231 -0
- data/smoke/diagnostics-rbs/unknown-method-alias.rbs +3 -0
- data/smoke/diagnostics-rbs/unknown-type-name-2.rbs +5 -0
- data/smoke/diagnostics-rbs/unknown-type-name.rbs +13 -0
- data/smoke/diagnostics/Steepfile +5 -0
- data/smoke/diagnostics/a.rbs +26 -0
- data/smoke/diagnostics/argument_type_mismatch.rb +1 -0
- data/smoke/diagnostics/block_body_type_mismatch.rb +1 -0
- data/smoke/diagnostics/block_type_mismatch.rb +3 -0
- data/smoke/diagnostics/break_type_mismatch.rb +1 -0
- data/smoke/diagnostics/else_on_exhaustive_case.rb +12 -0
- data/smoke/diagnostics/incompatible_annotation.rb +6 -0
- data/smoke/diagnostics/incompatible_argument.rb +1 -0
- data/smoke/diagnostics/incompatible_assignment.rb +8 -0
- data/smoke/diagnostics/method_arity_mismatch.rb +11 -0
- data/smoke/diagnostics/method_body_type_mismatch.rb +6 -0
- data/smoke/diagnostics/method_definition_missing.rb +2 -0
- data/smoke/diagnostics/method_return_type_annotation_mismatch.rb +7 -0
- data/smoke/diagnostics/missing_keyword.rb +1 -0
- data/smoke/diagnostics/no_method.rb +1 -0
- data/smoke/diagnostics/required_block_missing.rb +1 -0
- data/smoke/diagnostics/return_type_mismatch.rb +6 -0
- data/smoke/diagnostics/test_expectations.yml +477 -0
- data/smoke/diagnostics/unexpected_block_given.rb +1 -0
- data/smoke/diagnostics/unexpected_dynamic_method.rb +3 -0
- data/smoke/diagnostics/unexpected_jump.rb +4 -0
- data/smoke/diagnostics/unexpected_jump_value.rb +3 -0
- data/smoke/diagnostics/unexpected_keyword.rb +1 -0
- data/smoke/diagnostics/unexpected_splat.rb +1 -0
- data/smoke/diagnostics/unexpected_yield.rb +6 -0
- data/smoke/diagnostics/unknown_constant_assigned.rb +7 -0
- data/smoke/diagnostics/unresolved_overloading.rb +1 -0
- data/smoke/diagnostics/unsatisfiable_constraint.rb +7 -0
- data/smoke/diagnostics/unsupported_syntax.rb +2 -0
- data/smoke/dstr/a.rb +0 -1
- data/smoke/dstr/test_expectations.yml +13 -0
- data/smoke/ensure/a.rb +0 -4
- data/smoke/ensure/test_expectations.yml +62 -0
- data/smoke/enumerator/a.rb +0 -6
- data/smoke/enumerator/b.rb +0 -3
- data/smoke/enumerator/test_expectations.yml +135 -0
- data/smoke/extension/a.rb +0 -1
- data/smoke/extension/b.rb +0 -2
- data/smoke/extension/c.rb +0 -1
- data/smoke/extension/f.rb +2 -0
- data/smoke/extension/f.rbs +3 -0
- data/smoke/extension/test_expectations.yml +73 -0
- data/smoke/hash/b.rb +0 -1
- data/smoke/hash/c.rb +0 -3
- data/smoke/hash/d.rb +0 -1
- data/smoke/hash/e.rb +0 -1
- data/smoke/hash/test_expectations.yml +81 -0
- data/smoke/hello/hello.rb +0 -2
- data/smoke/hello/test_expectations.yml +25 -0
- data/smoke/if/a.rb +0 -2
- data/smoke/if/test_expectations.yml +34 -0
- data/smoke/implements/a.rb +0 -2
- data/smoke/implements/test_expectations.yml +23 -0
- data/smoke/initialize/test_expectations.yml +1 -0
- data/smoke/integer/a.rb +0 -7
- data/smoke/integer/test_expectations.yml +101 -0
- data/smoke/interface/a.rb +0 -2
- data/smoke/interface/test_expectations.yml +23 -0
- data/smoke/kwbegin/a.rb +0 -1
- data/smoke/kwbegin/test_expectations.yml +17 -0
- data/smoke/lambda/a.rb +1 -4
- data/smoke/lambda/test_expectations.yml +39 -0
- data/smoke/literal/a.rb +0 -5
- data/smoke/literal/b.rb +0 -2
- data/smoke/literal/test_expectations.yml +106 -0
- data/smoke/map/test_expectations.yml +1 -0
- data/smoke/method/a.rb +0 -5
- data/smoke/method/b.rb +0 -1
- data/smoke/method/test_expectations.yml +90 -0
- data/smoke/module/a.rb +0 -2
- data/smoke/module/b.rb +0 -2
- data/smoke/module/c.rb +0 -1
- data/smoke/module/d.rb +0 -1
- data/smoke/module/f.rb +0 -2
- data/smoke/module/test_expectations.yml +75 -0
- data/smoke/regexp/a.rb +0 -38
- data/smoke/regexp/b.rb +0 -26
- data/smoke/regexp/test_expectations.yml +615 -0
- data/smoke/regression/set_divide.rb +0 -4
- data/smoke/regression/test_expectations.yml +43 -0
- data/smoke/rescue/a.rb +0 -5
- data/smoke/rescue/test_expectations.yml +79 -0
- data/smoke/self/a.rb +0 -2
- data/smoke/self/test_expectations.yml +23 -0
- data/smoke/skip/skip.rb +0 -2
- data/smoke/skip/test_expectations.yml +23 -0
- data/smoke/stdout/test_expectations.yml +1 -0
- data/smoke/super/a.rb +0 -4
- data/smoke/super/test_expectations.yml +79 -0
- data/smoke/toplevel/a.rb +0 -1
- data/smoke/toplevel/test_expectations.yml +15 -0
- data/smoke/tsort/Steepfile +2 -0
- data/smoke/tsort/a.rb +0 -3
- data/smoke/tsort/test_expectations.yml +63 -0
- data/smoke/type_case/a.rb +0 -4
- data/smoke/type_case/test_expectations.yml +48 -0
- data/smoke/unexpected/Steepfile +5 -0
- data/smoke/unexpected/test_expectations.yml +25 -0
- data/smoke/unexpected/unexpected.rb +1 -0
- data/smoke/unexpected/unexpected.rbs +3 -0
- data/smoke/yield/a.rb +0 -3
- data/smoke/yield/b.rb +6 -0
- data/smoke/yield/test_expectations.yml +68 -0
- data/steep.gemspec +4 -3
- metadata +144 -29
- data/bin/smoke_runner.rb +0 -139
- data/lib/steep/drivers/signature_error_printer.rb +0 -25
- data/lib/steep/errors.rb +0 -565
- data/lib/steep/project/file_loader.rb +0 -68
- data/lib/steep/project/signature_file.rb +0 -33
- data/lib/steep/project/source_file.rb +0 -129
- data/lib/steep/server/code_worker.rb +0 -137
- data/lib/steep/server/signature_worker.rb +0 -152
- data/lib/steep/server/utils.rb +0 -69
- data/lib/steep/signature/errors.rb +0 -82
- data/lib/steep/type_assignability.rb +0 -367
data/smoke/alias/a.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# @type var x: foo
|
2
2
|
x = ""
|
3
3
|
|
4
|
-
# !expects* UnresolvedOverloading: receiver=(::String | ::Integer), method_name=+,
|
5
4
|
x + 123
|
6
5
|
|
7
6
|
# @type var y: bar
|
@@ -11,9 +10,7 @@ y = []
|
|
11
10
|
# @type var z: Symbol
|
12
11
|
case x
|
13
12
|
when String
|
14
|
-
# !expects IncompatibleAssignment: lhs_type=::Symbol, rhs_type=::String
|
15
13
|
z = x
|
16
14
|
when Integer
|
17
|
-
# !expects IncompatibleAssignment: lhs_type=::Symbol, rhs_type=::Integer
|
18
15
|
z = x
|
19
16
|
end
|
data/smoke/alias/b.rb
CHANGED
data/smoke/alias/c.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
# @type var x: String
|
2
2
|
|
3
|
-
# !expects IncompatibleAssignment: lhs_type=::String, rhs_type=::Integer
|
4
3
|
x = AliasMethodArg.new.foo(:foo)
|
5
4
|
|
6
5
|
# @type var name: name
|
7
6
|
name = :bar
|
8
7
|
|
9
|
-
# !expects IncompatibleAssignment: lhs_type=::String, rhs_type=::Integer
|
10
8
|
x = AliasMethodArg.new.foo(name)
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
- file: a.rb
|
3
|
+
diagnostics:
|
4
|
+
- range:
|
5
|
+
start:
|
6
|
+
line: 4
|
7
|
+
character: 0
|
8
|
+
end:
|
9
|
+
line: 4
|
10
|
+
character: 7
|
11
|
+
severity: ERROR
|
12
|
+
message: |-
|
13
|
+
Cannot find compatible overloading of method `+` of type `(::String | ::Integer)`
|
14
|
+
Method types:
|
15
|
+
def +: ((::string & ::Integer)) -> (::String | ::Integer)
|
16
|
+
| ((::string & ::Float)) -> (::String | ::Float)
|
17
|
+
| ((::string & ::Rational)) -> (::String | ::Rational)
|
18
|
+
| ((::string & ::Complex)) -> (::String | ::Complex)
|
19
|
+
code: Ruby::UnresolvedOverloading
|
20
|
+
- range:
|
21
|
+
start:
|
22
|
+
line: 13
|
23
|
+
character: 2
|
24
|
+
end:
|
25
|
+
line: 13
|
26
|
+
character: 7
|
27
|
+
severity: ERROR
|
28
|
+
message: |-
|
29
|
+
Cannot assign a value of type `::String` to a variable of type `::Symbol`
|
30
|
+
::String <: ::Symbol
|
31
|
+
::Object <: ::Symbol
|
32
|
+
::BasicObject <: ::Symbol
|
33
|
+
code: Ruby::IncompatibleAssignment
|
34
|
+
- range:
|
35
|
+
start:
|
36
|
+
line: 15
|
37
|
+
character: 2
|
38
|
+
end:
|
39
|
+
line: 15
|
40
|
+
character: 7
|
41
|
+
severity: ERROR
|
42
|
+
message: |-
|
43
|
+
Cannot assign a value of type `::Integer` to a variable of type `::Symbol`
|
44
|
+
::Integer <: ::Symbol
|
45
|
+
::Numeric <: ::Symbol
|
46
|
+
::Object <: ::Symbol
|
47
|
+
::BasicObject <: ::Symbol
|
48
|
+
code: Ruby::IncompatibleAssignment
|
49
|
+
- file: b.rb
|
50
|
+
diagnostics:
|
51
|
+
- range:
|
52
|
+
start:
|
53
|
+
line: 6
|
54
|
+
character: 0
|
55
|
+
end:
|
56
|
+
line: 6
|
57
|
+
character: 8
|
58
|
+
severity: ERROR
|
59
|
+
message: |-
|
60
|
+
Cannot assign a value of type `::String` to a variable of type `::Integer`
|
61
|
+
::String <: ::Integer
|
62
|
+
::Object <: ::Integer
|
63
|
+
::BasicObject <: ::Integer
|
64
|
+
code: Ruby::IncompatibleAssignment
|
65
|
+
- file: c.rb
|
66
|
+
diagnostics:
|
67
|
+
- range:
|
68
|
+
start:
|
69
|
+
line: 3
|
70
|
+
character: 0
|
71
|
+
end:
|
72
|
+
line: 3
|
73
|
+
character: 32
|
74
|
+
severity: ERROR
|
75
|
+
message: |-
|
76
|
+
Cannot assign a value of type `::Integer` to a variable of type `::String`
|
77
|
+
::Integer <: ::String
|
78
|
+
::Numeric <: ::String
|
79
|
+
::Object <: ::String
|
80
|
+
::BasicObject <: ::String
|
81
|
+
code: Ruby::IncompatibleAssignment
|
82
|
+
- range:
|
83
|
+
start:
|
84
|
+
line: 8
|
85
|
+
character: 0
|
86
|
+
end:
|
87
|
+
line: 8
|
88
|
+
character: 32
|
89
|
+
severity: ERROR
|
90
|
+
message: |-
|
91
|
+
Cannot assign a value of type `::Integer` to a variable of type `::String`
|
92
|
+
::Integer <: ::String
|
93
|
+
::Numeric <: ::String
|
94
|
+
::Object <: ::String
|
95
|
+
::BasicObject <: ::String
|
96
|
+
code: Ruby::IncompatibleAssignment
|
data/smoke/and/a.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
- file: a.rb
|
3
|
+
diagnostics:
|
4
|
+
- range:
|
5
|
+
start:
|
6
|
+
line: 6
|
7
|
+
character: 0
|
8
|
+
end:
|
9
|
+
line: 6
|
10
|
+
character: 17
|
11
|
+
severity: ERROR
|
12
|
+
message: |-
|
13
|
+
Cannot assign a value of type `(::String | nil)` to a variable of type `::String`
|
14
|
+
(::String | nil) <: ::String
|
15
|
+
nil <: ::String
|
16
|
+
code: Ruby::IncompatibleAssignment
|
17
|
+
- range:
|
18
|
+
start:
|
19
|
+
line: 8
|
20
|
+
character: 0
|
21
|
+
end:
|
22
|
+
line: 8
|
23
|
+
character: 17
|
24
|
+
severity: ERROR
|
25
|
+
message: |-
|
26
|
+
Cannot assign a value of type `(::String | nil)` to a variable of type `::Integer`
|
27
|
+
(::String | nil) <: ::Integer
|
28
|
+
::String <: ::Integer
|
29
|
+
::Object <: ::Integer
|
30
|
+
::BasicObject <: ::Integer
|
31
|
+
code: Ruby::IncompatibleAssignment
|
data/smoke/array/a.rb
CHANGED
@@ -3,19 +3,16 @@
|
|
3
3
|
a = []
|
4
4
|
a[1] = 3
|
5
5
|
|
6
|
-
# !expects* UnresolvedOverloading: receiver=::Array[::Integer], method_name=[]=,
|
7
6
|
a[2] = "foo"
|
8
7
|
|
9
8
|
# @type var i: Integer
|
10
9
|
i = a[0]
|
11
10
|
|
12
11
|
# @type var s: String
|
13
|
-
# !expects IncompatibleAssignment: lhs_type=::String, rhs_type=::Integer
|
14
12
|
s = a[1]
|
15
13
|
|
16
14
|
|
17
15
|
b = ["a", "b", "c"]
|
18
16
|
|
19
17
|
s = b[0]
|
20
|
-
# !expects IncompatibleAssignment: lhs_type=::Integer, rhs_type=::String
|
21
18
|
i = b[1]
|
data/smoke/array/b.rb
CHANGED
data/smoke/array/c.rb
CHANGED
@@ -0,0 +1,103 @@
|
|
1
|
+
---
|
2
|
+
- file: a.rb
|
3
|
+
diagnostics:
|
4
|
+
- range:
|
5
|
+
start:
|
6
|
+
line: 6
|
7
|
+
character: 0
|
8
|
+
end:
|
9
|
+
line: 6
|
10
|
+
character: 12
|
11
|
+
severity: ERROR
|
12
|
+
message: |-
|
13
|
+
Cannot find compatible overloading of method `[]=` of type `::Array[::Integer]`
|
14
|
+
Method types:
|
15
|
+
def []=: (::int, ::Integer) -> ::Integer
|
16
|
+
| (::int, ::int, ::Integer) -> ::Integer
|
17
|
+
| (::int, ::int, ::Array[::Integer]) -> ::Array[::Integer]
|
18
|
+
| (::int, ::int, nil) -> nil
|
19
|
+
| (::Range[::Integer], ::Integer) -> ::Integer
|
20
|
+
| (::Range[::Integer], ::Array[::Integer]) -> ::Array[::Integer]
|
21
|
+
| (::Range[::Integer], nil) -> nil
|
22
|
+
code: Ruby::UnresolvedOverloading
|
23
|
+
- range:
|
24
|
+
start:
|
25
|
+
line: 12
|
26
|
+
character: 0
|
27
|
+
end:
|
28
|
+
line: 12
|
29
|
+
character: 8
|
30
|
+
severity: ERROR
|
31
|
+
message: |-
|
32
|
+
Cannot assign a value of type `::Integer` to a variable of type `::String`
|
33
|
+
::Integer <: ::String
|
34
|
+
::Numeric <: ::String
|
35
|
+
::Object <: ::String
|
36
|
+
::BasicObject <: ::String
|
37
|
+
code: Ruby::IncompatibleAssignment
|
38
|
+
- range:
|
39
|
+
start:
|
40
|
+
line: 18
|
41
|
+
character: 0
|
42
|
+
end:
|
43
|
+
line: 18
|
44
|
+
character: 8
|
45
|
+
severity: ERROR
|
46
|
+
message: |-
|
47
|
+
Cannot assign a value of type `::String` to a variable of type `::Integer`
|
48
|
+
::String <: ::Integer
|
49
|
+
::Object <: ::Integer
|
50
|
+
::BasicObject <: ::Integer
|
51
|
+
code: Ruby::IncompatibleAssignment
|
52
|
+
- file: b.rb
|
53
|
+
diagnostics:
|
54
|
+
- range:
|
55
|
+
start:
|
56
|
+
line: 11
|
57
|
+
character: 0
|
58
|
+
end:
|
59
|
+
line: 11
|
60
|
+
character: 5
|
61
|
+
severity: ERROR
|
62
|
+
message: |-
|
63
|
+
Cannot assign a value of type `::Array[::Integer]` to a variable of type `::Array[::String]`
|
64
|
+
::Array[::Integer] <: ::Array[::String]
|
65
|
+
::Integer <: ::String
|
66
|
+
::Numeric <: ::String
|
67
|
+
::Object <: ::String
|
68
|
+
::BasicObject <: ::String
|
69
|
+
code: Ruby::IncompatibleAssignment
|
70
|
+
- range:
|
71
|
+
start:
|
72
|
+
line: 12
|
73
|
+
character: 0
|
74
|
+
end:
|
75
|
+
line: 12
|
76
|
+
character: 5
|
77
|
+
severity: ERROR
|
78
|
+
message: |-
|
79
|
+
Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Integer]`
|
80
|
+
::Array[::String] <: ::Array[::Integer]
|
81
|
+
::String <: ::Integer
|
82
|
+
::Object <: ::Integer
|
83
|
+
::BasicObject <: ::Integer
|
84
|
+
code: Ruby::IncompatibleAssignment
|
85
|
+
- file: c.rb
|
86
|
+
diagnostics:
|
87
|
+
- range:
|
88
|
+
start:
|
89
|
+
line: 6
|
90
|
+
character: 0
|
91
|
+
end:
|
92
|
+
line: 6
|
93
|
+
character: 7
|
94
|
+
severity: ERROR
|
95
|
+
message: |-
|
96
|
+
Cannot assign a value of type `::Array[::Integer]` to a variable of type `::Array[(::String | nil)]`
|
97
|
+
::Array[::Integer] <: ::Array[(::String | nil)]
|
98
|
+
::Integer <: (::String | nil)
|
99
|
+
::Integer <: ::String
|
100
|
+
::Numeric <: ::String
|
101
|
+
::Object <: ::String
|
102
|
+
::BasicObject <: ::String
|
103
|
+
code: Ruby::IncompatibleAssignment
|
data/smoke/block/a.rb
CHANGED
data/smoke/block/b.rb
CHANGED
@@ -2,13 +2,11 @@
|
|
2
2
|
a = (_ = nil)
|
3
3
|
|
4
4
|
a.bar do |x|
|
5
|
-
# !expects BreakTypeMismatch: expected=::Symbol, actual=::Integer
|
6
5
|
break 3
|
7
6
|
end
|
8
7
|
|
9
8
|
# @type var s: ::String
|
10
9
|
|
11
|
-
# !expects IncompatibleAssignment: lhs_type=::String, rhs_type=(::Integer | ::Symbol)
|
12
10
|
s = a.bar do |x|
|
13
11
|
# @type break: ::Integer
|
14
12
|
break 3
|
data/smoke/block/d.rb
CHANGED
@@ -3,13 +3,9 @@ a = -> (x) { x.to_s }
|
|
3
3
|
|
4
4
|
# @type var b: Array[Float]
|
5
5
|
|
6
|
-
# !expects IncompatibleAssignment: lhs_type=::Array[::Float], rhs_type=::Array[::String]
|
7
6
|
b = [1,2,3].map(&a)
|
8
7
|
|
9
|
-
# !expects IncompatibleAssignment: lhs_type=::Array[::Float], rhs_type=::Array[::String]
|
10
8
|
b = [1,2,3].map(&:to_s)
|
11
9
|
|
12
|
-
# !expects* UnresolvedOverloading: receiver=::Array[::Integer], method_name=map,
|
13
10
|
[1,2,3].map(&:no_such_method)
|
14
|
-
# !expects* UnresolvedOverloading: receiver=::Array[::Integer], method_name=map,
|
15
11
|
[1,2,3].map(&:divmod)
|
@@ -0,0 +1,125 @@
|
|
1
|
+
---
|
2
|
+
- file: a.rb
|
3
|
+
diagnostics:
|
4
|
+
- range:
|
5
|
+
start:
|
6
|
+
line: 8
|
7
|
+
character: 0
|
8
|
+
end:
|
9
|
+
line: 8
|
10
|
+
character: 9
|
11
|
+
severity: ERROR
|
12
|
+
message: |-
|
13
|
+
Cannot assign a value of type `::Integer` to a variable of type `::String`
|
14
|
+
::Integer <: ::String
|
15
|
+
::Numeric <: ::String
|
16
|
+
::Object <: ::String
|
17
|
+
::BasicObject <: ::String
|
18
|
+
code: Ruby::IncompatibleAssignment
|
19
|
+
- range:
|
20
|
+
start:
|
21
|
+
line: 10
|
22
|
+
character: 0
|
23
|
+
end:
|
24
|
+
line: 10
|
25
|
+
character: 17
|
26
|
+
severity: ERROR
|
27
|
+
message: |-
|
28
|
+
Cannot assign a value of type `::String` to a variable of type `::Integer`
|
29
|
+
::String <: ::Integer
|
30
|
+
::Object <: ::Integer
|
31
|
+
::BasicObject <: ::Integer
|
32
|
+
code: Ruby::IncompatibleAssignment
|
33
|
+
- file: b.rb
|
34
|
+
diagnostics:
|
35
|
+
- range:
|
36
|
+
start:
|
37
|
+
line: 5
|
38
|
+
character: 2
|
39
|
+
end:
|
40
|
+
line: 5
|
41
|
+
character: 9
|
42
|
+
severity: ERROR
|
43
|
+
message: |-
|
44
|
+
Cannot break with a value of type `::Integer` because type `::Symbol` is assumed
|
45
|
+
::Integer <: ::Symbol
|
46
|
+
::Numeric <: ::Symbol
|
47
|
+
::Object <: ::Symbol
|
48
|
+
::BasicObject <: ::Symbol
|
49
|
+
code: Ruby::BreakTypeMismatch
|
50
|
+
- range:
|
51
|
+
start:
|
52
|
+
line: 10
|
53
|
+
character: 0
|
54
|
+
end:
|
55
|
+
line: 13
|
56
|
+
character: 3
|
57
|
+
severity: ERROR
|
58
|
+
message: |-
|
59
|
+
Cannot assign a value of type `(::Integer | ::Symbol)` to a variable of type `::String`
|
60
|
+
(::Integer | ::Symbol) <: ::String
|
61
|
+
::Integer <: ::String
|
62
|
+
::Numeric <: ::String
|
63
|
+
::Object <: ::String
|
64
|
+
::BasicObject <: ::String
|
65
|
+
code: Ruby::IncompatibleAssignment
|
66
|
+
- file: d.rb
|
67
|
+
diagnostics:
|
68
|
+
- range:
|
69
|
+
start:
|
70
|
+
line: 6
|
71
|
+
character: 0
|
72
|
+
end:
|
73
|
+
line: 6
|
74
|
+
character: 19
|
75
|
+
severity: ERROR
|
76
|
+
message: |-
|
77
|
+
Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Float]`
|
78
|
+
::Array[::String] <: ::Array[::Float]
|
79
|
+
::String <: ::Float
|
80
|
+
::Object <: ::Float
|
81
|
+
::BasicObject <: ::Float
|
82
|
+
code: Ruby::IncompatibleAssignment
|
83
|
+
- range:
|
84
|
+
start:
|
85
|
+
line: 8
|
86
|
+
character: 0
|
87
|
+
end:
|
88
|
+
line: 8
|
89
|
+
character: 23
|
90
|
+
severity: ERROR
|
91
|
+
message: |-
|
92
|
+
Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Float]`
|
93
|
+
::Array[::String] <: ::Array[::Float]
|
94
|
+
::String <: ::Float
|
95
|
+
::Object <: ::Float
|
96
|
+
::BasicObject <: ::Float
|
97
|
+
code: Ruby::IncompatibleAssignment
|
98
|
+
- range:
|
99
|
+
start:
|
100
|
+
line: 10
|
101
|
+
character: 0
|
102
|
+
end:
|
103
|
+
line: 10
|
104
|
+
character: 29
|
105
|
+
severity: ERROR
|
106
|
+
message: |-
|
107
|
+
Cannot find compatible overloading of method `map` of type `::Array[::Integer]`
|
108
|
+
Method types:
|
109
|
+
def map: [U] () { (::Integer) -> U } -> ::Array[U]
|
110
|
+
| () -> ::Enumerator[::Integer, ::Array[untyped]]
|
111
|
+
code: Ruby::UnresolvedOverloading
|
112
|
+
- range:
|
113
|
+
start:
|
114
|
+
line: 11
|
115
|
+
character: 0
|
116
|
+
end:
|
117
|
+
line: 11
|
118
|
+
character: 21
|
119
|
+
severity: ERROR
|
120
|
+
message: |-
|
121
|
+
Cannot find compatible overloading of method `map` of type `::Array[::Integer]`
|
122
|
+
Method types:
|
123
|
+
def map: [U] () { (::Integer) -> U } -> ::Array[U]
|
124
|
+
| () -> ::Enumerator[::Integer, ::Array[untyped]]
|
125
|
+
code: Ruby::UnresolvedOverloading
|