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

Re: problems with OCaml 3.01 beta #2692

Closed
vicuna opened this issue Feb 27, 2001 · 2 comments
Closed

Re: problems with OCaml 3.01 beta #2692

vicuna opened this issue Feb 27, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 27, 2001

Original bug ID: 295
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Dear Manuel,

Thanks for the beta-testing!

  1. The file byterun/makefile.nt needs to be fixed by adding backtrace.obj to
    the OBJ list.

Oups, sorry. I've fixed this.

  1. Compiling our Vault compiler with the new version, I noticed that
    camldepend seems to be less smart about local modules with the same name as
    some global module. E.g., I had a module env.ml containing a functor called
    ENV(...).
    Camldepend generated a self-dependency on env.cmo.

  2. More seriously, I'm getting a type error where I did not used to get one.
    It seems that Ocaml considers some types to be distinct where they were not
    before, although I'm confused as to why. Here's the error.

File "typing/typematch.ml", line 1778, characters 4-19:
This pattern matches values of type Types.presence * ([< Absent] as 'a) but is here used to match values of type Types.presence * Types.presence Type 'a is not compatible with type Types.presence = [ Present of Types.state * Types.type_expr | `Absent]

If I understand it correctly, the compiler complains that `Absent does not
match Types.presence, whereas it should. The error was generated in a
pattern match of the form:

match p1,p2 with
Absent,Absent -> ()
| Present (s1,ty1), Present (s2,ty2) ->
unify_state (Some r) unif assm env modpath s1 s2;
begin try
unify unif assm env modpath ty1 ty2
with
Unify(cause,env,c1,c2) ->
raise (Unify(RsrcType(r,cause),env,c1,c2)) end | Absent, _ ->
raise (Unify(Missing r, env, CCap c1, CCap c2)) | _, Absent ->
raise (Unify(Extra r, env, CCap c1, `CCap c2))

That's a showstopper for me.

We will look into this.

Cheers,

  • Xavier
@vicuna
Copy link
Author

vicuna commented Mar 5, 2001

Comment author: administrator

Fixed by change in the typing of variant matching. Jacques, 2001-03-03.

@vicuna vicuna closed this as completed Mar 5, 2001
@vicuna
Copy link
Author

vicuna commented Mar 5, 2001

Comment author: administrator

  1. More seriously, I'm getting a type error where I did not used to get one.
    It seems that Ocaml considers some types to be distinct where they were not
    before, although I'm confused as to why. Here's the error.

match p1,p2 with
Absent,Absent -> ()
| Present (s1,ty1), Present (s2,ty2) ->
unify_state (Some r) unif assm env modpath s1 s2;
begin try
unify unif assm env modpath ty1 ty2
with
Unify(cause,env,c1,c2) ->
raise (Unify(RsrcType(r,cause),env,c1,c2)) end | Absent, _ ->
raise (Unify(Missing r, env, CCap c1, CCap c2)) | _, Absent ->
raise (Unify(Extra r, env, CCap c1, `CCap c2))

I'm a bit surprised that this worked at all before, because I do not
remember any major change there, and multiple matching of variants
with wild patterns on both sides was rather imprevisible.
But anyway this has just been corrected as a side-effect of a bigger
change on how to use exhaustivity information from the match compiler
in typing (namely, do not discard tags explicitely matched from the
synthesized type), to get more previsibility.

Yet, this issue is still in discussion, and the semantics of _ might
change, so mark this code as fragile, as it might need to be adapted
in the future. And inform us if anything strange happens.

Jacques

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant