steep 1.10.0.pre.1 → 1.10.0.pre.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: 2233f51ac985ee697a7f3617582dc034f32b1cd3b0732a87b8184210f2c1d7b0
4
- data.tar.gz: 1298685cafa59f5074afa950df4c1f14cff9a8b6be9b99b914902b37e537aad3
3
+ metadata.gz: 8dd3b63cbd4f85f05eb3643505e5bff6c4a6d6a1384959c3a0660153030e9449
4
+ data.tar.gz: b4afe185ffc5f9e0907e97b2f6a60638b887dcecb8b8b57992d8a652b63d94f7
5
5
  SHA512:
6
- metadata.gz: 1cb518e2f5743330e58b0c6032ed99d22f29254b91d9c8e33e3bafc3cb1a9f46247f181ee5b9b078dba13768f675f03b1c2e8fb24b53609902d6534092625282
7
- data.tar.gz: e26fde370f8d793b13138d71dc6295ffde59e781ed2d0a39cf73e639c8440517d7fa13586d871c9eab6880ae8864c31a711beb45c49280152416d0111935f3da
6
+ metadata.gz: 2060d786b8adf7d3876f3168f3fea26e999f6f4445cf8c109032e73ddcb99f2e4483706a4aedd1a61a9eb480cb9f42bcaea941f41d9ea9f843b84bcfa7cef3da
7
+ data.tar.gz: 875d9870e9c6082b428636b9e70c9e794008feb35b25a040aa608893e70bac5021f5cd4f0d9b44064f07851c134b17a148377906df0e90c547cf8359b01e9972
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.10.0.pre.2 (2025-03-14)
4
+
5
+ ### Type checker core
6
+
7
+ * Fix `self` type handling at block-self-hint ([#1531](https://github.com/soutaro/steep/pull/1531))
8
+ * Delay type variable resolution on method call with blocks ([#1530](https://github.com/soutaro/steep/pull/1530))
9
+ * Fix type checking block calls on `untyped` receiver ([#1528](https://github.com/soutaro/steep/pull/1528))
10
+ * Catch the message of VariableDuplicationError ([#1521](https://github.com/soutaro/steep/pull/1521))
11
+
3
12
  ## 1.10.0.pre.1 (2025-03-11)
4
13
 
5
14
  ### Type checker core
data/Rakefile CHANGED
@@ -224,3 +224,26 @@ NOTES
224
224
  end
225
225
  end
226
226
  end
227
+
228
+ namespace :rbs do
229
+ task :watch do
230
+ require "listen"
231
+ listener = Listen.to('test') do |modified, added, removed|
232
+ paths = (modified + added).map do
233
+ Pathname(_1).relative_path_from(Pathname.pwd)
234
+ end
235
+ sh "rbs-inline", "--opt-out", "--output=sig", *paths.map(&:to_s)
236
+ end
237
+ listener.start
238
+ begin
239
+ sleep
240
+ rescue Interrupt
241
+ listener.stop
242
+ end
243
+ end
244
+
245
+ task :generate do
246
+ sh "rbs-inline --opt-out --output=sig test"
247
+ sh "rbs-inline --opt-out --output=tmp/rbs-inline bin/generate-diagnostics-docs.rb"
248
+ end
249
+ end
@@ -273,6 +273,30 @@ module Steep
273
273
  end
274
274
  end
275
275
 
276
+ class VariableDuplicationError < Base
277
+ attr_reader :type_name
278
+ attr_reader :variable_name
279
+ attr_reader :location
280
+
281
+ def initialize(type_name:, variable_name:, location:)
282
+ @type_name = type_name
283
+ @variable_name = variable_name
284
+ @location = location
285
+ end
286
+ end
287
+
288
+ class InstanceVariableDuplicationError < VariableDuplicationError
289
+ def header_line
290
+ "Duplicated instance variable name `#{variable_name}` in `#{type_name}`"
291
+ end
292
+ end
293
+
294
+ class ClassInstanceVariableDuplicationError < VariableDuplicationError
295
+ def header_line
296
+ "Duplicated class instance variable name `#{variable_name}` in `#{type_name}`"
297
+ end
298
+ end
299
+
276
300
  class ClassVariableDuplicationError < Base
277
301
  attr_reader :class_name
278
302
  attr_reader :other_class_name
@@ -581,6 +605,10 @@ module Steep
581
605
  Diagnostic::Signature::CyclicClassAliasDefinitionError.new(decl: error.alias_entry.decl)
582
606
  when RBS::TypeParamDefaultReferenceError
583
607
  Diagnostic::Signature::TypeParamDefaultReferenceError.new(error.type_param, location: error.location)
608
+ when RBS::InstanceVariableDuplicationError
609
+ Diagnostic::Signature::InstanceVariableDuplicationError.new(type_name: error.type_name, variable_name: error.variable_name, location: error.location)
610
+ when RBS::ClassInstanceVariableDuplicationError
611
+ Diagnostic::Signature::ClassInstanceVariableDuplicationError.new(type_name: error.type_name, variable_name: error.variable_name, location: error.location)
584
612
  else
585
613
  raise error
586
614
  end
@@ -3458,7 +3458,7 @@ module Steep
3458
3458
  block_annotations = source.annotations(block: node, factory: checker.factory, context: nesting)
3459
3459
  block_params or raise
3460
3460
 
3461
- constr = constr.synthesize_children(node.children[0])
3461
+ constr = constr.synthesize_children(node.children[0], skips: [receiver])
3462
3462
 
3463
3463
  constr.type_block_without_hint(
3464
3464
  node: node,
@@ -4119,6 +4119,15 @@ module Steep
4119
4119
 
4120
4120
  fvs_.merge(method_type.type.params.free_variables) if method_type.type.params
4121
4121
  fvs_.merge(method_type.block.type.params.free_variables) if method_type.block.type.params
4122
+ (method_type.type.return_type.free_variables + method_type.block.type.return_type.free_variables).each do |var|
4123
+ if var.is_a?(Symbol)
4124
+ if constraints.unknown?(var)
4125
+ unless constraints.has_constraint?(var)
4126
+ fvs_.delete(var)
4127
+ end
4128
+ end
4129
+ end
4130
+ end
4122
4131
 
4123
4132
  constraints.solution(checker, variables: fvs_, context: ccontext)
4124
4133
  }
@@ -4130,7 +4139,7 @@ module Steep
4130
4139
  block_constr = block_constr.update_type_env {|env| env.subst(s) }
4131
4140
  block_constr = block_constr.update_context {|context|
4132
4141
  context.with(
4133
- self_type: method_type.block.self_type || context.self_type,
4142
+ self_type: context.self_type.subst(s),
4134
4143
  type_env: context.type_env.subst(s),
4135
4144
  block_context: context.block_context&.subst(s),
4136
4145
  break_context: context.break_context&.subst(s)
@@ -4575,12 +4584,11 @@ module Steep
4575
4584
  next_type: block_context.body_type || AST::Builtin.any_type
4576
4585
  )
4577
4586
 
4578
- self_type = block_annotations.self_type || block_self_hint || self.self_type
4587
+ self_type = block_self_hint || self.self_type
4579
4588
  module_context = self.module_context
4580
4589
 
4581
4590
  if implements = block_annotations.implement_module_annotation
4582
4591
  module_context = default_module_context(implements.name, nesting: nesting)
4583
-
4584
4592
  self_type = module_context.module_type
4585
4593
  end
4586
4594
 
@@ -4588,6 +4596,11 @@ module Steep
4588
4596
  self_type = annotation_self_type
4589
4597
  end
4590
4598
 
4599
+ # self_type here means the top-level `self` type because of the `Interface::Builder` implementation
4600
+ if self_type
4601
+ self_type = expand_self(self_type)
4602
+ end
4603
+
4591
4604
  self.class.new(
4592
4605
  checker: checker,
4593
4606
  source: source,
@@ -155,6 +155,10 @@ module Steep
155
155
  @type_env = type_env
156
156
  @call_context = call_context
157
157
  @variable_context = variable_context
158
+
159
+ if self_type.free_variables.include?(AST::Types::Self.instance)
160
+ raise "Context#self_type cannot contain `self`"
161
+ end
158
162
  end
159
163
 
160
164
  def with(method_context: self.method_context,
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.10.0.pre.1"
2
+ VERSION = "1.10.0.pre.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0.pre.1
4
+ version: 1.10.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-11 00:00:00.000000000 Z
10
+ date: 2025-03-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: parser