steep 1.6.0.pre.1 → 1.6.0.pre.2

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: d8a5efa97a65add83ffc658ddfbdf9a436accc8dd4472969610b2224140543ea
4
- data.tar.gz: 537d28e28ae6b3bc47392170948db46d3d7fa50d61f6f274182b922a253394ea
3
+ metadata.gz: 7a94bcc44621f7c597278fe70c9a9f909983408b8f02fae8ba400b8193f88918
4
+ data.tar.gz: 32381468ac551d739b2ab84c70a5bfb0ea30265ca66ab3020f8eb3a99b53b2ba
5
5
  SHA512:
6
- metadata.gz: 386ddbecc785a37748b8a6d9dcf514af55cec3bcafca945e363d5e76e56fd266cd91238183b3c99635595168b0049e93b065f3154569d10909c2ecd6ccdd9519
7
- data.tar.gz: 15a3baf8009e78767015a4529f71b20300edc221aaf0b218efdee5a894f73d619d2c3078c68f4e3511bec4dbb67aece479e9a95c6b1ae1fb9066da86094fc810
6
+ metadata.gz: 02bb300d0a9f42ccf368a32f8b6161eb6332433b5a68d6f9e75158d52cfe9ea19b67aba437b31000817b21b009e78f46633c5b7745157f32520deb711dcdbeb8
7
+ data.tar.gz: 367df39a6e217e6c962d4eee1d38a0d1f8e55833190375ce3e17d2b11f2a049e9e8ce78e6fdfb14db5d69c917f4f6ff4460ffb2d50197325f8dc0433bfd4149f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.6.0.pre.2 (2023-10-31)
6
+
7
+ ### Type checker core
8
+
9
+ * Assign types on method calls in mlhs node ([#951](https://github.com/soutaro/steep/pull/951))
10
+ * Change severity of block diagnostics ([#950](https://github.com/soutaro/steep/pull/950))
11
+
12
+ ### Commandline tool
13
+
14
+ * Match with `**` in pattern ([#949](https://github.com/soutaro/steep/pull/949))
15
+
5
16
  ## 1.6.0.pre.1 (2023-10-27)
6
17
 
7
18
  ### 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.1)
4
+ steep (1.6.0.pre.2)
5
5
  activesupport (>= 5.1)
6
6
  concurrent-ruby (>= 1.1.10)
7
7
  csv (>= 3.0.9)
@@ -68,7 +68,7 @@ GEM
68
68
  stringio
69
69
  racc (1.7.1)
70
70
  rainbow (3.1.1)
71
- rake (13.0.6)
71
+ rake (13.1.0)
72
72
  rb-fsevent (0.11.2)
73
73
  rb-inotify (0.10.1)
74
74
  ffi (~> 1.0)
@@ -1013,8 +1013,8 @@ module Steep
1013
1013
  @default ||= _ = all_error.merge(
1014
1014
  {
1015
1015
  ArgumentTypeMismatch => :error,
1016
- BlockBodyTypeMismatch => :hint,
1017
- BlockTypeMismatch => :hint,
1016
+ BlockBodyTypeMismatch => :warning,
1017
+ BlockTypeMismatch => :warning,
1018
1018
  BreakTypeMismatch => :hint,
1019
1019
  DifferentMethodParameterKind => :hint,
1020
1020
  FallbackAny => :hint,
@@ -1129,8 +1129,8 @@ module Steep
1129
1129
  @lenient ||= _ = all_error.merge(
1130
1130
  {
1131
1131
  ArgumentTypeMismatch => :information,
1132
- BlockBodyTypeMismatch => :hint,
1133
- BlockTypeMismatch => :hint,
1132
+ BlockBodyTypeMismatch => :information,
1133
+ BlockTypeMismatch => :information,
1134
1134
  BreakTypeMismatch => :hint,
1135
1135
  DifferentMethodParameterKind => nil,
1136
1136
  FallbackAny => nil,
@@ -48,7 +48,7 @@ module Steep
48
48
  string = path.to_s
49
49
  extension = path.extname
50
50
 
51
- patterns.any? {|pat| File.fnmatch(pat, string) } ||
51
+ patterns.any? {|pat| File.fnmatch(pat, string, File::FNM_PATHNAME) } ||
52
52
  prefixes.any? {|prefix| string.start_with?(prefix) && extension == ext }
53
53
  end
54
54
  end
@@ -663,7 +663,7 @@ module Steep
663
663
  if parent
664
664
  case parent.type
665
665
  when :const
666
- const_name = typing.source_index.reference(constant_node: parent)
666
+ const_name = typing.source_index.reference(constant_node: parent) or raise "Unknown node in source_index: #{parent}"
667
667
  consts = context.type_env.constant_env.children(const_name)
668
668
  end
669
669
  else
@@ -2908,6 +2908,8 @@ module Steep
2908
2908
  _, constr = constr.gvasgn(asgn_node, type)
2909
2909
  when :mlhs
2910
2910
  constr = (constr.type_masgn_type(asgn_node, type, masgn: masgn, optional: optional) or return)
2911
+ else
2912
+ _, constr = constr.synthesize_children(asgn_node).add_typing(asgn_node, type: AST::Builtin.any_type)
2911
2913
  end
2912
2914
 
2913
2915
  if node.type == :splat
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.6.0.pre.1"
2
+ VERSION = "1.6.0.pre.2"
3
3
  end
@@ -1,22 +1,44 @@
1
1
  module Steep
2
2
  class Project
3
+ # `Pattern` class represents a pair of *positive* and *negative* patterns that may match with a pathname
4
+ #
5
+ # ```rb
6
+ # pat = Pattern.new(patterns: ["app/models"], ignores: ["app/models/account.rb"], ext: ".rbs")
7
+ #
8
+ # pat =~ "app/models/group.rb" # => true
9
+ # pat =~ "app/models/account.rb" # => false
10
+ # ```
11
+ #
12
+ # The pattern may be:
13
+ #
14
+ # 1. Directory name pattern -- `lib`, or
15
+ # 2. *Glob* pattern -- `foo/**/bar.rb`
16
+ #
3
17
  class Pattern
18
+ # Positive patterns, which is tested with `fnmatch`
4
19
  attr_reader patterns: Array[String]
5
20
 
21
+ # Negative patterns, which is tested with `fnmatch`
6
22
  attr_reader ignores: Array[String]
7
23
 
24
+ # Positive *dir name* pattern constructed from `#patterns`, which is tested with `start_with?`
8
25
  attr_reader prefixes: Array[String]
9
26
 
27
+ # Negative *dir name* pattern constructed from `#ignores`, which is tested with `start_with?`
10
28
  attr_reader ignore_prefixes: Array[String]
11
29
 
12
30
  attr_reader ext: String
13
31
 
14
32
  def initialize: (patterns: Array[String], ext: String, ?ignores: Array[String]) -> void
15
33
 
34
+ # Returns `true` if given path matches to *positive* pattern, but doesn't match to *negative* pattern
35
+ #
16
36
  def =~: (Pathname | String path) -> bool
17
37
 
38
+ # Returns true if given `Pathname` matches to *positive* pattern
18
39
  def match?: (Pathname path) -> bool
19
40
 
41
+ # Returns true if given `Pathname` matches to *negative* pattern
20
42
  def ignore?: (Pathname path) -> bool
21
43
 
22
44
  def test_string: (Pathname path, Array[String] patterns, Array[String] prefixes) -> bool
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.1
4
+ version: 1.6.0.pre.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: 2023-10-27 00:00:00.000000000 Z
11
+ date: 2023-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser