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

Unexpected MethodParameterMismatch with positional argument after optional argument #1172

Open
pocke opened this issue Jun 14, 2024 · 0 comments · May be fixed by #1270
Open

Unexpected MethodParameterMismatch with positional argument after optional argument #1172

pocke opened this issue Jun 14, 2024 · 0 comments · May be fixed by #1270

Comments

@pocke
Copy link
Contributor

pocke commented Jun 14, 2024

Steep raises an error with the following RBS and Ruby files.

test.rbs

class C
  def f: (?untyped a, untyped b) -> void
end

test.rb

class C
  def f(a = nil, b)
  end
end
$ bundle exec steep --version
1.7.1

$ bundle exec steep check
# Type checking files:

...................................F.................................................

test.rb:2:17: [error] The method parameter is incompatible with the declaration `(?untyped) -> void`
│ Diagnostic ID: Ruby::MethodParameterMismatch

└   def f(a = nil, b)
                   ~

Detected 1 problem from 1 file

I expect that it does not raise any error, but Steep displays an error.
The error message says the type of method f is (?untyped) -> void. Probably Steep ignores the positional argument after an optional argument.

tk0miya added a commit to tk0miya/steep that referenced this issue Oct 8, 2024
@tk0miya tk0miya linked a pull request Oct 8, 2024 that will close this issue
tk0miya added a commit to tk0miya/steep that referenced this issue Oct 8, 2024
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 a pull request may close this issue.

1 participant