diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-12-22 10:59:16 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-12-24 00:42:51 -0500 |
commit | 6d62f6bfbb5a86131e7cbc30993f3fa510d8b3ab (patch) | |
tree | e888f791533511ce762e8768ba4790772c3b7ce7 /compiler/Language/Haskell/Syntax | |
parent | f42ba88fd32f1def7dcf02f0a2227b453bf5971c (diff) | |
download | haskell-6d62f6bfbb5a86131e7cbc30993f3fa510d8b3ab.tar.gz |
Store RdrName rather than OccName in Holes
In #20472 it was pointed out that you couldn't defer out of scope but
the implementation collapsed a RdrName into an OccName to stuff it into
a Hole. This leads to the error message for a deferred qualified name
dropping the qualification which affects the quality of the error
message.
This commit adds a bit more structure to a hole, so a hole can replace a
RdrName without losing information about what that RdrName was. This is
important when printing error messages.
I also added a test which checks the Template Haskell deferral of out of
scope qualified names works properly.
Fixes #22130
Diffstat (limited to 'compiler/Language/Haskell/Syntax')
-rw-r--r-- | compiler/Language/Haskell/Syntax/Expr.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs index ba818e82c5..44c731735c 100644 --- a/compiler/Language/Haskell/Syntax/Expr.hs +++ b/compiler/Language/Haskell/Syntax/Expr.hs @@ -30,7 +30,6 @@ import Language.Haskell.Syntax.Type import Language.Haskell.Syntax.Binds -- others: -import GHC.Types.Name (OccName) import GHC.Types.Fixity (LexicalFixity(Infix), Fixity) import GHC.Types.SourceText (StringLiteral) @@ -44,6 +43,7 @@ import Data.Either import Data.Eq import Data.Maybe import Data.List.NonEmpty ( NonEmpty ) +import GHC.Types.Name.Reader {- Note [RecordDotSyntax field updates] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -255,7 +255,7 @@ data HsExpr p -- See Note [Located RdrNames] | HsUnboundVar (XUnboundVar p) - OccName -- ^ Unbound variable; also used for "holes" + RdrName -- ^ Unbound variable; also used for "holes" -- (_ or _x). -- Turned from HsVar to HsUnboundVar by the -- renamer, when it finds an out-of-scope |