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

vicuna opened this issue Nov 27, 2011 · 1 comment


None yet
2 participants
Copy link

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
Monitored by: @diml

Bug description

Considering the few lines :

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 -o
File "", line 5, characters 32-35:
Error: This expression has type int -> int -> int
but an expression was expected of type int
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 >


This comment has been minimized.

Copy link

commented Dec 21, 2011

Comment author: @diml


Commits 11916 and 11917.

@vicuna vicuna closed this Sep 25, 2012

@vicuna vicuna added the camlp4 label 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
You can’t perform that action at this time.