steep 0.40.0 → 0.44.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -0
- data/Gemfile +1 -0
- data/bin/output_rebaseline.rb +15 -30
- data/bin/output_test.rb +23 -57
- data/lib/steep.rb +89 -15
- data/lib/steep/annotation_parser.rb +10 -2
- data/lib/steep/ast/types/class.rb +4 -0
- data/lib/steep/cli.rb +31 -6
- data/lib/steep/diagnostic/ruby.rb +13 -8
- data/lib/steep/diagnostic/signature.rb +152 -2
- data/lib/steep/drivers/annotations.rb +18 -36
- data/lib/steep/drivers/check.rb +140 -31
- data/lib/steep/drivers/diagnostic_printer.rb +20 -11
- data/lib/steep/drivers/langserver.rb +4 -8
- data/lib/steep/drivers/print_project.rb +10 -9
- data/lib/steep/drivers/stats.rb +135 -119
- data/lib/steep/drivers/utils/driver_helper.rb +35 -0
- data/lib/steep/drivers/utils/jobs_count.rb +9 -0
- data/lib/steep/drivers/validate.rb +29 -18
- data/lib/steep/drivers/watch.rb +55 -49
- data/lib/steep/drivers/worker.rb +11 -8
- data/lib/steep/expectations.rb +159 -0
- data/lib/steep/index/signature_symbol_provider.rb +23 -1
- data/lib/steep/index/source_index.rb +55 -5
- data/lib/steep/interface/block.rb +4 -0
- data/lib/steep/project.rb +0 -30
- data/lib/steep/project/dsl.rb +5 -3
- data/lib/steep/project/pattern.rb +56 -0
- data/lib/steep/project/target.rb +11 -227
- data/lib/steep/server/base_worker.rb +1 -3
- data/lib/steep/server/change_buffer.rb +63 -0
- data/lib/steep/server/interaction_worker.rb +72 -57
- data/lib/steep/server/master.rb +652 -234
- data/lib/steep/server/type_check_worker.rb +304 -0
- data/lib/steep/server/worker_process.rb +16 -11
- data/lib/steep/{project → services}/completion_provider.rb +5 -5
- data/lib/steep/services/content_change.rb +61 -0
- data/lib/steep/services/file_loader.rb +48 -0
- data/lib/steep/services/goto_service.rb +321 -0
- data/lib/steep/{project → services}/hover_content.rb +19 -20
- data/lib/steep/services/path_assignment.rb +27 -0
- data/lib/steep/services/signature_service.rb +403 -0
- data/lib/steep/services/stats_calculator.rb +69 -0
- data/lib/steep/services/type_check_service.rb +413 -0
- data/lib/steep/signature/validator.rb +187 -85
- data/lib/steep/source.rb +21 -18
- data/lib/steep/subtyping/check.rb +246 -45
- data/lib/steep/subtyping/constraints.rb +4 -4
- data/lib/steep/type_construction.rb +428 -193
- data/lib/steep/type_inference/block_params.rb +1 -1
- data/lib/steep/type_inference/context.rb +22 -0
- data/lib/steep/type_inference/local_variable_type_env.rb +26 -12
- data/lib/steep/type_inference/logic.rb +1 -1
- data/lib/steep/type_inference/logic_type_interpreter.rb +4 -4
- data/lib/steep/type_inference/type_env.rb +43 -17
- data/lib/steep/version.rb +1 -1
- data/smoke/alias/test_expectations.yml +96 -0
- data/smoke/and/test_expectations.yml +31 -0
- data/smoke/array/test_expectations.yml +103 -0
- data/smoke/block/test_expectations.yml +125 -0
- data/smoke/case/test_expectations.yml +47 -0
- data/smoke/class/test_expectations.yml +120 -0
- data/smoke/const/test_expectations.yml +129 -0
- data/smoke/diagnostics-rbs-duplicated/test_expectations.yml +13 -0
- data/smoke/diagnostics-rbs/Steepfile +7 -4
- data/smoke/diagnostics-rbs/test_expectations.yml +231 -0
- data/smoke/diagnostics-rbs/unknown-type-name-2.rbs +5 -0
- data/smoke/{broken → diagnostics-ruby-unsat}/Steepfile +0 -0
- data/smoke/diagnostics-ruby-unsat/a.rbs +3 -0
- data/smoke/diagnostics-ruby-unsat/test_expectations.yml +27 -0
- data/smoke/{diagnostics → diagnostics-ruby-unsat}/unsatisfiable_constraint.rb +0 -1
- data/smoke/diagnostics/a.rbs +0 -4
- data/smoke/diagnostics/test_expectations.yml +451 -0
- data/smoke/dstr/test_expectations.yml +13 -0
- data/smoke/ensure/test_expectations.yml +62 -0
- data/smoke/enumerator/test_expectations.yml +135 -0
- 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/test_expectations.yml +81 -0
- data/smoke/hello/test_expectations.yml +25 -0
- data/smoke/if/test_expectations.yml +34 -0
- data/smoke/implements/b.rb +13 -0
- data/smoke/implements/b.rbs +12 -0
- data/smoke/implements/test_expectations.yml +23 -0
- data/smoke/initialize/test_expectations.yml +1 -0
- data/smoke/integer/test_expectations.yml +101 -0
- data/smoke/interface/test_expectations.yml +23 -0
- data/smoke/kwbegin/test_expectations.yml +17 -0
- data/smoke/lambda/test_expectations.yml +39 -0
- data/smoke/literal/test_expectations.yml +106 -0
- data/smoke/map/test_expectations.yml +1 -0
- data/smoke/method/test_expectations.yml +90 -0
- data/smoke/module/test_expectations.yml +75 -0
- data/smoke/regexp/test_expectations.yml +615 -0
- data/smoke/regression/issue_328.rb +1 -0
- data/smoke/regression/issue_328.rbs +0 -0
- data/smoke/regression/issue_332.rb +11 -0
- data/smoke/regression/issue_332.rbs +19 -0
- data/smoke/regression/issue_372.rb +8 -0
- data/smoke/regression/issue_372.rbs +4 -0
- data/smoke/regression/masgn.rb +4 -0
- data/smoke/regression/test_expectations.yml +60 -0
- data/smoke/regression/thread.rb +7 -0
- data/smoke/rescue/test_expectations.yml +79 -0
- data/smoke/self/test_expectations.yml +23 -0
- data/smoke/skip/test_expectations.yml +23 -0
- data/smoke/stdout/test_expectations.yml +1 -0
- data/smoke/super/test_expectations.yml +69 -0
- data/smoke/toplevel/test_expectations.yml +15 -0
- data/smoke/tsort/Steepfile +2 -0
- data/smoke/tsort/test_expectations.yml +63 -0
- 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/test_expectations.yml +68 -0
- data/steep.gemspec +4 -3
- metadata +127 -80
- data/lib/steep/project/file_loader.rb +0 -68
- data/lib/steep/project/signature_file.rb +0 -39
- data/lib/steep/project/source_file.rb +0 -129
- data/lib/steep/project/stats_calculator.rb +0 -80
- data/lib/steep/server/code_worker.rb +0 -150
- data/lib/steep/server/signature_worker.rb +0 -157
- data/lib/steep/server/utils.rb +0 -69
- data/smoke/alias/test.yaml +0 -73
- data/smoke/and/test.yaml +0 -24
- data/smoke/array/test.yaml +0 -80
- data/smoke/block/test.yaml +0 -96
- data/smoke/broken/broken.rb +0 -0
- data/smoke/broken/broken.rbs +0 -0
- data/smoke/broken/test.yaml +0 -6
- data/smoke/case/test.yaml +0 -36
- data/smoke/class/test.yaml +0 -89
- data/smoke/const/test.yaml +0 -96
- data/smoke/diagnostics-rbs-duplicated/test.yaml +0 -10
- data/smoke/diagnostics-rbs/test.yaml +0 -142
- data/smoke/diagnostics/test.yaml +0 -333
- data/smoke/dstr/test.yaml +0 -10
- data/smoke/ensure/test.yaml +0 -47
- data/smoke/enumerator/test.yaml +0 -100
- data/smoke/extension/test.yaml +0 -50
- data/smoke/hash/test.yaml +0 -62
- data/smoke/hello/test.yaml +0 -18
- data/smoke/if/test.yaml +0 -27
- data/smoke/implements/test.yaml +0 -16
- data/smoke/initialize/test.yaml +0 -4
- data/smoke/integer/test.yaml +0 -66
- data/smoke/interface/test.yaml +0 -16
- data/smoke/kwbegin/test.yaml +0 -14
- data/smoke/lambda/test.yaml +0 -28
- data/smoke/literal/test.yaml +0 -79
- data/smoke/map/test.yaml +0 -4
- data/smoke/method/test.yaml +0 -71
- data/smoke/module/test.yaml +0 -51
- data/smoke/regexp/test.yaml +0 -372
- data/smoke/regression/test.yaml +0 -38
- data/smoke/rescue/test.yaml +0 -60
- data/smoke/self/test.yaml +0 -16
- data/smoke/skip/test.yaml +0 -16
- data/smoke/stdout/test.yaml +0 -4
- data/smoke/super/test.yaml +0 -52
- data/smoke/toplevel/test.yaml +0 -12
- data/smoke/tsort/test.yaml +0 -32
- data/smoke/type_case/test.yaml +0 -33
- data/smoke/yield/test.yaml +0 -49
@@ -1,157 +0,0 @@
|
|
1
|
-
module Steep
|
2
|
-
module Server
|
3
|
-
class SignatureWorker < BaseWorker
|
4
|
-
attr_reader :queue
|
5
|
-
attr_reader :last_target_validated_at
|
6
|
-
|
7
|
-
def initialize(project:, reader:, writer:, queue: Queue.new)
|
8
|
-
super(project: project, reader: reader, writer: writer)
|
9
|
-
|
10
|
-
@queue = queue
|
11
|
-
@last_target_validated_at = {}
|
12
|
-
end
|
13
|
-
|
14
|
-
def validate_signature_if_required(request)
|
15
|
-
path = source_path(URI.parse(request[:params][:textDocument][:uri]))
|
16
|
-
|
17
|
-
project.targets.each do |target|
|
18
|
-
if target.signature_file?(path)
|
19
|
-
enqueue_target target: target, timestamp: Time.now
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def enqueue_target(target:, timestamp:)
|
25
|
-
Steep.logger.debug "queueing target #{target.name}@#{timestamp}"
|
26
|
-
last_target_validated_at[target] = timestamp
|
27
|
-
queue << [:validate, [target, timestamp]]
|
28
|
-
end
|
29
|
-
|
30
|
-
def enqueue_symbol(id:, query:)
|
31
|
-
Steep.logger.debug "queueing symbol #{query} (#{id})"
|
32
|
-
queue << [:symbol, [id, query]]
|
33
|
-
end
|
34
|
-
|
35
|
-
def handle_request(request)
|
36
|
-
case request[:method]
|
37
|
-
when "initialize"
|
38
|
-
# Start type checking.
|
39
|
-
project.targets.each do |target|
|
40
|
-
enqueue_target(target: target, timestamp: Time.now)
|
41
|
-
end
|
42
|
-
|
43
|
-
writer.write({ id: request[:id], result: nil})
|
44
|
-
|
45
|
-
when "textDocument/didChange"
|
46
|
-
update_source(request)
|
47
|
-
validate_signature_if_required(request)
|
48
|
-
when "workspace/symbol"
|
49
|
-
enqueue_symbol(query: request[:params][:query], id: request[:id])
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def validate_signature(target, timestamp:)
|
54
|
-
Steep.logger.info "Starting signature validation: #{target.name} (#{timestamp})..."
|
55
|
-
|
56
|
-
target.type_check(target_sources: [], validate_signatures: true)
|
57
|
-
|
58
|
-
Steep.logger.info "Finished signature validation: #{target.name} (#{timestamp})"
|
59
|
-
|
60
|
-
diagnostics = case status = target.status
|
61
|
-
when Project::Target::SignatureErrorStatus
|
62
|
-
error_hash = status.errors.group_by {|error| error.location.buffer.name }
|
63
|
-
formatter = Diagnostic::LSPFormatter.new
|
64
|
-
|
65
|
-
target.signature_files.each_key.with_object({}) do |path, hash|
|
66
|
-
errors = error_hash[path] || []
|
67
|
-
hash[path] = errors.map {|error| formatter.format(error) }
|
68
|
-
end
|
69
|
-
when Project::Target::TypeCheckStatus
|
70
|
-
target.signature_files.each_key.with_object({}) do |path, hash|
|
71
|
-
hash[path] = []
|
72
|
-
end
|
73
|
-
else
|
74
|
-
Steep.logger.info "Unexpected target status: #{status.class}"
|
75
|
-
{}
|
76
|
-
end
|
77
|
-
|
78
|
-
diagnostics.each do |path, diags|
|
79
|
-
writer.write(
|
80
|
-
method: :"textDocument/publishDiagnostics",
|
81
|
-
params: LSP::Interface::PublishDiagnosticsParams.new(
|
82
|
-
uri: URI.parse(project.absolute_path(path).to_s).tap {|uri| uri.scheme = "file"},
|
83
|
-
diagnostics: diags
|
84
|
-
)
|
85
|
-
)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def active_job?(target, timestamp)
|
90
|
-
if last_target_validated_at[target] == timestamp
|
91
|
-
sleep 0.1
|
92
|
-
last_target_validated_at[target] == timestamp
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def handle_workspace_symbol(query:, id:)
|
97
|
-
provider = Index::SignatureSymbolProvider.new()
|
98
|
-
|
99
|
-
project.targets.each do |target|
|
100
|
-
case target.status
|
101
|
-
when Project::Target::TypeCheckStatus
|
102
|
-
index = Index::RBSIndex.new()
|
103
|
-
|
104
|
-
builder = Index::RBSIndex::Builder.new(index: index)
|
105
|
-
builder.env(target.status.environment)
|
106
|
-
|
107
|
-
provider.indexes << index
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
symbols = provider.query_symbol(query)
|
112
|
-
|
113
|
-
result = symbols.map do |symbol|
|
114
|
-
{
|
115
|
-
name: symbol.name.to_s,
|
116
|
-
kind: symbol.kind,
|
117
|
-
deprecated: false,
|
118
|
-
containerName: symbol.container_name.to_s,
|
119
|
-
location: {
|
120
|
-
uri: URI.parse(project.absolute_path(symbol.location.buffer.name).to_s),
|
121
|
-
range: {
|
122
|
-
start: LSP::Interface::Position.new(
|
123
|
-
line: symbol.location.start_line - 1,
|
124
|
-
character: symbol.location.start_column,
|
125
|
-
),
|
126
|
-
end: LSP::Interface::Position.new(
|
127
|
-
line: symbol.location.end_line - 1,
|
128
|
-
character: symbol.location.end_column
|
129
|
-
)
|
130
|
-
}
|
131
|
-
}
|
132
|
-
}
|
133
|
-
end
|
134
|
-
|
135
|
-
writer.write(id: id, result: result)
|
136
|
-
end
|
137
|
-
|
138
|
-
def handle_job(job)
|
139
|
-
action, data = job
|
140
|
-
|
141
|
-
case action
|
142
|
-
when :validate
|
143
|
-
target, timestamp = data
|
144
|
-
|
145
|
-
if active_job?(target, timestamp)
|
146
|
-
validate_signature(target, timestamp: timestamp)
|
147
|
-
else
|
148
|
-
Steep.logger.info "Skipping signature validation: #{target.name}, queued timestamp=#{timestamp}, latest timestamp=#{last_target_validated_at[target]}"
|
149
|
-
end
|
150
|
-
when :symbol
|
151
|
-
id, query = data
|
152
|
-
handle_workspace_symbol(query: query, id: id)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
data/lib/steep/server/utils.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
module Steep
|
2
|
-
module Server
|
3
|
-
module Utils
|
4
|
-
LSP = LanguageServer::Protocol
|
5
|
-
|
6
|
-
def source_path(uri)
|
7
|
-
project.relative_path(Pathname(uri.path))
|
8
|
-
end
|
9
|
-
|
10
|
-
def apply_change(change, text)
|
11
|
-
range = change[:range]
|
12
|
-
|
13
|
-
if range
|
14
|
-
text = text.dup
|
15
|
-
|
16
|
-
buf = RBS::Buffer.new(name: :_, content: text)
|
17
|
-
|
18
|
-
start_pos = buf.loc_to_pos(range[:start].yield_self {|pos| [pos[:line]+1, pos[:character]] })
|
19
|
-
end_pos = buf.loc_to_pos(range[:end].yield_self {|pos| [pos[:line]+1, pos[:character]] })
|
20
|
-
|
21
|
-
text[start_pos...end_pos] = change[:text]
|
22
|
-
text
|
23
|
-
else
|
24
|
-
change[:text]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def update_source(request)
|
29
|
-
path = source_path(URI.parse(request[:params][:textDocument][:uri]))
|
30
|
-
version = request[:params][:textDocument][:version]
|
31
|
-
Steep.logger.info { "Updating source: path=#{path}, version=#{version}..." }
|
32
|
-
|
33
|
-
changes = request[:params][:contentChanges]
|
34
|
-
|
35
|
-
source_target, signature_targets = project.targets_for_path(path)
|
36
|
-
|
37
|
-
if source_target
|
38
|
-
changes.each do |change|
|
39
|
-
case
|
40
|
-
when source_target.source_file?(path)
|
41
|
-
Steep.logger.debug { "Updating source in #{source_target.name}: path=#{path}" }
|
42
|
-
source_target.update_source(path) {|text| apply_change(change, text) }
|
43
|
-
when source_target.possible_source_file?(path)
|
44
|
-
Steep.logger.debug { "Adding source to #{source_target.name}: path=#{path}" }
|
45
|
-
source_target.add_source(path, change[:text])
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
signature_targets.each do |target|
|
51
|
-
changes.each do |change|
|
52
|
-
case
|
53
|
-
when target.signature_file?(path)
|
54
|
-
Steep.logger.debug { "Updating signature in #{target.name}: path=#{path}" }
|
55
|
-
target.update_signature(path) {|text| apply_change(change, text) }
|
56
|
-
when target.possible_signature_file?(path)
|
57
|
-
Steep.logger.debug { "Adding signature to #{target.name}: path=#{path}" }
|
58
|
-
target.add_signature(path, change[:text])
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
if block_given?
|
64
|
-
yield path, version
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
data/smoke/alias/test.yaml
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
---
|
2
|
-
test:
|
3
|
-
a.rb:
|
4
|
-
diagnostics:
|
5
|
-
- |
|
6
|
-
a.rb:4:0: [error] Cannot find compatible overloading of method `+` of type `(::String | ::Integer)`
|
7
|
-
│ Method types:
|
8
|
-
│ def +: ((::string & ::Integer)) -> (::String | ::Integer)
|
9
|
-
│ | ((::string & ::Float)) -> (::String | ::Float)
|
10
|
-
│ | ((::string & ::Rational)) -> (::String | ::Rational)
|
11
|
-
│ | ((::string & ::Complex)) -> (::String | ::Complex)
|
12
|
-
│
|
13
|
-
│ Diagnostic ID: Ruby::UnresolvedOverloading
|
14
|
-
│
|
15
|
-
└ x + 123
|
16
|
-
~~~~~~~
|
17
|
-
- |
|
18
|
-
a.rb:13:2: [error] Cannot assign a value of type `::String` to a variable of type `::Symbol`
|
19
|
-
│ ::String <: ::Symbol
|
20
|
-
│ ::Object <: ::Symbol
|
21
|
-
│ ::BasicObject <: ::Symbol
|
22
|
-
│
|
23
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
24
|
-
│
|
25
|
-
└ z = x
|
26
|
-
~~~~~
|
27
|
-
- |
|
28
|
-
a.rb:15:2: [error] Cannot assign a value of type `::Integer` to a variable of type `::Symbol`
|
29
|
-
│ ::Integer <: ::Symbol
|
30
|
-
│ ::Numeric <: ::Symbol
|
31
|
-
│ ::Object <: ::Symbol
|
32
|
-
│ ::BasicObject <: ::Symbol
|
33
|
-
│
|
34
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
35
|
-
│
|
36
|
-
└ z = x
|
37
|
-
~~~~~
|
38
|
-
b.rb:
|
39
|
-
diagnostics:
|
40
|
-
- |
|
41
|
-
b.rb:6:0: [error] Cannot assign a value of type `::String` to a variable of type `::Integer`
|
42
|
-
│ ::String <: ::Integer
|
43
|
-
│ ::Object <: ::Integer
|
44
|
-
│ ::BasicObject <: ::Integer
|
45
|
-
│
|
46
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
47
|
-
│
|
48
|
-
└ x = a[0]
|
49
|
-
~~~~~~~~
|
50
|
-
c.rb:
|
51
|
-
diagnostics:
|
52
|
-
- |
|
53
|
-
c.rb:3:0: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
|
54
|
-
│ ::Integer <: ::String
|
55
|
-
│ ::Numeric <: ::String
|
56
|
-
│ ::Object <: ::String
|
57
|
-
│ ::BasicObject <: ::String
|
58
|
-
│
|
59
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
60
|
-
│
|
61
|
-
└ x = AliasMethodArg.new.foo(:foo)
|
62
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
63
|
-
- |
|
64
|
-
c.rb:8:0: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
|
65
|
-
│ ::Integer <: ::String
|
66
|
-
│ ::Numeric <: ::String
|
67
|
-
│ ::Object <: ::String
|
68
|
-
│ ::BasicObject <: ::String
|
69
|
-
│
|
70
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
71
|
-
│
|
72
|
-
└ x = AliasMethodArg.new.foo(name)
|
73
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
data/smoke/and/test.yaml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
test:
|
3
|
-
a.rb:
|
4
|
-
diagnostics:
|
5
|
-
- |
|
6
|
-
a.rb:6:0: [error] Cannot assign a value of type `(::String | nil)` to a variable of type `::String`
|
7
|
-
│ (::String | nil) <: ::String
|
8
|
-
│ nil <: ::String
|
9
|
-
│
|
10
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
11
|
-
│
|
12
|
-
└ b = a && a.to_str
|
13
|
-
~~~~~~~~~~~~~~~~~
|
14
|
-
- |
|
15
|
-
a.rb:8:0: [error] Cannot assign a value of type `(::String | nil)` to a variable of type `::Integer`
|
16
|
-
│ (::String | nil) <: ::Integer
|
17
|
-
│ ::String <: ::Integer
|
18
|
-
│ ::Object <: ::Integer
|
19
|
-
│ ::BasicObject <: ::Integer
|
20
|
-
│
|
21
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
22
|
-
│
|
23
|
-
└ c = a && a.to_str
|
24
|
-
~~~~~~~~~~~~~~~~~
|
data/smoke/array/test.yaml
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
---
|
2
|
-
test:
|
3
|
-
a.rb:
|
4
|
-
diagnostics:
|
5
|
-
- |
|
6
|
-
a.rb:6:0: [error] Cannot find compatible overloading of method `[]=` of type `::Array[::Integer]`
|
7
|
-
│ Method types:
|
8
|
-
│ def []=: (::int, ::Integer) -> ::Integer
|
9
|
-
│ | (::int, ::int, ::Integer) -> ::Integer
|
10
|
-
│ | (::int, ::int, ::Array[::Integer]) -> ::Array[::Integer]
|
11
|
-
│ | (::int, ::int, nil) -> nil
|
12
|
-
│ | (::Range[::Integer], ::Integer) -> ::Integer
|
13
|
-
│ | (::Range[::Integer], ::Array[::Integer]) -> ::Array[::Integer]
|
14
|
-
│ | (::Range[::Integer], nil) -> nil
|
15
|
-
│
|
16
|
-
│ Diagnostic ID: Ruby::UnresolvedOverloading
|
17
|
-
│
|
18
|
-
└ a[2] = "foo"
|
19
|
-
~~~~~~~~~~~~
|
20
|
-
- |
|
21
|
-
a.rb:12:0: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
|
22
|
-
│ ::Integer <: ::String
|
23
|
-
│ ::Numeric <: ::String
|
24
|
-
│ ::Object <: ::String
|
25
|
-
│ ::BasicObject <: ::String
|
26
|
-
│
|
27
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
28
|
-
│
|
29
|
-
└ s = a[1]
|
30
|
-
~~~~~~~~
|
31
|
-
- |
|
32
|
-
a.rb:18:0: [error] Cannot assign a value of type `::String` to a variable of type `::Integer`
|
33
|
-
│ ::String <: ::Integer
|
34
|
-
│ ::Object <: ::Integer
|
35
|
-
│ ::BasicObject <: ::Integer
|
36
|
-
│
|
37
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
38
|
-
│
|
39
|
-
└ i = b[1]
|
40
|
-
~~~~~~~~
|
41
|
-
b.rb:
|
42
|
-
diagnostics:
|
43
|
-
- |
|
44
|
-
b.rb:11:0: [error] Cannot assign a value of type `::Array[::Integer]` to a variable of type `::Array[::String]`
|
45
|
-
│ ::Array[::Integer] <: ::Array[::String]
|
46
|
-
│ ::Integer <: ::String
|
47
|
-
│ ::Numeric <: ::String
|
48
|
-
│ ::Object <: ::String
|
49
|
-
│ ::BasicObject <: ::String
|
50
|
-
│
|
51
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
52
|
-
│
|
53
|
-
└ b = a
|
54
|
-
~~~~~
|
55
|
-
- |
|
56
|
-
b.rb:12:0: [error] Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Integer]`
|
57
|
-
│ ::Array[::String] <: ::Array[::Integer]
|
58
|
-
│ ::String <: ::Integer
|
59
|
-
│ ::Object <: ::Integer
|
60
|
-
│ ::BasicObject <: ::Integer
|
61
|
-
│
|
62
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
63
|
-
│
|
64
|
-
└ a = b
|
65
|
-
~~~~~
|
66
|
-
c.rb:
|
67
|
-
diagnostics:
|
68
|
-
- |
|
69
|
-
c.rb:6:0: [error] Cannot assign a value of type `::Array[::Integer]` to a variable of type `::Array[(::String | nil)]`
|
70
|
-
│ ::Array[::Integer] <: ::Array[(::String | nil)]
|
71
|
-
│ ::Integer <: (::String | nil)
|
72
|
-
│ ::Integer <: ::String
|
73
|
-
│ ::Numeric <: ::String
|
74
|
-
│ ::Object <: ::String
|
75
|
-
│ ::BasicObject <: ::String
|
76
|
-
│
|
77
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
78
|
-
│
|
79
|
-
└ x = [1]
|
80
|
-
~~~~~~~
|
data/smoke/block/test.yaml
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
---
|
2
|
-
test:
|
3
|
-
a.rb:
|
4
|
-
diagnostics:
|
5
|
-
- |
|
6
|
-
a.rb:8:0: [error] Cannot assign a value of type `::Integer` to a variable of type `::String`
|
7
|
-
│ ::Integer <: ::String
|
8
|
-
│ ::Numeric <: ::String
|
9
|
-
│ ::Object <: ::String
|
10
|
-
│ ::BasicObject <: ::String
|
11
|
-
│
|
12
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
13
|
-
│
|
14
|
-
└ s = a.foo
|
15
|
-
~~~~~~~~~
|
16
|
-
- |
|
17
|
-
a.rb:10:0: [error] Cannot assign a value of type `::String` to a variable of type `::Integer`
|
18
|
-
│ ::String <: ::Integer
|
19
|
-
│ ::Object <: ::Integer
|
20
|
-
│ ::BasicObject <: ::Integer
|
21
|
-
│
|
22
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
23
|
-
│
|
24
|
-
└ i = a.foo { nil }
|
25
|
-
~~~~~~~~~~~~~~~~~
|
26
|
-
b.rb:
|
27
|
-
diagnostics:
|
28
|
-
- |
|
29
|
-
b.rb:5:2: [error] Cannot break with a value of type `::Integer` because type `::Symbol` is assumed
|
30
|
-
│ ::Integer <: ::Symbol
|
31
|
-
│ ::Numeric <: ::Symbol
|
32
|
-
│ ::Object <: ::Symbol
|
33
|
-
│ ::BasicObject <: ::Symbol
|
34
|
-
│
|
35
|
-
│ Diagnostic ID: Ruby::BreakTypeMismatch
|
36
|
-
│
|
37
|
-
└ break 3
|
38
|
-
~~~~~~~
|
39
|
-
- |
|
40
|
-
b.rb:10:0: [error] Cannot assign a value of type `(::Integer | ::Symbol)` to a variable of type `::String`
|
41
|
-
│ (::Integer | ::Symbol) <: ::String
|
42
|
-
│ ::Integer <: ::String
|
43
|
-
│ ::Numeric <: ::String
|
44
|
-
│ ::Object <: ::String
|
45
|
-
│ ::BasicObject <: ::String
|
46
|
-
│
|
47
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
48
|
-
│
|
49
|
-
└ s = a.bar do |x|
|
50
|
-
~~~~~~~~~~~~~~~~
|
51
|
-
c.rb:
|
52
|
-
diagnostics: []
|
53
|
-
d.rb:
|
54
|
-
diagnostics:
|
55
|
-
- |
|
56
|
-
d.rb:6:0: [error] Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Float]`
|
57
|
-
│ ::Array[::String] <: ::Array[::Float]
|
58
|
-
│ ::String <: ::Float
|
59
|
-
│ ::Object <: ::Float
|
60
|
-
│ ::BasicObject <: ::Float
|
61
|
-
│
|
62
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
63
|
-
│
|
64
|
-
└ b = [1,2,3].map(&a)
|
65
|
-
~~~~~~~~~~~~~~~~~~~
|
66
|
-
- |
|
67
|
-
d.rb:8:0: [error] Cannot assign a value of type `::Array[::String]` to a variable of type `::Array[::Float]`
|
68
|
-
│ ::Array[::String] <: ::Array[::Float]
|
69
|
-
│ ::String <: ::Float
|
70
|
-
│ ::Object <: ::Float
|
71
|
-
│ ::BasicObject <: ::Float
|
72
|
-
│
|
73
|
-
│ Diagnostic ID: Ruby::IncompatibleAssignment
|
74
|
-
│
|
75
|
-
└ b = [1,2,3].map(&:to_s)
|
76
|
-
~~~~~~~~~~~~~~~~~~~~~~~
|
77
|
-
- |
|
78
|
-
d.rb:10:0: [error] Cannot find compatible overloading of method `map` of type `::Array[::Integer]`
|
79
|
-
│ Method types:
|
80
|
-
│ def map: [U] () { (::Integer) -> U } -> ::Array[U]
|
81
|
-
│ | () -> ::Enumerator[::Integer, ::Array[untyped]]
|
82
|
-
│
|
83
|
-
│ Diagnostic ID: Ruby::UnresolvedOverloading
|
84
|
-
│
|
85
|
-
└ [1,2,3].map(&:no_such_method)
|
86
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
87
|
-
- |
|
88
|
-
d.rb:11:0: [error] Cannot find compatible overloading of method `map` of type `::Array[::Integer]`
|
89
|
-
│ Method types:
|
90
|
-
│ def map: [U] () { (::Integer) -> U } -> ::Array[U]
|
91
|
-
│ | () -> ::Enumerator[::Integer, ::Array[untyped]]
|
92
|
-
│
|
93
|
-
│ Diagnostic ID: Ruby::UnresolvedOverloading
|
94
|
-
│
|
95
|
-
└ [1,2,3].map(&:divmod)
|
96
|
-
~~~~~~~~~~~~~~~~~~~~~
|