steep 0.39.0 → 0.40.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 +6 -0
- data/Rakefile +5 -2
- data/bin/output_rebaseline.rb +49 -0
- data/bin/output_test.rb +93 -0
- data/lib/steep.rb +8 -3
- data/lib/steep/cli.rb +1 -1
- data/lib/steep/diagnostic/helper.rb +17 -0
- data/lib/steep/diagnostic/lsp_formatter.rb +16 -0
- data/lib/steep/diagnostic/ruby.rb +623 -0
- data/lib/steep/diagnostic/signature.rb +224 -0
- data/lib/steep/drivers/annotations.rb +13 -6
- data/lib/steep/drivers/check.rb +83 -60
- data/lib/steep/drivers/diagnostic_printer.rb +94 -0
- data/lib/steep/drivers/stats.rb +125 -29
- data/lib/steep/drivers/trace_printer.rb +5 -1
- data/lib/steep/drivers/validate.rb +13 -6
- data/lib/steep/drivers/watch.rb +26 -9
- data/lib/steep/drivers/worker.rb +5 -0
- data/lib/steep/project/options.rb +4 -4
- data/lib/steep/project/signature_file.rb +8 -2
- data/lib/steep/project/stats_calculator.rb +80 -0
- data/lib/steep/project/target.rb +64 -53
- data/lib/steep/range_extension.rb +29 -0
- data/lib/steep/server/base_worker.rb +42 -4
- data/lib/steep/server/code_worker.rb +37 -24
- data/lib/steep/server/interaction_worker.rb +1 -0
- data/lib/steep/server/master.rb +268 -82
- data/lib/steep/server/signature_worker.rb +7 -59
- data/lib/steep/server/worker_process.rb +9 -9
- data/lib/steep/signature/validator.rb +33 -9
- data/lib/steep/type_construction.rb +276 -194
- 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.yaml +73 -0
- data/smoke/and/a.rb +0 -3
- data/smoke/and/test.yaml +24 -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.yaml +80 -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.yaml +96 -0
- data/smoke/broken/Steepfile +5 -0
- data/smoke/broken/broken.rb +0 -0
- data/smoke/broken/broken.rbs +0 -0
- data/smoke/broken/test.yaml +6 -0
- data/smoke/case/a.rb +0 -3
- data/smoke/case/test.yaml +36 -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.yaml +89 -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.yaml +96 -0
- data/smoke/diagnostics-rbs-duplicated/Steepfile +5 -0
- data/smoke/diagnostics-rbs-duplicated/a.rbs +5 -0
- data/smoke/diagnostics-rbs-duplicated/test.yaml +10 -0
- data/smoke/diagnostics-rbs/Steepfile +5 -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.yaml +142 -0
- data/smoke/diagnostics-rbs/unknown-method-alias.rbs +3 -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.yaml +333 -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.yaml +10 -0
- data/smoke/ensure/a.rb +0 -4
- data/smoke/ensure/test.yaml +47 -0
- data/smoke/enumerator/a.rb +0 -6
- data/smoke/enumerator/b.rb +0 -3
- data/smoke/enumerator/test.yaml +100 -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/test.yaml +50 -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.yaml +62 -0
- data/smoke/hello/hello.rb +0 -2
- data/smoke/hello/test.yaml +18 -0
- data/smoke/if/a.rb +0 -2
- data/smoke/if/test.yaml +27 -0
- data/smoke/implements/a.rb +0 -2
- data/smoke/implements/test.yaml +16 -0
- data/smoke/initialize/test.yaml +4 -0
- data/smoke/integer/a.rb +0 -7
- data/smoke/integer/test.yaml +66 -0
- data/smoke/interface/a.rb +0 -2
- data/smoke/interface/test.yaml +16 -0
- data/smoke/kwbegin/a.rb +0 -1
- data/smoke/kwbegin/test.yaml +14 -0
- data/smoke/lambda/a.rb +1 -4
- data/smoke/lambda/test.yaml +28 -0
- data/smoke/literal/a.rb +0 -5
- data/smoke/literal/b.rb +0 -2
- data/smoke/literal/test.yaml +79 -0
- data/smoke/map/test.yaml +4 -0
- data/smoke/method/a.rb +0 -5
- data/smoke/method/b.rb +0 -1
- data/smoke/method/test.yaml +71 -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.yaml +51 -0
- data/smoke/regexp/a.rb +0 -38
- data/smoke/regexp/b.rb +0 -26
- data/smoke/regexp/test.yaml +372 -0
- data/smoke/regression/set_divide.rb +0 -4
- data/smoke/regression/test.yaml +38 -0
- data/smoke/rescue/a.rb +0 -5
- data/smoke/rescue/test.yaml +60 -0
- data/smoke/self/a.rb +0 -2
- data/smoke/self/test.yaml +16 -0
- data/smoke/skip/skip.rb +0 -2
- data/smoke/skip/test.yaml +16 -0
- data/smoke/stdout/test.yaml +4 -0
- data/smoke/super/a.rb +0 -4
- data/smoke/super/test.yaml +52 -0
- data/smoke/toplevel/a.rb +0 -1
- data/smoke/toplevel/test.yaml +12 -0
- data/smoke/tsort/a.rb +0 -3
- data/smoke/tsort/test.yaml +32 -0
- data/smoke/type_case/a.rb +0 -4
- data/smoke/type_case/test.yaml +33 -0
- data/smoke/yield/a.rb +0 -3
- data/smoke/yield/b.rb +6 -0
- data/smoke/yield/test.yaml +49 -0
- data/steep.gemspec +3 -3
- metadata +108 -17
- data/bin/smoke_runner.rb +0 -139
- data/lib/steep/drivers/signature_error_printer.rb +0 -25
- data/lib/steep/errors.rb +0 -594
- data/lib/steep/signature/errors.rb +0 -128
- data/lib/steep/type_assignability.rb +0 -367
@@ -0,0 +1 @@
|
|
1
|
+
[1].at(1) { 123 }
|
@@ -0,0 +1 @@
|
|
1
|
+
UnexpectedKeyword.new.foo(foo: 123, bar: :bar)
|
@@ -0,0 +1 @@
|
|
1
|
+
{ foo: :bar, **123 }
|
@@ -0,0 +1 @@
|
|
1
|
+
1 + ""
|
data/smoke/dstr/a.rb
CHANGED
data/smoke/ensure/a.rb
CHANGED
@@ -1,22 +1,18 @@
|
|
1
1
|
# @type var a: Integer
|
2
2
|
# @type var b: Integer
|
3
3
|
|
4
|
-
# !expects IncompatibleAssignment: lhs_type=::Integer, rhs_type=::String
|
5
4
|
a = begin
|
6
5
|
'foo'
|
7
6
|
ensure
|
8
|
-
# !expects IncompatibleAssignment: lhs_type=::Integer, rhs_type=::Symbol
|
9
7
|
b = :foo
|
10
8
|
1
|
11
9
|
end
|
12
10
|
|
13
11
|
# @type method foo: (String) -> String
|
14
12
|
|
15
|
-
# !expects MethodBodyTypeMismatch: method=foo, expected=::String, actual=::Integer
|
16
13
|
def foo(a)
|
17
14
|
10
|
18
15
|
ensure
|
19
|
-
# !expects* UnresolvedOverloading: receiver=::Integer, method_name=+,
|
20
16
|
1 + '1'
|
21
17
|
a
|
22
18
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
test:
|
3
|
+
a.rb:
|
4
|
+
diagnostics:
|
5
|
+
- |
|
6
|
+
a.rb:7:6: [error] Cannot assign a value of type `::Symbol` to a variable of type `::Integer`
|
7
|
+
│ ::Symbol <: ::Integer
|
8
|
+
│ ::Object <: ::Integer
|
9
|
+
│ ::BasicObject <: ::Integer
|
10
|
+
│
|
11
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
12
|
+
│
|
13
|
+
└ b = :foo
|
14
|
+
~~~~~~~~
|
15
|
+
- |
|
16
|
+
a.rb:4:0: [error] Cannot assign a value of type `::String` to a variable of type `::Integer`
|
17
|
+
│ ::String <: ::Integer
|
18
|
+
│ ::Object <: ::Integer
|
19
|
+
│ ::BasicObject <: ::Integer
|
20
|
+
│
|
21
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
22
|
+
│
|
23
|
+
└ a = begin
|
24
|
+
~~~~~~~~~
|
25
|
+
- |
|
26
|
+
a.rb:16:2: [error] Cannot find compatible overloading of method `+` of type `::Integer`
|
27
|
+
│ Method types:
|
28
|
+
│ def +: (::Integer) -> ::Integer
|
29
|
+
│ | (::Float) -> ::Float
|
30
|
+
│ | (::Rational) -> ::Rational
|
31
|
+
│ | (::Complex) -> ::Complex
|
32
|
+
│
|
33
|
+
│ Diagnostic ID: Ruby::UnresolvedOverloading
|
34
|
+
│
|
35
|
+
└ 1 + '1'
|
36
|
+
~~~~~~~
|
37
|
+
- |
|
38
|
+
a.rb:13:0: [error] Cannot allow method body have type `::Integer` because declared as type `::String`
|
39
|
+
│ ::Integer <: ::String
|
40
|
+
│ ::Numeric <: ::String
|
41
|
+
│ ::Object <: ::String
|
42
|
+
│ ::BasicObject <: ::String
|
43
|
+
│
|
44
|
+
│ Diagnostic ID: Ruby::MethodBodyTypeMismatch
|
45
|
+
│
|
46
|
+
└ def foo(a)
|
47
|
+
~~~~~~~~~~
|
data/smoke/enumerator/a.rb
CHANGED
@@ -2,18 +2,12 @@
|
|
2
2
|
|
3
3
|
a = [1]
|
4
4
|
|
5
|
-
# !expects IncompatibleAssignment: lhs_type=::Hash[::Symbol, ::String], rhs_type=::String
|
6
5
|
hash = a.each.with_object("") do |x, y|
|
7
|
-
# !expects IncompatibleAssignment: lhs_type=::Hash[::Symbol, ::String], rhs_type=::Integer
|
8
6
|
hash = x
|
9
|
-
# !expects IncompatibleAssignment: lhs_type=::Hash[::Symbol, ::String], rhs_type=::String
|
10
7
|
hash = y
|
11
8
|
end
|
12
9
|
|
13
|
-
# !expects IncompatibleAssignment: lhs_type=::Hash[::Symbol, ::String], rhs_type=::Array[::Integer]
|
14
10
|
hash = a.each.with_index do |x, y|
|
15
|
-
# !expects IncompatibleAssignment: lhs_type=::Hash[::Symbol, ::String], rhs_type=::Integer
|
16
11
|
hash = x
|
17
|
-
# !expects IncompatibleAssignment: lhs_type=::Hash[::Symbol, ::String], rhs_type=::Integer
|
18
12
|
hash = y
|
19
13
|
end
|
data/smoke/enumerator/b.rb
CHANGED
@@ -3,20 +3,17 @@
|
|
3
3
|
|
4
4
|
a = [1]
|
5
5
|
|
6
|
-
# !expects* UnresolvedOverloading:
|
7
6
|
b = a.each.with_object([]) do |i, xs|
|
8
7
|
# @type var xs: String
|
9
8
|
xs << i.to_s
|
10
9
|
end
|
11
10
|
|
12
|
-
# !expects IncompatibleAssignment: lhs_type=::Array[::Integer], rhs_type=::Array[::String]
|
13
11
|
c = a.each.with_object([]) do |i, xs|
|
14
12
|
# @type var xs: Array[String]
|
15
13
|
xs << i.to_s
|
16
14
|
end
|
17
15
|
|
18
16
|
# @type var d: String
|
19
|
-
# !expects IncompatibleAssignment: lhs_type=::String, rhs_type=::Array[untyped]
|
20
17
|
d = a.each.with_object([]) do |i, xs|
|
21
18
|
xs << i.to_s
|
22
19
|
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
test:
|
3
|
+
a.rb:
|
4
|
+
diagnostics:
|
5
|
+
- |
|
6
|
+
a.rb:6:2: [error] Cannot assign a value of type `::Integer` to a variable of type `::Hash[::Symbol, ::String]`
|
7
|
+
│ ::Integer <: ::Hash[::Symbol, ::String]
|
8
|
+
│ ::Numeric <: ::Hash[::Symbol, ::String]
|
9
|
+
│ ::Object <: ::Hash[::Symbol, ::String]
|
10
|
+
│ ::BasicObject <: ::Hash[::Symbol, ::String]
|
11
|
+
│
|
12
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
13
|
+
│
|
14
|
+
└ hash = x
|
15
|
+
~~~~~~~~
|
16
|
+
- |
|
17
|
+
a.rb:7:2: [error] Cannot assign a value of type `::String` to a variable of type `::Hash[::Symbol, ::String]`
|
18
|
+
│ ::String <: ::Hash[::Symbol, ::String]
|
19
|
+
│ ::Object <: ::Hash[::Symbol, ::String]
|
20
|
+
│ ::BasicObject <: ::Hash[::Symbol, ::String]
|
21
|
+
│
|
22
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
23
|
+
│
|
24
|
+
└ hash = y
|
25
|
+
~~~~~~~~
|
26
|
+
- |
|
27
|
+
a.rb:5:0: [error] Cannot assign a value of type `::String` to a variable of type `::Hash[::Symbol, ::String]`
|
28
|
+
│ ::String <: ::Hash[::Symbol, ::String]
|
29
|
+
│ ::Object <: ::Hash[::Symbol, ::String]
|
30
|
+
│ ::BasicObject <: ::Hash[::Symbol, ::String]
|
31
|
+
│
|
32
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
33
|
+
│
|
34
|
+
└ hash = a.each.with_object("") do |x, y|
|
35
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
36
|
+
- |
|
37
|
+
a.rb:11:2: [error] Cannot assign a value of type `::Integer` to a variable of type `::Hash[::Symbol, ::String]`
|
38
|
+
│ ::Integer <: ::Hash[::Symbol, ::String]
|
39
|
+
│ ::Numeric <: ::Hash[::Symbol, ::String]
|
40
|
+
│ ::Object <: ::Hash[::Symbol, ::String]
|
41
|
+
│ ::BasicObject <: ::Hash[::Symbol, ::String]
|
42
|
+
│
|
43
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
44
|
+
│
|
45
|
+
└ hash = x
|
46
|
+
~~~~~~~~
|
47
|
+
- |
|
48
|
+
a.rb:12:2: [error] Cannot assign a value of type `::Integer` to a variable of type `::Hash[::Symbol, ::String]`
|
49
|
+
│ ::Integer <: ::Hash[::Symbol, ::String]
|
50
|
+
│ ::Numeric <: ::Hash[::Symbol, ::String]
|
51
|
+
│ ::Object <: ::Hash[::Symbol, ::String]
|
52
|
+
│ ::BasicObject <: ::Hash[::Symbol, ::String]
|
53
|
+
│
|
54
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
55
|
+
│
|
56
|
+
└ hash = y
|
57
|
+
~~~~~~~~
|
58
|
+
- |
|
59
|
+
a.rb:10:0: [error] Cannot assign a value of type `::Array[::Integer]` to a variable of type `::Hash[::Symbol, ::String]`
|
60
|
+
│ ::Array[::Integer] <: ::Hash[::Symbol, ::String]
|
61
|
+
│ ::Object <: ::Hash[::Symbol, ::String]
|
62
|
+
│ ::BasicObject <: ::Hash[::Symbol, ::String]
|
63
|
+
│
|
64
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
65
|
+
│
|
66
|
+
└ hash = a.each.with_index do |x, y|
|
67
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
68
|
+
b.rb:
|
69
|
+
diagnostics:
|
70
|
+
- |
|
71
|
+
b.rb:6:4: [error] Cannot find compatible overloading of method `with_object` of type `::Enumerator[::Integer, ::Array[::Integer]]`
|
72
|
+
│ Method types:
|
73
|
+
│ def with_object: [U] (U) { (::Integer, U) -> untyped } -> U
|
74
|
+
│ | [U] (U) -> ::Enumerator[[::Integer, U], ::Array[::Integer]]
|
75
|
+
│
|
76
|
+
│ Diagnostic ID: Ruby::UnresolvedOverloading
|
77
|
+
│
|
78
|
+
└ b = a.each.with_object([]) do |i, xs|
|
79
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
80
|
+
- |
|
81
|
+
b.rb:11:0: [error] Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Integer]`
|
82
|
+
│ ::Array[::String] <: ::Array[::Integer]
|
83
|
+
│ ::String <: ::Integer
|
84
|
+
│ ::Object <: ::Integer
|
85
|
+
│ ::BasicObject <: ::Integer
|
86
|
+
│
|
87
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
88
|
+
│
|
89
|
+
└ c = a.each.with_object([]) do |i, xs|
|
90
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
91
|
+
- |
|
92
|
+
b.rb:17:0: [error] Cannot assign a value of type `::Array[untyped]` to a variable of type `::String`
|
93
|
+
│ ::Array[untyped] <: ::String
|
94
|
+
│ ::Object <: ::String
|
95
|
+
│ ::BasicObject <: ::String
|
96
|
+
│
|
97
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
98
|
+
│
|
99
|
+
└ d = a.each.with_object([]) do |i, xs|
|
100
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
data/smoke/extension/a.rb
CHANGED
data/smoke/extension/b.rb
CHANGED
@@ -4,9 +4,7 @@ foo = (_ = nil)
|
|
4
4
|
# @type var integer: Integer
|
5
5
|
|
6
6
|
# Foo#f returns String because overridden
|
7
|
-
# !expects IncompatibleAssignment: lhs_type=::Integer, rhs_type=::String
|
8
7
|
integer = foo.f()
|
9
8
|
|
10
9
|
# String#f returns Object because Object(X)#f is used
|
11
|
-
# !expects IncompatibleAssignment: lhs_type=::Integer, rhs_type=::Object
|
12
10
|
integer = "".f()
|
data/smoke/extension/c.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
test:
|
3
|
+
a.rb:
|
4
|
+
diagnostics:
|
5
|
+
- |
|
6
|
+
a.rb:8:2: [error] Cannot assign a value of type `::Foo` to a variable of type `::String`
|
7
|
+
│ ::Foo <: ::String
|
8
|
+
│ ::Object <: ::String
|
9
|
+
│ ::BasicObject <: ::String
|
10
|
+
│
|
11
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
12
|
+
│
|
13
|
+
└ string = x
|
14
|
+
~~~~~~~~~~
|
15
|
+
b.rb:
|
16
|
+
diagnostics:
|
17
|
+
- |
|
18
|
+
b.rb:7:0: [error] Cannot assign a value of type `::String` to a variable of type `::Integer`
|
19
|
+
│ ::String <: ::Integer
|
20
|
+
│ ::Object <: ::Integer
|
21
|
+
│ ::BasicObject <: ::Integer
|
22
|
+
│
|
23
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
24
|
+
│
|
25
|
+
└ integer = foo.f()
|
26
|
+
~~~~~~~~~~~~~~~~~
|
27
|
+
- |
|
28
|
+
b.rb:10:0: [error] Cannot assign a value of type `::Object` to a variable of type `::Integer`
|
29
|
+
│ ::Object <: ::Integer
|
30
|
+
│ ::BasicObject <: ::Integer
|
31
|
+
│
|
32
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
33
|
+
│
|
34
|
+
└ integer = "".f()
|
35
|
+
~~~~~~~~~~~~~~~~
|
36
|
+
c.rb:
|
37
|
+
diagnostics:
|
38
|
+
- |
|
39
|
+
c.rb:6:4: [error] Cannot assign a value of type `::Object` to a variable of type `::String`
|
40
|
+
│ ::Object <: ::String
|
41
|
+
│ ::BasicObject <: ::String
|
42
|
+
│
|
43
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
44
|
+
│
|
45
|
+
└ string = super()
|
46
|
+
~~~~~~~~~~~~~~~~
|
47
|
+
d.rb:
|
48
|
+
diagnostics: []
|
49
|
+
e.rb:
|
50
|
+
diagnostics: []
|
data/smoke/hash/b.rb
CHANGED
data/smoke/hash/c.rb
CHANGED
@@ -2,14 +2,11 @@
|
|
2
2
|
params = _ = nil
|
3
3
|
|
4
4
|
id = params[:id]
|
5
|
-
# !expects NoMethodError: type=::Integer, method=abcdefg
|
6
5
|
id.abcdefg
|
7
6
|
|
8
7
|
name = params[:name]
|
9
|
-
# !expects NoMethodError: type=::String, method=abcdefg
|
10
8
|
name.abcdefg
|
11
9
|
|
12
|
-
# !expects NoMethodError: type=(::Integer | ::String), method=abcdefg
|
13
10
|
params[(_=nil) ? :id : :name].abcdefg
|
14
11
|
|
15
12
|
# @type var controller: Controller
|
data/smoke/hash/d.rb
CHANGED
data/smoke/hash/e.rb
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
test:
|
3
|
+
a.rb:
|
4
|
+
diagnostics: []
|
5
|
+
b.rb:
|
6
|
+
diagnostics:
|
7
|
+
- |
|
8
|
+
b.rb:6:0: [error] Cannot assign a value of type `::Hash[::Symbol, ::Integer]` to a variable of type `::Hash[::Symbol, (::String | nil)]`
|
9
|
+
│ ::Hash[::Symbol, ::Integer] <: ::Hash[::Symbol, (::String | nil)]
|
10
|
+
│ ::Integer <: (::String | nil)
|
11
|
+
│ ::Integer <: ::String
|
12
|
+
│ ::Numeric <: ::String
|
13
|
+
│ ::Object <: ::String
|
14
|
+
│ ::BasicObject <: ::String
|
15
|
+
│
|
16
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
17
|
+
│
|
18
|
+
└ x = { foo: 3 }
|
19
|
+
~~~~~~~~~~~~~~
|
20
|
+
c.rb:
|
21
|
+
diagnostics:
|
22
|
+
- |
|
23
|
+
c.rb:5:3: [error] Type `::Integer` does not have method `abcdefg`
|
24
|
+
│ Diagnostic ID: Ruby::NoMethod
|
25
|
+
│
|
26
|
+
└ id.abcdefg
|
27
|
+
~~~~~~~
|
28
|
+
- |
|
29
|
+
c.rb:8:5: [error] Type `::String` does not have method `abcdefg`
|
30
|
+
│ Diagnostic ID: Ruby::NoMethod
|
31
|
+
│
|
32
|
+
└ name.abcdefg
|
33
|
+
~~~~~~~
|
34
|
+
- |
|
35
|
+
c.rb:10:30: [error] Type `(::Integer | ::String)` does not have method `abcdefg`
|
36
|
+
│ Diagnostic ID: Ruby::NoMethod
|
37
|
+
│
|
38
|
+
└ params[(_=nil) ? :id : :name].abcdefg
|
39
|
+
~~~~~~~
|
40
|
+
d.rb:
|
41
|
+
diagnostics:
|
42
|
+
- |
|
43
|
+
d.rb:5:0: [error] Cannot assign a value of type `{ :email => ::String, :id => ::String, :name => ::String }` to a variable of type `{ :id => ::Integer, :name => ::String }`
|
44
|
+
│ { :email => ::String, :id => ::String, :name => ::String } <: { :id => ::Integer, :name => ::String }
|
45
|
+
│ ::String <: ::Integer
|
46
|
+
│ ::Object <: ::Integer
|
47
|
+
│ ::BasicObject <: ::Integer
|
48
|
+
│
|
49
|
+
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
50
|
+
│
|
51
|
+
└ params = { id: "30", name: "foo", email: "matsumoto@soutaro.com" }
|
52
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
53
|
+
e.rb:
|
54
|
+
diagnostics:
|
55
|
+
- |
|
56
|
+
e.rb:1:24: [error] Type `::Integer` does not have method `fffffffffffff`
|
57
|
+
│ Diagnostic ID: Ruby::NoMethod
|
58
|
+
│
|
59
|
+
└ Foo.new.get({ foo: 3 }).fffffffffffff
|
60
|
+
~~~~~~~~~~~~~
|
61
|
+
f.rb:
|
62
|
+
diagnostics: []
|