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 3A6117FA5E for ; Tue, 16 May 2017 18:58:19 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=tim@ryanleonard.us; spf=None smtp.mailfrom=tim@ryanleonard.us; spf=None smtp.helo=postmaster@mail-qt0-f174.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of tim@ryanleonard.us) identity=pra; client-ip=209.85.216.174; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tim@ryanleonard.us"; x-sender="tim@ryanleonard.us"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of tim@ryanleonard.us) identity=mailfrom; client-ip=209.85.216.174; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tim@ryanleonard.us"; x-sender="tim@ryanleonard.us"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qt0-f174.google.com) identity=helo; client-ip=209.85.216.174; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tim@ryanleonard.us"; x-sender="postmaster@mail-qt0-f174.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3ASxbL1RIpyCtWybOo4dmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgRK/7xwZ3uMQTl6Ol3ixeRBMOAuq4C07KempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgpp?= =?us-ascii?q?POT1HZPZg9iq2+yo9ZDeZwpFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+?= =?us-ascii?q?RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLd?= =?us-ascii?q?QgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgfliD?= =?us-ascii?q?wHOTEl/27ZhNF+gqFFrhymvBFw2ZLYYISPOfp+Yq/RY9UXTndBUMZLUCxBB5ux?= =?us-ascii?q?YZUOD+oEIO1WqZfyp1wIrRSkHwmjGf7kxzhWiH/32K03yPovEQDD3AImAd0Ot3?= =?us-ascii?q?LUo8/vNKgPS+y10bLIwCzFYvhL2jn98JDFfg49rfyIR759csrcxVMxGw/Yj1ic?= =?us-ascii?q?s5HpMjGa2+gVsWWX8vBsWf+thmMosQ19vDaiy8Y2hoTJgI8e10rK+j9jwIkvIN?= =?us-ascii?q?21UE57bsCgEJtXryyaMpF5QsImQ21xoSY61qEKtYe1fCQXypkqyATTa/OAc4iP?= =?us-ascii?q?7RLjUPieLS1ki3JifbKznxey8U6+xe3gTsS4zkpGoy5fntTPtn0BzQLf5tWGR/?= =?us-ascii?q?dn40us2zmC2xjW6u5eIEA0kaTbK4Qmwr41jpcTrUXDHirtlUXsjK6ZbEMk+uy2?= =?us-ascii?q?5OTgZLXpvIWcOJJuhgHjKaQigta/DvggMggSQ2ib/vyx26H58k38RLVGl/k2kq?= =?us-ascii?q?jCsJDGPskbva64AwpN0ok58Rq/DjGm0M4ZnXYdNl5FdgiH3MDVPATFKfX8SPO+?= =?us-ascii?q?mEiEkTFxxvmAMKeyLI/KKy3/kbKpWbt67UdGxEJn8dFaz65VD5UMJ/T6QEO3qc?= =?us-ascii?q?eOXUxxCBC93+uyUIY17YgZQ2/aWqI=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0ApEABGLxtZf67YVdFcSBgHg3ATgQmfS?= =?us-ascii?q?JBekzpDFAEBAQEBAQEBAQEBEgEBCQsLCCYxgjMignEZAQE4EA52AQUBFopCn3g?= =?us-ascii?q?/ix2CVjqDCQEBBYgcCAkBCIVagnwLiBSCdYIxng+BHJxxEIZpkACCezOBFTaBK?= =?us-ascii?q?08zWwGCUoFOAUAfgX9aAYhCAQEB?= X-IPAS-Result: =?us-ascii?q?A0ApEABGLxtZf67YVdFcSBgHg3ATgQmfSJBekzpDFAEBAQE?= =?us-ascii?q?BAQEBAQEBEgEBCQsLCCYxgjMignEZAQE4EA52AQUBFopCn3g/ix2CVjqDCQEBB?= =?us-ascii?q?YgcCAkBCIVagnwLiBSCdYIxng+BHJxxEIZpkACCezOBFTaBK08zWwGCUoFOAUA?= =?us-ascii?q?fgX9aAYhCAQEB?= X-IronPort-AV: E=Sophos;i="5.38,350,1491256800"; d="scan'208,217";a="273379758" Received: from mail-qt0-f174.google.com ([209.85.216.174]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 16 May 2017 18:58:18 +0200 Received: by mail-qt0-f174.google.com with SMTP id c13so71615136qtc.1 for ; Tue, 16 May 2017 09:58:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ryanleonard-us.20150623.gappssmtp.com; s=20150623; h=sender:from:mime-version:date:subject:message-id:to; bh=2Q16EaR6Pizq10zWXVdWYOVGBohfLX3jpFRXWAiAXR0=; b=aQ8m0D5sU14TmVLwbdWVpFet2QSIaimSWpwAMCWh48HqzshcUXlQL9ghZVbhmAnaO9 kVR5yqu5K/1kkBHQ2tm/rqGmIexnBx/1hyOyl+oMTtUT+qE08IQF659Wl+DpiWxL63pH 2CUM9/hmmI6LOMMLzBaYvokpmnYb47K4nybXg6G2+jPeGcCZNYZHL7kEv89B59By/kRi wj3E9oMBe/tC1rbk30iKPybEFwedP4FNFsVxVaELLgfgQSXOEdzo4V/aah4aen1YfOQ0 UO6JaduZGTb47FWpWwWTmjSRqvmnI33ZOQYF4EdZTjlgbWP5bQm61QpD0RUhgpbYGcdc lH6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:mime-version:date:subject:message-id :to; bh=2Q16EaR6Pizq10zWXVdWYOVGBohfLX3jpFRXWAiAXR0=; b=RUtZgu4rI3/bQ82jZAKALEOvQcOTkNcLPtEr8CZLxdT9Gkoe3SNxsR51pI8GX/Jexr 8wORimUqZ10iq9Rh1C5wa1Lh8y1fMv2HzT5Z7JPhz12R5yIdWkeJ1LraTpIHSWRrL5kP vkd/KXVJHMlXAGgDgdS0qFs6IGTzOUJLnv/8JONh7Zvt6nh/ESBtbMbOAvKbfp6ZY3rh gO0XLwYXjb+Uo4pGumpNrNPvi2hJe42CHWlvcFuw1Anao5npBhlAlJbwMKxm/56ZIXk+ JbgoRa9nvFU3gbiLz4Gq6Rg9VRZnQvMNb6jHRCj9Sd9kgTqx8TtVr434LkIEo4Hjh3Mh ggsg== X-Gm-Message-State: AODbwcCM4VwRImaINr7rqu6wu5GIzc4TBcmj8Gfg7CrqFWCF27sIx9VO pD4UVePzmlrbnyr1Sa8= X-Received: by 10.200.35.240 with SMTP id r45mr11070623qtr.233.1494953896905; Tue, 16 May 2017 09:58:16 -0700 (PDT) Received: from [192.168.2.128] (books.gpl.org. [71.174.236.5]) by smtp.gmail.com with ESMTPSA id g66sm10980310qkb.55.2017.05.16.09.58.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 May 2017 09:58:16 -0700 (PDT) Sender: Tim Leonard From: Tim Leonard Content-Type: multipart/alternative; boundary="Apple-Mail=_C30DDEC6-723F-45AD-AA16-6DECE9D66A35" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Tue, 16 May 2017 12:58:14 -0400 Message-Id: To: caml-list@inria.fr X-Mailer: Apple Mail (2.3273) Subject: [Caml-list] type inference of record field that is an array --Apple-Mail=_C30DDEC6-723F-45AD-AA16-6DECE9D66A35 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Is type inference working as expected here, or is this a bug? # type record_type = { array_field : int array };; type record_type = { array_field : int array; } # let test_function_1 x = Array.set x.array_field 1 3;; val test_function_1 : record_type -> unit = # let test_function_2 x = x.array_field.[1] <- 3;; Characters 24-46: let test_function_2 x = x.array_field.[1] <- 3;; ^^^^^^^^^^^^^^^^^^^^^^ Warning 3: deprecated: String.set Use Bytes.set instead. Characters 24-37: let test_function_2 x = x.array_field.[1] <- 3;; ^^^^^^^^^^^^^ Error: This expression has type int array but an expression was expected of type bytes = string # --Apple-Mail=_C30DDEC6-723F-45AD-AA16-6DECE9D66A35 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Is type inference working as expected here, or is this a bug?

=
# type record_type = =3D { array_field : int array };;
type record_type =3D { array_field : int array; }<= /font>
# let tes= t_function_1 x =3D Array.set x.array_field 1 3;;
val test_function_1 : record_type -= > unit =3D <fun>
# let test_function_2 x =3D x.array_field.[1] <- 3;;
Characters = 24-46:
&n= bsp; let test_function_2 x =3D x.array_field.[1] <- 3;;
      &nbs= p;                   ^^^^^^^^^= ^^^^^^^^^^^^^
Warning 3: deprecated: String.set
Use Bytes.set instead.
Characters 24-37:
=
  let test_funct= ion_2 x =3D x.array_field.[1] <- 3;;
            &n= bsp;             ^^^^^^^^^^^^^
Error: This expression = has type int array
       but an expression was expected of type= bytes =3D string
= --Apple-Mail=_C30DDEC6-723F-45AD-AA16-6DECE9D66A35--