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

Message d'erreur etrange. #8328

Closed
vicuna opened this issue Oct 19, 2003 · 2 comments
Closed

Message d'erreur etrange. #8328

vicuna opened this issue Oct 19, 2003 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 19, 2003

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

Bug description

Full_Name: Sejourne Kevin
Version: 3.06 & 3.07
OS: (win 3.07)(debian 3.06)
Submission from: aste-genev-bois-104-1-1-143.w217-128.abo.wanadoo.fr (217.128.225.143)

Pour reproduire ce message d'erreur etrange il faut saisir c'est ligne dans un
interpreteur interractif.

let f = function A _ -> 1 | B x -> x;;

val f : [< A of 'a | B of int ] -> int =

let g = function C _ -> 2 | B x ->if x then 3 else 4;;

val g : [< B of bool | C of 'a ] -> int =

let h x = (f x)+(g x);;

Characters 19-20:
let h x = (f x)+(g x);;
^
This expression has type [< B of int & bool ] but is here used with type [< B of bool & int ]

Evidemment ce code ne devrais pas compiler, mais l'explication donné par
le compilateur est très curieuse.

@vicuna
Copy link
Author

vicuna commented Nov 7, 2003

Comment author: administrator

Fixed by Jacques in ctype.ml (2003-11-07)

@vicuna vicuna closed this as completed Nov 7, 2003
@vicuna
Copy link
Author

vicuna commented Nov 7, 2003

Comment author: administrator

From: sejourne_kevin@yahoo.fr

This expression has type [< B of int & bool ] but is here used with type [< B of bool & int ]

This is now fixed in CVS. (Harder than you imagine)
The new message is:
This expression has type [< B of int & bool ] but is here used with type [ B of bool ]
I hesitated between this and
This expression has type [< B of int ] but is here used with type [< B of bool ]
but the latter may be harder to understand in some cases (if you don't
remember that variants with only one case cannot use conjunctive
types). Actually you can even imagine situations where it would still
give you the original message.

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