Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in camlp4o when printing class application #5410

Closed
vicuna opened this issue Nov 27, 2011 · 1 comment
Closed

error in camlp4o when printing class application #5410

vicuna opened this issue Nov 27, 2011 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Nov 27, 2011

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

@vicuna
Copy link
Author

vicuna commented Dec 21, 2011

Comment author: @diml

Fixed.

Commits 11916 and 11917.

@vicuna vicuna closed this as completed Sep 25, 2012
@vicuna vicuna added the camlp4 label Mar 14, 2019
@vicuna vicuna assigned ghost Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant