steep 1.8.0.pre.2 → 1.8.1
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/CHANGELOG.md +13 -0
- data/lib/steep/ast/builtin.rb +1 -0
- data/lib/steep/diagnostic/result_printer2.rb +48 -0
- data/lib/steep/diagnostic/ruby.rb +0 -45
- data/lib/steep/diagnostic/signature.rb +50 -4
- data/lib/steep/drivers/checkfile.rb +1 -0
- data/lib/steep/drivers/stats.rb +1 -1
- data/lib/steep/interface/builder.rb +22 -1
- data/lib/steep/server/master.rb +30 -20
- data/lib/steep/signature/validator.rb +42 -2
- data/lib/steep/type_construction.rb +2 -29
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +1 -0
- data/sample/sig/generics.rbs +15 -0
- data/steep.gemspec +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1619c69c7c85bbe5f0dffc4826aabf3e5a4ffa46c4eba61bab5a47ef29957d65
|
4
|
+
data.tar.gz: 25540890ecd3d6b7dfa2cd280c65da59b7ec65e520942fa09175908d3bfe124a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3715058e9bf76839a0072e3f5e01fbcce25913e0a23b03ae645644b8c88f0f5160264ce3aa989c391a3b81ee04c7104670f0c77ce3c8192a847909c6f4e8fa9d
|
7
|
+
data.tar.gz: 759e541a4444b02c2c86a8adbab2c606e667010c427146d4e74a61d422ddd55ce70ef30953d1ad94a7f1afea0a216f9e6198ffab71693b0bb7370819cc52707e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.8.1 (2024-10-08)
|
4
|
+
|
5
|
+
### Language server
|
6
|
+
|
7
|
+
* Skip sending response to `$/steep/typecheck` request from `steep langserver` ([#1268](https://github.com/soutaro/steep/pull/1268), backport [#1267](https://github.com/soutaro/steep/pull/1267))
|
8
|
+
|
9
|
+
## 1.8.0 (2024-09-30)
|
10
|
+
|
11
|
+
### Type checker core
|
12
|
+
|
13
|
+
* RBS validation ([#1239](https://github.com/soutaro/steep/pull/1239))
|
14
|
+
* Add special path for `Kernel#class` method ([#1229](https://github.com/soutaro/steep/pull/1229))
|
15
|
+
|
3
16
|
## 1.8.0.pre.2 (2024-09-18)
|
4
17
|
|
5
18
|
### Type checker core
|
data/lib/steep/ast/builtin.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Steep
|
2
|
+
module Diagnostic
|
3
|
+
module ResultPrinter2
|
4
|
+
def result_line(result)
|
5
|
+
case result
|
6
|
+
when Subtyping::Result::Failure
|
7
|
+
case result.error
|
8
|
+
when Subtyping::Result::Failure::UnknownPairError
|
9
|
+
nil
|
10
|
+
when Subtyping::Result::Failure::UnsatisfiedConstraints
|
11
|
+
"Unsatisfied constraints: #{result.relation}"
|
12
|
+
when Subtyping::Result::Failure::MethodMissingError
|
13
|
+
"Method `#{result.error.name}` is missing"
|
14
|
+
when Subtyping::Result::Failure::BlockMismatchError
|
15
|
+
"Incomaptible block: #{result.relation}"
|
16
|
+
when Subtyping::Result::Failure::ParameterMismatchError
|
17
|
+
if result.relation.params?
|
18
|
+
"Incompatible arity: #{result.relation.super_type} and #{result.relation.sub_type}"
|
19
|
+
else
|
20
|
+
"Incompatible arity: #{result.relation}"
|
21
|
+
end
|
22
|
+
when Subtyping::Result::Failure::PolyMethodSubtyping
|
23
|
+
"Unsupported polymorphic method comparison: #{result.relation}"
|
24
|
+
when Subtyping::Result::Failure::SelfBindingMismatch
|
25
|
+
"Incompatible block self type: #{result.relation}"
|
26
|
+
end
|
27
|
+
else
|
28
|
+
result.relation.to_s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def detail_lines
|
33
|
+
lines = StringIO.new.tap do |io|
|
34
|
+
failure_path = result.failure_path || []
|
35
|
+
failure_path.reverse_each.filter_map do |result|
|
36
|
+
result_line(result)
|
37
|
+
end.each.with_index(1) do |message, index|
|
38
|
+
io.puts "#{" " * (index)}#{message}"
|
39
|
+
end
|
40
|
+
end.string.chomp
|
41
|
+
|
42
|
+
unless lines.empty?
|
43
|
+
lines
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -61,51 +61,6 @@ module Steep
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
module ResultPrinter2
|
65
|
-
def result_line(result)
|
66
|
-
case result
|
67
|
-
when Subtyping::Result::Failure
|
68
|
-
case result.error
|
69
|
-
when Subtyping::Result::Failure::UnknownPairError
|
70
|
-
nil
|
71
|
-
when Subtyping::Result::Failure::UnsatisfiedConstraints
|
72
|
-
"Unsatisfied constraints: #{result.relation}"
|
73
|
-
when Subtyping::Result::Failure::MethodMissingError
|
74
|
-
"Method `#{result.error.name}` is missing"
|
75
|
-
when Subtyping::Result::Failure::BlockMismatchError
|
76
|
-
"Incomaptible block: #{result.relation}"
|
77
|
-
when Subtyping::Result::Failure::ParameterMismatchError
|
78
|
-
if result.relation.params?
|
79
|
-
"Incompatible arity: #{result.relation.super_type} and #{result.relation.sub_type}"
|
80
|
-
else
|
81
|
-
"Incompatible arity: #{result.relation}"
|
82
|
-
end
|
83
|
-
when Subtyping::Result::Failure::PolyMethodSubtyping
|
84
|
-
"Unsupported polymorphic method comparison: #{result.relation}"
|
85
|
-
when Subtyping::Result::Failure::SelfBindingMismatch
|
86
|
-
"Incompatible block self type: #{result.relation}"
|
87
|
-
end
|
88
|
-
else
|
89
|
-
result.relation.to_s
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def detail_lines
|
94
|
-
lines = StringIO.new.tap do |io|
|
95
|
-
failure_path = result.failure_path || []
|
96
|
-
failure_path.reverse_each.filter_map do |result|
|
97
|
-
result_line(result)
|
98
|
-
end.each.with_index(1) do |message, index|
|
99
|
-
io.puts "#{" " * (index)}#{message}"
|
100
|
-
end
|
101
|
-
end.string.chomp
|
102
|
-
|
103
|
-
unless lines.empty?
|
104
|
-
lines
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
64
|
class IncompatibleAssignment < Base
|
110
65
|
attr_reader :lhs_type
|
111
66
|
attr_reader :rhs_type
|
@@ -105,12 +105,16 @@ module Steep
|
|
105
105
|
attr_reader :type_name
|
106
106
|
attr_reader :type_arg
|
107
107
|
attr_reader :type_param
|
108
|
+
attr_reader :result
|
108
109
|
|
109
|
-
|
110
|
+
include ResultPrinter2
|
111
|
+
|
112
|
+
def initialize(type_name:, type_arg:, type_param:, result:, location:)
|
110
113
|
super(location: location)
|
111
114
|
@type_name = type_name
|
112
115
|
@type_arg = type_arg
|
113
116
|
@type_param = type_param
|
117
|
+
@result = result
|
114
118
|
end
|
115
119
|
|
116
120
|
def header_line
|
@@ -248,14 +252,20 @@ module Steep
|
|
248
252
|
class ModuleSelfTypeError < Base
|
249
253
|
attr_reader :name
|
250
254
|
attr_reader :ancestor
|
251
|
-
attr_reader :
|
255
|
+
attr_reader :result
|
256
|
+
|
257
|
+
include ResultPrinter2
|
252
258
|
|
253
|
-
def initialize(name:, ancestor:,
|
259
|
+
def initialize(name:, ancestor:, result:, location:)
|
254
260
|
super(location: location)
|
255
261
|
|
256
262
|
@name = name
|
257
263
|
@ancestor = ancestor
|
258
|
-
@
|
264
|
+
@result = result
|
265
|
+
end
|
266
|
+
|
267
|
+
def relation
|
268
|
+
result.relation
|
259
269
|
end
|
260
270
|
|
261
271
|
def header_line
|
@@ -417,6 +427,40 @@ module Steep
|
|
417
427
|
end
|
418
428
|
end
|
419
429
|
|
430
|
+
class TypeParamDefaultReferenceError < Base
|
431
|
+
attr_reader :type_param
|
432
|
+
|
433
|
+
def initialize(type_param, location:)
|
434
|
+
super(location: location)
|
435
|
+
@type_param = type_param
|
436
|
+
end
|
437
|
+
|
438
|
+
def header_line
|
439
|
+
"The default type of `#{type_param.name}` cannot depend on optional type parameters"
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
class UnsatisfiableGenericsDefaultType < Base
|
444
|
+
attr_reader :param_name, :result
|
445
|
+
|
446
|
+
include ResultPrinter2
|
447
|
+
|
448
|
+
def initialize(param_name, result, location:)
|
449
|
+
super(location: location)
|
450
|
+
@param_name = param_name
|
451
|
+
@result = result
|
452
|
+
end
|
453
|
+
|
454
|
+
def relation
|
455
|
+
result.relation
|
456
|
+
end
|
457
|
+
|
458
|
+
def header_line
|
459
|
+
"The default type of `#{param_name}` doesn't satisfy upper bound constarint: #{relation}"
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
|
420
464
|
def self.from_rbs_error(error, factory:)
|
421
465
|
case error
|
422
466
|
when RBS::ParsingError
|
@@ -515,6 +559,8 @@ module Steep
|
|
515
559
|
Diagnostic::Signature::InconsistentClassModuleAliasError.new(decl: error.alias_entry.decl)
|
516
560
|
when RBS::CyclicClassAliasDefinitionError
|
517
561
|
Diagnostic::Signature::CyclicClassAliasDefinitionError.new(decl: error.alias_entry.decl)
|
562
|
+
when RBS::TypeParamDefaultReferenceError
|
563
|
+
Diagnostic::Signature::TypeParamDefaultReferenceError.new(error.type_param, location: error.location)
|
518
564
|
else
|
519
565
|
raise error
|
520
566
|
end
|
@@ -165,6 +165,7 @@ module Steep
|
|
165
165
|
request.signature_paths << project.absolute_path(path)
|
166
166
|
end
|
167
167
|
|
168
|
+
request.needs_response = true
|
168
169
|
master.start_type_check(request: request, last_request: nil, report_progress_threshold: 0)
|
169
170
|
|
170
171
|
Steep.logger.info { "Starting type checking: #{request_guid}" }
|
data/lib/steep/drivers/stats.rb
CHANGED
@@ -162,7 +162,7 @@ module Steep
|
|
162
162
|
master.job_queue << -> do
|
163
163
|
Steep.logger.info { "Type checking for stats..." }
|
164
164
|
progress = master.work_done_progress(typecheck_guid)
|
165
|
-
master.start_type_check(last_request: nil, progress: progress, include_unchanged: true, report_progress_threshold: 0)
|
165
|
+
master.start_type_check(last_request: nil, progress: progress, include_unchanged: true, report_progress_threshold: 0, needs_response: true)
|
166
166
|
end
|
167
167
|
wait_for_message(reader: client_reader) do |message|
|
168
168
|
message[:id] == typecheck_guid
|
@@ -281,6 +281,7 @@ module Steep
|
|
281
281
|
method_name = method_name_for(type_def, name)
|
282
282
|
method_type = factory.method_type(type_def.type)
|
283
283
|
method_type = replace_primitive_method(method_name, type_def, method_type)
|
284
|
+
method_type = replace_kernel_class(method_name, type_def, method_type) { AST::Builtin::Class.instance_type }
|
284
285
|
Shape::MethodOverload.new(method_type, [type_def])
|
285
286
|
end
|
286
287
|
|
@@ -311,6 +312,9 @@ module Steep
|
|
311
312
|
method_name = method_name_for(type_def, name)
|
312
313
|
method_type = factory.method_type(type_def.type)
|
313
314
|
method_type = replace_primitive_method(method_name, type_def, method_type)
|
315
|
+
if type_name.class?
|
316
|
+
method_type = replace_kernel_class(method_name, type_def, method_type) { AST::Types::Name::Singleton.new(name: type_name) }
|
317
|
+
end
|
314
318
|
Shape::MethodOverload.new(method_type, [type_def])
|
315
319
|
end
|
316
320
|
|
@@ -748,7 +752,7 @@ module Steep
|
|
748
752
|
return_type: AST::Types::Logic::ReceiverIsNil.instance()
|
749
753
|
)
|
750
754
|
)
|
751
|
-
|
755
|
+
end
|
752
756
|
end
|
753
757
|
|
754
758
|
when :!
|
@@ -801,6 +805,23 @@ module Steep
|
|
801
805
|
|
802
806
|
method_type
|
803
807
|
end
|
808
|
+
|
809
|
+
def replace_kernel_class(method_name, method_def, method_type)
|
810
|
+
defined_in = method_def.defined_in
|
811
|
+
member = method_def.member
|
812
|
+
|
813
|
+
if member.is_a?(RBS::AST::Members::MethodDefinition)
|
814
|
+
case method_name.method_name
|
815
|
+
when :class
|
816
|
+
case defined_in
|
817
|
+
when AST::Builtin::Kernel.module_name
|
818
|
+
return method_type.with(type: method_type.type.with(return_type: yield))
|
819
|
+
end
|
820
|
+
end
|
821
|
+
end
|
822
|
+
|
823
|
+
method_type
|
824
|
+
end
|
804
825
|
end
|
805
826
|
end
|
806
827
|
end
|
data/lib/steep/server/master.rb
CHANGED
@@ -12,6 +12,7 @@ module Steep
|
|
12
12
|
attr_reader :checked_paths
|
13
13
|
attr_reader :work_done_progress
|
14
14
|
attr_reader :started_at
|
15
|
+
attr_accessor :needs_response
|
15
16
|
|
16
17
|
def initialize(guid:, progress:)
|
17
18
|
@guid = guid
|
@@ -22,6 +23,7 @@ module Steep
|
|
22
23
|
@checked_paths = Set[]
|
23
24
|
@work_done_progress = progress
|
24
25
|
@started_at = Time.now
|
26
|
+
@needs_response = false
|
25
27
|
end
|
26
28
|
|
27
29
|
def uri(path)
|
@@ -732,7 +734,8 @@ module Steep
|
|
732
734
|
start_type_check(
|
733
735
|
last_request: last_request,
|
734
736
|
include_unchanged: true,
|
735
|
-
progress: work_done_progress(guid)
|
737
|
+
progress: work_done_progress(guid),
|
738
|
+
needs_response: false
|
736
739
|
)
|
737
740
|
end
|
738
741
|
)
|
@@ -755,7 +758,8 @@ module Steep
|
|
755
758
|
|
756
759
|
start_type_check(
|
757
760
|
last_request: last_request,
|
758
|
-
progress: work_done_progress(guid)
|
761
|
+
progress: work_done_progress(guid),
|
762
|
+
needs_response: false
|
759
763
|
)
|
760
764
|
end
|
761
765
|
)
|
@@ -859,7 +863,8 @@ module Steep
|
|
859
863
|
start_type_check(
|
860
864
|
last_request: current_type_check_request,
|
861
865
|
include_unchanged: true,
|
862
|
-
progress: work_done_progress(guid || SecureRandom.uuid)
|
866
|
+
progress: work_done_progress(guid || SecureRandom.uuid),
|
867
|
+
needs_response: true
|
863
868
|
)
|
864
869
|
|
865
870
|
when "$/ping"
|
@@ -920,25 +925,27 @@ module Steep
|
|
920
925
|
finished_at = Time.now
|
921
926
|
duration = finished_at - request.started_at
|
922
927
|
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
928
|
+
if request.needs_response
|
929
|
+
enqueue_write_job(
|
930
|
+
SendMessageJob.to_client(
|
931
|
+
message: CustomMethods::TypeCheck.response(
|
932
|
+
request.guid,
|
933
|
+
{
|
934
|
+
guid: request.guid,
|
935
|
+
completed: request.finished?,
|
936
|
+
started_at: request.started_at.iso8601,
|
937
|
+
finished_at: finished_at.iso8601,
|
938
|
+
duration: duration.to_i
|
939
|
+
}
|
940
|
+
)
|
934
941
|
)
|
935
942
|
)
|
936
|
-
|
937
|
-
|
938
|
-
|
943
|
+
else
|
944
|
+
Steep.logger.debug { "Skip sending response to #{CustomMethods::TypeCheck::METHOD} request" }
|
945
|
+
end
|
939
946
|
end
|
940
947
|
|
941
|
-
def start_type_check(request: nil, last_request:, progress: nil, include_unchanged: false, report_progress_threshold: 10)
|
948
|
+
def start_type_check(request: nil, last_request:, progress: nil, include_unchanged: false, report_progress_threshold: 10, needs_response: nil)
|
942
949
|
Steep.logger.tagged "#start_type_check(#{progress&.guid || request&.guid}, #{last_request&.guid}" do
|
943
950
|
if last_request
|
944
951
|
finish_type_check(last_request)
|
@@ -947,6 +954,7 @@ module Steep
|
|
947
954
|
unless request
|
948
955
|
progress or raise
|
949
956
|
request = controller.make_request(guid: progress.guid, include_unchanged: include_unchanged, progress: progress) or return
|
957
|
+
request.needs_response = needs_response ? true : false
|
950
958
|
end
|
951
959
|
|
952
960
|
if request.total > report_progress_threshold
|
@@ -960,7 +968,8 @@ module Steep
|
|
960
968
|
end
|
961
969
|
|
962
970
|
if request.finished?
|
963
|
-
|
971
|
+
finish_type_check(request)
|
972
|
+
@current_type_check_request = nil
|
964
973
|
return
|
965
974
|
end
|
966
975
|
else
|
@@ -992,7 +1001,8 @@ module Steep
|
|
992
1001
|
current.work_done_progress.report(percentage, "#{percentage}%")
|
993
1002
|
|
994
1003
|
if current.finished?
|
995
|
-
|
1004
|
+
finish_type_check(current)
|
1005
|
+
@current_type_check_request = nil
|
996
1006
|
end
|
997
1007
|
end
|
998
1008
|
end
|
@@ -104,6 +104,7 @@ module Steep
|
|
104
104
|
unchecked: param.unchecked?,
|
105
105
|
default_type: factory.type_opt(param.default_type)
|
106
106
|
),
|
107
|
+
result: result,
|
107
108
|
location: location
|
108
109
|
)
|
109
110
|
end
|
@@ -252,6 +253,39 @@ module Steep
|
|
252
253
|
end
|
253
254
|
end
|
254
255
|
|
256
|
+
def validate_type_params(type_name, type_params)
|
257
|
+
if error_type_params = RBS::AST::TypeParam.validate(type_params)
|
258
|
+
error_type_params.each do |type_param|
|
259
|
+
default_type = type_param.default_type or raise
|
260
|
+
@errors << Diagnostic::Signature::TypeParamDefaultReferenceError.new(type_param, location: default_type.location)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
upper_bounds = type_params.each.with_object({}) do |param, bounds| #$ Hash[Symbol, AST::Types::t?]
|
265
|
+
bounds[param.name] = factory.type_opt(param.upper_bound_type)
|
266
|
+
end
|
267
|
+
|
268
|
+
checker.push_variable_bounds(upper_bounds) do
|
269
|
+
type_params.each do |type_param|
|
270
|
+
param = checker.factory.type_param(type_param)
|
271
|
+
|
272
|
+
default_type = param.default_type or next
|
273
|
+
upper_bound = param.upper_bound or next
|
274
|
+
|
275
|
+
relation = Subtyping::Relation.new(sub_type: default_type, super_type: upper_bound)
|
276
|
+
result = checker.check(relation, self_type: nil, instance_type: nil, class_type: nil, constraints: Subtyping::Constraints.empty)
|
277
|
+
|
278
|
+
if result.failure?
|
279
|
+
@errors << Diagnostic::Signature::UnsatisfiableGenericsDefaultType.new(
|
280
|
+
type_param.name,
|
281
|
+
result,
|
282
|
+
location: (type_param.default_type || raise).location
|
283
|
+
)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
255
289
|
def validate_one_class_decl(name, entry)
|
256
290
|
rescue_validation_errors(name) do
|
257
291
|
Steep.logger.debug { "Validating class definition `#{name}`..." }
|
@@ -310,7 +344,7 @@ module Steep
|
|
310
344
|
name: name,
|
311
345
|
location: ancestor.source&.location || raise,
|
312
346
|
ancestor: ancestor,
|
313
|
-
|
347
|
+
result: _1
|
314
348
|
)
|
315
349
|
end
|
316
350
|
end
|
@@ -405,7 +439,7 @@ module Steep
|
|
405
439
|
name: name,
|
406
440
|
location: ancestor.source&.location || raise,
|
407
441
|
ancestor: ancestor,
|
408
|
-
|
442
|
+
result: _1
|
409
443
|
)
|
410
444
|
end
|
411
445
|
end
|
@@ -419,6 +453,8 @@ module Steep
|
|
419
453
|
validate_definition_type(definition)
|
420
454
|
end
|
421
455
|
end
|
456
|
+
|
457
|
+
validate_type_params(name, entry.type_params)
|
422
458
|
end
|
423
459
|
end
|
424
460
|
end
|
@@ -480,6 +516,8 @@ module Steep
|
|
480
516
|
Steep.logger.tagged "#{name}" do
|
481
517
|
definition = builder.build_interface(name)
|
482
518
|
|
519
|
+
validate_type_params(name, definition.type_params_decl)
|
520
|
+
|
483
521
|
upper_bounds = definition.type_params_decl.each.with_object({}) do |param, bounds|
|
484
522
|
bounds[param.name] = factory.type_opt(param.upper_bound_type)
|
485
523
|
end
|
@@ -575,6 +613,8 @@ module Steep
|
|
575
613
|
builder.validate_type_name(outer, entry.decl.location&.aref(:name))
|
576
614
|
end
|
577
615
|
|
616
|
+
validate_type_params(name, entry.decl.type_params)
|
617
|
+
|
578
618
|
upper_bounds = entry.decl.type_params.each.with_object({}) do |param, bounds|
|
579
619
|
bounds[param.name] = factory.type_opt(param.upper_bound_type)
|
580
620
|
end
|
@@ -2657,34 +2657,11 @@ module Steep
|
|
2657
2657
|
def synthesize_sendish(node, hint:, tapp:)
|
2658
2658
|
case node.type
|
2659
2659
|
when :send
|
2660
|
-
|
2661
|
-
if self_class?(node)
|
2662
|
-
module_type = expand_alias(module_context.module_type)
|
2663
|
-
type = if module_type.is_a?(AST::Types::Name::Singleton)
|
2664
|
-
AST::Types::Name::Singleton.new(name: module_type.name)
|
2665
|
-
else
|
2666
|
-
module_type
|
2667
|
-
end
|
2668
|
-
|
2669
|
-
add_typing(node, type: type)
|
2670
|
-
else
|
2671
|
-
type_send(node, send_node: node, block_params: nil, block_body: nil, tapp: tapp, hint: hint)
|
2672
|
-
end
|
2673
|
-
end
|
2660
|
+
type_send(node, send_node: node, block_params: nil, block_body: nil, tapp: tapp, hint: hint)
|
2674
2661
|
when :csend
|
2675
2662
|
yield_self do
|
2676
2663
|
send_type, constr =
|
2677
|
-
|
2678
|
-
module_type = expand_alias(module_context.module_type)
|
2679
|
-
type = if module_type.is_a?(AST::Types::Name::Singleton)
|
2680
|
-
AST::Types::Name::Singleton.new(name: module_type.name)
|
2681
|
-
else
|
2682
|
-
module_type
|
2683
|
-
end
|
2684
|
-
add_typing(node, type: type).to_ary
|
2685
|
-
else
|
2686
|
-
type_send(node, send_node: node, block_params: nil, block_body: nil, unwrap: true, tapp: tapp, hint: hint).to_ary
|
2687
|
-
end
|
2664
|
+
type_send(node, send_node: node, block_params: nil, block_body: nil, unwrap: true, tapp: tapp, hint: hint).to_ary
|
2688
2665
|
|
2689
2666
|
constr
|
2690
2667
|
.update_type_env { context.type_env.join(constr.context.type_env, context.type_env) }
|
@@ -4687,10 +4664,6 @@ module Steep
|
|
4687
4664
|
add_typing node, type: AST::Builtin.any_type
|
4688
4665
|
end
|
4689
4666
|
|
4690
|
-
def self_class?(node)
|
4691
|
-
node.type == :send && node.children[0]&.type == :self && node.children[1] == :class
|
4692
|
-
end
|
4693
|
-
|
4694
4667
|
def namespace_module?(node)
|
4695
4668
|
# @type var nodes: Array[Parser::AST::Node]
|
4696
4669
|
nodes =
|
data/lib/steep/version.rb
CHANGED
data/lib/steep.rb
CHANGED
@@ -75,6 +75,7 @@ require "steep/subtyping/constraints"
|
|
75
75
|
require "steep/subtyping/variable_variance"
|
76
76
|
|
77
77
|
require "steep/diagnostic/helper"
|
78
|
+
require "steep/diagnostic/result_printer2"
|
78
79
|
require "steep/diagnostic/ruby"
|
79
80
|
require "steep/diagnostic/signature"
|
80
81
|
require "steep/diagnostic/lsp_formatter"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module LocationHelper : _WithLocation
|
2
|
+
interface _WithLocation
|
3
|
+
def location_method: () -> String
|
4
|
+
end
|
5
|
+
|
6
|
+
def hello: () -> void
|
7
|
+
end
|
8
|
+
|
9
|
+
class StringGeneric[X < Integer, Y < Integer = String]
|
10
|
+
def location_method: () -> Integer
|
11
|
+
|
12
|
+
include LocationHelper
|
13
|
+
extend LocationHelper
|
14
|
+
end
|
15
|
+
|
data/steep.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
|
37
37
|
spec.add_runtime_dependency "listen", "~> 3.0"
|
38
38
|
spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
|
39
|
-
spec.add_runtime_dependency "rbs", "~> 3.6.0
|
39
|
+
spec.add_runtime_dependency "rbs", "~> 3.6.0"
|
40
40
|
spec.add_runtime_dependency "concurrent-ruby", ">= 1.1.10"
|
41
41
|
spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
|
42
42
|
spec.add_runtime_dependency "securerandom", ">= 0.1"
|
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: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -98,14 +98,14 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 3.6.0
|
101
|
+
version: 3.6.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: 3.6.0
|
108
|
+
version: 3.6.0
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: concurrent-ruby
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -291,6 +291,7 @@ files:
|
|
291
291
|
- lib/steep/diagnostic/deprecated/unknown_constant_assigned.rb
|
292
292
|
- lib/steep/diagnostic/helper.rb
|
293
293
|
- lib/steep/diagnostic/lsp_formatter.rb
|
294
|
+
- lib/steep/diagnostic/result_printer2.rb
|
294
295
|
- lib/steep/diagnostic/ruby.rb
|
295
296
|
- lib/steep/diagnostic/signature.rb
|
296
297
|
- lib/steep/drivers/annotations.rb
|
@@ -384,6 +385,7 @@ files:
|
|
384
385
|
- sample/lib/conference.rb
|
385
386
|
- sample/lib/length.rb
|
386
387
|
- sample/sig/conference.rbs
|
388
|
+
- sample/sig/generics.rbs
|
387
389
|
- sample/sig/length.rbs
|
388
390
|
- steep.gemspec
|
389
391
|
homepage: https://github.com/soutaro/steep
|
@@ -408,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
408
410
|
- !ruby/object:Gem::Version
|
409
411
|
version: '0'
|
410
412
|
requirements: []
|
411
|
-
rubygems_version: 3.5.
|
413
|
+
rubygems_version: 3.5.17
|
412
414
|
signing_key:
|
413
415
|
specification_version: 4
|
414
416
|
summary: Gradual Typing for Ruby
|