Skip to content

Commit

Permalink
[ new ] Add compile.casetree.missing topic
Browse files Browse the repository at this point in the history
This allows us to track when we're compiling non-covering case blocks.
  • Loading branch information
CodingCellist authored and gallais committed Apr 22, 2023
1 parent 3eeb4f4 commit a423715
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
* The Lifted IR Representation now has a `HasNamespaces` implementation
in `Compiler.Separate` so Compilation Units at that stage can be generated.

* Added the `compile.casetree.missing` log topic, along with its use in
`TTImp.ProcessDef.genRunTime`. This allows us to track when incomplete `case`
blocks get the runtime error added.

### Library changes

#### Prelude
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Options/Log.idr
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ knownTopics = [
("compile.casetree.getpmdef", Nothing),
("compile.casetree.intermediate", Nothing),
("compile.casetree.measure", Just "Log the node counts of each runtime case tree."),
("compile.casetree.pick", Nothing),
("compile.casetree.missing", Just "Log when we add an error case for uncovered branches."),
("compile.casetree.partition", Nothing),
("compile.casetree.pick", Nothing),
("compiler.const-fold", Just "Log definitions before and after constant folding."),
("compiler.cse", Just "Log information about common sub-expression elimination."),
("compiler.identity", Just "Log definitions that are equivalent to identity at runtime."),
Expand Down
7 changes: 4 additions & 3 deletions src/TTImp/ProcessDef.idr
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,10 @@ mkRunTime fc n
pats

let clauses_init = map (toClause (location gdef)) pats'
let clauses = case cov of
MissingCases _ => addErrorCase clauses_init
_ => clauses_init
clauses <- case cov of
MissingCases _ => do log "compile.casetree.missing" 5 $ "Adding uncovered error to \{show clauses_init}"
pure $ addErrorCase clauses_init
_ => pure clauses_init

(rargs ** (tree_rt, _)) <- getPMDef (location gdef) RunTime n ty clauses
logC "compile.casetree" 5 $ do
Expand Down

0 comments on commit a423715

Please sign in to comment.