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: 5054 Reporter: jeremy Status: closed (set by @damiendoligez on 2010-05-20T14:57:52Z) Resolution: fixed Priority: normal Severity: minor Version: 3.11.2 Fixed in version: 3.12.0+dev Category: ~DO NOT USE (was: OCaml general)
Bug description
I can't think of any reason this should fail, and the documentation about "statically constructive" expressions would seem to allow it.
jeremy:~$ ocamlc -c minimal.ml
File "minimal.ml", line 18, characters 21-53:
Error: This kind of expression is not allowed as right-hand side of `let rec'
Here's minimal.ml:
module type POINTED_SET = sig
type t
val x : t
end
module IntWith3 : POINTED_SET = struct
type t = int
let x = 3
end
(* all of these are fine *)
let rec silly_list = (IntWith3.x :: silly_list)
let rec silly_list = (Some IntWith3.x :: silly_list)
let rec silly_list = ([ IntWith3.x ] :: silly_list)
let rec silly_list = (ref IntWith3.x :: silly_list)
(* but this causes an error! *)
let rec silly_list = ([| IntWith3.x |] :: silly_list)
-Jeremy
Additional information
On Snow Leopard.
The text was updated successfully, but these errors were encountered:
Damien: do you remember the reason for this case? It seems to me that the default behavior (accepting the array expression if it does not refer to any variable defined in the current let-rec) should be sound.
I don't remember exactly, but looking at the code I see there is a trap with generic arrays:
you don't know their size because it depends on their type (float or not).
This pattern should probably be moved up to check_top, and then we can do better than
the default case by doing the same as for other arrays (just check all the arguments).
Original bug ID: 5054
Reporter: jeremy
Status: closed (set by @damiendoligez on 2010-05-20T14:57:52Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.2
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)
Bug description
I can't think of any reason this should fail, and the documentation about "statically constructive" expressions would seem to allow it.
jeremy:~$ ocamlc -c minimal.ml
File "minimal.ml", line 18, characters 21-53:
Error: This kind of expression is not allowed as right-hand side of `let rec'
Here's minimal.ml:
module type POINTED_SET = sig
type t
val x : t
end
module IntWith3 : POINTED_SET = struct
type t = int
let x = 3
end
(* all of these are fine *)
let rec silly_list = (IntWith3.x :: silly_list)
let rec silly_list = (Some IntWith3.x :: silly_list)
let rec silly_list = ([ IntWith3.x ] :: silly_list)
let rec silly_list = (ref IntWith3.x :: silly_list)
(* but this causes an error! *)
let rec silly_list = ([| IntWith3.x |] :: silly_list)
-Jeremy
Additional information
On Snow Leopard.
The text was updated successfully, but these errors were encountered: