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
Original bug ID: 372 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
In the following case it warns for the row | hd::tl ->
'nil' doesn't occur in the reference manual. I would say that this is
a bit dangerous, since most programmers would use say that nil is nil,
i.e. a synononym for [].
let rec foo (l:int list) : unit =
match l with
| nil -> ()
| hd::tl -> foo tl
File "nil.ml", line 4, characters 4-10:
Warning: this match case is unused.
/mattias
The text was updated successfully, but these errors were encountered:
In the following case it warns for the row | hd::tl ->
'nil' doesn't occur in the reference manual. I would say that this is
a bit dangerous, since most programmers would use say that nil is nil,
i.e. a synononym for [].
let rec foo (l:int list) : unit =
match l with
| nil -> ()
| hd::tl -> foo tl
"nil" is just an identifier like any other. What you wrote is
equivalent to
let rec foo (l:int list) : unit =
match l with
| x -> ()
| hd::tl -> foo tl
or indeed any name instead of "x", so the first line is a "catch-up"
case. With this in mind, the compiler warning should make sense.
Original bug ID: 372
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
In the following case it warns for the row | hd::tl ->
'nil' doesn't occur in the reference manual. I would say that this is
a bit dangerous, since most programmers would use say that nil is nil,
i.e. a synononym for [].
let rec foo (l:int list) : unit =
match l with
| nil -> ()
| hd::tl -> foo tl
File "nil.ml", line 4, characters 4-10:
Warning: this match case is unused.
/mattias
The text was updated successfully, but these errors were encountered: