diff --git a/src/passes/4-typer-old/typer.ml b/src/passes/4-typer-old/typer.ml index 7093f1d24..b2cc7824e 100644 --- a/src/passes/4-typer-old/typer.ml +++ b/src/passes/4-typer-old/typer.ml @@ -12,13 +12,19 @@ type environment = Environment.t module Errors = struct let unbound_type_variable (e:environment) (tv:I.type_variable) () = + let name = Var.to_name tv in + let suggestion = match name with + | "integer" -> "int" + | "str" -> "string" + | _ -> "no suggestion" in let title = (thunk "unbound type variable") in let message () = "" in let data = [ ("variable" , fun () -> Format.asprintf "%a" Stage_common.PP.type_variable tv) ; (* TODO: types don't have srclocs for now. *) (* ("location" , fun () -> Format.asprintf "%a" Location.pp (n.location)) ; *) - ("in" , fun () -> Format.asprintf "%a" Environment.PP.full_environment e) + ("in" , fun () -> Format.asprintf "%a" Environment.PP.full_environment e) ; + ("did_you_mean" , fun () -> suggestion) ] in error ~data title message () diff --git a/src/test/contracts/error_typer_5.mligo b/src/test/contracts/error_typer_5.mligo new file mode 100644 index 000000000..ae3391ce5 --- /dev/null +++ b/src/test/contracts/error_typer_5.mligo @@ -0,0 +1,4 @@ +let foo : integer = 3 + +let main (p:int) (storage : int) = + (([] : operation list) , p + foo)