summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-09-09 15:53:14 +0000
committerhallgren <hallgren@chalmers.se>2013-09-09 15:53:14 +0000
commit990789eb91fdb99f423f1ca85dfb0b1ff216875a (patch)
tree0ef55c0dd080cb5c21d20161d8b118287757b1ef /src
parent83283b0d6a1e714def620a2ad2a7166c6c3a0147 (diff)
partial evaluator: complain about nonlinear patterns
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Compile/Compute/ConcreteNew.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/GF/Compile/Compute/ConcreteNew.hs b/src/compiler/GF/Compile/Compute/ConcreteNew.hs
index e2dc1f50f..7cb31a72b 100644
--- a/src/compiler/GF/Compile/Compute/ConcreteNew.hs
+++ b/src/compiler/GF/Compile/Compute/ConcreteNew.hs
@@ -15,8 +15,8 @@ import GF.Compile.Compute.Predef(predef,predefName,delta)
import GF.Data.Str(Str,glueStr,str2strings,str,sstr,plusStr,strTok)
import GF.Data.Operations(Err,err,errIn,maybeErr,combinations,mapPairsM)
import GF.Data.Utilities(mapFst,mapSnd,mapBoth,apBoth,apSnd)
-import Control.Monad(ap,liftM,liftM2,mplus)
-import Data.List (findIndex,intersect,isInfixOf,nub,elemIndex)
+import Control.Monad(ap,liftM,liftM2,mplus,unless)
+import Data.List (findIndex,intersect,isInfixOf,nub,elemIndex,(\\))
import Data.Char (isUpper,toUpper,toLower)
import Text.PrettyPrint
import qualified Data.ByteString.Char8 as BS
@@ -325,7 +325,11 @@ valueTable env i cs =
_ -> False
valueCase (p,t) = do p' <- measurePatt # inlinePattMacro p
- let pvs = pattVars p'
+ let allpvs = allPattVars p'
+ pvs = nub allpvs
+ dups = allpvs \\ pvs
+ unless (null dups) $
+ fail $ "Pattern is not linear: "++show p'
vt <- value (extend pvs env) t
return (p', \ vs -> Bind $ \ bs -> vt (push' p' bs pvs vs))
--{-