castwide/solargraph

Solargraph recommended approach for concerns included in files that override a function?

lukecivantos opened this issue · 0 comments

So the situation I'm running into is I have an interaction (using ActiveInteraction which overrides hash):

class ExampleInteraction < ActiveInteraction::Base
  include ExampleConcern
end

and that interaction includes a Rails concern:

module ExampleConcern
  extend ActiveSupport::Concern
  
  included do
    hash :some_hash, default: {}, strip: false
  end
end

And I'm subsequently getting an error on the hash: Too many arguments to Object#hash from Typecheck – it looks at Object#hash instead of ActiveInteraction#hash

This behavior makes sense as it can't really know that the concern is going to be included in a file that overrides hash, but I'm wondering if there's any recommended workaround to avoid this error as this is a fairly common pattern in our codebase

I believe I can add something to definitions.rb to solve, but I haven't been able to figure it out