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

Can't define types with `True or `False #4705

vicuna opened this issue Jan 31, 2009 · 0 comments


None yet
1 participant
Copy link

commented Jan 31, 2009

Original bug ID: 4705
Reporter: @mjambon
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2012-09-25T18:06:17Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.0
Fixed in version: 3.12.1+dev
Category: -for Camlp4 use

Bug description

Quotations in the revised syntax do not handle True or False correctly in type definitions. It is very hard to guess since the type definition is processed and compiled without errors. The problems only occur when using the type in question.

Affected versions: 3.10.2, 3.11.0 with camlp4orf
Old Camlp4 3.09.2 works fine on that case.

$ ocamlc -c -pp camlp4orf -I +camlp4
$ ocamlc -c -pp 'camlp4o -parser pa_foo.cmo'
File "", line 10, characters 1-7:
Error: This expression has type [> False ] but is here used with type foo The second variant type does not allow tag(s) False

This is

ocamlc -c -pp camlp4orf -I +camlp4

open Camlp4.PreCast
open Syntax

GLOBAL: str_item;
str_item: [
[ "FOO" -> <:str_item< type foo = [ = `False ] >> ]

This is

camlp4o -parser pa_foo.cmo -printer o
ocamlc -c -pp 'camlp4o -parser pa_foo.cmo'

FOO ;;

(`False : foo)


Pretty-printing goes well:

$ camlp4o -parser pa_foo.cmo -printer o
This is

camlp4o -parser pa_foo.cmo -printer o
ocamlc -c -pp 'camlp4o -parser pa_foo.cmo'
type foo = [ | `False ]

let _ = (`False : foo)

So one first workaround is to preprocess files with 'camlp4o -printer o ...'.
Another workaround is to avoid using True or False.
A third workaround is to use quotations in the classic syntax.

@vicuna vicuna closed this Sep 25, 2012

@vicuna vicuna added camlp4 bug labels Mar 14, 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.