Monomorphisation: add a better error message
Motivation and Context
Monomorphisation cannot treat non-variable instantiations (which was guaranteed by previous typer).
Description
This MR adds a better message for monomorphisation error until we come up with a better strategy for monomorphisation.
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to not work as expected) -
Performance improvement (non-breaking change that improves performance) -
None (change with no changelog)
Changelog
Before change
$ cat monomorphisation_fail.mligo
let f (_ : unit) s = ([], s)
let main ((p, s) : unit * unit) : operation list * unit = f p s
$ ligo compile contract monomorphisation_fail.mligo
Internal error: Monomorphisation: cannot resolve non-variables with instantiations
After change
$ cat monomorphisation_fail.mligo
let f (_ : unit) s = ([], s)
let main ((p, s) : unit * unit) : operation list * unit = f p s
$ ligo compile contract monomorphisation_fail.mligo
File "monomorphisation_fail.mligo", line 3, characters 58-63:
2 |
3 | let main ((p, s) : unit * unit) : operation list * unit = f p s
Cannot monomorphise the expression.
Checklist:
-
Changes follow the existing coding style (use dune @fmt
to check). -
Tests for the changes have been added (for bug fixes / feature). -
Documentation has been updated. -
Changelog description has been added (if appropriate). -
Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by E. Rivas