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

Assertion failure in printtyp.ml #2484

Closed
vicuna opened this issue Jun 12, 2000 · 2 comments
Closed

Assertion failure in printtyp.ml #2484

vicuna opened this issue Jun 12, 2000 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 12, 2000

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

Bug description

Full_Name:
Version: Objective Caml 3.00
OS:
Submission from: orion.kurims.kyoto-u.ac.jp (130.54.16.5)
Submitted by: garrigue

~# ocaml
Objective Caml version 3.00

type t = string option;;

type t = string option

let (f : t -> string) = function

  None -> ""
| Some v -> v;;

val f : t -> string =

let g ?opt () = f opt;;

val g : ?opt:Uncaught exception: File "typing/printtyp.ml", line 0, characters
6494-6506: Assertion failed

The same message was printed when trying to compile the code.
Perhaps a better error message could be used?

@vicuna
Copy link
Author

vicuna commented Jun 12, 2000

Comment author: administrator

type t = string option;;

type t = string option

let (f : t -> string) = function

  None -> ""
| Some v -> v;;

val f : t -> string =

let g ?opt () = f opt;;

val g : ?opt:Uncaught exception: File "typing/printtyp.ml", line 0,
characters
6494-6506: Assertion failed

The same message was printed when trying to compile the code.
Perhaps a better error message could be used?

Indeed. Due to the structure of the compiler, it would difficult to
get the correct type printed, but I changed it so as to have partial type
information (and no error).

let g ?opt () = f opt;;

val g : ?opt: -> unit -> string

The only way to have the system print the correct type is to write a module
signature... (A type constraint would not do, since it propagates
abbreviation.)

Jacques Garrigue

@vicuna
Copy link
Author

vicuna commented Jun 12, 2000

Comment author: administrator

Partially fixed by Jacques on 2000-06-12.

@vicuna vicuna closed this as completed Jun 12, 2000
@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