diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-06-10 16:54:10 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-06-10 16:57:26 +0200 |
commit | 5e021e6811c0388198955c0b3bbe002445c99d96 (patch) | |
tree | 4ab90302bef26edfa18df9cf8582eebb83e7a618 | |
parent | d69067a1b920f1122f55dd9caa39cf9ed9ba1d9b (diff) | |
download | haskell-wip/T19972.tar.gz |
Fix error message for record updates, #19972wip/T19972
Fix found by Adam Gundry.
-rw-r--r-- | compiler/GHC/Tc/Types/Origin.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/compiler/GHC/Tc/Types/Origin.hs b/compiler/GHC/Tc/Types/Origin.hs index e35f5ba385..cb15e962f6 100644 --- a/compiler/GHC/Tc/Types/Origin.hs +++ b/compiler/GHC/Tc/Types/Origin.hs @@ -526,7 +526,7 @@ exprCtOrigin (HsMultiIf _ rhs) = lGRHSCtOrigin rhs exprCtOrigin (HsLet _ _ e) = lexprCtOrigin e exprCtOrigin (HsDo {}) = DoOrigin exprCtOrigin (RecordCon {}) = Shouldn'tHappenOrigin "record construction" -exprCtOrigin (RecordUpd {}) = Shouldn'tHappenOrigin "record update" +exprCtOrigin (RecordUpd {}) = RecordUpdOrigin exprCtOrigin (ExprWithTySig {}) = ExprSigOrigin exprCtOrigin (ArithSeq {}) = Shouldn'tHappenOrigin "arithmetic sequence" exprCtOrigin (HsPragE _ _ e) = lexprCtOrigin e diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr index 8b5369731f..24c3f2a59b 100644 --- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr +++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr @@ -1,14 +1,12 @@ -RecordDotSyntaxFail13.hs:26:11: - Couldn't match type ‘Int’ with ‘Foo -> Int’ +RecordDotSyntaxFail13.hs:26:11: error: + • Couldn't match type ‘Int’ with ‘Foo -> Int’ arising from a functional dependency between: constraint ‘HasField "foo" Foo (Foo -> Int)’ - << This should not appear in error messages. If you see this - in an error message, please report a bug mentioning ‘record update’ at - https://gitlab.haskell.org/ghc/ghc/wikis/report-a-bug >> + arising from a record update instance ‘HasField "foo" Foo Int’ at RecordDotSyntaxFail13.hs:21:10-31 - In the second argument of ‘($)’, namely ‘a {foo}’ + • In the second argument of ‘($)’, namely ‘a {foo}’ In a stmt of a 'do' block: print $ a {foo} In the expression: do let a = ... |