`deriveRPCWithStrategy` fails on `data` with type variables
Description
It looks like, at least in some cases, deriving a customGeneric on a data with a type variable and then trying to derive an AsRPC instance with deriveRPCWithStrategy results in a compilation error.
Steps to reproduce
Ass this test to Test.AsRPC:
----------------------------------------------------------------------------
-- Data type with type variables and custom generic strategy
----------------------------------------------------------------------------
data WithTypeVariablesStrategy a = WithTypeVariablesStrategy
{ _wtvsField1 :: a
}
deriving anyclass instance IsoValue a => IsoValue (WithTypeVariablesStrategy a)
customGeneric "WithTypeVariablesStrategy" haskellBalanced
deriveRPCWithStrategy "WithTypeVariablesStrategy" haskellBalanced
data ExpectedWithTypeVariablesStrategyRPC = ExpectedWithTypeVariablesStrategyRPC
{ expectedWtvsField1 :: BigMapId Integer MText
}
deriving stock Generic
deriving anyclass IsoValue
_checkWithTypeVariablesStrategy :: ToT (WithTypeVariablesStrategyRPC (BigMap Integer MText)) :~: ToT ExpectedWithTypeVariablesStrategyRPC
_checkWithTypeVariablesStrategy = Refl
_checkWithTypeVariablesStrategyLaws :: ()
_checkWithTypeVariablesStrategyLaws = checkLaws @(WithTypeVariablesStrategy (BigMap Integer MText)) Refl
Note: the problem doesn't seem to be restricted to a specific strategy, any can be replaced above and result in the same problem.
Expected behaviour
The testing snippet above compiles successfully.
Actual behaviour
An error similar to:
The exact Name ‘a_aAZe’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
is raised.