steep 1.7.0.dev.1 → 1.7.0.dev.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: 7e08a21c496335ac125c03ae833cd7a18383c3e21e963bd809c349e04b3549cb
4
- data.tar.gz: 49e9eb2a8e00788bf3b5dea25617af75b51b5f9c69582dd13553e8c1f24d8ea0
3
+ metadata.gz: 0646b6c1cb596e684bc62461ee2dac160e134bc7e126f447df8f6e46a535c8b6
4
+ data.tar.gz: fda1f8d1903253537fec79679dd88f3579404372d4fc611a0d4b9d085e5b3502
5
5
  SHA512:
6
- metadata.gz: 6a6c44532ff30efa59ba74ff506319a446333a265a43e27e0d1a39dc49ab06018b6b4feab9952d4597451b274b3033be016c505d49e5be4977c00a4350a8fd2f
7
- data.tar.gz: d19406af1b45c773305a642a2da22c9a1beed54129eb1f0826385bfa895a17717cbdb351d9b2434aeec49d4324e6cd818cf9ef45ccf1c218eae21e53e15a1ab9
6
+ metadata.gz: 46fe48e86a4fe74482765debeb255e1b806298fb797603ebf292443432506e80ac7ffb7aa964b6331e4f71d2f4e607379340834a6f66866d75bc8c0ca4b73633
7
+ data.tar.gz: c822e0bf8a0484914423ece12d3d38bebf4102d6f63b1eb79f779cc3bf8aa9b909d34b189a594cf5d0a4f607ed0474d7b9bb2ed6a6c6d400212e329f4d5a8e96
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steep (1.7.0.dev.1)
4
+ steep (1.7.0.dev.2)
5
5
  activesupport (>= 5.1)
6
6
  concurrent-ruby (>= 1.1.10)
7
7
  csv (>= 3.0.9)
@@ -21,7 +21,7 @@ GEM
21
21
  remote: https://rubygems.org/
22
22
  specs:
23
23
  abbrev (0.1.2)
24
- activesupport (7.1.3)
24
+ activesupport (7.1.3.2)
25
25
  base64
26
26
  bigdecimal
27
27
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -56,7 +56,7 @@ GEM
56
56
  rb-fsevent (~> 0.10, >= 0.10.3)
57
57
  rb-inotify (~> 0.9, >= 0.9.10)
58
58
  logger (1.6.0)
59
- minitest (5.21.2)
59
+ minitest (5.22.2)
60
60
  minitest-hooks (1.5.1)
61
61
  minitest (> 5.3)
62
62
  minitest-slow_test (0.2.0)
@@ -73,7 +73,7 @@ GEM
73
73
  rb-fsevent (0.11.2)
74
74
  rb-inotify (0.10.1)
75
75
  ffi (~> 1.0)
76
- rbs (3.4.3)
76
+ rbs (3.4.4)
77
77
  abbrev
78
78
  rdoc (6.6.2)
79
79
  psych (>= 4.0.0)
@@ -83,7 +83,7 @@ GEM
83
83
  securerandom (0.3.1)
84
84
  stackprof (0.2.26)
85
85
  stringio (3.1.0)
86
- strscan (3.0.9)
86
+ strscan (3.1.0)
87
87
  terminal-table (3.0.2)
88
88
  unicode-display_width (>= 1.1.1, < 3)
89
89
  tzinfo (2.0.6)
data/Rakefile CHANGED
@@ -188,6 +188,11 @@ NOTES
188
188
  milestone = "Steep #{major}.#{minor}.x"
189
189
  end
190
190
 
191
+ if pre =~ /dev/
192
+ puts "🔍 Skipping `Released` tags because `dev` release: `#{pre}`"
193
+ next
194
+ end
195
+
191
196
  puts "🔍 Finding pull requests that is associated to milestone `#{milestone}`..."
192
197
 
193
198
  command = [
@@ -1,3 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'steep', require: false
3
+ gem 'steep', "~> 1.7.0.dev", require: false
@@ -30,7 +30,7 @@ GEM
30
30
  rb-fsevent (~> 0.10, >= 0.10.3)
31
31
  rb-inotify (~> 0.9, >= 0.9.10)
32
32
  logger (1.6.0)
33
- minitest (5.21.2)
33
+ minitest (5.22.2)
34
34
  mutex_m (0.2.0)
35
35
  parser (3.3.0.5)
36
36
  ast (~> 2.4.1)
@@ -40,11 +40,11 @@ GEM
40
40
  rb-fsevent (0.11.2)
41
41
  rb-inotify (0.10.1)
42
42
  ffi (~> 1.0)
43
- rbs (3.4.3)
43
+ rbs (3.4.4)
44
44
  abbrev
45
45
  ruby2_keywords (0.0.5)
46
46
  securerandom (0.3.1)
47
- steep (1.6.0)
47
+ steep (1.7.0.dev.1)
48
48
  activesupport (>= 5.1)
49
49
  concurrent-ruby (>= 1.1.10)
50
50
  csv (>= 3.0.9)
@@ -59,7 +59,7 @@ GEM
59
59
  securerandom (>= 0.1)
60
60
  strscan (>= 1.0.0)
61
61
  terminal-table (>= 2, < 4)
62
- strscan (3.0.9)
62
+ strscan (3.1.0)
63
63
  terminal-table (3.0.2)
64
64
  unicode-display_width (>= 1.1.1, < 3)
65
65
  tzinfo (2.0.6)
@@ -73,7 +73,7 @@ PLATFORMS
73
73
  x86_64-linux
74
74
 
75
75
  DEPENDENCIES
76
- steep
76
+ steep (~> 1.7.0.dev)
77
77
 
78
78
  BUNDLED WITH
79
79
  2.3.15
@@ -175,18 +175,20 @@ module Steep
175
175
  when :splat
176
176
  method_type.type.required_positionals.size + method_type.type.optional_positionals.size if method_type.type.rest_positionals
177
177
  when :kwargs
178
- case argument_nodes[-3].type
179
- when :pair
180
- argname = argument_nodes[-3].children.first.children.first
181
- if method_type.type.required_keywords.key?(argname)
182
- positionals + method_type.type.required_keywords.keys.index(argname).to_i
183
- elsif method_type.type.optional_keywords.key?(argname)
184
- positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.keys.index(argname).to_i
185
- elsif method_type.type.rest_keywords
186
- positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size
178
+ if argument_nodes[-3]
179
+ case argument_nodes[-3].type
180
+ when :pair
181
+ argname = argument_nodes[-3].children.first.children.first
182
+ if method_type.type.required_keywords.key?(argname)
183
+ positionals + method_type.type.required_keywords.keys.index(argname).to_i
184
+ elsif method_type.type.optional_keywords.key?(argname)
185
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.keys.index(argname).to_i
186
+ elsif method_type.type.rest_keywords
187
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size
188
+ end
189
+ when :kwsplat
190
+ positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size if method_type.type.rest_keywords
187
191
  end
188
- when :kwsplat
189
- positionals + method_type.type.required_keywords.size + method_type.type.optional_keywords.size if method_type.type.rest_keywords
190
192
  end
191
193
  else
192
194
  pos = (node.children[2...] || raise).index { |c| c.location == argument_nodes[-2].location }.to_i
@@ -1,6 +1,8 @@
1
1
  module Steep
2
2
  module Subtyping
3
3
  class Check
4
+ ABORT_LIMIT = ENV.fetch("STEEP_SUBTYPING_ABORT_LIMIT", 50).to_i
5
+
4
6
  attr_reader :builder
5
7
  attr_reader :cache
6
8
 
@@ -187,6 +189,10 @@ module Steep
187
189
  end
188
190
 
189
191
  def check_type(relation)
192
+ if assumptions.size > ABORT_LIMIT
193
+ return Failure(relation, Result::Failure::LoopAbort.new)
194
+ end
195
+
190
196
  relation.type!
191
197
 
192
198
  Steep.logger.tagged "#{relation.sub_type} <: #{relation.super_type}" do
@@ -269,6 +269,12 @@ module Steep
269
269
  end
270
270
  end
271
271
 
272
+ class LoopAbort
273
+ def message
274
+ "Detected infinite loop with limit of `#{Check::ABORT_LIMIT}`; specify $STEEP_SUBTYPING_ABORT_LIMIT env var to override the limit."
275
+ end
276
+ end
277
+
272
278
  attr_reader :error
273
279
 
274
280
  def initialize(relation, error)
@@ -3622,10 +3622,6 @@ module Steep
3622
3622
  end
3623
3623
  end
3624
3624
 
3625
- def inspect
3626
- "#<#{self.class}>"
3627
- end
3628
-
3629
3625
  def with_child_typing(range:)
3630
3626
  constr = with_new_typing(typing.new_child(range))
3631
3627
 
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.7.0.dev.1"
2
+ VERSION = "1.7.0.dev.2"
3
3
  end
@@ -1,6 +1,8 @@
1
1
  module Steep
2
2
  module Subtyping
3
3
  class Check
4
+ ABORT_LIMIT: Integer
5
+
4
6
  attr_reader builder: Interface::Builder
5
7
 
6
8
  attr_reader cache: Cache
@@ -81,7 +81,7 @@ module Steep
81
81
  class Failure < Base
82
82
  type error = MethodMissingError | BlockMismatchError | ParameterMismatchError
83
83
  | UnknownPairError | PolyMethodSubtyping | UnsatisfiedConstraints
84
- | SelfBindingMismatch
84
+ | SelfBindingMismatch | LoopAbort
85
85
 
86
86
  class MethodMissingError
87
87
  attr_reader name: untyped
@@ -145,6 +145,10 @@ module Steep
145
145
  def message: () -> String
146
146
  end
147
147
 
148
+ class LoopAbort
149
+ def message: () -> String
150
+ end
151
+
148
152
  attr_reader error: error
149
153
 
150
154
  def initialize: (Relation[untyped] relation, error error) -> void
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.7.0.dev.1
4
+ version: 1.7.0.dev.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-01-30 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -503,7 +503,6 @@ files:
503
503
  - sig/steep/thread_waiter.rbs
504
504
  - sig/steep/type_construction.rbs
505
505
  - sig/steep/type_inference/block_params.rbs
506
- - sig/steep/type_inference/branch.rbs
507
506
  - sig/steep/type_inference/case_when.rbs
508
507
  - sig/steep/type_inference/constant_env.rbs
509
508
  - sig/steep/type_inference/context.rbs
@@ -1,15 +0,0 @@
1
- use Steep::TypeConstruction::Pair, Steep::TypeInference::LogicTypeInterpreter::Result
2
-
3
- module Steep
4
- module TypeInference
5
- class Branch
6
- attr_reader start_env: TypeEnv
7
-
8
- def initialize: (TypeEnv start_env) -> void
9
-
10
- def add_branch: () { (TypeEnv) -> [Result, Pair] } -> void
11
-
12
-
13
- end
14
- end
15
- end