Deducteam / Dedukti

Implementation of the λΠ-calculus modulo rewriting

Home Page:https://deducteam.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error codes

francoisthire opened this issue · comments

Today, we use a function Errors.code which assigns arbitrary a code to an error. This is mainly use for the KO tests. However, this code is kind of weird I think. One thing we could do would to match on the error name. If we assume that we use extensible type for errors as:

type typing_error   = ..
type typing_error +=
  | KindIsNotTypable
  | ConvertibilityError                of term * typed_context * term * term
  ...

we could implement the code of an error as

let code exn = 
     Obj.Extension_constructor.name (Obj.Extension_constructor.of_val exn)

and replace the tests such as

(; KO 3 ;)
...

by

(; KO Typing.ConvertibilityError ;)

This requires to put every exception type declared in the kernel as extensible however.