steep 1.6.0.pre.2 → 1.6.0.pre.4
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/Gemfile.lock +2 -2
- data/lib/steep/interface/builder.rb +27 -13
- data/lib/steep/server/master.rb +33 -22
- data/lib/steep/type_construction.rb +11 -2
- data/lib/steep/version.rb +1 -1
- data/sig/steep/server/master.rbs +22 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d612ef62eb6e7c7e280b918e6cf1bfbcaac06346f4a49b18f61db5cc277798d
|
4
|
+
data.tar.gz: 04c2542f6fc1b05f6c1a36ac470b85d90cbe9a1af5eb82bda37be5a41cc93b14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48bc0af1c2ad26831d11588e2224eb6b45fe71f45faa3d030475402260e6f693b8a528d6831e2619b68e76359264a1d8445c8902efe6aaefc2adfe3c8fc8513c
|
7
|
+
data.tar.gz: c61112bbc9cc29bf805fe12cc4b21352e7603252538440952e63af19888f34219131e38726b181238c052c09b479d3a1e4d2c23adf4d70e1f004ed207dccb796
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.6.0.pre.4 (2023-11-02)
|
6
|
+
|
7
|
+
### Language server
|
8
|
+
|
9
|
+
* Fix LSP text synchronization problems ([#954](https://github.com/soutaro/steep/pull/954))
|
10
|
+
|
11
|
+
## 1.6.0.pre.3 (2023-11-01)
|
12
|
+
|
13
|
+
### Type checker core
|
14
|
+
|
15
|
+
* Object methods are moved to Kernel ([#952](https://github.com/soutaro/steep/pull/952))
|
16
|
+
* Check if `rescue` body has `bot` type ([#953](https://github.com/soutaro/steep/pull/953))
|
17
|
+
|
5
18
|
## 1.6.0.pre.2 (2023-10-31)
|
6
19
|
|
7
20
|
### Type checker core
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
steep (1.6.0.pre.
|
4
|
+
steep (1.6.0.pre.4)
|
5
5
|
activesupport (>= 5.1)
|
6
6
|
concurrent-ruby (>= 1.1.10)
|
7
7
|
csv (>= 3.0.9)
|
@@ -66,7 +66,7 @@ GEM
|
|
66
66
|
racc
|
67
67
|
psych (5.1.0)
|
68
68
|
stringio
|
69
|
-
racc (1.7.
|
69
|
+
racc (1.7.2)
|
70
70
|
rainbow (3.1.1)
|
71
71
|
rake (13.1.0)
|
72
72
|
rb-fsevent (0.11.2)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module Steep
|
3
2
|
module Interface
|
4
3
|
class Builder
|
@@ -718,22 +717,30 @@ module Steep
|
|
718
717
|
if member.is_a?(RBS::AST::Members::MethodDefinition)
|
719
718
|
case method_name.method_name
|
720
719
|
when :is_a?, :kind_of?, :instance_of?
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
720
|
+
case
|
721
|
+
when RBS::BuiltinNames::Object.name,
|
722
|
+
RBS::BuiltinNames::Kernel.name
|
723
|
+
if member.instance?
|
724
|
+
return method_type.with(
|
725
|
+
type: method_type.type.with(
|
726
|
+
return_type: AST::Types::Logic::ReceiverIsArg.new(location: method_type.type.return_type.location)
|
727
|
+
)
|
725
728
|
)
|
726
|
-
|
729
|
+
end
|
727
730
|
end
|
728
731
|
|
729
732
|
when :nil?
|
730
733
|
case defined_in
|
731
|
-
when RBS::BuiltinNames::Object.name,
|
732
|
-
|
733
|
-
|
734
|
-
|
734
|
+
when RBS::BuiltinNames::Object.name,
|
735
|
+
AST::Builtin::NilClass.module_name,
|
736
|
+
RBS::BuiltinNames::Kernel.name
|
737
|
+
if member.instance?
|
738
|
+
return method_type.with(
|
739
|
+
type: method_type.type.with(
|
740
|
+
return_type: AST::Types::Logic::ReceiverIsNil.new(location: method_type.type.return_type.location)
|
741
|
+
)
|
735
742
|
)
|
736
|
-
|
743
|
+
end
|
737
744
|
end
|
738
745
|
|
739
746
|
when :!
|
@@ -757,8 +764,14 @@ module Steep
|
|
757
764
|
return_type: AST::Types::Logic::ArgIsReceiver.new(location: method_type.type.return_type.location)
|
758
765
|
)
|
759
766
|
)
|
760
|
-
when RBS::BuiltinNames::Object.name,
|
761
|
-
RBS::BuiltinNames::
|
767
|
+
when RBS::BuiltinNames::Object.name,
|
768
|
+
RBS::BuiltinNames::Kernel.name,
|
769
|
+
RBS::BuiltinNames::String.name,
|
770
|
+
RBS::BuiltinNames::Integer.name,
|
771
|
+
RBS::BuiltinNames::Symbol.name,
|
772
|
+
RBS::BuiltinNames::TrueClass.name,
|
773
|
+
RBS::BuiltinNames::FalseClass.name,
|
774
|
+
TypeName("::NilClass")
|
762
775
|
# Value based type-case works on literal types which is available for String, Integer, Symbol, TrueClass, FalseClass, and NilClass
|
763
776
|
return method_type.with(
|
764
777
|
type: method_type.type.with(
|
@@ -783,3 +796,4 @@ module Steep
|
|
783
796
|
end
|
784
797
|
end
|
785
798
|
end
|
799
|
+
|
data/lib/steep/server/master.rb
CHANGED
@@ -115,18 +115,25 @@ module Steep
|
|
115
115
|
code_paths.include?(path)
|
116
116
|
end
|
117
117
|
|
118
|
-
def add(path)
|
119
|
-
return if
|
118
|
+
def add(path, library: false)
|
119
|
+
return true if signature_path?(path) || code_path?(path) || library_path?(path)
|
120
120
|
|
121
|
-
|
122
|
-
|
123
|
-
case
|
124
|
-
when target.source_pattern =~ relative_path
|
125
|
-
code_paths << path
|
126
|
-
when target.signature_pattern =~ relative_path
|
127
|
-
signature_paths << path
|
128
|
-
else
|
121
|
+
if library
|
129
122
|
library_paths << path
|
123
|
+
true
|
124
|
+
else
|
125
|
+
relative_path = project.relative_path(path)
|
126
|
+
|
127
|
+
case
|
128
|
+
when target.source_pattern =~ relative_path
|
129
|
+
code_paths << path
|
130
|
+
true
|
131
|
+
when target.signature_pattern =~ relative_path
|
132
|
+
signature_paths << path
|
133
|
+
true
|
134
|
+
else
|
135
|
+
false
|
136
|
+
end
|
130
137
|
end
|
131
138
|
end
|
132
139
|
|
@@ -645,20 +652,22 @@ module Steep
|
|
645
652
|
|
646
653
|
path = PathHelper.to_pathname(uri) or next
|
647
654
|
|
648
|
-
controller.
|
655
|
+
unless controller.priority_paths.include?(path)
|
656
|
+
controller.push_changes(path)
|
649
657
|
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
658
|
+
case type
|
659
|
+
when 1, 2
|
660
|
+
content = path.read
|
661
|
+
when 4
|
662
|
+
# Deleted
|
663
|
+
content = ""
|
664
|
+
end
|
657
665
|
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
666
|
+
broadcast_notification({
|
667
|
+
method: "$/file/reset",
|
668
|
+
params: { uri: uri, content: content }
|
669
|
+
})
|
670
|
+
end
|
662
671
|
end
|
663
672
|
|
664
673
|
if typecheck_automatically
|
@@ -683,6 +692,8 @@ module Steep
|
|
683
692
|
start_type_checking_queue.execute do
|
684
693
|
job_queue.push(
|
685
694
|
-> do
|
695
|
+
Steep.logger.info { "Starting type check from textDocument/didChange notification..." }
|
696
|
+
|
686
697
|
last_request = current_type_check_request
|
687
698
|
if request = controller.make_request(last_request: last_request)
|
688
699
|
start_type_check(request, last_request: last_request, start_progress: request.total > 10)
|
@@ -2214,6 +2214,10 @@ module Steep
|
|
2214
2214
|
end
|
2215
2215
|
end
|
2216
2216
|
|
2217
|
+
resbody_pairs.select! do |pair|
|
2218
|
+
no_subtyping?(sub_type: pair.type, super_type: AST::Types::Bot.new)
|
2219
|
+
end
|
2220
|
+
|
2217
2221
|
resbody_types = resbody_pairs.map(&:type)
|
2218
2222
|
resbody_envs = resbody_pairs.map {|pair| pair.context.type_env }
|
2219
2223
|
|
@@ -2225,8 +2229,13 @@ module Steep
|
|
2225
2229
|
.update_type_env {|env| env.join(*resbody_envs, env) }
|
2226
2230
|
.add_typing(node, type: union_type(else_type, *resbody_types))
|
2227
2231
|
else
|
2228
|
-
|
2229
|
-
|
2232
|
+
if resbody_types.empty?
|
2233
|
+
constr = body_pair ? body_pair.constr : self
|
2234
|
+
constr.add_typing(node, type: body_pair&.type || AST::Builtin.nil_type)
|
2235
|
+
else
|
2236
|
+
update_type_env {|env| env.join(*resbody_envs, else_constr.context.type_env) }
|
2237
|
+
.add_typing(node, type: union_type(*[body_pair&.type, *resbody_types].compact))
|
2238
|
+
end
|
2230
2239
|
end
|
2231
2240
|
end
|
2232
2241
|
|
data/lib/steep/version.rb
CHANGED
data/sig/steep/server/master.rbs
CHANGED
@@ -61,15 +61,29 @@ module Steep
|
|
61
61
|
|
62
62
|
attr_reader target_paths: Array[TargetPaths]
|
63
63
|
|
64
|
+
# TargetPaths object keeps track of the expanded absolute paths of each target
|
65
|
+
#
|
66
|
+
# 1. *Library path* is a RBS file that is loaded as a part of a library
|
67
|
+
# 2. *Signature path* is a RBS file that is loaded as a part of the application library
|
68
|
+
# 3. *Code path* is a Ruby file that is being type checked
|
69
|
+
#
|
64
70
|
class TargetPaths
|
65
71
|
attr_reader project: Project
|
66
72
|
|
67
73
|
attr_reader target: Project::Target
|
68
74
|
|
75
|
+
# Set of absolute paths of Ruby code
|
76
|
+
#
|
69
77
|
attr_reader code_paths: Set[Pathname]
|
70
78
|
|
79
|
+
# Set of absolute paths of app signatures
|
80
|
+
#
|
71
81
|
attr_reader signature_paths: Set[Pathname]
|
72
82
|
|
83
|
+
# Set of absolute paths of library signatures
|
84
|
+
#
|
85
|
+
# Unlike `code_paths` and `signature_paths`, the `library_paths` must be added explicitly not by `#add` method.
|
86
|
+
#
|
73
87
|
attr_reader library_paths: Set[Pathname]
|
74
88
|
|
75
89
|
def initialize: (project: Project, target: Project::Target) -> void
|
@@ -82,7 +96,14 @@ module Steep
|
|
82
96
|
|
83
97
|
def code_path?: (Pathname path) -> bool
|
84
98
|
|
85
|
-
|
99
|
+
# Adds `path` to the object
|
100
|
+
#
|
101
|
+
# Returns `false` if the path is not a part of the project.
|
102
|
+
#
|
103
|
+
# Whether `path` is a code path or signature path is automatically detected.
|
104
|
+
# `library: true` is required to add the path to library path.
|
105
|
+
#
|
106
|
+
def add: (Pathname path, ?library: bool) -> bool
|
86
107
|
|
87
108
|
alias << add
|
88
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.0.pre.
|
4
|
+
version: 1.6.0.pre.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|