Skip to content

Commit

Permalink
Improve errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Grant Jeffries committed Nov 15, 2019
1 parent 25816ac commit 3e2897a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bowtie/src/Bowtie/Infer/BottomUp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bottomUpCase env ms targetExpr alts = do
)

[] ->
panic "no cases"
panic "Case statement has no alternatives (this should have been caught by the parser)"
where
-- Eg, for
--
Expand All @@ -185,7 +185,7 @@ bottomUpCase env ms targetExpr alts = do
addConInfo (Alt conId bindings expr) =
case lookup conId env of
Nothing ->
panic "conid"
panic ("Constructor id not found: " <> unId conId)

Just (TypeScheme polyVars typ) -> do
let
Expand All @@ -196,7 +196,8 @@ bottomUpCase env ms targetExpr alts = do
pure (t2, (binding, targ) : xs)

_ ->
panic "whoops"
-- TODO: find another way to report this than panic:
panic ("Alternative tries to bind too many variables: " <> unId conId)

(finalType, args) <- foldM g (typ, mempty) bindings
pure (TypeScheme polyVars finalType, args, expr)

0 comments on commit 3e2897a

Please sign in to comment.