steep 0.52.1 → 0.52.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c373c6a4366397b2b014850a8993ce6d8a0c27bcdd8bc8c5135bb64b4132b162
4
- data.tar.gz: '097245d5e3745ceb634a2f2bcd007cca0c549449c835b644feb62c23c3c6e3ed'
3
+ metadata.gz: 3c9d5eb873780b31a2431d2e6c4efdc558fbb3a4a42c08cbe2580bb191db5bc8
4
+ data.tar.gz: dee794e9cb098309b9875396ed1dc9904a4c6882aeadb27c83c26604ebcbc87d
5
5
  SHA512:
6
- metadata.gz: eadc49c7c81bce14e4e4c5f9adbcb0411669cd1f78eb290029953e26ea3997d15a65db53329124812e841f3fbe486d30f25bbf89d7bce74d528692176250c795
7
- data.tar.gz: 3257fa14e2888e68afd6266e1c1d28dc95b8ef7e1ec499393994f35cb715abfc133f005d0ce79962fc6642f7fdeb0b28c35fa0d3bb5687972ea1b31d0a9d6c38
6
+ metadata.gz: ba05f88c28a78414ffcd41744558bdea978b72621f422571cb1450b7b0d56fb77c2b65329064226863db2517d4769a6f54e7c47ce92eef59d97f0403bb9e9425
7
+ data.tar.gz: 6e260b48940214b7c0910bf2678c587b469e163e70265f197ef8fd17a1703a68fd9488c77c3d1f8254939c074281717593e49812875fb705615189cd3ec4cdf0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.52.2 (2022-05-02)
6
+
7
+ * Handle class declaration with non-const super class ([\#546](https://github.com/soutaro/steep/pull/546))
8
+ * Remove `#to_a` error message ([\#545](https://github.com/soutaro/steep/pull/545))
9
+ * Add `#filter_map` shim ([\#544](https://github.com/soutaro/steep/pull/544))
10
+
5
11
  ## 0.52.1 (2022-04-25)
6
12
 
7
13
  * Better union type inference (it type checks `Array#filter_map` now!) ([\#531](https://github.com/soutaro/steep/pull/531))
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steep (0.52.1)
4
+ steep (0.52.2)
5
5
  activesupport (>= 5.1)
6
6
  language_server-protocol (>= 3.15, < 4.0)
7
7
  listen (~> 3.0)
@@ -24,7 +24,7 @@ PATH
24
24
  GEM
25
25
  remote: https://rubygems.org/
26
26
  specs:
27
- activesupport (7.0.2.3)
27
+ activesupport (7.0.2.4)
28
28
  concurrent-ruby (~> 1.0, >= 1.0.2)
29
29
  i18n (>= 1.6, < 2)
30
30
  minitest (>= 5.1)
@@ -0,0 +1,30 @@
1
+ # Steep runs on Ruby 2.6 and it needs a shim of `filter_map`
2
+
3
+ module Shims
4
+ module EnumerableFilterMap
5
+ def filter_map(&block)
6
+ if block
7
+ result = []
8
+
9
+ each do |element|
10
+ if value = yield(element)
11
+ result << value
12
+ end
13
+ end
14
+
15
+ result
16
+ else
17
+ enum_for :filter_map
18
+ end
19
+ end
20
+ end
21
+
22
+ unless Enumerable.method_defined?(:filter_map)
23
+ Enumerable.include EnumerableFilterMap
24
+
25
+ module ::Enumerable
26
+ alias filter_map filter_map
27
+ end
28
+ end
29
+ end
30
+
@@ -1498,13 +1498,18 @@ module Steep
1498
1498
  end
1499
1499
 
1500
1500
  if super_node
1501
- _, constr, super_name = constr.synthesize_constant(super_node, super_node.children[0], super_node.children[1]) do
1502
- typing.add_error(
1503
- Diagnostic::Ruby::UnknownConstant.new(node: super_node, name: super_node.children[1]).class!
1504
- )
1505
- end
1506
- if super_name
1507
- typing.source_index.add_reference(constant: super_name, ref: super_node)
1501
+ if super_node.type == :const
1502
+ _, constr, super_name = constr.synthesize_constant(super_node, super_node.children[0], super_node.children[1]) do
1503
+ typing.add_error(
1504
+ Diagnostic::Ruby::UnknownConstant.new(node: super_node, name: super_node.children[1]).class!
1505
+ )
1506
+ end
1507
+
1508
+ if super_name
1509
+ typing.source_index.add_reference(constant: super_name, ref: super_node)
1510
+ end
1511
+ else
1512
+ _, constr = synthesize(super_node, hint: nil, condition: false)
1508
1513
  end
1509
1514
  end
1510
1515
 
@@ -3981,6 +3986,11 @@ module Steep
3981
3986
  end
3982
3987
 
3983
3988
  def try_convert(type, method)
3989
+ case type
3990
+ when AST::Types::Any, AST::Types::Bot, AST::Types::Top, AST::Types::Var
3991
+ return
3992
+ end
3993
+
3984
3994
  interface = checker.factory.interface(type, private: false)
3985
3995
  if entry = interface.methods[method]
3986
3996
  method_type = entry.method_types.find do |method_type|
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "0.52.1"
2
+ VERSION = "0.52.2"
3
3
  end
data/lib/steep.rb CHANGED
@@ -21,6 +21,8 @@ require "terminal-table"
21
21
 
22
22
  require "rbs"
23
23
 
24
+ require "steep/shims/filter_map"
25
+
24
26
  require "steep/equatable"
25
27
  require "steep/method_name"
26
28
  require "steep/ast/types/helper"
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: 0.52.1
4
+ version: 0.52.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: 2022-04-25 00:00:00.000000000 Z
11
+ date: 2022-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -248,6 +248,7 @@ files:
248
248
  - lib/steep/services/signature_service.rb
249
249
  - lib/steep/services/stats_calculator.rb
250
250
  - lib/steep/services/type_check_service.rb
251
+ - lib/steep/shims/filter_map.rb
251
252
  - lib/steep/signature/validator.rb
252
253
  - lib/steep/source.rb
253
254
  - lib/steep/subtyping/cache.rb