Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unfold type alias before splatting on block parameters #643

Merged
merged 4 commits into from
Sep 5, 2022
Merged

Conversation

soutaro
Copy link
Owner

@soutaro soutaro commented Sep 5, 2022

Steep supports block parameter auto-splat on tuples and arrays.

# @type var array: Array[[Integer, String]]
array = ...

array.each do |x, y|
  x + 1      # x is Integer
  y + ""     # y is String
end

This PR is to let the array element a type alias -- like Array[pair] where type pair = [Integer, String].

Note that this doesn't support #to_ary conversion, or the case the argument is a subclass of Array.

@soutaro soutaro enabled auto-merge September 5, 2022 01:20
@soutaro soutaro merged commit 32d2ae4 into master Sep 5, 2022
@soutaro soutaro deleted the unfold-alias branch September 5, 2022 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant