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: 1921 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I just found out something which I don't know if it should be qualified as a
bug or not: take a look at toy-min.ml. It compiles fine with ocaml 3.06, and
works as expected, but fails with ocaml 3.07.
This is a toy example based on a 47Ko source file (!), which compiled fine
with 3.06 but not with the new version.
The toy.ml file is the syntactic equivalent of this source file, though you
might prefer to take a look at toy-min.ml instead.
The reason why I hope :-) it is a bug, is that the incriminated source file is
generated automatically, and understanding how to correct it would cause me
headaches ;-).
I looked for the cause of this incompatibility, and saw that there had been
some changes in check_recursive_lambda of bytecomp/translcore.ml.
So I attempted to get the lambda term that caused the problem, so as to unroll
manually the check_recursive_lambda function, but I saw that when there was an
syntactic error, the lambda term was not dumped (while the parse tree was). So
maybe changing the order of function calls in driver/compile.ml would be a
good idea (but I dunno, I didn't attempt to see if the order was important or
not).
Thanks in advance.
let rec recData=
let module SomeModule=
struct
let callRecData x=
if x<=0
then 1
else ((fst recData) (x-1)) * x
let mk_double x=2 * x
end
in
(SomeModule.callRecData, SomeModule.mk_double)
let _=
let test=(snd recData) ((fst recData) 5) in
print_int test
module type DummyType=
sig
type t
val mk_id : t -> t
end
module MakeModule=
functor(M:DummyType) ->
struct
let fun1 a= M.mk_id a
let fun2 a= M.mk_id a
end
let first (t,,)=t
let second (,t,)=t
let third (,,t)=t
let treatment x=x
let callsthg x=x
let rec recData=
let useRecData x=callsthg (second recData x) in
let module SomeModule=
struct
type t=int
let rec useUser somefun what=
match what with
| None -> what
| Some(_:int) -> treatment (useUser useRecData None)
let callRecData x=
first recData x
let mk_id x=x
end
in
let module UserModule=MakeModule(SomeModule) in
(UserModule.fun1, UserModule.fun2, SomeModule.useUser)
The text was updated successfully, but these errors were encountered:
See also #8497 for a follow-up.
This is not really a bug. The checking of recursive values is tighter in 3.07,
so more things are rejected.
Eta-expansion solves the problem in this case.
--DD 2004-06-16
Original bug ID: 1921
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I just found out something which I don't know if it should be qualified as a
bug or not: take a look at toy-min.ml. It compiles fine with ocaml 3.06, and
works as expected, but fails with ocaml 3.07.
This is a toy example based on a 47Ko source file (!), which compiled fine
with 3.06 but not with the new version.
The toy.ml file is the syntactic equivalent of this source file, though you
might prefer to take a look at toy-min.ml instead.
The reason why I hope :-) it is a bug, is that the incriminated source file is
generated automatically, and understanding how to correct it would cause me
headaches ;-).
I looked for the cause of this incompatibility, and saw that there had been
some changes in check_recursive_lambda of bytecomp/translcore.ml.
So I attempted to get the lambda term that caused the problem, so as to unroll
manually the check_recursive_lambda function, but I saw that when there was an
syntactic error, the lambda term was not dumped (while the parse tree was). So
maybe changing the order of function calls in driver/compile.ml would be a
good idea (but I dunno, I didn't attempt to see if the order was important or
not).
Thanks in advance.
let rec recData=
let module SomeModule=
struct
in
(SomeModule.callRecData, SomeModule.mk_double)
let _=
let test=(snd recData) ((fst recData) 5) in
print_int test
module type DummyType=
sig
type t
val mk_id : t -> t
end
module MakeModule=
functor(M:DummyType) ->
struct
let fun1 a= M.mk_id a
let fun2 a= M.mk_id a
end
let first (t,,)=t
let second (,t,)=t
let third (,,t)=t
let treatment x=x
let callsthg x=x
let rec recData=
let useRecData x=callsthg (second recData x) in
let module SomeModule=
struct
type t=int
in
let module UserModule=MakeModule(SomeModule) in
(UserModule.fun1, UserModule.fun2, SomeModule.useUser)
The text was updated successfully, but these errors were encountered: