Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005054OCamlOCaml generalpublic2010-05-19 03:032010-05-20 16:57
Reporterjeremy 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.2 
Target VersionFixed in Version3.12.0+dev 
Summary0005054: simple recursive value not accepted
DescriptionI 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 InformationOn Snow Leopard.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005457)
frisch (developer)
2010-05-19 13:34
edited on: 2010-05-19 13:34

This is caused by this case in Translcore.check_recursive_lambda:

    | Lprim (Pmakearray (Pgenarray), args) -> false


This was introduced in rev 7742 ( http://caml.inria.fr/cgi-bin/viewcvs.cgi/ocaml/version/3.09/bytecomp/translcore.ml?rev=7742&r1=7175&r2=7742 [^] ) as part of the fix for 0004141.

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.

(0005472)
doligez (administrator)
2010-05-20 16:31

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).

I'll implement that and do some testing.
(0005475)
doligez (administrator)
2010-05-20 16:57

OK. Seems to work, and I'm reasonably confident that it's sound.

- Issue History
Date Modified Username Field Change
2010-05-19 03:03 jeremy New Issue
2010-05-19 13:34 frisch Note Added: 0005457
2010-05-19 13:34 frisch Note Edited: 0005457
2010-05-20 16:31 doligez Note Added: 0005472
2010-05-20 16:57 doligez Note Added: 0005475
2010-05-20 16:57 doligez Status new => closed
2010-05-20 16:57 doligez Resolution open => fixed
2010-05-20 16:57 doligez Fixed in Version => 3.12.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker