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

Variadic arguments don't work in some scenarios #480

Closed
jaredoconnor opened this issue Jan 7, 2022 · 1 comment
Closed

Variadic arguments don't work in some scenarios #480

jaredoconnor opened this issue Jan 7, 2022 · 1 comment

Comments

@jaredoconnor
Copy link

jaredoconnor commented Jan 7, 2022

Working Example

class MyVariadicClass
  def my_method required, *variadic
  end
end
class MyOptionalClass
  def my_method required, optional: ''
  end
end
class MyVariadicClass
  def my_method: (String required, *String variadic) -> void
end
class MyOptionalClass
  def my_method: (String required, ?optional: String) -> void
end

Failing Example

class MyClass
  def my_method required, *variadic, optional: ''
  end
end
class MyClass
  def my_method: (String required, *String variadic, ?optional: String) -> void
end
demo/commands.rb:12:16: [error] Method parameters are incompatible with declaration `(::String, *::String, ?optional: ::String) -> void`
│ Diagnostic ID: Ruby::MethodArityMismatch
│
└   def my_method required, *variadic, optional: ''
@soutaro
Copy link
Owner

soutaro commented Jun 11, 2022

An improvement ships with 1.0.0 related to this. #552

@soutaro soutaro closed this as completed Jun 11, 2022
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

No branches or pull requests

2 participants