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: 6417 Reporter: Nick Chapman Assigned to:@garrigue Status: closed (set by @xavierleroy on 2015-12-11T18:27:41Z) Resolution: fixed Priority: normal Severity: minor Fixed in version: 4.02.0+dev Category: ~DO NOT USE (was: OCaml general)
Bug description
The following ml is rejected by the latest trunk 4.02
Having a local module named Pervasives in scope, breaks a following sprintf.
module Pervasives = struct end
let _:string = Printf.sprintf "%d" 123
File "bad_sprintf.ml", line 2, characters 30-34:
Error: This expression has type string but an expression was expected of type
('a -> 'b, unit, string) format =
('a -> 'b, unit, string, string, string, string)
CamlinternalFormatBasics.fmt * string
The name "Pervasives" is being used as the name for a non top-level module. It is not intended in any way to rebind the real Pervasives.
This was in code which already existed in our code base; but it is not a widely used idiom, and so should be only a small effort to choose a different name.
However, it does seem rather surprising that format strings would compile to reference the definition of Pervasives which is dynamically in scope.
Fixed by applying formatBasics.diff, committed in 4.02 at revision 14921.
This solves the problem by turning CamlinternalFormatBasics into an independent compilation unit, which is referred to by Pervasives, but does not require it.
Original bug ID: 6417
Reporter: Nick Chapman
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:27:41Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Bug description
The following ml is rejected by the latest trunk 4.02
Having a local module named Pervasives in scope, breaks a following sprintf.
module Pervasives = struct end
let _:string = Printf.sprintf "%d" 123
File "bad_sprintf.ml", line 2, characters 30-34:
Error: This expression has type string but an expression was expected of type
('a -> 'b, unit, string) format =
('a -> 'b, unit, string, string, string, string)
CamlinternalFormatBasics.fmt * string
Steps to reproduce
4.02 trunk
commit c82c004
File attachments
The text was updated successfully, but these errors were encountered: