From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id C572C7FACD for ; Mon, 15 Sep 2014 17:20:26 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of agarwal1975@gmail.com) identity=pra; client-ip=209.85.216.52; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of agarwal1975@gmail.com designates 209.85.216.52 as permitted sender) identity=mailfrom; client-ip=209.85.216.52; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qa0-f52.google.com) identity=helo; client-ip=209.85.216.52; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="postmaster@mail-qa0-f52.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApYBAH8CF1TRVdg0m2dsb2JhbABhg2BXBIJ4xgWBZ4dSgQsIFhABAQEBAQYLCwkUKoQcEQQZARseAxIDBgc3AiQBEQEFARYMNYgHAQMRiS+NEYMZa4swgXKDEIhlChknDWaGIQEFDo0vggyDA4FTAQSWBIcEgV+NJIRKGCmDGB6BdSEvgkoBAQE X-IPAS-Result: ApYBAH8CF1TRVdg0m2dsb2JhbABhg2BXBIJ4xgWBZ4dSgQsIFhABAQEBAQYLCwkUKoQcEQQZARseAxIDBgc3AiQBEQEFARYMNYgHAQMRiS+NEYMZa4swgXKDEIhlChknDWaGIQEFDo0vggyDA4FTAQSWBIcEgV+NJIRKGCmDGB6BdSEvgkoBAQE X-IronPort-AV: E=Sophos;i="5.04,528,1406584800"; d="scan'208";a="95511621" Received: from mail-qa0-f52.google.com ([209.85.216.52]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 15 Sep 2014 17:20:26 +0200 Received: by mail-qa0-f52.google.com with SMTP id m5so3915237qaj.25 for ; Mon, 15 Sep 2014 08:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=uoDlIi7QkITqsebrzom6WSxf7C4Esr2wJvyqYs7kMtk=; b=UpNfGGPYkRZ1TjbWe7EZcT07VvNNHvL9HF4ifVhk4lLEQBrNPNUlysnJeRewQXjZz1 kPwBd2aNYC4wM6G/RmAZviNqBMD13BXKg7r/70mjgWfgBXfgvGlXtMiLBbwlLPoLVsfJ obPBocXN4BcLZ+U4pf0WR0VCInyK9ZwgNHwRAZIhLO3aopnW0xa9cR5pENOsY2XipoBM W3DHvvykL/UugEF5+p5En36pyIqlNHfvS1/r+Xg5x4UOIzB44ejXhIGH1+mJBWgjI8nC RoGGEWF6UJNOnG4f43Cua/XMWafYt7EnEyuOZGZt8RNdB6gzmhR/N61XlaCyMnCLKhfz 7u0A== X-Received: by 10.140.94.144 with SMTP id g16mr15134623qge.77.1410794420976; Mon, 15 Sep 2014 08:20:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.165.144 with HTTP; Mon, 15 Sep 2014 08:20:00 -0700 (PDT) From: Ashish Agarwal Date: Mon, 15 Sep 2014 11:20:00 -0400 Message-ID: To: Caml List Content-Type: multipart/alternative; boundary=001a113abee45044ab05031c2c06 Subject: [Caml-list] type printing error --001a113abee45044ab05031c2c06 Content-Type: text/plain; charset=UTF-8 The following example leads to an assertion from printtyp.ml when loaded in utop. I made the example as small as I could, but unfortunately it still depends on a package called Future which in turn depends on Core. To run it you'll have to do: $ opam pin add future https://github.com/agarwal/future Then hit Y to install the package. $ cat tmp.ml open Future_std let f items = Pipe.peek_deferred items >>= function | `Comment _ -> return () #require "future.std";; # #use "tmp.ml";; Fatal error: exception "Assert_failure typing/printtyp.ml:583:12" Raised at file "bytes.ml", line 220, characters 25-34 Doing the equivalent in the standard ocaml toploop or compiling with ocamlc/ocamlopt doesn't exhibit this assertion. You correctly get the real error reported: $ ocamlfind ocamlc -package future.std -thread tmp.ml File "tmp.ml", line 5, characters 4-14: Error: This pattern matches values of type [? `Comment of 'a ] but a pattern was expected which matches values of type ('b Future_std.Deferred.t as 'b) Future_std.Deferred.t The second variant type does not allow tag(s) `Comment The assertion is also avoided if you replace `open Future_std` with a copy/paste of the relevant part of Future_std. --001a113abee45044ab05031c2c06 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The following example leads to an assertion from printtyp.ml when loaded in utop. =C2=A0I made t= he example as small as I could, but unfortunately it still depends on a pac= kage called Future which in turn depends on Core.

To run= it you'll have to do:

$ opam pin add future https://github.com/agarwal/future

$ cat tmp.ml=C2=A0
= open Future_std
let f items =3D
=C2=A0 Pipe.peek_deferr= ed items >>=3D function
=C2=A0 | `Comment _ -> return ()=


#require "future.std";;<= /div>

# #use "tmp.ml&= quot;;;
Fatal error: exception "Assert_failure typing/printt= yp.ml:583:12"
Raised at file "bytes.ml", line 220, characters 25-34 =C2=A0

Doing the equivalent in the standard ocaml topl= oop or compiling with ocamlc/ocamlopt doesn't exhibit this assertion. Y= ou correctly get the real error reported:

$ o= camlfind ocamlc -package future.std -thread tmp.m= l=C2=A0
File "tmp.ml"= , line 5, characters 4-14:
Error: This pattern matches values of = type [? `Comment of 'a ]
=C2=A0 =C2=A0 =C2=A0 =C2=A0but a pat= tern was expected which matches values of type
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0('b Future_std.Deferred.t as 'b) Future_std.Deferr= ed.t
=C2=A0 =C2=A0 =C2=A0 =C2=A0The second variant type does not = allow tag(s) `Comment


The ass= ertion is also avoided if you replace `open Future_std` with a copy/paste o= f the relevant part of Future_std.

--001a113abee45044ab05031c2c06--