Fix lookupGlobalOccRn_maybe sometimes reporting an error
In some cases it was possible for lookupGlobalOccRn_maybe
to return an error, when it should be returning a Nothing
. If it called lookupExactOcc_either
when there were no matching GlobalRdrElts
in the otherwise case, it would return an error message. This could be caused when lookupThName_maybe
in Template Haskell was looking in different namespaces (thRdrNameGuesses
), guessing different namespaces that the name wasn't guaranteed to be found in.
The test case is a bit funny, but it's the quickest way I could get the error message to occur. It still errors on something different, but should be missing the main culprit
The exact Name ‘x_aFi’ 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
cc @mpickering