steep 1.10.0.pre.2 → 1.10.0.pre.3
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 +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/steep/source.rb +1 -1
- data/lib/steep/type_construction.rb +20 -6
- data/lib/steep/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f331bc22e08a6a06be70e413f4eb99361a2c868d6f38f1d4f05fc21778fc21
|
4
|
+
data.tar.gz: 3c6a8f14f8596926d4add8de3f7cdc72c27c6a47d90faadae4e4485c1f241dbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e89df803b5c799cb50eb4a2e115f9dd189addfda847facfc87538a6cd46dd99fc87cff71a7c7939f97cce05a1e8b123b3ac289540c96ef6f23595bd2bea8a0a
|
7
|
+
data.tar.gz: 2e1844ebaf2e597b57bccf1b65bc3a97708e1f5b964daeb609fc4f692e4c92f64ca27f767ea4ac89178484c8ce8ca6d593d74117dfaff82dcf664874ca1495aa
|
data/CHANGELOG.md
CHANGED
data/lib/steep/source.rb
CHANGED
@@ -257,7 +257,7 @@ module Steep
|
|
257
257
|
annot.line or next
|
258
258
|
|
259
259
|
case node.type
|
260
|
-
when :def, :module, :class, :block, :ensure, :defs, :resbody
|
260
|
+
when :def, :module, :class, :block, :numblock, :ensure, :defs, :resbody
|
261
261
|
location = node.loc
|
262
262
|
location.line <= annot.line && annot.line < location.last_line
|
263
263
|
else
|
@@ -3108,7 +3108,7 @@ module Steep
|
|
3108
3108
|
body_node,
|
3109
3109
|
block_params: params,
|
3110
3110
|
block_param_hint: params_hint,
|
3111
|
-
|
3111
|
+
block_next_type: return_hint,
|
3112
3112
|
block_block_hint: block_hint,
|
3113
3113
|
block_annotations: block_annotations,
|
3114
3114
|
block_self_hint: self_hint,
|
@@ -4064,7 +4064,7 @@ module Steep
|
|
4064
4064
|
block_body,
|
4065
4065
|
block_params: block_params_,
|
4066
4066
|
block_param_hint: method_type.block.type.params,
|
4067
|
-
|
4067
|
+
block_next_type: method_type.block.type.return_type,
|
4068
4068
|
block_block_hint: nil,
|
4069
4069
|
block_annotations: block_annotations,
|
4070
4070
|
block_self_hint: method_type.block.self_type,
|
@@ -4435,7 +4435,7 @@ module Steep
|
|
4435
4435
|
block_body,
|
4436
4436
|
block_params: block_params,
|
4437
4437
|
block_param_hint: nil,
|
4438
|
-
|
4438
|
+
block_next_type: nil,
|
4439
4439
|
block_block_hint: nil,
|
4440
4440
|
block_annotations: block_annotations,
|
4441
4441
|
block_self_hint: nil,
|
@@ -4488,7 +4488,7 @@ module Steep
|
|
4488
4488
|
end
|
4489
4489
|
end
|
4490
4490
|
|
4491
|
-
def for_block(body_node, block_params:, block_param_hint:,
|
4491
|
+
def for_block(body_node, block_params:, block_param_hint:, block_next_type:, block_block_hint:, block_annotations:, node_type_hint:, block_self_hint:)
|
4492
4492
|
block_param_pairs = block_param_hint && block_params.zip(block_param_hint, block_block_hint, factory: checker.factory)
|
4493
4493
|
|
4494
4494
|
# @type var param_types_hash: Hash[Symbol?, AST::Types::t]
|
@@ -4577,11 +4577,11 @@ module Steep
|
|
4577
4577
|
end
|
4578
4578
|
|
4579
4579
|
block_context = TypeInference::Context::BlockContext.new(
|
4580
|
-
body_type: block_annotations.block_type
|
4580
|
+
body_type: block_annotations.block_type
|
4581
4581
|
)
|
4582
4582
|
break_context = TypeInference::Context::BreakContext.new(
|
4583
4583
|
break_type: break_type || AST::Builtin.any_type,
|
4584
|
-
next_type:
|
4584
|
+
next_type: block_next_type || AST::Builtin.any_type
|
4585
4585
|
)
|
4586
4586
|
|
4587
4587
|
self_type = block_self_hint || self.self_type
|
@@ -4623,6 +4623,20 @@ module Steep
|
|
4623
4623
|
if block_body
|
4624
4624
|
body_type, _, context = synthesize(block_body, hint: block_context&.body_type || block_type_hint)
|
4625
4625
|
|
4626
|
+
if annotated_body_type = block_context&.body_type
|
4627
|
+
if result = no_subtyping?(sub_type: body_type, super_type: annotated_body_type)
|
4628
|
+
typing.add_error(
|
4629
|
+
Diagnostic::Ruby::BlockBodyTypeMismatch.new(
|
4630
|
+
node: node,
|
4631
|
+
expected: annotated_body_type,
|
4632
|
+
actual: body_type,
|
4633
|
+
result: result
|
4634
|
+
)
|
4635
|
+
)
|
4636
|
+
end
|
4637
|
+
body_type = annotated_body_type
|
4638
|
+
end
|
4639
|
+
|
4626
4640
|
range = block_body.loc.expression.end_pos..node.loc.end.begin_pos
|
4627
4641
|
typing.cursor_context.set(range, context)
|
4628
4642
|
|
data/lib/steep/version.rb
CHANGED