Skip to content

Typer : Better locations

Rémi requested to merge wrong_propagation_of_tv_opt into dev

type:fixed

problems

  • tv_opt was not propagated in checking.ml on E_let_in and E_lambda
  • E_ascription was weird (a very old piece of code was hidding there)

effect of the fix

I couldn't find a buggy program, but this gives more precise errors (see promoted tests), for instance:

before:

> ligo print ast-typed src/test/contracts/negative/deep_pattern_matching/pm_fail8.mligo
File "src/test/contracts/negative/deep_pattern_matching/pm_fail8.mligo", line 18, characters 8-15:
 17 |         let f = fun (b:int) -> b + a in
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 18 |         f (b+1)
              ^^^^^^^
 19 |       | Cons (a,b) -> "invalid"

Invalid type(s).
Expected: "string", but got: "int". 

now:

> ligo print ast-typed src/test/contracts/negative/deep_pattern_matching/pm_fail8.mligo
File "src/test/contracts/negative/deep_pattern_matching/pm_fail8.mligo", line 18, characters 8-15:
 17 |         let f = fun (b:int) -> b + a in
 18 |         f (b+1)
              ^^^^^^^
 19 |       | Cons (a,b) -> "invalid"

Invalid type(s).
Expected: "string", but got: "int". 

Description details:

Improve error message locations for some type errors

Edited by Rémi

Merge request reports