Browse thread
is this a bug ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Samuel Mimram <samuel.mimram@e...> |
| Subject: | Re: [Caml-list] is this a bug ? |
Hi, Christophe Raffalli wrote: > -------------------------------- > let f b l = match l with > [] | [_] -> 1 > | [a;_] | [_;a] when a = b-> 2 > | _ -> 3 > > let _ = > print_int (f 1 [1;2]); > print_int (f 1 [2;1]); > print_newline () > -------------------------------- > > Do you think this code should have a useless pattern warning and print > "23" instead of "22" ? > > If someone tell me this is a bug then I fill a bug report ... I guess that the priorities says that you should "read" the third line as | [a;_] | ( [_;a] when a = b ) -> 2 This would justify the warning and explain the behaviour... Cheers, Samuel.