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

stdlib: Make the block arguments of Kernel#proc untyped #2036

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

tk0miya
Copy link
Contributor

@tk0miya tk0miya commented Sep 30, 2024

This changes the block argument of Kernel#proc to UntypedFunction. Then the arguments of the block become untyped instead of nil.

It allows users to override the type via comment annotation.

For example:

proc do |a, b, c|
  # @type var a: String
  # @type var b: Integer
  # @type var c: Symbol
end

I found this problem on the Steep repo.
https://github.com/soutaro/steep/blob/v1.8.0/lib/steep.rb#L169-L176

This changes the block argument of `Kernel#proc` to UntypedFunction.
Then the arguments of the block become untyped instead of nil.

It allows users to override the type via comment annotation.

For example:

```
proc do |a, b, c|
  # @type var a: String
  # @type var b: Integer
  # @type var c: Symbol
end
```

I found this problem on the Steep repo.
https://github.com/soutaro/steep/blob/v1.8.0/lib/steep.rb#L169-L176
@soutaro soutaro added this to the RBS 3.7 milestone Oct 4, 2024
Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@soutaro soutaro added this pull request to the merge queue Oct 4, 2024
Merged via the queue into ruby:master with commit 8f8b6db Oct 4, 2024
19 checks passed
@tk0miya tk0miya deleted the stdlib/Kernel.proc branch October 4, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants