obj.respond_to? :method_name isn't working correctly
まだ誰も着手していません。
評価
調査の方向性
まず、issue にある product API object と respond_to? の手順を使い、shopify_api version 13.4 で動作を再現します。respond_to? が true、false、または T::Private::Types::Void::VOID を返す仕組みを追跡します。完了とは、一貫して true または false を返し、サポートされていない呼び出しで NoMethodError が発生することです。
索引モデルが issue の本文から書いたものです。
説明
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_apiversion: 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
- Instantiate an api object (I used a product)
- Invoke
respond_to?on it (api_object.respond_to? :some_bs_method) - 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
- 主要言語
- Ruby
- スター
- 1.1k
- フォーク
- 484
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/shopify-api-ruby のほかの issue
-
devtools-gardener
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Shopify/shopify-api-ruby#1456 · リアクション 3 件 ·
-
devtools-gardener
難易度 3/5 1〜2日 初心者へのやさしさ 67/100
Shopify/shopify-api-ruby#1461 · コメント 1 件 ·
-
automated
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Shopify/shopify-api-ruby#1460 ·
-
devtools-gardener
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
Shopify/shopify-api-ruby#1455 ·
-
devtools-gardener
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Shopify/shopify-api-ruby#1453 · コメント 1 件 ·
Shopify/shopify-api-ruby の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
TheOdinProject/curriculum#31423 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
oxidize-rb/rb-sys#807 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信