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

(feature wish) messages d'erreurs et variants polymorphes #8458

Closed
vicuna opened this issue Jan 26, 2004 · 2 comments
Closed

(feature wish) messages d'erreurs et variants polymorphes #8458

vicuna opened this issue Jan 26, 2004 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jan 26, 2004

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

Bug description

Full_Name: Fabien Fleutot
Version: 3.07
OS: cygwin, linux
Submission from: 82.45.233.56 (82.45.233.56)

Quand il y a une erreur de typage due a un variant polymorphe, le message
indique quel est le tag fautif. Ca marche bien quand on a oublie une
alternative.

Ex:

type a = [A|B]

fun (x:a) -> match x with `A -> 0;;

This pattern matches values of type [ A ] but is here used to match values of type a = [ A | B ] The first variant type does not allow tag(s) B

Par contre, si on se trompe dans le type de valeur associe au tag, l'erreur est
moins visible:

type a=[A of int|B];;

fun (x:a) -> match x with A "foo" -> 0 | B -> 1;;

This pattern matches values of type [< A of string | B > B ] but is here used to match values of type a = [ A of int | `B ]

Pour peut que le type a ait beaucoup d'alternatives, il est difficile de
retrouver l'erreur. Ca serait immediat si le message precisait qqc comme:

Type string is not compatible with type int in tag `A

@vicuna
Copy link
Author

vicuna commented Jun 29, 2004

Comment author: administrator

Full_Name: Fabien Fleutot

Quand il y a une erreur de typage due a un variant polymorphe, le message
indique quel est le tag fautif. Ca marche bien quand on a oublie une
alternative.
Par contre, si on se trompe dans le type de valeur associe au tag, l'erreur
est
moins visible:

Votre voeu a ete exhauce'.
Le message dans 3.08 sera plus detaille'

Jacques Garrigue

@vicuna
Copy link
Author

vicuna commented Jun 29, 2004

Comment author: administrator

Exhauce' en 3.08 par JG (2004-06-??)

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