steep 1.9.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Steepfile +4 -0
- data/lib/steep/drivers/annotations.rb +1 -1
- data/lib/steep/interface/builder.rb +5 -2
- data/lib/steep/project/dsl.rb +9 -1
- data/lib/steep/project/target.rb +3 -1
- data/lib/steep/server/type_check_controller.rb +1 -1
- data/lib/steep/services/signature_service.rb +12 -8
- data/lib/steep/services/type_check_service.rb +1 -1
- data/lib/steep/source.rb +8 -0
- data/lib/steep/version.rb +1 -1
- data/steep.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4ab8afe918f1a916f4697310e5119e832e9245ad45872c34e0c7d39a80725fc
|
4
|
+
data.tar.gz: 613dffe12496d24cfef1db9b01bf4aac622e7d9bb438554c8227904a2532ca55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26c87982d9a05cc18558d2f2a7ca55d9a81611316d2cbe48c9e95bcc8089c8a7cd769f62b453c8fdc59ef0429b83ea37ab3d7b0a048d4b465a6856376b611242
|
7
|
+
data.tar.gz: cdc096149b19d7bd20a8a6766e25d204b5b31be69614f84119f451c6654f5a1289a6948309eab1df61bccb5287ce5e1b35c5fbb2df5e922854402898d32575fc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.9.2 (2024-12-16)
|
4
|
+
|
5
|
+
### Type checker core
|
6
|
+
|
7
|
+
* Attach type assertion to keyword args ([#1410](https://github.com/soutaro/steep/pull/1410))
|
8
|
+
|
9
|
+
### Miscellaneous
|
10
|
+
|
11
|
+
* deps: Add uri gem to dependencies list ([#1402](https://github.com/soutaro/steep/pull/1402))
|
12
|
+
|
13
|
+
## 1.9.1 (2024-12-09)
|
14
|
+
|
15
|
+
### Type checker core
|
16
|
+
|
17
|
+
* Make `implicitly-returns-nil` opt-in ([#1396](https://github.com/soutaro/steep/pull/1396))
|
18
|
+
|
3
19
|
## 1.9.0 (2024-12-06)
|
4
20
|
|
5
21
|
### Type checker core
|
data/Steepfile
CHANGED
@@ -23,6 +23,8 @@ target :app do
|
|
23
23
|
signature "sig"
|
24
24
|
ignore_signature "sig/test"
|
25
25
|
|
26
|
+
implicitly_returns_nil!
|
27
|
+
|
26
28
|
configure_code_diagnostics(D::Ruby.strict) do |hash|
|
27
29
|
end
|
28
30
|
|
@@ -37,6 +39,7 @@ target :test do
|
|
37
39
|
collection_config "rbs_collection.steep.yaml"
|
38
40
|
|
39
41
|
unreferenced!
|
42
|
+
implicitly_returns_nil!
|
40
43
|
|
41
44
|
check "test"
|
42
45
|
signature "sig/test"
|
@@ -52,6 +55,7 @@ end
|
|
52
55
|
|
53
56
|
target :bin do
|
54
57
|
unreferenced!
|
58
|
+
implicitly_returns_nil!
|
55
59
|
|
56
60
|
collection_config "rbs_collection.steep.yaml"
|
57
61
|
|
@@ -21,7 +21,7 @@ module Steep
|
|
21
21
|
|
22
22
|
project.targets.each do |target|
|
23
23
|
Steep.logger.tagged "target=#{target.name}" do
|
24
|
-
service = Services::SignatureService.load_from(target.new_env_loader())
|
24
|
+
service = Services::SignatureService.load_from(target.new_env_loader(), implicitly_returns_nil: target.implicitly_returns_nil)
|
25
25
|
|
26
26
|
sigs = loader.load_changes(target.signature_pattern, changes: {})
|
27
27
|
service.update(sigs)
|
@@ -54,13 +54,14 @@ module Steep
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
attr_reader :factory, :object_shape_cache, :union_shape_cache, :singleton_shape_cache
|
57
|
+
attr_reader :factory, :object_shape_cache, :union_shape_cache, :singleton_shape_cache, :implicitly_returns_nil
|
58
58
|
|
59
|
-
def initialize(factory)
|
59
|
+
def initialize(factory, implicitly_returns_nil:)
|
60
60
|
@factory = factory
|
61
61
|
@object_shape_cache = {}
|
62
62
|
@union_shape_cache = {}
|
63
63
|
@singleton_shape_cache = {}
|
64
|
+
@implicitly_returns_nil = implicitly_returns_nil
|
64
65
|
end
|
65
66
|
|
66
67
|
def shape(type, config)
|
@@ -826,6 +827,8 @@ module Steep
|
|
826
827
|
end
|
827
828
|
|
828
829
|
def add_implicitly_returns_nil(annotations, method_type)
|
830
|
+
return method_type unless implicitly_returns_nil
|
831
|
+
|
829
832
|
if annotations.find { _1.string == "implicitly-returns-nil" }
|
830
833
|
return_type = method_type.type.return_type
|
831
834
|
method_type = method_type.with(
|
data/lib/steep/project/dsl.rb
CHANGED
@@ -119,6 +119,7 @@ module Steep
|
|
119
119
|
attr_reader :project
|
120
120
|
attr_reader :unreferenced
|
121
121
|
attr_reader :groups
|
122
|
+
attr_reader :implicitly_returns_nil
|
122
123
|
|
123
124
|
def initialize(name, project:)
|
124
125
|
@name = name
|
@@ -127,6 +128,7 @@ module Steep
|
|
127
128
|
@project = project
|
128
129
|
@collection_config_path = collection_config_path
|
129
130
|
@unreferenced = false
|
131
|
+
@implicitly_returns_nil = false
|
130
132
|
@groups = []
|
131
133
|
end
|
132
134
|
|
@@ -144,6 +146,7 @@ module Steep
|
|
144
146
|
@project = other.project
|
145
147
|
@collection_config_path = other.collection_config_path
|
146
148
|
@unreferenced = other.unreferenced
|
149
|
+
@implicitly_returns_nil = other.implicitly_returns_nil
|
147
150
|
@groups = other.groups.dup
|
148
151
|
end
|
149
152
|
|
@@ -151,6 +154,10 @@ module Steep
|
|
151
154
|
@unreferenced = value
|
152
155
|
end
|
153
156
|
|
157
|
+
def implicitly_returns_nil!(value = true)
|
158
|
+
@implicitly_returns_nil = value
|
159
|
+
end
|
160
|
+
|
154
161
|
def configure_code_diagnostics(hash = nil)
|
155
162
|
if hash
|
156
163
|
code_diagnostics_config.merge!(hash)
|
@@ -245,7 +252,8 @@ module Steep
|
|
245
252
|
options: dsl.library_configured? ? dsl.to_library_options : nil,
|
246
253
|
code_diagnostics_config: dsl.code_diagnostics_config,
|
247
254
|
project: project,
|
248
|
-
unreferenced: dsl.unreferenced
|
255
|
+
unreferenced: dsl.unreferenced,
|
256
|
+
implicitly_returns_nil: dsl.implicitly_returns_nil
|
249
257
|
)
|
250
258
|
|
251
259
|
dsl.groups.each do
|
data/lib/steep/project/target.rb
CHANGED
@@ -10,8 +10,9 @@ module Steep
|
|
10
10
|
attr_reader :project
|
11
11
|
attr_reader :unreferenced
|
12
12
|
attr_reader :groups
|
13
|
+
attr_reader :implicitly_returns_nil
|
13
14
|
|
14
|
-
def initialize(name:, options:, source_pattern:, signature_pattern:, code_diagnostics_config:, project:, unreferenced:)
|
15
|
+
def initialize(name:, options:, source_pattern:, signature_pattern:, code_diagnostics_config:, project:, unreferenced:, implicitly_returns_nil:)
|
15
16
|
@name = name
|
16
17
|
@target_options = options
|
17
18
|
@source_pattern = source_pattern
|
@@ -20,6 +21,7 @@ module Steep
|
|
20
21
|
@project = project
|
21
22
|
@unreferenced = unreferenced
|
22
23
|
@groups = []
|
24
|
+
@implicitly_returns_nil = implicitly_returns_nil
|
23
25
|
end
|
24
26
|
|
25
27
|
def options
|
@@ -185,7 +185,7 @@ module Steep
|
|
185
185
|
loader = Services::FileLoader.new(base_dir: project.base_dir)
|
186
186
|
|
187
187
|
project.targets.each do |target|
|
188
|
-
signature_service = Services::SignatureService.load_from(target.new_env_loader())
|
188
|
+
signature_service = Services::SignatureService.load_from(target.new_env_loader(), implicitly_returns_nil: target.implicitly_returns_nil)
|
189
189
|
files.add_library_path(target, *signature_service.env_rbs_paths.to_a)
|
190
190
|
end
|
191
191
|
|
@@ -48,17 +48,18 @@ module Steep
|
|
48
48
|
end
|
49
49
|
|
50
50
|
class LoadedStatus
|
51
|
-
attr_reader :files, :builder
|
51
|
+
attr_reader :files, :builder, :implicitly_returns_nil
|
52
52
|
|
53
|
-
def initialize(files:, builder:)
|
53
|
+
def initialize(files:, builder:, implicitly_returns_nil:)
|
54
54
|
@files = files
|
55
55
|
@builder = builder
|
56
|
+
@implicitly_returns_nil = implicitly_returns_nil
|
56
57
|
end
|
57
58
|
|
58
59
|
def subtyping
|
59
60
|
@subtyping ||= begin
|
60
61
|
factory = AST::Types::Factory.new(builder: builder)
|
61
|
-
interface_builder = Interface::Builder.new(factory)
|
62
|
+
interface_builder = Interface::Builder.new(factory, implicitly_returns_nil: implicitly_returns_nil)
|
62
63
|
Subtyping::Check.new(builder: interface_builder)
|
63
64
|
end
|
64
65
|
end
|
@@ -77,14 +78,17 @@ module Steep
|
|
77
78
|
|
78
79
|
FileStatus = _ = Struct.new(:path, :content, :signature, keyword_init: true)
|
79
80
|
|
80
|
-
|
81
|
+
attr_reader :implicitly_returns_nil
|
82
|
+
|
83
|
+
def initialize(env:, implicitly_returns_nil:)
|
81
84
|
builder = RBS::DefinitionBuilder.new(env: env)
|
82
|
-
@status = LoadedStatus.new(builder: builder, files: {})
|
85
|
+
@status = LoadedStatus.new(builder: builder, files: {}, implicitly_returns_nil: implicitly_returns_nil)
|
86
|
+
@implicitly_returns_nil = implicitly_returns_nil
|
83
87
|
end
|
84
88
|
|
85
|
-
def self.load_from(loader)
|
89
|
+
def self.load_from(loader, implicitly_returns_nil:)
|
86
90
|
env = RBS::Environment.from_loader(loader).resolve_type_names
|
87
|
-
new(env: env)
|
91
|
+
new(env: env, implicitly_returns_nil: implicitly_returns_nil)
|
88
92
|
end
|
89
93
|
|
90
94
|
def env_rbs_paths
|
@@ -222,7 +226,7 @@ module Steep
|
|
222
226
|
)
|
223
227
|
when RBS::DefinitionBuilder::AncestorBuilder
|
224
228
|
builder2 = update_builder(ancestor_builder: result, paths: paths)
|
225
|
-
LoadedStatus.new(builder: builder2, files: files)
|
229
|
+
LoadedStatus.new(builder: builder2, files: files, implicitly_returns_nil: implicitly_returns_nil)
|
226
230
|
end
|
227
231
|
end
|
228
232
|
end
|
@@ -82,7 +82,7 @@ module Steep
|
|
82
82
|
@source_files = {}
|
83
83
|
@signature_services = project.targets.each.with_object({}) do |target, hash| #$ Hash[Symbol, SignatureService]
|
84
84
|
loader = Project::Target.construct_env_loader(options: target.options, project: project)
|
85
|
-
hash[target.name] = SignatureService.load_from(loader)
|
85
|
+
hash[target.name] = SignatureService.load_from(loader, implicitly_returns_nil: target.implicitly_returns_nil)
|
86
86
|
end
|
87
87
|
@signature_validation_diagnostics = project.targets.each.with_object({}) do |target, hash| #$ Hash[Symbol, Hash[Pathname, Array[Diagnostic::Signature::Base]]]
|
88
88
|
hash[target.name] = {}
|
data/lib/steep/source.rb
CHANGED
@@ -496,6 +496,14 @@ module Steep
|
|
496
496
|
# Skip
|
497
497
|
when :def, :defs
|
498
498
|
# Skip
|
499
|
+
when :kwargs
|
500
|
+
# skip
|
501
|
+
when :pair
|
502
|
+
key, value = node.children
|
503
|
+
key = insert_type_node(key, comments.except(last_line))
|
504
|
+
value = insert_type_node(value, comments)
|
505
|
+
node = node.updated(nil, [key, value])
|
506
|
+
return adjust_location(node)
|
499
507
|
when :masgn
|
500
508
|
lhs, rhs = node.children
|
501
509
|
node = node.updated(nil, [lhs, insert_type_node(rhs, comments)])
|
data/lib/steep/version.rb
CHANGED
data/steep.gemspec
CHANGED
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.9.
|
4
|
+
version: 1.9.2
|
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-12-
|
11
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -224,6 +224,20 @@ dependencies:
|
|
224
224
|
- - ">="
|
225
225
|
- !ruby/object:Gem::Version
|
226
226
|
version: 3.0.9
|
227
|
+
- !ruby/object:Gem::Dependency
|
228
|
+
name: uri
|
229
|
+
requirement: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - ">="
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: 0.12.0
|
234
|
+
type: :runtime
|
235
|
+
prerelease: false
|
236
|
+
version_requirements: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: 0.12.0
|
227
241
|
description: Gradual Typing for Ruby
|
228
242
|
email:
|
229
243
|
- matsumoto@soutaro.com
|