Skip to content

obj.respond_to? :method_name isn't working correctly #1273

Open
@jasonbuehler

Description

Issue summary

When using api_object.respond_to?(:method_name) the lib sometimes returns true and sometimes returns T::Private::Types::Void::VOID Sorbet private void type. It seems that true was returned if the method name had been previously used to dereference the object but on more inspection I am not so sure that's the case.

  • shopify_api version: 13.4
  • Ruby version:
  • Operating system:

Expected behavior

When calling respond_to? with a method name the object should return true if the object is able to respond to the method call or false if it is not, and if you call the method name on the object after it returns false it should raise a NoMethodError

Actual behavior

Sometimes the response is true, sometimes it's a private Sorbet type T::Private::Types::Void::VOID, and sometimes it switches from the private type to true after you dereference the object with the method in question.

Steps to reproduce the problem

  1. Instantiate an api object (I used a product)
  2. Invoke respond_to? on it ( api_object.respond_to? :some_bs_method )
  3. Bonus points - try invoking the method on the object after receiving the Sorbet type as a response and then calling respond_to? with the method name, it was returning true for me after doing so

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions