Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Emit reference to instance method instead class method #73
When the instance is fully resolved.
Basic plan (probably doesn't handle edge cases etc):
Idea: get the module of the
Idea#2: assign Tick to instance methods by concatenating the DFunId tick with the method name, so it's trivial to construct the Tick reference from the locally available info. Sounds like a much better idea.
This can work - but the instance method decls need to be taken from the typechecked tree, where we can harvest the related dFunId (the
Mental note. From Simon:
Interesting. Could for start just point to the "outermost" instance (here Eq [a]), but ideally (if the callsite's tc dict is fully saturated) we could even generate a virtual, monomorphic linked source (where clicking class methods used in the outermost instance's implementation links to the dependent instance's.....). But that seems deep.
Alternatively, following a link to a (virtual / overloadded / classmethod ....) thing should take into account the "current stack" or "current context", and that would have to be rolled along.
Note: this might come to HIE, see https://gitlab.haskell.org/ghc/ghc/merge_requests/1286 as mentioned in https://gitlab.haskell.org/ghc/ghc/wikis/hie-files:
The existing feature
seems to capture the monomorphized type, but not the instance used to get it? Not sure.