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

camlp4: camlp4r: exception equal to another exception #5301

Closed
vicuna opened this issue Jun 26, 2011 · 2 comments
Closed

camlp4: camlp4r: exception equal to another exception #5301

vicuna opened this issue Jun 26, 2011 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jun 26, 2011

Original bug ID: 5301
Reporter: Dmitry Grebeniuk
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2012-09-25T18:06:17Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.13.0+dev
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues

Bug description

Maybe I'm trying to use the wrong syntax, but the error message should be more readable.

$ ocaml
OCaml version 3.13.0+dev3

#use "topfind";;

[..]

#camlp4r;;

[..]

module A = struct exception E of int; end;

module A : sig exception E of int; end

exception Q of int = A.E;

Assertion failed, file "camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml", line 948, char 21

@vicuna
Copy link
Author

vicuna commented Jun 28, 2011

Comment author: @xclerc

The fix is temporary because it drops the type information provided at aliasing site.
The actual type is taken from the original exception without checking that it is the
same that is provided by the alias.

@vicuna
Copy link
Author

vicuna commented Jul 12, 2011

Comment author: @xclerc

After consultation of the AST for the original grammar,
and discussion with Nicolas Pouillard, it turns out that
the syntactic construct has to be disallowed.

Indeed, when aliasing an exception in the original syntax,
there is not way to "repeat" its type. As camlp4 has no type
information, it cannot do more than the original syntax.
Hence, the decision to forbid the syntactic construct.

However, you will now be presented a (hopefully) much
nicer error message.

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