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: 297 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi,
The following code compiled fine under 3.0 but doesn't compile under
3.00 + 22. I'm not complaining, since there was a type problem which is now
flagged, but since I don't think this was in the "Changes" file I thought
someone might be interested. Uncommenting the commented part of hier_base
fixes the problem. I was a bit lazy to minimize the error so I hope this is
small enough ;-).
class virtual hier_base insts kind name iname extents terms outline =
object (self)
(* inherit hier_intf ) ( In 3.00, omitting this is not a bug *)
inherit leaf_base kind name iname extents terms outline
The following code compiled fine under 3.0 but doesn't compile under
3.00 + 22. I'm not complaining, since there was a type problem which is now
flagged, but since I don't think this was in the "Changes" file I thought
someone might be interested. Uncommenting the commented part of hier_base
fixes the problem. I was a bit lazy to minimize the error so I hope this is
small enough ;-).
It seems related to this line in Changes:
Type-checking:
Improved implicit subtypes built by (... :> ty), closer to intuition.
What happens is that simple coercions were improved to give better
(not exactly more) polymorphism, which is good in general, but may
mean that something that was monomorphic before becomes polymorphic,
which is illegal in a class definition.
Another way to make typing correct is to specify more your coercion:
method full_view = Hier_node (self : #hier_intf :> hier_intf)
Original bug ID: 297
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi,
The following code compiled fine under 3.0 but doesn't compile under
3.00 + 22. I'm not complaining, since there was a type problem which is now
flagged, but since I don't think this was in the "Changes" file I thought
someone might be interested. Uncommenting the commented part of hier_base
fixes the problem. I was a bit lazy to minimize the error so I hope this is
small enough ;-).
-- Brian
(* **********************************************************************
*)
type orientation =
R0
| R90
| R180
| R270
| MX
| MY (* mirrored about the y axis )
| MXR90 ( mirrored about the x axis and then rotated *)
| MYR90
type ipoint = int * int
let zero = 0
type placement =
{ origin : ipoint
; orientation : orientation
}
type term_kind =
Power
| Ground
type term_side = North | South | East | West | Internal
type term =
{ term_name : string
; term_kind : term_kind
; term_side : term_side
; term_point : ipoint
; term_layer : string
; term_width : int
; term_depth : int
; term_equiv : string
}
type ('a, 'b) node = Leaf_node of 'a | Hier_node of 'b
type ('a,'b) instance =
CellRef of (string * ('a, 'b) node * placement)
| CellArrayRef of (string * ('a, 'b) node * placement * ipoint * ipoint * ipoint)
class virtual leaf_intf =
object
(* The Composite interface )
method virtual full_view : (leaf_intf, hier_intf) node
( The Visitor interface *)
method virtual accept : visitor_intf -> placement -> unit
end
and virtual hier_intf =
object
inherit leaf_intf
method virtual leaf_view : (leaf_intf, hier_intf) node
method virtual insts : (leaf_intf, hier_intf) instance list
end
and virtual visitor_intf =
object
method virtual visit : (leaf_intf, hier_intf) node -> placement -> unit
method virtual visit_leaf : leaf_intf -> placement -> unit
method virtual visit_hier : hier_intf -> placement -> unit
end
type inst = (leaf_intf, hier_intf) instance
and inst_list = inst list
(* Some root classes *)
class virtual leaf_base kind name iname extents terms outline =
object (self)
inherit leaf_intf
method kind = kind
method name = name
method iname = iname
method extents = extents
method terms = terms
method outline = outline
method full_view = Leaf_node (self :> leaf_intf)
method accept visitor placement =
visitor#visit_leaf (self :> leaf_intf) placement
end
class virtual hier_base insts kind name iname extents terms outline =
object (self)
(* inherit hier_intf ) ( In 3.00, omitting this is not a bug *)
inherit leaf_base kind name iname extents terms outline
end
The text was updated successfully, but these errors were encountered: