Commit b785be47 authored by simonpj's avatar simonpj

[project @ 2006-01-18 12:16:06 by simonpj]

Check for constructors in type signatures
parent e31827c6
......@@ -346,11 +346,15 @@ isValOcc other = False
-- Data constructor operator (starts with ':', or '[]')
-- Pretty inefficient!
isDataSymOcc (OccName DataName s) = isLexConSym s
isDataSymOcc (OccName VarName s) = isLexConSym s
isDataSymOcc (OccName VarName s)
| isLexConSym s = pprPanic "isDataSymOcc: check me" (ppr s)
-- Jan06: I don't think this should happen
isDataSymOcc other = False
isDataOcc (OccName DataName _) = True
isDataOcc (OccName VarName s) = isLexCon s
isDataOcc (OccName VarName s)
| isLexCon s = pprPanic "isDataOcc: check me" (ppr s)
-- Jan06: I don't think this should happen
isDataOcc other = False
-- Any operator (data constructor or variable)
......
......@@ -601,9 +601,11 @@ checkValSig
:: LHsExpr RdrName
-> LHsType RdrName
-> P (Sig RdrName)
checkValSig (L l (HsVar v)) ty | isUnqual v = return (TypeSig (L l v) ty)
checkValSig (L l (HsVar v)) ty
| isUnqual v && not (isDataOcc (rdrNameOcc v))
= return (TypeSig (L l v) ty)
checkValSig (L l other) ty
= parseError l "Type signature given for an expression"
= parseError l "Invalid type signature"
mkGadtDecl
:: Located RdrName
......
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