steep 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93e3e37cfc8107518827a5b5e7126618c6189fae7804456e706b8ee810941ad7
4
- data.tar.gz: c80ef32b93abb3f0c1f6f77eba1a675c993a2eb94632825f9057f76a39edb0ce
3
+ metadata.gz: 350eb85d965ebe0f830b76a4866e2380fbc03d19bdafb5c683e5cf426fff35f4
4
+ data.tar.gz: 6be02c8f8628ea4a4c3f701fb4066d678a0237c3079245e2738380a41975dff0
5
5
  SHA512:
6
- metadata.gz: 72d8aadb1ea9454f47f4ab98dbd353c8372aa676096923c05d13d87f3b226fc7102c573bf02d563a5adbb2a072747ff5e9ea282e33cf0654ad3d3f562ebe81a5
7
- data.tar.gz: 15fe6ea35cb298337440074e188178c6fdf73a03b5104fbca92863f8863862bfbb9d8e942e0b2482394307a19061185335da442af29d878c7d98f904ee52d2ab
6
+ metadata.gz: 8d18a11bf1ee0e927651727dde99a9db70e99669c91b37e361b0c4cf1dff6d0b4aab914a63480a4db8477fe49694ab4ba74e99aad4b27f6df64e664ec3d53ca2
7
+ data.tar.gz: 0cf526b1068660ffc759b41f1f197bf85b4f1590619bd2198b6f5fb5e770d26a2c617d53d00aa475cdacfd154eab1fcc1de5ff394da4ef804873b29f5fd9794a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.2.1 (2022-10-22)
6
+
7
+ ### Type checker core
8
+
9
+ * Fix type narrowing on case-when ([#662](https://github.com/soutaro/steep/pull/662))
10
+
5
11
  ## 1.2.0 (2022-10-08)
6
12
 
7
13
  ### Commandline tool
@@ -20,8 +26,7 @@
20
26
  * Support type checking block/proc self type binding ([#637](https://github.com/soutaro/steep/pull/637))
21
27
  * Type check multiple assignment on block parameters ([#641](https://github.com/soutaro/steep/pull/641), [#643](https://github.com/soutaro/steep/pull/643))
22
28
  * Make more multiple assignments type check ([#630](https://github.com/soutaro/steep/pull/630))
23
- * Refactor *shape* calculation ([#635](https://github.com/soutaro/steep/pull/635), [#649
24
- ](https://github.com/soutaro/steep/pull/649))
29
+ * Refactor *shape* calculation ([#635](https://github.com/soutaro/steep/pull/635), [#649](https://github.com/soutaro/steep/pull/649))
25
30
  * Report type errors if argument mismatch on yield ([#640](https://github.com/soutaro/steep/pull/640))
26
31
  * Relax caching requirements to cache more results ([#651](https://github.com/soutaro/steep/pull/651))
27
32
 
data/Gemfile.lock CHANGED
@@ -1,15 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steep (1.2.0)
4
+ steep (1.2.1)
5
5
  activesupport (>= 5.1)
6
+ csv (>= 3.0.9)
7
+ fileutils (>= 1.1.0)
8
+ json (>= 2.1.0)
6
9
  language_server-protocol (>= 3.15, < 4.0)
7
10
  listen (~> 3.0)
11
+ logger (>= 1.3.0)
8
12
  parallel (>= 1.0.0)
9
13
  parser (>= 3.1)
10
14
  rainbow (>= 2.2.2, < 4.0)
11
15
  rbs (>= 2.7.0)
12
16
  securerandom (>= 0.1)
17
+ strscan (>= 1.0.0)
13
18
  terminal-table (>= 2, < 4)
14
19
 
15
20
  GEM
@@ -22,16 +27,20 @@ GEM
22
27
  tzinfo (~> 2.0)
23
28
  ast (2.4.2)
24
29
  concurrent-ruby (1.1.10)
30
+ csv (3.2.5)
25
31
  debase (0.2.5.beta2)
26
32
  debase-ruby_core_source (>= 0.10.12)
27
33
  debase-ruby_core_source (0.10.16)
28
34
  ffi (1.15.5)
35
+ fileutils (1.6.0)
29
36
  i18n (1.12.0)
30
37
  concurrent-ruby (~> 1.0)
38
+ json (2.6.2)
31
39
  language_server-protocol (3.17.0.1)
32
40
  listen (3.7.1)
33
41
  rb-fsevent (~> 0.10, >= 0.10.3)
34
42
  rb-inotify (~> 0.9, >= 0.9.10)
43
+ logger (1.5.1)
35
44
  minitest (5.16.3)
36
45
  minitest-hooks (1.5.0)
37
46
  minitest (> 5.3)
@@ -50,6 +59,7 @@ GEM
50
59
  rake (>= 0.8.1)
51
60
  securerandom (0.2.0)
52
61
  stackprof (0.2.21)
62
+ strscan (3.0.4)
53
63
  terminal-table (3.0.2)
54
64
  unicode-display_width (>= 1.1.1, < 3)
55
65
  tzinfo (2.0.5)
data/Gemfile.steep CHANGED
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'steep', '~> 1.1.0'
4
- gem "rbs", "~> 2.7.pre"
3
+ gem 'steep', '~> 1.2.0'
4
+ gem "rbs"
data/Gemfile.steep.lock CHANGED
@@ -23,15 +23,17 @@ GEM
23
23
  rb-fsevent (0.11.2)
24
24
  rb-inotify (0.10.1)
25
25
  ffi (~> 1.0)
26
- rbs (2.7.0.pre.2)
27
- steep (1.1.1)
26
+ rbs (2.7.0)
27
+ securerandom (0.2.0)
28
+ steep (1.2.0)
28
29
  activesupport (>= 5.1)
29
30
  language_server-protocol (>= 3.15, < 4.0)
30
31
  listen (~> 3.0)
31
32
  parallel (>= 1.0.0)
32
33
  parser (>= 3.1)
33
34
  rainbow (>= 2.2.2, < 4.0)
34
- rbs (>= 2.3.2)
35
+ rbs (>= 2.7.0)
36
+ securerandom (>= 0.1)
35
37
  terminal-table (>= 2, < 4)
36
38
  terminal-table (3.0.2)
37
39
  unicode-display_width (>= 1.1.1, < 3)
@@ -43,8 +45,8 @@ PLATFORMS
43
45
  arm64-darwin-21
44
46
 
45
47
  DEPENDENCIES
46
- rbs (~> 2.7.pre)
47
- steep (~> 1.1.0)
48
+ rbs
49
+ steep (~> 1.2.0)
48
50
 
49
51
  BUNDLED WITH
50
52
  2.3.15
data/Steepfile CHANGED
@@ -1,30 +1,29 @@
1
+ D = Steep::Diagnostic
2
+
1
3
  target :app do
2
4
  check "lib"
3
5
  signature "sig"
4
6
 
5
7
  collection_config "rbs_collection.steep.yaml"
6
8
 
9
+ configure_code_diagnostics do |hash| # You can setup everything yourself
10
+ hash[D::Ruby::MethodDefinitionMissing] = :hint
11
+ end
12
+
7
13
  signature "../rbs/sig", "../rbs/stdlib/rdoc/0"
8
14
  library(
9
15
  "set",
10
16
  "pathname",
11
- "json",
12
- "logger",
13
17
  "monitor",
14
18
  "tsort",
15
19
  "uri",
16
20
  'yaml',
17
- 'dbm',
18
21
  'pstore',
19
22
  'singleton',
20
23
  'shellwords',
21
- 'fileutils',
22
24
  'find',
23
25
  'digest',
24
- "strscan",
25
- "rubygems",
26
26
  "optparse",
27
- "securerandom",
28
- "csv"
27
+ "securerandom"
29
28
  )
30
29
  end
@@ -373,17 +373,41 @@ module Steep
373
373
  ]
374
374
 
375
375
  else
376
+ # There are four possible relations between `type` and `instance_type`
377
+ #
378
+ # ```ruby
379
+ # case object # object: T
380
+ # when K # K: singleton(K)
381
+ # when ...
382
+ # end
383
+ # ````
384
+ #
385
+ # 1. T <: K && K <: T (T == K, T = Integer, K = Numeric)
386
+ # 2. T <: K (example: T = Integer, K = Numeric)
387
+ # 3. K <: T (example: T = Numeric, K = Integer)
388
+ # 4. none of the above (example: T = String, K = Integer)
389
+
376
390
  relation = Subtyping::Relation.new(sub_type: type, super_type: instance_type)
377
391
  if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.new, instance_type: AST::Types::Instance.new, class_type: AST::Types::Class.new).success?
392
+ # 1 or 2. Satisfies the condition, no narrowing because `type` is already more specific than/equals to `instance_type`
378
393
  [
379
394
  [type],
380
395
  []
381
396
  ]
382
397
  else
383
- [
384
- [],
385
- [type]
386
- ]
398
+ if subtyping.check(relation.flip, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.new, instance_type: AST::Types::Instance.new, class_type: AST::Types::Class.new).success?
399
+ # 3. Satisfied the condition, narrows to `instance_type`, but cannot remove it from *falsy* list
400
+ [
401
+ [instance_type],
402
+ [type]
403
+ ]
404
+ else
405
+ # 4
406
+ [
407
+ [],
408
+ [type]
409
+ ]
410
+ end
387
411
  end
388
412
  end
389
413
  end
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -10,12 +10,16 @@ gems:
10
10
  version: '0'
11
11
  source:
12
12
  type: stdlib
13
+ - name: dbm
14
+ version: '0'
15
+ source:
16
+ type: stdlib
13
17
  - name: activesupport
14
18
  version: '6.0'
15
19
  source:
16
20
  type: git
17
21
  name: ruby/gem_rbs_collection
18
- revision: dc7059ea0cdf67f486ca9cea2b01d53f04724652
22
+ revision: 84a7431af1db405ef827bfdd171a37a1416f6099
19
23
  remote: https://github.com/ruby/gem_rbs_collection.git
20
24
  repo_dir: gems
21
25
  - name: ast
@@ -23,25 +27,41 @@ gems:
23
27
  source:
24
28
  type: git
25
29
  name: ruby/gem_rbs_collection
26
- revision: dc7059ea0cdf67f486ca9cea2b01d53f04724652
30
+ revision: 84a7431af1db405ef827bfdd171a37a1416f6099
27
31
  remote: https://github.com/ruby/gem_rbs_collection.git
28
32
  repo_dir: gems
33
+ - name: csv
34
+ version: '0'
35
+ source:
36
+ type: stdlib
37
+ - name: fileutils
38
+ version: '0'
39
+ source:
40
+ type: stdlib
29
41
  - name: i18n
30
42
  version: '1.10'
31
43
  source:
32
44
  type: git
33
45
  name: ruby/gem_rbs_collection
34
- revision: dc7059ea0cdf67f486ca9cea2b01d53f04724652
46
+ revision: 84a7431af1db405ef827bfdd171a37a1416f6099
35
47
  remote: https://github.com/ruby/gem_rbs_collection.git
36
48
  repo_dir: gems
49
+ - name: json
50
+ version: '0'
51
+ source:
52
+ type: stdlib
37
53
  - name: listen
38
54
  version: '3.2'
39
55
  source:
40
56
  type: git
41
57
  name: ruby/gem_rbs_collection
42
- revision: dc7059ea0cdf67f486ca9cea2b01d53f04724652
58
+ revision: 84a7431af1db405ef827bfdd171a37a1416f6099
43
59
  remote: https://github.com/ruby/gem_rbs_collection.git
44
60
  repo_dir: gems
61
+ - name: logger
62
+ version: '0'
63
+ source:
64
+ type: stdlib
45
65
  - name: minitest
46
66
  version: '0'
47
67
  source:
@@ -51,7 +71,7 @@ gems:
51
71
  source:
52
72
  type: git
53
73
  name: ruby/gem_rbs_collection
54
- revision: dc7059ea0cdf67f486ca9cea2b01d53f04724652
74
+ revision: 84a7431af1db405ef827bfdd171a37a1416f6099
55
75
  remote: https://github.com/ruby/gem_rbs_collection.git
56
76
  repo_dir: gems
57
77
  - name: rainbow
@@ -59,26 +79,26 @@ gems:
59
79
  source:
60
80
  type: git
61
81
  name: ruby/gem_rbs_collection
62
- revision: dc7059ea0cdf67f486ca9cea2b01d53f04724652
82
+ revision: 84a7431af1db405ef827bfdd171a37a1416f6099
63
83
  remote: https://github.com/ruby/gem_rbs_collection.git
64
84
  repo_dir: gems
65
85
  - name: securerandom
66
86
  version: '0'
67
87
  source:
68
88
  type: stdlib
69
- - name: monitor
89
+ - name: strscan
70
90
  version: '0'
71
91
  source:
72
92
  type: stdlib
73
- - name: date
93
+ - name: monitor
74
94
  version: '0'
75
95
  source:
76
96
  type: stdlib
77
- - name: singleton
97
+ - name: date
78
98
  version: '0'
79
99
  source:
80
100
  type: stdlib
81
- - name: logger
101
+ - name: singleton
82
102
  version: '0'
83
103
  source:
84
104
  type: stdlib
@@ -94,3 +114,7 @@ gems:
94
114
  version: '0'
95
115
  source:
96
116
  type: stdlib
117
+ - name: forwardable
118
+ version: '0'
119
+ source:
120
+ type: stdlib
@@ -18,3 +18,4 @@ gems:
18
18
  ignore: true
19
19
  - name: with_steep_types
20
20
  ignore: true
21
+ - name: dbm
data/steep.gemspec CHANGED
@@ -37,4 +37,9 @@ Gem::Specification.new do |spec|
37
37
  spec.add_runtime_dependency "parallel", ">= 1.0.0"
38
38
  spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
39
39
  spec.add_runtime_dependency "securerandom", ">= 0.1"
40
+ spec.add_runtime_dependency "json", ">= 2.1.0"
41
+ spec.add_runtime_dependency "logger", ">= 1.3.0"
42
+ spec.add_runtime_dependency "fileutils", ">= 1.1.0"
43
+ spec.add_runtime_dependency "strscan", ">= 1.0.0"
44
+ spec.add_runtime_dependency "csv", ">= 3.0.9"
40
45
  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.2.0
4
+ version: 1.2.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: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -154,6 +154,76 @@ dependencies:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0.1'
157
+ - !ruby/object:Gem::Dependency
158
+ name: json
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: 2.1.0
164
+ type: :runtime
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: 2.1.0
171
+ - !ruby/object:Gem::Dependency
172
+ name: logger
173
+ requirement: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: 1.3.0
178
+ type: :runtime
179
+ prerelease: false
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: 1.3.0
185
+ - !ruby/object:Gem::Dependency
186
+ name: fileutils
187
+ requirement: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: 1.1.0
192
+ type: :runtime
193
+ prerelease: false
194
+ version_requirements: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: 1.1.0
199
+ - !ruby/object:Gem::Dependency
200
+ name: strscan
201
+ requirement: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: 1.0.0
206
+ type: :runtime
207
+ prerelease: false
208
+ version_requirements: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: 1.0.0
213
+ - !ruby/object:Gem::Dependency
214
+ name: csv
215
+ requirement: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: 3.0.9
220
+ type: :runtime
221
+ prerelease: false
222
+ version_requirements: !ruby/object:Gem::Requirement
223
+ requirements:
224
+ - - ">="
225
+ - !ruby/object:Gem::Version
226
+ version: 3.0.9
157
227
  description: Gradual Typing for Ruby
158
228
  email:
159
229
  - matsumoto@soutaro.com