You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5410 Reporter: kyoDralliam Assigned to:@diml Status: closed (set by @xavierleroy on 2012-09-25T18:07:21Z) Resolution: fixed Priority: normal Severity: minor Version: 3.12.1 Fixed in version: 3.12.1+dev Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues Monitored by:@diml
Bug description
Considering the few lines :
$cat a.ml
class my_class (x:int) = object method get () = x end
let foo x y = x + y
class my_other_class = my_class (foo 5 3)
camlp4o has the bad habit to remove the parentheses in the last line when using
the command
$camlp4o a.ml -o b.ml
$ocamlc b.ml
File "b.ml", line 5, characters 32-35:
Error: This expression has type int -> int -> int
but an expression was expected of type int
$cat b.ml
class my_class (x : int) = object method get = fun () -> x end
let foo x y = x + y
class my_other_class = my_class foo 5 3
Moreover, there is a hack that allows to keep the wanted meaning :
class other_method () = let z = foo 5 3 in my_class z
class other_method_bis = other_m
Both my_other_class and other_method_bis have the same behavior when the code compile.
Additional information
Doing the following works fine
$camlp4o a.ml > b.ml
$ocamlc b.ml
The text was updated successfully, but these errors were encountered:
Original bug ID: 5410
Reporter: kyoDralliam
Assigned to: @diml
Status: closed (set by @xavierleroy on 2012-09-25T18:07:21Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.1
Fixed in version: 3.12.1+dev
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Monitored by: @diml
Bug description
Considering the few lines :
$cat a.ml
class my_class (x:int) = object method get () = x end
let foo x y = x + y
class my_other_class = my_class (foo 5 3)
camlp4o has the bad habit to remove the parentheses in the last line when using
the command
$camlp4o a.ml -o b.ml
$ocamlc b.ml
File "b.ml", line 5, characters 32-35:
Error: This expression has type int -> int -> int
but an expression was expected of type int
$cat b.ml
class my_class (x : int) = object method get = fun () -> x end
let foo x y = x + y
class my_other_class = my_class foo 5 3
Moreover, there is a hack that allows to keep the wanted meaning :
class other_method () = let z = foo 5 3 in my_class z
class other_method_bis = other_m
Both my_other_class and other_method_bis have the same behavior when the code compile.
Additional information
Doing the following works fine
$camlp4o a.ml > b.ml
$ocamlc b.ml
The text was updated successfully, but these errors were encountered: