diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2022-03-10 23:42:49 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-12 07:02:40 -0500 |
commit | cf081476eb60ba8d65335234b654b457154b9d83 (patch) | |
tree | 1d7ae8f04797c0e69f4e6f643e9e4a5103a5bc5f | |
parent | e40cf4ef6cab8e02fcd34efdf98f1715bfa7315c (diff) | |
download | haskell-cf081476eb60ba8d65335234b654b457154b9d83.tar.gz |
checkUnboxedLitPat: use non-fatal addError
This enables GHC to report more parse errors in a single pass.
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/corelint/T21115.stderr | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index b9be24259a..e5557855c0 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -1869,14 +1869,14 @@ checkUnboxedLitPat (L loc lit) = -- Don't allow primitive string literal patterns. -- See #13260. HsStringPrim {} - -> addFatalError $ mkPlainErrorMsgEnvelope loc $ + -> addError $ mkPlainErrorMsgEnvelope loc $ (PsErrIllegalUnboxedStringInPat lit) -- Don't allow Float#/Double# literal patterns. -- See #9238 and Note [Rules for floating-point comparisons] -- in GHC.Core.Opt.ConstantFold. _ | is_floating_lit lit - -> addFatalError $ mkPlainErrorMsgEnvelope loc $ + -> addError $ mkPlainErrorMsgEnvelope loc $ (PsErrIllegalUnboxedFloatingLitInPat lit) | otherwise diff --git a/testsuite/tests/corelint/T21115.stderr b/testsuite/tests/corelint/T21115.stderr index cb4f3a3e4f..e7b69f8131 100644 --- a/testsuite/tests/corelint/T21115.stderr +++ b/testsuite/tests/corelint/T21115.stderr @@ -2,3 +2,11 @@ T21115.hs:10:5: error: Illegal unboxed floating point literal in pattern: 0.0## + +T21115.hs:11:5: error: + Illegal unboxed floating point literal in pattern: + 2.0## + +T21115.hs:12:5: error: + Illegal unboxed floating point literal in pattern: + -0.0## |