Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
type unsoundness with constraints and polymorphic variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-11 (20:46)
From: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] type unsoundness with constraints and polymorphic variants
On Feb 11, 2008 3:03 PM, Stephen Weeks <> wrote:
> Here is a distillation of the bug.  If you compile this, you get a
> warning about line 11 being an unused case.  If you then run the
> resulting executable, you get a segfault.

Line 11 can obviously be deleted, the segfault still persists.  The
unsoundness seems to appear when the signature constraint is applied
to the module.  It should fail, because the identity function is
clearly not a valid instance of this type, since `X can be passed to
it and it would just be returned, thus violating the return type.

It seems that constraints on polymorphic variables are not handled
correctly during the unification of the contents of the module with
its signature.


Markus Mottl