solargraph icon indicating copy to clipboard operation
solargraph copied to clipboard

Typecheck fails on file included by gem as part of a generator and can't seem to override / overload it.

Open swalke16 opened this issue 3 years ago • 2 comments

I made a test repository for reproduction. It's just a Rails.new with about three files added and one additional gem included.

If you run solargraph typecheck in this project you should get:

/solar-test/app/models/concerns/admin_permissions.rb:3 - Not enough arguments to ApplicationPolicy.new This seems to be happening because the pundit gem includes a template file for application_policy.rb used as part of a generator that has an initializer with definition of:

def initialize(user, record); end Our project overrides / overloads this in app/policies/application_policy.rb with a new initializer defined as:

def initialize(user, record = nil); end No matter what I attempt to put in my config/solargraph_definitions.rb for overload / override I can't seem to eliminate that typecheck error.

Thanks in advance for any suggestions!

swalke16 avatar Mar 01 '22 18:03 swalke16

What version of Solargraph are you using? I haven't been able to reproduce this error with 0.44.3.

castwide avatar Mar 26 '22 12:03 castwide

The test repo is on 0.44.3 and still reproduces this error.

swalke16 avatar Apr 11 '22 13:04 swalke16