-
Notifications
You must be signed in to change notification settings - Fork 215
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
NoMethodError: undefined method `required_positionals' #2025
Comments
Related issue on Ruby LSP which seems to be caused because of this: Shopify/ruby-lsp#2630 |
module Domainic
module Type
module DSL
class ParameterBuilder
...
def coercer: (?(Proc | Symbol)? proc_or_symbol) { (?) -> void } -> self
alias coerce coercer
def define: (String | Symbol parameter_name) ?{ (self) -> self } -> self
...
end
end
end
end class ParameterBuilder
...
def define(parameter_name, &)
@current_parameter = @data[parameter_name.to_sym] ||=
PARAMETER_DEFAULTS.transform_values { |value| value == UNSPECIFIED ? value : value.dup } .merge(name: parameter_name.to_sym)
instance_exec(&) if block_given?
self
end
...
end class BaseConstraint
def parameter(parameter_name, &)
parameter_builder.define(parameter_name, &).build!
end
end # This spec passes without signatures
it 'defines coercers for the parameter' do
coercer = ->(value) { value.to_s }
constraint_class.parameter(parameter_name) do
coercer coercer
end
parameter = constraint_class.parameters.public_send(parameter_name)
expect(parameter.instance_variable_get(:@coercers)).to include(coercer)
end 1) Domainic::Type::Constraint::BaseConstraint.parameter defines coercers for the parameter
Failure/Error:
constraint_class.parameter(parameter_name) do
coercer coercer
end
RBS::Test::Tester::TypeError:
TypeError: [Domainic::Type::Constraint::BaseConstraint.parameter] BlockArgumentError: expected method type (::String | ::Symbol parameter_name) ?{ (::Domainic::Type::DSL::ParameterBuilder) -> ::Domainic::Type::DSL::ParameterBuilder } -> void
# ./domainic-type/spec/domainic/type/constraint/base_constraint_spec.rb:25:in `block (3 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# NoMethodError:
# undefined method `coercer' for #<RSpec::ExampleGroups::DomainicTypeConstraintBaseConstraint::Parameter "defines coercers for the parameter" (./domainic-type/spec/domainic/type/constraint/base_constraint_spec.rb:23)>
# ./domainic-type/spec/domainic/type/constraint/base_constraint_spec.rb:26:in `block (4 levels) in <top (required)>' |
I'm using |
@aaronmallen How about upgrading to rbs-3.6? There are some fixes related to the runtime test and |
I've upgraded and still run into the same issues |
Thanks. Hmm… Will look at the problem. 🙇♂️ |
@aaronmallen I have two things to share with you.
I couldn't reproduce the |
I'm no longer running into the
I look forward to your patch as I've pulled defining signatures out of scope for my project until a fix is released. |
Hi, I am running into an issue with blocks in rbs. It should be noted that this spec passes with rbs disabled.
given the following RSpec spec:
and the following signatures:
I get:
Additionally the recommended annotation to skip tests does not fix the issue:
The text was updated successfully, but these errors were encountered: