Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005619OCamlOCaml generalpublic2012-05-18 14:172013-08-12 08:33
Reporterlpw25 
Assigned Togarrigue 
PrioritylowSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.00.0+dev 
Summary0005619: Uncuaght CType.Unify exception
DescriptionCompiling the following code produces an uncaught CType.Unify exception:

  exception Bad_cast

  class type foo_t =
  object
    method foo: string
  end

  type 'a name =
      Foo: foo_t name
    | Int: int name

  class foo: foo_t =
  object(self)
    method foo = "foo"
    method cast: type a. a name -> a =
      function
          Foo -> (self :> foo_t)
        | _ -> ((raise Bad_cast) : a)
  end

I am using revision 12464 from the repository.

I know that this code is not valid. The original code used my "open types" extension, but I had to remove those bits to show that the bug was not in my extension.

The bug could be avoided in my original code by changing (self :> foo_t) to (self : #foo_t :> foo_t).
TagsNo tags attached.
Attached Files? file icon cast.ml [^] (295 bytes) 2012-05-18 14:17 [Show Content]

- Relationships
related to 0006123resolvedgarrigue Assert_failure("typing/ctype.ml", 359, 6) 

-  Notes
(0007462)
garrigue (manager)
2012-05-25 07:22

Duplicating the environment for GADT pattern matching resulted in wrong detection of self-escape.
Solved by not copying the argument to the dummy_method in subst.ml, under specific conditions.
Fixed in trunk and 4.00, at revisions 12482 and 12483.

- Issue History
Date Modified Username Field Change
2012-05-18 14:17 lpw25 New Issue
2012-05-18 14:17 lpw25 File Added: cast.ml
2012-05-18 15:28 gasche Status new => acknowledged
2012-05-19 03:52 garrigue Assigned To => garrigue
2012-05-19 03:52 garrigue Status acknowledged => assigned
2012-05-25 07:22 garrigue Note Added: 0007462
2012-05-25 07:22 garrigue Status assigned => closed
2012-05-25 07:22 garrigue Resolution open => fixed
2012-05-25 07:22 garrigue Fixed in Version => 4.00.0+dev
2013-08-12 08:33 garrigue Relationship added related to 0006123


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker