Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add variable name to unused resource error message. #7

Open
wants to merge 1 commit into from

2 participants

@magnusjonsson

No description provided.

@pikatchu
Owner

Hum ... not too sure about this one.
Does it print the right thing when the resource is an underscore?
If so then I am more than happy to merge the change.

This example currently prints `__tmp101':

  val main : unit -> unit
  let main() =
     let _ = List.Empty
     in ()

What do you think it should print?

Owner

Yea I thought so :-(
I used temporary variables for underscores so that I could handle them as simple variables.
That's why the tmp101 comes out of nowhere ... That's probably why I never added the variable name in the first place.
An easy way around this would be to call the variable "_" :-)
I will look into that, thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +2 −2 compiler/error.ml
  2. +1 −1  compiler/linearCheck.ml
View
4 compiler/error.ml
@@ -428,9 +428,9 @@ let forgot_branch p1 p2 =
err "In this branch" ;
exit 2
-let unused_variable p =
+let unused_variable (p: Pos.t) (id: string) =
pos p ;
- err ("This ressource hasn't been used") ;
+ err ("The resource `" ^ id ^ "' has not been used") ;
exit 2
let already_used p p' =
View
2  compiler/linearCheck.ml
@@ -273,7 +273,7 @@ end = struct
IMap.iter (
fun x ty ->
match ty with
- | Var (p, _) -> Error.unused_variable p
+ | Var (p, x) -> Error.unused_variable p (Ident.to_string x)
| _ -> ()
) env
Something went wrong with that request. Please try again.