Classify constructors, only dump modules if they successfully compile
This commit is contained in:
@@ -694,7 +694,7 @@ getConstructors ctx scfc (VRef fc nm _) = do
|
||||
lookupDCon nm = do
|
||||
top <- getTop
|
||||
case lookup nm top of
|
||||
(Just (MkEntry _ name type (DCon k str))) => pure (name, k, type)
|
||||
(Just (MkEntry _ name type (DCon _ k str))) => pure (name, k, type)
|
||||
Just _ => error fc "Internal Error: \{show nm} is not a DCon"
|
||||
Nothing => error fc "Internal Error: DCon \{show nm} not found"
|
||||
getConstructors ctx scfc tm = do
|
||||
@@ -946,7 +946,7 @@ buildCase ctx prob scnm scty (dcName, arity, ty) = do
|
||||
-- TODO can we check this when we make the PatCon?
|
||||
top <- getTop
|
||||
case lookup nm top of
|
||||
(Just (MkEntry _ name type (DCon k tcname))) =>
|
||||
(Just (MkEntry _ name type (DCon _ k tcname))) =>
|
||||
if (tcname /= sctynm)
|
||||
then error fc "Constructor is \{show tcname} expected \{show sctynm}"
|
||||
else pure Nothing
|
||||
@@ -974,7 +974,7 @@ mkPat (tm, icit) = do
|
||||
top <- getTop
|
||||
case splitArgs tm Nil of
|
||||
((RVar fc nm), b) => case lookupRaw nm top of
|
||||
(Just (MkEntry _ name type (DCon k str))) => do
|
||||
(Just (MkEntry _ name type (DCon _ k str))) => do
|
||||
-- TODO check arity, also figure out why we need reverse
|
||||
bpat <- traverse (mkPat) b
|
||||
pure $ PatCon fc icit name bpat Nothing
|
||||
|
||||
Reference in New Issue
Block a user