You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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'
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)
BPar 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
The text was updated successfully, but these errors were encountered: