Commit 6177c0d8 authored by ruperthorlick's avatar ruperthorlick Committed by Ben Gamari

Disallow unboxed string literals in patterns (#13260)

Signed-off-by: ruperthorlick's avatarRupert Horlick <ruperthorlick@gmail.com>

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3286
parent f57bd2ae
......@@ -829,6 +829,9 @@ checkAPat msg loc e0 = do
case e0 of
EWildPat -> return (WildPat placeHolderType)
HsVar x -> return (VarPat x)
HsLit (HsStringPrim _ _) -- (#13260)
-> parseErrorSDoc loc (text "Illegal unboxed string literal in pattern:" $$ ppr e0)
HsLit l -> return (LitPat l)
-- Overloaded numeric patterns (e.g. f 0 x = x)
......
{-# LANGUAGE MagicHash #-}
module T13260 where
g y = case y of
"a"# -> True
_ -> False
T13260.hs:6:5: error:
Illegal unboxed string literal in pattern:
"a"#
......@@ -96,3 +96,4 @@ test('T10498b', normal, compile_fail, [''])
test('T12051', normal, compile_fail, [''])
test('T12429', normal, compile_fail, [''])
test('T12811', normal, compile_fail, [''])
test('T13260', normal, compile_fail, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment