Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007532OCamltypingpublic2017-05-11 12:522017-05-11 19:56
ReporterMatthieu Lemerre 
Assigned Togasche 
PlatformLinuxOSDebianOS Version
Product Version4.04.0 
Target VersionFixed in Version 
Summary0007532: The compiler does not unbox a type which can not contain a float value
DescriptionThe compiler fails at detecting that a type cannot contain a float value on a recursive type definition, and fails with the following error:

Error: This type cannot be unboxed because
       it might contain both float and non-float values.
       You should annotate it with [@@ocaml.boxed].

If the type definition is not recursive, the type is correctly detected as unboxable.
Steps To Reproduceocamlc on the following program. Reports an error with opam switch 4.04.0+fp and latest trunk (908a38182752f4052289f6616)

type x
type y

type 'a t =
  | X: {id: int} -> x t
  | Y: {id: int} -> y t

and any = Any: 'a t -> any [@@unboxed]

Additional Information
With the following program, everything works as intended; the only difference is that the type definition is not recursive:

type x
type y

type 'a t =
  | X: {id: int} -> x t
  | Y: {id: int} -> y t

type any = Any: 'a t -> any [@@unboxed]

Of course I actually need a recursive version, where X contains an "any" field.
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0007364assigneddoligez Inflexibility of unboxed types in recursive declarations 

-  Notes
gasche (developer)
2017-05-11 19:56

It is an unfortunate restriction of the current unboxed analysis that mutually-recursive types are not well supported. This has been previously reported at [^]

so I will redirect the conversation there to avoid splits. Thanks for the report!

- Issue History
Date Modified Username Field Change
2017-05-11 12:52 Matthieu Lemerre New Issue
2017-05-11 19:56 gasche Note Added: 0017793
2017-05-11 19:56 gasche Relationship added duplicate of 0007364
2017-05-11 19:56 gasche Status new => resolved
2017-05-11 19:56 gasche Resolution open => duplicate
2017-05-11 19:56 gasche Assigned To => gasche

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker