Add a breakable space to the "missing rec" hint message

master
Armaël Guéneau 2018-04-23 09:49:19 +02:00 committed by Armael
parent dbe2e4c352
commit d9c4a4eb48
2 changed files with 11 additions and 6 deletions

View File

@ -10,7 +10,8 @@ Line _, characters 28-33:
if n = 0 then 1 else n * facto (n-1)
^^^^^
Error: Unbound value facto
Hint: If this is a recursive definition, you should add a 'rec' keyword on line 1
Hint: If this is a recursive definition,
you should add a 'rec' keyword on line 1
|}];;
let x = 3 in
@ -22,7 +23,8 @@ Line _, characters 10-11:
let f x = f x in
^
Error: Unbound value f
Hint: If this is a recursive definition, you should add a 'rec' keyword on line 2
Hint: If this is a recursive definition,
you should add a 'rec' keyword on line 2
|}];;
let f x = if x < 0 then x else h (x-1)
@ -34,7 +36,8 @@ Line _, characters 31-32:
let f x = if x < 0 then x else h (x-1)
^
Error: Unbound value h
Hint: If this is a recursive definition, you should add a 'rec' keyword on line 1
Hint: If this is a recursive definition,
you should add a 'rec' keyword on line 1
|}];;
let value1 = 3 in
@ -59,5 +62,6 @@ Line _, characters 17-24:
^^^^^^^
Error: Unbound value foobar2
Hint: Did you mean foobar1?
Hint: If this is a recursive definition, you should add a 'rec' keyword on line 2
Hint: If this is a recursive definition,
you should add a 'rec' keyword on line 2
|}];;

View File

@ -1023,8 +1023,9 @@ let report_error env ppf = function
spellcheck ppf fold_values env lid;
let (_, line, _) = Location.get_pos_info loc.Location.loc_start in
fprintf ppf
"@.@[%s %i@]"
"Hint: If this is a recursive definition, you should add a 'rec' keyword on line"
"@.@[%s@ %s %i@]"
"Hint: If this is a recursive definition,"
"you should add a 'rec' keyword on line"
line
let () =