├── .github └── workflows │ └── test.yml ├── .gitignore ├── README.md ├── dune-project ├── esy.lock ├── .gitattributes ├── .gitignore ├── index.json ├── opam │ ├── astring.0.8.5 │ │ └── opam │ ├── base-bigarray.base │ │ └── opam │ ├── base-bytes.base │ │ └── opam │ ├── base-threads.base │ │ └── opam │ ├── base-unix.base │ │ └── opam │ ├── base.v0.15.0 │ │ └── opam │ ├── biniou.1.2.1 │ │ └── opam │ ├── cmdliner.1.1.1 │ │ └── opam │ ├── cppo.1.6.9 │ │ └── opam │ ├── csexp.1.5.1 │ │ └── opam │ ├── dune-build-info.3.2.0 │ │ └── opam │ ├── dune-configurator.3.2.0 │ │ └── opam │ ├── dune-rpc.3.2.0 │ │ └── opam │ ├── dune.3.2.0 │ │ └── opam │ ├── dyn.3.2.0 │ │ └── opam │ ├── easy-format.1.3.3 │ │ └── opam │ ├── either.1.0.0 │ │ └── opam │ ├── fiber.3.2.0 │ │ └── opam │ ├── fix.20220121 │ │ └── opam │ ├── fpath.0.7.3 │ │ └── opam │ ├── menhir.20220210 │ │ └── opam │ ├── menhirLib.20220210 │ │ └── opam │ ├── menhirSdk.20220210 │ │ └── opam │ ├── ocaml-compiler-libs.v0.12.4 │ │ └── opam │ ├── ocaml-lsp-server.1.11.6 │ │ └── opam │ ├── ocaml-migrate-parsetree.2.3.0 │ │ └── opam │ ├── ocaml-version.3.4.0 │ │ └── opam │ ├── ocamlbuild.0.14.1 │ │ └── opam │ ├── ocamlfind.1.9.3 │ │ └── opam │ ├── ocamlformat-rpc-lib.0.21.0 │ │ └── opam │ ├── ocamlformat.0.21.0 │ │ └── opam │ ├── ocp-indent.1.8.1 │ │ └── opam │ ├── octavius.1.2.2 │ │ └── opam │ ├── odoc-parser.1.0.0 │ │ └── opam │ ├── omd.1.3.1 │ │ └── opam │ ├── ordering.3.2.0 │ │ └── opam │ ├── pp.1.1.2 │ │ └── opam │ ├── ppx_derivers.1.2.1 │ │ └── opam │ ├── ppx_optcomp.v0.15.0 │ │ └── opam │ ├── ppx_yojson_conv_lib.v0.15.0 │ │ └── opam │ ├── ppxlib.0.26.0 │ │ └── opam │ ├── re.1.10.4 │ │ └── opam │ ├── result.1.5 │ │ └── opam │ ├── seq.base │ │ ├── files │ │ │ ├── META.seq │ │ │ └── seq.install │ │ └── opam │ ├── sexplib0.v0.15.0 │ │ └── opam │ ├── spawn.v0.15.1 │ │ └── opam │ ├── stdio.v0.15.0 │ │ └── opam │ ├── stdlib-shims.0.3.0 │ │ └── opam │ ├── stdune.3.2.0 │ │ └── opam │ ├── topkg.1.0.5 │ │ └── opam │ ├── uucp.14.0.0 │ │ └── opam │ ├── uuseg.14.0.0 │ │ └── opam │ ├── uutf.1.0.3 │ │ └── opam │ ├── xdg.3.2.0 │ │ └── opam │ └── yojson.1.7.0 │ │ └── opam └── overrides │ ├── opam__s__easy_format_opam__c__1.3.3_opam_override │ └── package.json │ ├── opam__s__ocamlbuild_opam__c__0.14.1_opam_override │ ├── files │ │ └── winpatch.patch │ └── package.json │ └── opam__s__ocamlfind_opam__c__1.9.3_opam_override │ ├── files │ └── findlib.patch │ └── package.json ├── ocaml-migrate-types.opam ├── package.json ├── src ├── .ocamlformat ├── dune ├── migrate_408_409.ml ├── migrate_409_410.ml ├── migrate_410_411.ml ├── migrate_411_412.ml ├── migrate_412_413.ml ├── migrate_413_414.ml ├── shape_414.ml ├── shape_414.mli ├── type_immediacy_410.ml ├── type_immediacy_411.ml ├── type_immediacy_412.ml ├── type_immediacy_413.ml ├── type_immediacy_414.ml ├── types_408.ml ├── types_408.mli ├── types_409.ml ├── types_409.mli ├── types_410.ml ├── types_410.mli ├── types_411.ml ├── types_411.mli ├── types_412.ml ├── types_412.mli ├── types_413.ml ├── types_413.mli ├── types_414.ml └── types_414.mli └── tools ├── .ocamlformat ├── dune └── make_copies.ml /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Run Test 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | native: 7 | name: Build 8 | 9 | strategy: 10 | matrix: 11 | version: [4.08.x, 4.09.x, 4.10.x, 4.11.x, 4.12.x] 12 | system: [ubuntu-latest] 13 | include: 14 | - version: 4.08.x 15 | system: macos-latest 16 | - version: 4.08.x 17 | system: windows-latest 18 | 19 | runs-on: ${{ matrix.system }} 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | - uses: actions/setup-node@v2 24 | with: 25 | node-version: 14 26 | 27 | - name: Install esy 28 | run: npm install -g esy 29 | 30 | - name: Create esy wrapper 31 | run: | 32 | echo '{ 33 | "source": "./package.json", 34 | "override": { 35 | "dependencies": { 36 | "ocaml": "'${{ matrix.version }}'" 37 | } 38 | } 39 | }' > override.json 40 | 41 | - uses: esy/github-action@master 42 | with: 43 | manifest: override.json 44 | cache-key: ${{ hashFiles('esy.lock/index.json') }}-${{ matrix.version }} 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _esy 2 | node_modules 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ocaml-migrate-types 2 | 3 | Convert OCaml Types to the most recent version 4 | 5 | Supported versions are 4.08, 4.09, 4.10, 4.11 and 4.12. For each version, there is a snapshot of the Types and conversion functions to the next version. 6 | 7 | So that a tool using with the last version of the OCaml typechecker will be capable of understanding older types. 8 | -------------------------------------------------------------------------------- /dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 2.8) 2 | 3 | (name ocaml-migrate-types) 4 | 5 | (generate_opam_files true) 6 | 7 | (package 8 | (name ocaml-migrate-types) 9 | (depends 10 | (ocaml 11 | (and 12 | (>= "4.08.0") 13 | (< "4.14.0"))) 14 | ocaml-migrate-parsetree 15 | ppx_optcomp)) 16 | -------------------------------------------------------------------------------- /esy.lock/.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | # Set eol to LF so files aren't converted to CRLF-eol on Windows. 3 | * text eol=lf linguist-generated 4 | -------------------------------------------------------------------------------- /esy.lock/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Reset any possible .gitignore, we want all esy.lock to be un-ignored. 3 | !* 4 | -------------------------------------------------------------------------------- /esy.lock/opam/astring.0.8.5/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Daniel Bünzli " 3 | authors: ["The astring programmers"] 4 | homepage: "https://erratique.ch/software/astring" 5 | doc: "https://erratique.ch/software/astring/doc" 6 | dev-repo: "git+http://erratique.ch/repos/astring.git" 7 | bug-reports: "https://github.com/dbuenzli/astring/issues" 8 | tags: [ "string" "org:erratique" ] 9 | license: "ISC" 10 | depends: [ 11 | "ocaml" {>= "4.05.0"} 12 | "ocamlfind" {build} 13 | "ocamlbuild" {build} 14 | "topkg" {build} ] 15 | build: [[ "ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" ]] 16 | 17 | synopsis: """Alternative String module for OCaml""" 18 | description: """\ 19 | 20 | Astring exposes an alternative `String` module for OCaml. This module 21 | tries to balance minimality and expressiveness for basic, index-free, 22 | string processing and provides types and functions for substrings, 23 | string sets and string maps. 24 | 25 | Remaining compatible with the OCaml `String` module is a non-goal. The 26 | `String` module exposed by Astring has exception safe functions, 27 | removes deprecated and rarely used functions, alters some signatures 28 | and names, adds a few missing functions and fully exploits OCaml's 29 | newfound string immutability. 30 | 31 | Astring depends only on the OCaml standard library. It is distributed 32 | under the ISC license. 33 | """ 34 | url { 35 | archive: "https://erratique.ch/software/astring/releases/astring-0.8.5.tbz" 36 | checksum: "e148907c24157d1df43bec89b58b3ec8" 37 | } 38 | -------------------------------------------------------------------------------- /esy.lock/opam/base-bigarray.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "https://github.com/ocaml/opam-repository/issues" 3 | description: """ 4 | Bigarray library distributed with the OCaml compiler 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /esy.lock/opam/base-bytes.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: " " 3 | authors: " " 4 | homepage: " " 5 | depends: [ 6 | "ocaml" {>= "4.02.0"} 7 | "ocamlfind" {>= "1.5.3"} 8 | ] 9 | synopsis: "Bytes library distributed with the OCaml compiler" 10 | -------------------------------------------------------------------------------- /esy.lock/opam/base-threads.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "https://github.com/ocaml/opam-repository/issues" 3 | description: """ 4 | Threads library distributed with the OCaml compiler 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /esy.lock/opam/base-unix.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "https://github.com/ocaml/opam-repository/issues" 3 | description: """ 4 | Unix library distributed with the OCaml compiler 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /esy.lock/opam/base.v0.15.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/base" 5 | bug-reports: "https://github.com/janestreet/base/issues" 6 | dev-repo: "git+https://github.com/janestreet/base.git" 7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/base/index.html" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "4.10.0"} 14 | "sexplib0" {>= "v0.15" & < "v0.16"} 15 | "dune" {>= "2.0.0"} 16 | "dune-configurator" 17 | ] 18 | synopsis: "Full standard library replacement for OCaml" 19 | description: " 20 | Full standard library replacement for OCaml 21 | 22 | Base is a complete and portable alternative to the OCaml standard 23 | library. It provides all standard functionalities one would expect 24 | from a language standard library. It uses consistent conventions 25 | across all of its module. 26 | 27 | Base aims to be usable in any context. As a result system dependent 28 | features such as I/O are not offered by Base. They are instead 29 | provided by companion libraries such as stdio: 30 | 31 | https://github.com/janestreet/stdio 32 | " 33 | url { 34 | src: "https://ocaml.janestreet.com/ocaml-core/v0.15/files/base-v0.15.0.tar.gz" 35 | checksum: "sha256=8657ae4324a9948457112245c49d97d2da95f157f780f5d97f0b924312a6a53d" 36 | } 37 | -------------------------------------------------------------------------------- /esy.lock/opam/biniou.1.2.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | build: [ 3 | ["dune" "subst"] {dev} 4 | ["dune" "build" "-p" name "-j" jobs] 5 | ["dune" "runtest" "-p" name "-j" jobs] {with-test} 6 | ["dune" "build" "-p" name "@doc"] {with-doc} 7 | ] 8 | maintainer: ["martin@mjambon.com"] 9 | authors: ["Martin Jambon"] 10 | bug-reports: "https://github.com/mjambon/biniou/issues" 11 | homepage: "https://github.com/mjambon/biniou" 12 | doc: "https://mjambon.github.io/biniou/" 13 | license: "BSD-3-Clause" 14 | dev-repo: "git+https://github.com/mjambon/biniou.git" 15 | synopsis: 16 | "Binary data format designed for speed, safety, ease of use and backward compatibility as protocols evolve" 17 | description: """ 18 | 19 | Biniou (pronounced "be new") is a binary data format designed for speed, safety, 20 | ease of use and backward compatibility as protocols evolve. Biniou is vastly 21 | equivalent to JSON in terms of functionality but allows implementations several 22 | times faster (4 times faster than yojson), with 25-35% space savings. 23 | 24 | Biniou data can be decoded into human-readable form without knowledge of type 25 | definitions except for field and variant names which are represented by 31-bit 26 | hashes. A program named bdump is provided for routine visualization of biniou 27 | data files. 28 | 29 | The program atdgen is used to derive OCaml-Biniou serializers and deserializers 30 | from type definitions. 31 | 32 | Biniou format specification: mjambon.github.io/atdgen-doc/biniou-format.txt""" 33 | depends: [ 34 | "easy-format" 35 | "dune" {>= "1.10"} 36 | "ocaml" {>= "4.02.3"} 37 | ] 38 | url { 39 | src: 40 | "https://github.com/mjambon/biniou/releases/download/1.2.1/biniou-1.2.1.tbz" 41 | checksum: [ 42 | "sha256=35546c68b1929a8e6d27a3b39ecd17b38303a0d47e65eb9d1480c2061ea84335" 43 | "sha512=82670cc77bf3e869ee26e5fbe5a5affa45a22bc8b6c4bd7e85473912780e0111baca59b34a2c14feae3543ce6e239d7fddaeab24b686a65bfe642cdb91d27ebf" 44 | ] 45 | } 46 | -------------------------------------------------------------------------------- /esy.lock/opam/cmdliner.1.1.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Declarative definition of command line interfaces for OCaml" 3 | description: """\ 4 | Cmdliner allows the declarative definition of command line interfaces 5 | for OCaml. 6 | 7 | It provides a simple and compositional mechanism to convert command 8 | line arguments to OCaml values and pass them to your functions. The 9 | module automatically handles syntax errors, help messages and UNIX man 10 | page generation. It supports programs with single or multiple commands 11 | and respects most of the [POSIX][1] and [GNU][2] conventions. 12 | 13 | Cmdliner has no dependencies and is distributed under the ISC license. 14 | 15 | [1]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html 16 | [2]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html 17 | 18 | Home page: http://erratique.ch/software/cmdliner""" 19 | maintainer: "Daniel Bünzli " 20 | authors: "The cmdliner programmers" 21 | license: "ISC" 22 | tags: ["cli" "system" "declarative" "org:erratique"] 23 | homepage: "https://erratique.ch/software/cmdliner" 24 | doc: "https://erratique.ch/software/cmdliner/doc" 25 | bug-reports: "https://github.com/dbuenzli/cmdliner/issues" 26 | depends: [ 27 | "ocaml" {>= "4.08.0"} 28 | ] 29 | build: [make "all" "PREFIX=%{prefix}%"] 30 | install: [ 31 | [make "install" "LIBDIR=%{_:lib}%" "DOCDIR=%{_:doc}%"] 32 | [make "install-doc" "LIBDIR=%{_:lib}%" "DOCDIR=%{_:doc}%"] 33 | ] 34 | dev-repo: "git+https://erratique.ch/repos/cmdliner.git" 35 | url { 36 | src: "https://erratique.ch/software/cmdliner/releases/cmdliner-1.1.1.tbz" 37 | checksum: 38 | "sha512=5478ad833da254b5587b3746e3a8493e66e867a081ac0f653a901cc8a7d944f66e4387592215ce25d939be76f281c4785702f54d4a74b1700bc8838a62255c9e" 39 | } -------------------------------------------------------------------------------- /esy.lock/opam/cppo.1.6.9/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Code preprocessor like cpp for OCaml" 3 | description: """\ 4 | Cppo is an equivalent of the C preprocessor for OCaml programs. 5 | It allows the definition of simple macros and file inclusion. 6 | 7 | Cppo is: 8 | 9 | * more OCaml-friendly than cpp 10 | * easy to learn without consulting a manual 11 | * reasonably fast 12 | * simple to install and to maintain""" 13 | maintainer: [ 14 | "Martin Jambon " "Yishuai Li " 15 | ] 16 | authors: "Martin Jambon" 17 | license: "BSD-3-Clause" 18 | homepage: "https://github.com/ocaml-community/cppo" 19 | doc: "https://ocaml-community.github.io/cppo" 20 | bug-reports: "https://github.com/ocaml-community/cppo/issues" 21 | depends: [ 22 | "ocaml" {>= "4.02.3"} 23 | "dune" {>= "1.10"} 24 | "base-unix" 25 | ] 26 | build: [ 27 | ["dune" "subst"] {dev} 28 | ["dune" "build" "-p" name "-j" jobs] 29 | ["dune" "runtest" "-p" name "-j" jobs] {with-test} 30 | ["dune" "build" "-p" name "@doc"] {with-doc} 31 | ] 32 | dev-repo: "git+https://github.com/ocaml-community/cppo.git" 33 | url { 34 | src: "https://github.com/ocaml-community/cppo/archive/v1.6.9.tar.gz" 35 | checksum: [ 36 | "md5=d23ffe85ac7dc8f0afd1ddf622770d09" 37 | "sha512=26ff5a7b7f38c460661974b23ca190f0feae3a99f1974e0fd12ccf08745bd7d91b7bc168c70a5385b837bfff9530e0e4e41cf269f23dd8cf16ca658008244b44" 38 | ] 39 | } -------------------------------------------------------------------------------- /esy.lock/opam/csexp.1.5.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Parsing and printing of S-expressions in Canonical form" 3 | description: """ 4 | 5 | This library provides minimal support for Canonical S-expressions 6 | [1]. Canonical S-expressions are a binary encoding of S-expressions 7 | that is super simple and well suited for communication between 8 | programs. 9 | 10 | This library only provides a few helpers for simple applications. If 11 | you need more advanced support, such as parsing from more fancy input 12 | sources, you should consider copying the code of this library given 13 | how simple parsing S-expressions in canonical form is. 14 | 15 | To avoid a dependency on a particular S-expression library, the only 16 | module of this library is parameterised by the type of S-expressions. 17 | 18 | [1] https://en.wikipedia.org/wiki/Canonical_S-expressions 19 | """ 20 | maintainer: ["Jeremie Dimino "] 21 | authors: [ 22 | "Quentin Hocquet " 23 | "Jane Street Group, LLC" 24 | "Jeremie Dimino " 25 | ] 26 | license: "MIT" 27 | homepage: "https://github.com/ocaml-dune/csexp" 28 | doc: "https://ocaml-dune.github.io/csexp/" 29 | bug-reports: "https://github.com/ocaml-dune/csexp/issues" 30 | depends: [ 31 | "dune" {>= "1.11"} 32 | "ocaml" {>= "4.03.0"} 33 | # "ppx_expect" {with-test & >= "v0.14"} 34 | "odoc" {with-doc} 35 | ] 36 | dev-repo: "git+https://github.com/ocaml-dune/csexp.git" 37 | build: [ 38 | ["dune" "subst"] {dev} 39 | [ 40 | "dune" 41 | "build" 42 | "-p" 43 | name 44 | "-j" 45 | jobs 46 | "@install" 47 | # Tests disabled because of a cyclic dependency with csexp, dune-configurator and ppx_expect 48 | # "@runtest" {with-test} 49 | "@doc" {with-doc} 50 | ] 51 | ] 52 | x-commit-hash: "7eeb86206819d2b1782d6cde1be9d6cf8b5fc851" 53 | url { 54 | src: 55 | "https://github.com/ocaml-dune/csexp/releases/download/1.5.1/csexp-1.5.1.tbz" 56 | checksum: [ 57 | "sha256=d605e4065fa90a58800440ef2f33a2d931398bf2c22061a8acb7df845c0aac02" 58 | "sha512=d785bbabaff9f6bf601399149ef0a42e5e99647b54e27f97ef1625907793dda22a45bf83e0e8a1eba2c63634c5484b54739ff0904ef556f5fc592efa38af7505" 59 | ] 60 | } 61 | -------------------------------------------------------------------------------- /esy.lock/opam/dune-build-info.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Embed build informations inside executable" 3 | description: """ 4 | The build-info library allows to access information about how the 5 | executable was built, such as the version of the project at which it 6 | was built or the list of statically linked libraries with their 7 | versions. It supports reporting the version from the version control 8 | system during development to get an precise reference of when the 9 | executable was built. 10 | """ 11 | maintainer: ["Jane Street Group, LLC "] 12 | authors: ["Jane Street Group, LLC "] 13 | license: "MIT" 14 | homepage: "https://github.com/ocaml/dune" 15 | doc: "https://dune.readthedocs.io/" 16 | bug-reports: "https://github.com/ocaml/dune/issues" 17 | depends: [ 18 | "dune" {>= "3.0"} 19 | "ocaml" {>= "4.08"} 20 | "odoc" {with-doc} 21 | ] 22 | dev-repo: "git+https://github.com/ocaml/dune.git" 23 | build: [ 24 | ["dune" "subst"] {dev} 25 | ["rm" "-rf" "vendor/csexp"] 26 | ["rm" "-rf" "vendor/pp"] 27 | [ 28 | "dune" 29 | "build" 30 | "-p" 31 | name 32 | "-j" 33 | jobs 34 | "@install" 35 | "@doc" {with-doc} 36 | ] 37 | ] 38 | url { 39 | src: 40 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 41 | checksum: [ 42 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 43 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 44 | ] 45 | } 46 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 47 | -------------------------------------------------------------------------------- /esy.lock/opam/dune-configurator.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Helper library for gathering system configuration" 3 | description: """ 4 | dune-configurator is a small library that helps writing OCaml scripts that 5 | test features available on the system, in order to generate config.h 6 | files for instance. 7 | Among other things, dune-configurator allows one to: 8 | - test if a C program compiles 9 | - query pkg-config 10 | - import #define from OCaml header files 11 | - generate config.h file 12 | """ 13 | maintainer: ["Jane Street Group, LLC "] 14 | authors: ["Jane Street Group, LLC "] 15 | license: "MIT" 16 | homepage: "https://github.com/ocaml/dune" 17 | doc: "https://dune.readthedocs.io/" 18 | bug-reports: "https://github.com/ocaml/dune/issues" 19 | depends: [ 20 | "dune" {>= "3.0"} 21 | "ocaml" {>= "4.04.0"} 22 | "csexp" {>= "1.5.0"} 23 | "odoc" {with-doc} 24 | ] 25 | dev-repo: "git+https://github.com/ocaml/dune.git" 26 | build: [ 27 | ["dune" "subst"] {dev} 28 | ["rm" "-rf" "vendor/csexp"] 29 | ["rm" "-rf" "vendor/pp"] 30 | [ 31 | "dune" 32 | "build" 33 | "-p" 34 | name 35 | "-j" 36 | jobs 37 | "@install" 38 | "@doc" {with-doc} 39 | ] 40 | ] 41 | url { 42 | src: 43 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 44 | checksum: [ 45 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 46 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 47 | ] 48 | } 49 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 50 | -------------------------------------------------------------------------------- /esy.lock/opam/dune-rpc.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Communicate with dune using rpc" 3 | description: "Library to connect and control a running dune instance" 4 | maintainer: ["Jane Street Group, LLC "] 5 | authors: ["Jane Street Group, LLC "] 6 | license: "MIT" 7 | homepage: "https://github.com/ocaml/dune" 8 | doc: "https://dune.readthedocs.io/" 9 | bug-reports: "https://github.com/ocaml/dune/issues" 10 | depends: [ 11 | "dune" {>= "3.0"} 12 | "csexp" 13 | "ordering" 14 | "dyn" 15 | "xdg" 16 | "stdune" {= version} 17 | "pp" {>= "1.1.0"} 18 | "odoc" {with-doc} 19 | ] 20 | dev-repo: "git+https://github.com/ocaml/dune.git" 21 | build: [ 22 | ["dune" "subst"] {dev} 23 | ["rm" "-rf" "vendor/csexp"] 24 | ["rm" "-rf" "vendor/pp"] 25 | [ 26 | "dune" 27 | "build" 28 | "-p" 29 | name 30 | "-j" 31 | jobs 32 | "@install" 33 | "@doc" {with-doc} 34 | ] 35 | ] 36 | url { 37 | src: 38 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 39 | checksum: [ 40 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 41 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 42 | ] 43 | } 44 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 45 | -------------------------------------------------------------------------------- /esy.lock/opam/dune.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Fast, portable, and opinionated build system" 3 | description: """ 4 | 5 | dune is a build system that was designed to simplify the release of 6 | Jane Street packages. It reads metadata from "dune" files following a 7 | very simple s-expression syntax. 8 | 9 | dune is fast, has very low-overhead, and supports parallel builds on 10 | all platforms. It has no system dependencies; all you need to build 11 | dune or packages using dune is OCaml. You don't need make or bash 12 | as long as the packages themselves don't use bash explicitly. 13 | 14 | dune supports multi-package development by simply dropping multiple 15 | repositories into the same directory. 16 | 17 | It also supports multi-context builds, such as building against 18 | several opam roots/switches simultaneously. This helps maintaining 19 | packages across several versions of OCaml and gives cross-compilation 20 | for free. 21 | """ 22 | maintainer: ["Jane Street Group, LLC "] 23 | authors: ["Jane Street Group, LLC "] 24 | license: "MIT" 25 | homepage: "https://github.com/ocaml/dune" 26 | doc: "https://dune.readthedocs.io/" 27 | bug-reports: "https://github.com/ocaml/dune/issues" 28 | conflicts: [ 29 | "merlin" {< "3.4.0"} 30 | "ocaml-lsp-server" {< "1.3.0"} 31 | "dune-configurator" {< "2.3.0"} 32 | "odoc" {< "2.0.1"} 33 | "dune-release" {< "1.3.0"} 34 | "js_of_ocaml-compiler" {< "3.6.0"} 35 | "jbuilder" {= "transition"} 36 | ] 37 | dev-repo: "git+https://github.com/ocaml/dune.git" 38 | build: [ 39 | ["ocaml" "bootstrap.ml" "-j" jobs] 40 | ["./dune.exe" "build" "dune.install" "--release" "--profile" "dune-bootstrap" "-j" jobs] 41 | ] 42 | depends: [ 43 | # Please keep the lower bound in sync with .github/workflows/workflow.yml, 44 | # dune-project and min_ocaml_version in bootstrap.ml 45 | ("ocaml" {>= "4.08"} | ("ocaml" {< "4.08~~"} & "ocamlfind-secondary")) 46 | "base-unix" 47 | "base-threads" 48 | ] 49 | url { 50 | src: 51 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 52 | checksum: [ 53 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 54 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 55 | ] 56 | } 57 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 58 | -------------------------------------------------------------------------------- /esy.lock/opam/dyn.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Dynamic type" 3 | description: "Dynamic type" 4 | maintainer: ["Jane Street Group, LLC "] 5 | authors: ["Jane Street Group, LLC "] 6 | license: "MIT" 7 | homepage: "https://github.com/ocaml/dune" 8 | doc: "https://dune.readthedocs.io/" 9 | bug-reports: "https://github.com/ocaml/dune/issues" 10 | depends: [ 11 | "dune" {>= "3.0"} 12 | "ocaml" {>= "4.08.0"} 13 | "ordering" {= version} 14 | "pp" {>= "1.1.0"} 15 | "odoc" {with-doc} 16 | ] 17 | dev-repo: "git+https://github.com/ocaml/dune.git" 18 | build: [ 19 | ["dune" "subst"] {dev} 20 | ["rm" "-rf" "vendor/csexp"] 21 | ["rm" "-rf" "vendor/pp"] 22 | [ 23 | "dune" 24 | "build" 25 | "-p" 26 | name 27 | "-j" 28 | jobs 29 | "@install" 30 | "@doc" {with-doc} 31 | ] 32 | ] 33 | url { 34 | src: 35 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 36 | checksum: [ 37 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 38 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 39 | ] 40 | } 41 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 42 | -------------------------------------------------------------------------------- /esy.lock/opam/easy-format.1.3.3/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: 3 | "High-level and functional interface to the Format module of the OCaml standard library" 4 | description: """ 5 | 6 | This module offers a high-level and functional interface to the Format module of 7 | the OCaml standard library. It is a pretty-printing facility, i.e. it takes as 8 | input some code represented as a tree and formats this code into the most 9 | visually satisfying result, breaking and indenting lines of code where 10 | appropriate. 11 | 12 | Input data must be first modelled and converted into a tree using 3 kinds of 13 | nodes: 14 | 15 | * atoms 16 | * lists 17 | * labelled nodes 18 | 19 | Atoms represent any text that is guaranteed to be printed as-is. Lists can model 20 | any sequence of items such as arrays of data or lists of definitions that are 21 | labelled with something like "int main", "let x =" or "x:".""" 22 | maintainer: ["martin@mjambon.com" "rudi.grinberg@gmail.com"] 23 | authors: ["Martin Jambon"] 24 | license: "BSD-3-Clause" 25 | homepage: "https://github.com/mjambon/easy-format" 26 | doc: "https://mjambon.github.io/easy-format/" 27 | bug-reports: "https://github.com/mjambon/easy-format/issues" 28 | depends: [ 29 | "dune" {>= "2.9"} 30 | "ocaml" {>= "4.08"} 31 | "odoc" {with-doc} 32 | ] 33 | build: [ 34 | ["dune" "subst"] {dev} 35 | [ 36 | "dune" 37 | "build" 38 | "-p" 39 | name 40 | "-j" 41 | jobs 42 | "--promote-install-files=false" 43 | "@install" 44 | "@runtest" {with-test} 45 | "@doc" {with-doc} 46 | ] 47 | ["dune" "install" "-p" name "--create-install-files" name] 48 | ] 49 | dev-repo: "git+https://github.com/mjambon/easy-format.git" 50 | url { 51 | src: 52 | "https://github.com/mjambon/easy-format/releases/download/1.3.3/easy-format-1.3.3.tbz" 53 | checksum: [ 54 | "sha256=eafccae911c26ca23e4ddacee3eaa54654d20f973b8680f84b708cef43adc416" 55 | "sha512=611b3124f6a0ec6406b7bda8018a94c9c4a9da9d22495a5c34a6312bf7f0f0607a9529b276f7039ce3f3b15a955dac413d6d1229a55d5ac291302a3ddd5807e5" 56 | ] 57 | } 58 | x-commit-hash: "56c57e69ef067d1cc4e31029d31e77e55b46be95" 59 | -------------------------------------------------------------------------------- /esy.lock/opam/either.1.0.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Compatibility Either module" 3 | description: """ 4 | Projects that want to use the Either module defined in OCaml 4.12.0 while 5 | staying compatible with older versions of OCaml should use this library 6 | instead. 7 | """ 8 | maintainer: ["Craig Ferguson "] 9 | authors: ["Craig Ferguson "] 10 | license: "MIT" 11 | homepage: "https://github.com/mirage/either" 12 | doc: "https://mirage.github.io/either" 13 | bug-reports: "https://github.com/mirage/either/issues" 14 | depends: [ 15 | "dune" {>= "2.0"} 16 | ] 17 | build: [ 18 | ["dune" "subst"] {dev} 19 | [ 20 | "dune" 21 | "build" 22 | "-p" 23 | name 24 | "-j" 25 | jobs 26 | "@install" 27 | "@runtest" {with-test} 28 | "@doc" {with-doc} 29 | ] 30 | ] 31 | dev-repo: "git+https://github.com/mirage/either.git" 32 | x-commit-hash: "a270ceac58e3e5bed6fe7e8bfb7132b14ee9c322" 33 | url { 34 | src: 35 | "https://github.com/mirage/either/releases/download/1.0.0/either-1.0.0.tbz" 36 | checksum: [ 37 | "sha256=bf674de3312dee7b7215f07df1e8a96eb3d679164b8a918cdd95b8d97e505884" 38 | "sha512=147854c09f897dd028b18a9f19acea8666107aaa7b1aab3c92f568af531364f57298edcaf3897d74246d3857d52e9bfb7ad0fc39220d988d9f14694ca1d5e9ed" 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /esy.lock/opam/fiber.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Structured concurrency library" 3 | description: 4 | "This library offers no backwards compatibility guarantees. Use at your own risk." 5 | maintainer: ["Jane Street Group, LLC "] 6 | authors: ["Jane Street Group, LLC "] 7 | license: "MIT" 8 | homepage: "https://github.com/ocaml/dune" 9 | doc: "https://dune.readthedocs.io/" 10 | bug-reports: "https://github.com/ocaml/dune/issues" 11 | depends: [ 12 | "dune" {>= "3.0"} 13 | "ocaml" {>= "4.08.0"} 14 | "stdune" {= version} 15 | "dyn" {= version} 16 | "odoc" {with-doc} 17 | ] 18 | dev-repo: "git+https://github.com/ocaml/dune.git" 19 | build: [ 20 | ["dune" "subst"] {dev} 21 | ["rm" "-rf" "vendor/csexp"] 22 | ["rm" "-rf" "vendor/pp"] 23 | [ 24 | "dune" 25 | "build" 26 | "-p" 27 | name 28 | "-j" 29 | jobs 30 | "@install" 31 | "@doc" {with-doc} 32 | ] 33 | ] 34 | url { 35 | src: 36 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 37 | checksum: [ 38 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 39 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 40 | ] 41 | } 42 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 43 | -------------------------------------------------------------------------------- /esy.lock/opam/fix.20220121/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | ] 7 | homepage: "https://gitlab.inria.fr/fpottier/fix" 8 | dev-repo: "git+https://gitlab.inria.fr/fpottier/fix.git" 9 | bug-reports: "francois.pottier@inria.fr" 10 | license: "LGPL-2.0-only" 11 | build: [ 12 | ["dune" "build" "-p" name "-j" jobs] 13 | ] 14 | depends: [ 15 | "ocaml" { >= "4.03" } 16 | "dune" { >= "1.3" } 17 | ] 18 | synopsis: "Algorithmic building blocks for memoization, recursion, and more" 19 | url { 20 | src: 21 | "https://gitlab.inria.fr/fpottier/fix/-/archive/20220121/archive.tar.gz" 22 | checksum: [ 23 | "md5=48d8a5bdff23cf7fbf9288877df2b6aa" 24 | "sha512=a851d8783c0c519c6e55359a5c471af433058872409c29a1a7bdfd0076813341ad2c0ebd1ce9e28bff4d4c729dfbc808c41c084fe12a42b45a2b5e391e77ccd2" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /esy.lock/opam/fpath.0.7.3/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Daniel Bünzli " 3 | authors: ["The fpath programmers"] 4 | homepage: "https://erratique.ch/software/fpath" 5 | doc: "https://erratique.ch/software/fpath/doc" 6 | dev-repo: "git+https://erratique.ch/repos/fpath.git" 7 | bug-reports: "https://github.com/dbuenzli/fpath/issues" 8 | tags: [ "file" "system" "path" "org:erratique" ] 9 | license: "ISC" 10 | depends: [ 11 | "ocaml" {>= "4.03.0"} 12 | "ocamlfind" {build} 13 | "ocamlbuild" {build} 14 | "topkg" {build & >= "0.9.0"} 15 | "astring" 16 | ] 17 | build: [[ 18 | "ocaml" "pkg/pkg.ml" "build" 19 | "--dev-pkg=true" {dev} ]] 20 | 21 | synopsis: """File system paths for OCaml""" 22 | description: """\ 23 | 24 | Fpath is an OCaml module for handling file system paths with POSIX or 25 | Windows conventions. Fpath processes paths without accessing the file 26 | system and is independent from any system library. 27 | 28 | Fpath depends on [Astring][astring] and is distributed under the ISC 29 | license. 30 | 31 | [astring]: http://erratique.ch/software/astring 32 | """ 33 | url { 34 | archive: "https://erratique.ch/software/fpath/releases/fpath-0.7.3.tbz" 35 | checksum: "0740b530e8fed5b0adc5eee8463cfc2f" 36 | } 37 | -------------------------------------------------------------------------------- /esy.lock/opam/menhir.20220210/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" {>= "4.03.0"} 17 | "dune" {>= "2.8.0"} 18 | "menhirLib" {= version} 19 | "menhirSdk" {= version} 20 | ] 21 | synopsis: "An LR(1) parser generator" 22 | url { 23 | src: 24 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz" 25 | checksum: [ 26 | "md5=e3cef220f676c4b1c16cbccb174cefe3" 27 | "sha512=3063fec1d8b9fe092c8461b0689d426c7fe381a2bf3fd258dc42ceecca1719d32efbb8a18d94ada5555c38175ea352da3adbb239fdbcbcf52c3a5c85a4d9586f" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /esy.lock/opam/menhirLib.20220210/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" { >= "4.03.0" } 17 | "dune" { >= "2.8.0" } 18 | ] 19 | conflicts: [ 20 | "menhir" { != version } 21 | ] 22 | synopsis: "Runtime support library for parsers generated by Menhir" 23 | url { 24 | src: 25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz" 26 | checksum: [ 27 | "md5=e3cef220f676c4b1c16cbccb174cefe3" 28 | "sha512=3063fec1d8b9fe092c8461b0689d426c7fe381a2bf3fd258dc42ceecca1719d32efbb8a18d94ada5555c38175ea352da3adbb239fdbcbcf52c3a5c85a4d9586f" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /esy.lock/opam/menhirSdk.20220210/opam: -------------------------------------------------------------------------------- 1 | 2 | opam-version: "2.0" 3 | maintainer: "francois.pottier@inria.fr" 4 | authors: [ 5 | "François Pottier " 6 | "Yann Régis-Gianas " 7 | ] 8 | homepage: "http://gitlab.inria.fr/fpottier/menhir" 9 | dev-repo: "git+https://gitlab.inria.fr/fpottier/menhir.git" 10 | bug-reports: "https://gitlab.inria.fr/fpottier/menhir/-/issues" 11 | license: "LGPL-2.0-only with OCaml-LGPL-linking-exception" 12 | build: [ 13 | ["dune" "build" "-p" name "-j" jobs] 14 | ] 15 | depends: [ 16 | "ocaml" { >= "4.03.0" } 17 | "dune" { >= "2.8.0" } 18 | ] 19 | conflicts: [ 20 | "menhir" { != version } 21 | ] 22 | synopsis: "Compile-time library for auxiliary tools related to Menhir" 23 | url { 24 | src: 25 | "https://gitlab.inria.fr/fpottier/menhir/-/archive/20220210/archive.tar.gz" 26 | checksum: [ 27 | "md5=e3cef220f676c4b1c16cbccb174cefe3" 28 | "sha512=3063fec1d8b9fe092c8461b0689d426c7fe381a2bf3fd258dc42ceecca1719d32efbb8a18d94ada5555c38175ea352da3adbb239fdbcbcf52c3a5c85a4d9586f" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "OCaml compiler libraries repackaged" 3 | description: """ 4 | This packages exposes the OCaml compiler libraries repackages under 5 | the toplevel names Ocaml_common, Ocaml_bytecomp, Ocaml_optcomp, ...""" 6 | maintainer: ["Jane Street developers"] 7 | authors: ["Jane Street Group, LLC"] 8 | license: "MIT" 9 | homepage: "https://github.com/janestreet/ocaml-compiler-libs" 10 | bug-reports: "https://github.com/janestreet/ocaml-compiler-libs/issues" 11 | depends: [ 12 | "dune" {>= "2.8"} 13 | "ocaml" {>= "4.04.1"} 14 | "odoc" {with-doc} 15 | ] 16 | build: [ 17 | ["dune" "subst"] {dev} 18 | [ 19 | "dune" 20 | "build" 21 | "-p" 22 | name 23 | "-j" 24 | jobs 25 | "@install" 26 | "@runtest" {with-test} 27 | "@doc" {with-doc} 28 | ] 29 | ] 30 | dev-repo: "git+https://github.com/janestreet/ocaml-compiler-libs.git" 31 | url { 32 | src: 33 | "https://github.com/janestreet/ocaml-compiler-libs/releases/download/v0.12.4/ocaml-compiler-libs-v0.12.4.tbz" 34 | checksum: [ 35 | "sha256=4ec9c9ec35cc45c18c7a143761154ef1d7663036a29297f80381f47981a07760" 36 | "sha512=978dba8dfa61f98fa24fda7a9c26c2e837081f37d1685fe636dc19cfc3278a940cf01a10293504b185c406706bc1008bc54313d50f023bcdea6d5ac6c0788b35" 37 | ] 38 | } 39 | x-commit-hash: "8cd12f18bb7171c2b67d661868c4271fae528d93" 40 | -------------------------------------------------------------------------------- /esy.lock/opam/ocaml-lsp-server.1.11.6/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "LSP Server for OCaml" 3 | description: "An LSP server for OCaml." 4 | maintainer: ["Rudi Grinberg "] 5 | authors: [ 6 | "Andrey Popp <8mayday@gmail.com>" 7 | "Rusty Key " 8 | "Louis Roché " 9 | "Oleksiy Golovko " 10 | "Rudi Grinberg " 11 | "Sacha Ayoun " 12 | "cannorin " 13 | "Ulugbek Abdullaev " 14 | "Thibaut Mattio " 15 | "Max Lantas " 16 | ] 17 | license: "ISC" 18 | homepage: "https://github.com/ocaml/ocaml-lsp" 19 | bug-reports: "https://github.com/ocaml/ocaml-lsp/issues" 20 | depends: [ 21 | "dune" {>= "2.9"} 22 | "yojson" 23 | "re" {>= "1.5.0"} 24 | "ppx_yojson_conv_lib" {>= "v0.14"} 25 | "dune-rpc" 26 | "dyn" 27 | "stdune" 28 | "fiber" {>= "3.1.1"} 29 | "xdg" 30 | "ordering" 31 | "dune-build-info" 32 | "spawn" 33 | "omd" {<= "1.3.1"} 34 | "octavius" {>= "1.2.2"} 35 | "uutf" {>= "1.0.2"} 36 | "pp" {>= "1.1.2"} 37 | "csexp" {>= "1.5"} 38 | "ocamlformat-rpc-lib" {>= "0.21.0"} 39 | "odoc" {with-doc} 40 | "ocaml" {>= "4.14" & < "4.15"} 41 | ] 42 | dev-repo: "git+https://github.com/ocaml/ocaml-lsp.git" 43 | build: [ 44 | ["dune" "subst"] {dev} 45 | [ 46 | "dune" 47 | "build" 48 | "-j" 49 | jobs 50 | "ocaml-lsp-server.install" 51 | "--release" 52 | ] 53 | ] 54 | url { 55 | src: 56 | "https://github.com/ocaml/ocaml-lsp/releases/download/1.11.6/jsonrpc-1.11.6.tbz" 57 | checksum: [ 58 | "sha256=50b546ced5332c4a038bcf68b65b7888cb8e61aebe102e8c80b23a4c5899bbbb" 59 | "sha512=e7c6d07d3943b088198af383120f2e75478b84dd6077eafa0f01fc808072b9cebe667651d22e11592c1f134f5d289cccf7c58e1ad1aae6c0ce92a4eca32b1371" 60 | ] 61 | } 62 | x-commit-hash: "1c02a6b8c44f3858ad8c0b7c114d4f14fbf53f9c" 63 | -------------------------------------------------------------------------------- /esy.lock/opam/ocaml-migrate-parsetree.2.3.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "frederic.bour@lakaban.net" 3 | authors: [ 4 | "Frédéric Bour " 5 | "Jérémie Dimino " 6 | ] 7 | license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception" 8 | homepage: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree" 9 | bug-reports: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/issues" 10 | dev-repo: "git+https://github.com/ocaml-ppx/ocaml-migrate-parsetree.git" 11 | doc: "https://ocaml-ppx.github.io/ocaml-migrate-parsetree/" 12 | tags: [ "syntax" "org:ocamllabs" ] 13 | build: ["dune" "build" "-p" name "-j" jobs] 14 | run-test: ["dune" "runtest" "-p" name "-j" jobs] 15 | depends: [ 16 | "dune" {>= "2.3"} 17 | "ocaml" {>= "4.02.3" & < "4.15"} 18 | "cinaps" {with-test & >= "v0.13.0"} 19 | ] 20 | conflicts: [ 21 | "base-effects" 22 | ] 23 | synopsis: "Convert OCaml parsetrees between different versions" 24 | description: """ 25 | Convert OCaml parsetrees between different versions 26 | 27 | This library converts parsetrees, outcometree and ast mappers between 28 | different OCaml versions. High-level functions help making PPX 29 | rewriters independent of a compiler version. 30 | """ 31 | url { 32 | src: 33 | "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v2.3.0/ocaml-migrate-parsetree-2.3.0.tbz" 34 | checksum: [ 35 | "sha256=108126b247f190e04c8afd3d72ced0b63ffdf73c3f801f09be5db0cd7280bf0a" 36 | "sha512=cccd766d33e2c70015735e050c2b7cdacf9f046e2874b563ef64b77706f56d004aa9b9df7d5cc201e5f3ba6e3267f95f654e1e3de58891b91f9c28a61988a9ee" 37 | ] 38 | } 39 | x-commit-hash: "7ef6ff49bfd7d6d816be61d3acea460af25d7d99" 40 | -------------------------------------------------------------------------------- /esy.lock/opam/ocaml-version.3.4.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Anil Madhavapeddy " 3 | authors: "Anil Madhavapeddy " 4 | license: "ISC" 5 | tags: "org:ocamllabs" 6 | homepage: "https://github.com/ocurrent/ocaml-version" 7 | doc: "https://ocurrent.github.io/ocaml-version/doc" 8 | bug-reports: "https://github.com/ocurrent/ocaml-version/issues" 9 | depends: [ 10 | "ocaml" {>= "4.07.0"} 11 | "dune" {>= "1.0"} 12 | "alcotest" {with-test} 13 | ] 14 | build: [ 15 | ["dune" "subst"] {dev} 16 | ["dune" "build" "-p" name "-j" jobs] 17 | ] 18 | dev-repo: "git+https://github.com/ocurrent/ocaml-version.git" 19 | synopsis: "Manipulate, parse and generate OCaml compiler version strings" 20 | description: """ 21 | This library provides facilities to parse version numbers of the OCaml 22 | compiler, and enumerates the various official OCaml releases and configuration 23 | variants. 24 | 25 | OCaml version numbers are of the form `major.minor.patch+extra`, where the 26 | `patch` and `extra` fields are optional. This library offers the following 27 | functionality: 28 | 29 | - Functions to parse and serialise OCaml compiler version numbers. 30 | - Enumeration of official OCaml compiler version releases. 31 | - Test compiler versions for a particular feature (e.g. the `bytes` type) 32 | - [opam](https://opam.ocaml.org) compiler switch enumeration. 33 | 34 | ### Further information 35 | 36 | - **Discussion:** Post on with the `ocaml` tag under 37 | the Ecosystem category. 38 | - **Bugs:** 39 | - **Docs:** 40 | """ 41 | url { 42 | src: 43 | "https://github.com/ocurrent/ocaml-version/releases/download/v3.4.0/ocaml-version-v3.4.0.tbz" 44 | checksum: [ 45 | "sha256=d8c1beb5e8d8ebb7710b5f434ce66a3ec8b752b1e4d6ba87c4fe27452bdb8a25" 46 | "sha512=215e5b0c4ea5fa5461cdc0fc81fbd84a2a319a246a19504d0a0abc8c891e252a9e41644356150a1dc25d56b3f7e084db7a0b15becab4e1339992e645fc3d8ef1" 47 | ] 48 | } 49 | x-commit-hash: "c535ad2f463664b31001888fc99495dd01632747" 50 | -------------------------------------------------------------------------------- /esy.lock/opam/ocamlbuild.0.14.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: 3 | "OCamlbuild is a build system with builtin rules to easily build most OCaml projects" 4 | maintainer: "Gabriel Scherer " 5 | authors: ["Nicolas Pouillard" "Berke Durak"] 6 | license: "LGPL-2.0-or-later WITH OCaml-LGPL-linking-exception" 7 | homepage: "https://github.com/ocaml/ocamlbuild/" 8 | doc: "https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc" 9 | bug-reports: "https://github.com/ocaml/ocamlbuild/issues" 10 | depends: [ 11 | "ocaml" {>= "4.03"} 12 | ] 13 | conflicts: [ 14 | "base-ocamlbuild" 15 | "ocamlfind" {< "1.6.2"} 16 | ] 17 | build: [ 18 | [ 19 | make 20 | "-f" 21 | "configure.make" 22 | "all" 23 | "OCAMLBUILD_PREFIX=%{prefix}%" 24 | "OCAMLBUILD_BINDIR=%{bin}%" 25 | "OCAMLBUILD_LIBDIR=%{lib}%" 26 | "OCAMLBUILD_MANDIR=%{man}%" 27 | "OCAML_NATIVE=%{ocaml:native}%" 28 | "OCAML_NATIVE_TOOLS=%{ocaml:native}%" 29 | ] 30 | [make "check-if-preinstalled" "all" "opam-install"] 31 | ] 32 | dev-repo: "git+https://github.com/ocaml/ocamlbuild.git" 33 | url { 34 | src: "https://github.com/ocaml/ocamlbuild/archive/refs/tags/0.14.1.tar.gz" 35 | checksum: [ 36 | "md5=7027e507ed85f290923ad198f3d2cd1c" 37 | "sha512=1f5b43215b1d3dc427b9c64e005add9d423ed4bca9686d52c55912df8955647cb2d7d86622d44b41b14c4f0d657b770c27967c541c868eeb7c78e3bd35b827ad" 38 | ] 39 | } -------------------------------------------------------------------------------- /esy.lock/opam/ocamlfind.1.9.3/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "A library manager for OCaml" 3 | description: """ 4 | Findlib is a library manager for OCaml. It provides a convention how 5 | to store libraries, and a file format ("META") to describe the 6 | properties of libraries. There is also a tool (ocamlfind) for 7 | interpreting the META files, so that it is very easy to use libraries 8 | in programs and scripts. 9 | """ 10 | license: "MIT" 11 | maintainer: "Thomas Gazagnaire " 12 | authors: "Gerd Stolpmann " 13 | homepage: "http://projects.camlcity.org/projects/findlib.html" 14 | bug-reports: "https://github.com/ocaml/ocamlfind/issues" 15 | depends: [ 16 | "ocaml" {>= "4.00.0"} 17 | ] 18 | depopts: ["graphics"] 19 | build: [ 20 | [ 21 | "./configure" 22 | "-bindir" bin 23 | "-sitelib" lib 24 | "-mandir" man 25 | "-config" "%{lib}%/findlib.conf" 26 | "-no-custom" 27 | "-no-camlp4" {!ocaml:preinstalled & ocaml:version >= "4.02.0"} 28 | "-no-topfind" {ocaml:preinstalled} 29 | ] 30 | [make "all"] 31 | [make "opt"] {ocaml:native} 32 | ] 33 | install: [ 34 | [make "install"] 35 | ["install" "-m" "0755" "ocaml-stub" "%{bin}%/ocaml"] {ocaml:preinstalled} 36 | ] 37 | dev-repo: "git+https://github.com/ocaml/ocamlfind.git" 38 | url { 39 | src: "http://download.camlcity.org/download/findlib-1.9.3.tar.gz" 40 | checksum: [ 41 | "md5=24047dd8a0da5322253de9b7aa254e42" 42 | "sha512=27cc4ce141576bf477fb9d61a82ad65f55478740eed59fb43f43edb794140829fd2ff89ad27d8a890cfc336b54c073a06de05b31100fc7c01cacbd7d88e928ea" 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /esy.lock/opam/ocamlformat-rpc-lib.0.21.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Auto-formatter for OCaml code (RPC mode)" 3 | description: 4 | "OCamlFormat is a tool to automatically format OCaml code in a uniform style. This package defines a RPC interface to OCamlFormat" 5 | maintainer: ["OCamlFormat Team "] 6 | authors: ["Josh Berdine "] 7 | license: "MIT" 8 | homepage: "https://github.com/ocaml-ppx/ocamlformat" 9 | bug-reports: "https://github.com/ocaml-ppx/ocamlformat/issues" 10 | depends: [ 11 | "dune" {>= "2.8"} 12 | "ocaml" {>= "4.08" & < "4.15"} 13 | "csexp" {>= "1.4.0"} 14 | "odoc" {with-doc} 15 | ] 16 | build: [ 17 | ["dune" "subst"] {dev} 18 | [ 19 | "dune" 20 | "build" 21 | "-p" 22 | name 23 | "-j" 24 | jobs 25 | "@install" 26 | "@runtest" {with-test} 27 | "@doc" {with-doc} 28 | ] 29 | ] 30 | dev-repo: "git+https://github.com/ocaml-ppx/ocamlformat.git" 31 | url { 32 | src: 33 | "https://github.com/ocaml-ppx/ocamlformat/releases/download/0.21.0/ocamlformat-0.21.0.tbz" 34 | checksum: [ 35 | "sha256=2a1817f6bc581ff0cce9f0aa9687b897b02726e2ab75749ee98d57637057332d" 36 | "sha512=db47f843bfc5a438d43f7c482cde86bd13f05a6825e2a0afa80614b651a88ae8b3805cca45da6bcf9189e741e0c79d38652b0bc47efe636c1502a66676dcb28e" 37 | ] 38 | } 39 | x-commit-hash: "63e478f1186a03c7e4dfeeb39b3d8fe2ef1cb429" 40 | -------------------------------------------------------------------------------- /esy.lock/opam/ocamlformat.0.21.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Auto-formatter for OCaml code" 3 | description: 4 | "OCamlFormat is a tool to automatically format OCaml code in a uniform style." 5 | maintainer: ["OCamlFormat Team "] 6 | authors: ["Josh Berdine "] 7 | homepage: "https://github.com/ocaml-ppx/ocamlformat" 8 | bug-reports: "https://github.com/ocaml-ppx/ocamlformat/issues" 9 | depends: [ 10 | "ocaml" {>= "4.08" & < "4.15"} 11 | "alcotest" {with-test} 12 | "base" {>= "v0.12.0"} 13 | "cmdliner" {>= "1.1.0"} 14 | "dune" {>= "2.8"} 15 | "dune" {with-test & < "3.0"} 16 | "dune-build-info" 17 | "either" 18 | "fix" 19 | "fpath" 20 | "menhir" {>= "20201216"} 21 | "menhirLib" {>= "20201216"} 22 | "menhirSdk" {>= "20201216"} 23 | "ocaml-version" {>= "3.3.0"} 24 | "ocp-indent" 25 | "odoc-parser" {>= "1.0.0"} 26 | "re" {>= "1.7.2"} 27 | "stdio" 28 | "uuseg" {>= "10.0.0"} 29 | "uutf" {>= "1.0.1"} 30 | "odoc" {with-doc} 31 | ] 32 | build: [ 33 | ["dune" "subst"] {dev} 34 | [ 35 | "dune" 36 | "build" 37 | "-p" 38 | name 39 | "-j" 40 | jobs 41 | "@install" 42 | "@runtest" {with-test} 43 | "@doc" {with-doc} 44 | ] 45 | ] 46 | dev-repo: "git+https://github.com/ocaml-ppx/ocamlformat.git" 47 | license: ["MIT" "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"] 48 | url { 49 | src: 50 | "https://github.com/ocaml-ppx/ocamlformat/releases/download/0.21.0/ocamlformat-0.21.0.tbz" 51 | checksum: [ 52 | "sha256=2a1817f6bc581ff0cce9f0aa9687b897b02726e2ab75749ee98d57637057332d" 53 | "sha512=db47f843bfc5a438d43f7c482cde86bd13f05a6825e2a0afa80614b651a88ae8b3805cca45da6bcf9189e741e0c79d38652b0bc47efe636c1502a66676dcb28e" 54 | ] 55 | } 56 | x-commit-hash: "63e478f1186a03c7e4dfeeb39b3d8fe2ef1cb429" # OCamlFormat is distributed under the MIT license. Parts of the OCaml library are vendored for OCamlFormat and distributed under their original LGPL 2.1 license 57 | -------------------------------------------------------------------------------- /esy.lock/opam/ocp-indent.1.8.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "contact@ocamlpro.com" 3 | synopsis: "A simple tool to indent OCaml programs" 4 | description: """ 5 | Ocp-indent is based on an approximate, tolerant OCaml parser and a simple stack 6 | machine ; this is much faster and more reliable than using regexps. Presets and 7 | configuration options available, with the possibility to set them project-wide. 8 | Supports most common syntax extensions, and extensible for others. 9 | 10 | Includes: 11 | - An indentor program, callable from the command-line or from within editors 12 | - Bindings for popular editors 13 | - A library that can be directly used by editor writers, or just for 14 | fault-tolerant/approximate parsing. 15 | """ 16 | authors: [ 17 | "Louis Gesbert " 18 | "Thomas Gazagnaire " 19 | "Jun Furuse" 20 | ] 21 | homepage: "http://www.typerex.org/ocp-indent.html" 22 | bug-reports: "https://github.com/OCamlPro/ocp-indent/issues" 23 | license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception" 24 | tags: ["org:ocamlpro" "org:typerex"] 25 | dev-repo: "git+https://github.com/OCamlPro/ocp-indent.git" 26 | build: [ 27 | ["dune" "build" "-p" name "-j" jobs] 28 | ] 29 | run-test: [ 30 | ["dune" "runtest" "-p" name "-j" jobs] 31 | ] 32 | depends: [ 33 | "ocaml" 34 | "dune" {>= "1.0"} 35 | "cmdliner" {>= "1.0.0"} 36 | "ocamlfind" 37 | "base-bytes" 38 | ] 39 | post-messages: [ 40 | "This package requires additional configuration for use in editors. Install package 'user-setup', or manually: 41 | 42 | * for Emacs, add these lines to ~/.emacs: 43 | (add-to-list 'load-path \"%{share}%/emacs/site-lisp\") 44 | (require 'ocp-indent) 45 | 46 | * for Vim, add this line to ~/.vimrc: 47 | set rtp^=\"%{share}%/ocp-indent/vim\" 48 | " 49 | {success & !user-setup:installed} 50 | ] 51 | url { 52 | src: "https://github.com/OCamlPro/ocp-indent/archive/1.8.1.tar.gz" 53 | checksum: [ 54 | "md5=70db6649a8c08a682ad63730c9752e31" 55 | "sha512=565353de333dd44375366fff75e85a6256c3cd9ff52b3db79803141f975e77cda04dfe32f5e0f2d4c82c59be8f04e9c2bf4d066b113b2cdf267f4c3dcfa401da" 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /esy.lock/opam/octavius.1.2.2/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: ["leo@lpw25.net"] 3 | authors: ["Leo White "] 4 | license: "ISC" 5 | homepage: "https://github.com/ocaml-doc/octavius" 6 | doc: "http://ocaml-doc.github.io/octavius/" 7 | bug-reports: "https://github.com/ocaml-doc/octavius/issues" 8 | depends: [ 9 | "dune" {>= "1.11"} 10 | "ocaml" {>= "4.03.0"} 11 | ] 12 | build: [ 13 | ["dune" "subst"] {dev} 14 | [ 15 | "dune" 16 | "build" 17 | "-p" 18 | name 19 | "-j" 20 | jobs 21 | "@install" 22 | "@runtest" {with-test} 23 | "@doc" {with-doc} 24 | ] 25 | ] 26 | dev-repo: "git+https://github.com/ocaml-doc/octavius.git" 27 | 28 | synopsis: "Ocamldoc comment syntax parser" 29 | description: "Octavius is a library to parse the `ocamldoc` comment syntax." 30 | url { 31 | src: "https://github.com/ocaml-doc/octavius/archive/v1.2.2.tar.gz" 32 | checksum: "md5=72f9e1d996e6c5089fc513cc9218607b" 33 | } 34 | -------------------------------------------------------------------------------- /esy.lock/opam/odoc-parser.1.0.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Parser for ocaml documentation comments" 3 | description: """ 4 | Odoc_parser is a library for parsing the contents of OCaml documentation 5 | comments, formatted using 'odoc' syntax, an extension of the language 6 | understood by ocamldoc.""" 7 | maintainer: ["Jon Ludlam "] 8 | authors: ["Anton Bachin "] 9 | license: "ISC" 10 | homepage: "https://github.com/ocaml-doc/odoc-parser" 11 | bug-reports: "https://github.com/ocaml-doc/odoc-parser/issues" 12 | dev-repo: "git+https://github.com/ocaml-doc/odoc-parser.git" 13 | # This template exists because without it dune pop is dependencies and build rules 14 | # involving odoc. Since odoc depends on this package, this doesn't work. 15 | doc: "https://ocaml-doc.github.io/odoc-parser/" 16 | depends: [ 17 | "dune" {>= "2.8"} 18 | "ocaml" {>= "4.02.0"} 19 | "astring" 20 | "result" 21 | "ppx_expect" {with-test} 22 | ("ocaml" {< "4.04.1" & with-test} | "sexplib0" {with-test}) 23 | ] 24 | build: [ 25 | ["dune" "subst"] {dev} 26 | [ 27 | "dune" 28 | "build" 29 | "-p" 30 | name 31 | "-j" 32 | jobs 33 | "@install" 34 | "@runtest" {with-test} 35 | ] 36 | ] 37 | url { 38 | src: 39 | "https://github.com/ocaml-doc/odoc-parser/releases/download/1.0.0/odoc-parser-1.0.0.tbz" 40 | checksum: [ 41 | "sha256=b6aa08ea71a9ebad9b2bebc4da1eda0d713cf3674e6d57d10459d934286e7aa1" 42 | "sha512=b5caee3a0d288aeaa95e3f32de8e5f75f169ad2691d75f8d6c932e4fb0e6cb188813ac2d92d4076fe75b12217130e6999c46e7890cf0fa765070870f85a96d63" 43 | ] 44 | } 45 | x-commit-hash: "b13ffc2f30ca20ca5bb733be4f630d46bd274fd6" 46 | 47 | -------------------------------------------------------------------------------- /esy.lock/opam/omd.1.3.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Philippe Wang " 3 | authors: [ "Philippe Wang " ] 4 | license: "ISC" 5 | homepage: "https://github.com/ocaml/omd" 6 | dev-repo: "git+https://github.com/ocaml/omd.git" 7 | bug-reports: "https://github.com/ocaml/omd/issues" 8 | tags: [ "org:ocamllabs" "org:mirage" ] 9 | build: [ 10 | ["ocaml" "setup.ml" "-configure" "--prefix" prefix] 11 | ["ocaml" "setup.ml" "-build"] 12 | ["ocaml" "setup.ml" "-configure" "--enable-tests"] {with-test} 13 | ["ocaml" "setup.ml" "-build"] {with-test} 14 | ["ocaml" "setup.ml" "-test"] {with-test} 15 | ] 16 | install: ["ocaml" "setup.ml" "-install"] 17 | remove: [ 18 | ["ocaml" "%{etc}%/omd/setup.ml" "-C" "%{etc}%/omd" "-uninstall"] 19 | ] 20 | depends: [ 21 | "ocaml" {>= "4.01"} 22 | "base-bigarray" 23 | "base-bytes" 24 | "ocamlbuild" {build} 25 | "ocamlfind" {build & >= "1.5"} 26 | ] 27 | synopsis: "A Markdown frontend in pure OCaml." 28 | description: """ 29 | This Markdown library is implemented using only pure OCaml (including 30 | I/O operations provided by the standard OCaml compiler distribution). 31 | OMD is meant to be as faithful as possible to the original Markdown. 32 | Additionally, OMD implements a few Github markdown features, an 33 | extension mechanism, and some other features. Note that the opam 34 | package installs both the OMD library and the command line tool `omd`.""" 35 | url { 36 | src: 37 | "https://github.com/Chris00/omd/releases/download/1.3.1/omd-1.3.1.tar.gz" 38 | checksum: "md5=845fc38e86ec0e85721130f2dd044d00" 39 | } 40 | -------------------------------------------------------------------------------- /esy.lock/opam/ordering.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Element ordering" 3 | description: "Element ordering" 4 | maintainer: ["Jane Street Group, LLC "] 5 | authors: ["Jane Street Group, LLC "] 6 | license: "MIT" 7 | homepage: "https://github.com/ocaml/dune" 8 | doc: "https://dune.readthedocs.io/" 9 | bug-reports: "https://github.com/ocaml/dune/issues" 10 | depends: [ 11 | "dune" {>= "3.0"} 12 | "ocaml" {>= "4.08.0"} 13 | "odoc" {with-doc} 14 | ] 15 | dev-repo: "git+https://github.com/ocaml/dune.git" 16 | build: [ 17 | ["dune" "subst"] {dev} 18 | ["rm" "-rf" "vendor/csexp"] 19 | ["rm" "-rf" "vendor/pp"] 20 | [ 21 | "dune" 22 | "build" 23 | "-p" 24 | name 25 | "-j" 26 | jobs 27 | "@install" 28 | "@doc" {with-doc} 29 | ] 30 | ] 31 | url { 32 | src: 33 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 34 | checksum: [ 35 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 36 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 37 | ] 38 | } 39 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 40 | -------------------------------------------------------------------------------- /esy.lock/opam/pp.1.1.2/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Pretty-printing library" 3 | description: """ 4 | 5 | This library provides a lean alternative to the Format [1] module of 6 | the OCaml standard library. It aims to make it easy for users to do 7 | the right thing. If you have tried Format before but find its API 8 | complicated and difficult to use, then Pp might be a good choice for 9 | you. 10 | 11 | Pp uses the same concepts of boxes and break hints, and the final 12 | rendering is done to formatter from the Format module. However it 13 | defines its own algebra which some might find easier to work with and 14 | reason about. No previous knowledge is required to start using this 15 | library, however the various guides for the Format module such as this 16 | one [2] should be applicable to Pp as well. 17 | 18 | [1]: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.html 19 | [2]: http://caml.inria.fr/resources/doc/guides/format.en.html 20 | """ 21 | maintainer: ["Jeremie Dimino "] 22 | authors: [ 23 | "Jane Street Group, LLC" 24 | "Jeremie Dimino " 25 | ] 26 | license: "MIT" 27 | homepage: "https://github.com/ocaml-dune/pp" 28 | doc: "https://ocaml-dune.github.io/pp/" 29 | bug-reports: "https://github.com/ocaml-dune/pp/issues" 30 | depends: [ 31 | "dune" {>= "2.0"} 32 | "ocaml" {>= "4.08.0"} 33 | "ppx_expect" {with-test} 34 | ] 35 | build: [ 36 | ["dune" "subst"] {dev} 37 | [ 38 | "dune" 39 | "build" 40 | "-p" 41 | name 42 | "-j" 43 | jobs 44 | "@install" 45 | "@runtest" {with-test} 46 | "@doc" {with-doc} 47 | ] 48 | ] 49 | dev-repo: "git+https://github.com/ocaml-dune/pp.git" 50 | x-commit-hash: "395b95c89cfe2c6d538dad9d56721b6a7278d46c" 51 | url { 52 | src: 53 | "https://github.com/ocaml-dune/pp/releases/download/1.1.2/pp-1.1.2.tbz" 54 | checksum: [ 55 | "sha256=e4a4e98d96b1bb76950fcd6da4e938c86d989df4d7e48f02f7a44595f5af1d56" 56 | "sha512=58f78b083483006b40814be9aac33c895349eb1c6427d2762b4d760192613401262478bd5deff909763517560b06af7bf013c6a6f87d549aafa77b26345303f2" 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /esy.lock/opam/ppx_derivers.1.2.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "jeremie@dimino.org" 3 | authors: ["Jérémie Dimino"] 4 | license: "BSD-3-Clause" 5 | homepage: "https://github.com/ocaml-ppx/ppx_derivers" 6 | bug-reports: "https://github.com/ocaml-ppx/ppx_derivers/issues" 7 | dev-repo: "git+https://github.com/ocaml-ppx/ppx_derivers.git" 8 | build: [ 9 | ["dune" "build" "-p" name "-j" jobs] 10 | ] 11 | depends: [ 12 | "ocaml" 13 | "dune" 14 | ] 15 | synopsis: "Shared [@@deriving] plugin registry" 16 | description: """ 17 | Ppx_derivers is a tiny package whose sole purpose is to allow 18 | ppx_deriving and ppx_type_conv to inter-operate gracefully when linked 19 | as part of the same ocaml-migrate-parsetree driver.""" 20 | url { 21 | src: "https://github.com/ocaml-ppx/ppx_derivers/archive/1.2.1.tar.gz" 22 | checksum: "md5=5dc2bf130c1db3c731fe0fffc5648b41" 23 | } 24 | -------------------------------------------------------------------------------- /esy.lock/opam/ppx_optcomp.v0.15.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/ppx_optcomp" 5 | bug-reports: "https://github.com/janestreet/ppx_optcomp/issues" 6 | dev-repo: "git+https://github.com/janestreet/ppx_optcomp.git" 7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/ppx_optcomp/index.html" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "4.08.0"} 14 | "base" {>= "v0.15" & < "v0.16"} 15 | "stdio" {>= "v0.15" & < "v0.16"} 16 | "dune" {>= "2.0.0"} 17 | "ppxlib" {>= "0.23.0"} 18 | ] 19 | synopsis: "Optional compilation for OCaml" 20 | description: " 21 | Part of the Jane Street's PPX rewriters collection. 22 | " 23 | url { 24 | src: "https://ocaml.janestreet.com/ocaml-core/v0.15/files/ppx_optcomp-v0.15.0.tar.gz" 25 | checksum: "sha256=c44e70d7b3c80f9e2bf8456da1076d16dc4504fc3e02d8709ca1b2e080caa6ed" 26 | } 27 | -------------------------------------------------------------------------------- /esy.lock/opam/ppx_yojson_conv_lib.v0.15.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/ppx_yojson_conv_lib" 5 | bug-reports: "https://github.com/janestreet/ppx_yojson_conv_lib/issues" 6 | dev-repo: "git+https://github.com/janestreet/ppx_yojson_conv_lib.git" 7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/ppx_yojson_conv_lib/index.html" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "4.02.3"} 14 | "dune" {>= "2.0.0"} 15 | "yojson" {>= "1.7.0"} 16 | ] 17 | synopsis: "Runtime lib for ppx_yojson_conv" 18 | description: " 19 | Part of the Jane Street's PPX rewriters collection. 20 | " 21 | url { 22 | src: "https://ocaml.janestreet.com/ocaml-core/v0.15/files/ppx_yojson_conv_lib-v0.15.0.tar.gz" 23 | checksum: "sha256=f9d2c5eff4566ec1f1f379b186ed22c8ddd6be0909a160bc5a9ac7abc6a6b684" 24 | } 25 | -------------------------------------------------------------------------------- /esy.lock/opam/ppxlib.0.26.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Standard library for ppx rewriters" 3 | description: """ 4 | Ppxlib is the standard library for ppx rewriters and other programs 5 | that manipulate the in-memory reprensation of OCaml programs, a.k.a 6 | the "Parsetree". 7 | 8 | It also comes bundled with two ppx rewriters that are commonly used to 9 | write tools that manipulate and/or generate Parsetree values; 10 | `ppxlib.metaquot` which allows to construct Parsetree values using the 11 | OCaml syntax directly and `ppxlib.traverse` which provides various 12 | ways of automatically traversing values of a given type, in particular 13 | allowing to inject a complex structured value into generated code. 14 | """ 15 | maintainer: ["opensource@janestreet.com"] 16 | authors: ["Jane Street Group, LLC "] 17 | license: "MIT" 18 | homepage: "https://github.com/ocaml-ppx/ppxlib" 19 | doc: "https://ocaml-ppx.github.io/ppxlib/" 20 | bug-reports: "https://github.com/ocaml-ppx/ppxlib/issues" 21 | depends: [ 22 | "dune" {>= "2.7"} 23 | "ocaml" {>= "4.04.1" & < "4.15"} 24 | "ocaml-compiler-libs" {>= "v0.11.0"} 25 | "ppx_derivers" {>= "1.0"} 26 | "sexplib0" {>= "v0.12"} 27 | "sexplib0" {with-test & < "v0.15"} 28 | "stdlib-shims" 29 | "ocamlfind" {with-test} 30 | "re" {with-test & >= "1.9.0"} 31 | "cinaps" {with-test & >= "v0.12.1"} 32 | "base" {with-test} 33 | "stdio" {with-test} 34 | "odoc" {with-doc} 35 | ] 36 | conflicts: [ 37 | "ocaml-migrate-parsetree" {< "2.0.0"} 38 | "base-effects" 39 | ] 40 | build: [ 41 | ["dune" "subst"] {dev} 42 | [ 43 | "dune" 44 | "build" 45 | "-p" 46 | name 47 | "-j" 48 | jobs 49 | "@install" 50 | "@runtest" {with-test} 51 | "@doc" {with-doc} 52 | ] 53 | ] 54 | dev-repo: "git+https://github.com/ocaml-ppx/ppxlib.git" 55 | url { 56 | src: 57 | "https://github.com/ocaml-ppx/ppxlib/releases/download/0.26.0/ppxlib-0.26.0.tbz" 58 | checksum: [ 59 | "sha256=63117b67ea5863935455fe921f88fe333c0530f0483f730313303a93af817efd" 60 | "sha512=9cfc9587657d17cdee5483e2a03292f872c42886e512bcc7442652e6418ce74c0135c731d8a68288c7fecae7f1b2defd93fe5acf8edb41e25144a8cec2806227" 61 | ] 62 | } 63 | x-commit-hash: "18b1ad68b59d151d662147661e43b159ac491f68" 64 | -------------------------------------------------------------------------------- /esy.lock/opam/re.1.10.4/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | 3 | maintainer: "rudi.grinberg@gmail.com" 4 | authors: [ 5 | "Jerome Vouillon" 6 | "Thomas Gazagnaire" 7 | "Anil Madhavapeddy" 8 | "Rudi Grinberg" 9 | "Gabriel Radanne" 10 | ] 11 | license: "LGPL-2.0-or-later WITH OCaml-LGPL-linking-exception" 12 | homepage: "https://github.com/ocaml/ocaml-re" 13 | bug-reports: "https://github.com/ocaml/ocaml-re/issues" 14 | dev-repo: "git+https://github.com/ocaml/ocaml-re.git" 15 | 16 | build: [ 17 | ["dune" "subst"] {dev} 18 | ["dune" "build" "-p" name "-j" jobs] 19 | ["dune" "runtest" "-p" name "-j" jobs] {with-test} 20 | ] 21 | 22 | depends: [ 23 | "ocaml" {>= "4.03"} 24 | "dune" {>= "2.0"} 25 | "ounit" {with-test} 26 | "seq" 27 | ] 28 | 29 | synopsis: "RE is a regular expression library for OCaml" 30 | description: """ 31 | Pure OCaml regular expressions with: 32 | * Perl-style regular expressions (module Re.Perl) 33 | * Posix extended regular expressions (module Re.Posix) 34 | * Emacs-style regular expressions (module Re.Emacs) 35 | * Shell-style file globbing (module Re.Glob) 36 | * Compatibility layer for OCaml's built-in Str module (module Re.Str) 37 | """ 38 | url { 39 | src: 40 | "https://github.com/ocaml/ocaml-re/releases/download/1.10.4/re-1.10.4.tbz" 41 | checksum: [ 42 | "sha256=83eb3e4300aa9b1dc7820749010f4362ea83524742130524d78c20ce99ca747c" 43 | "sha512=92b05cf92c389fa8c753f2acca837b15dd05a4a2e8e2bec7a269d2e14c35b1a786d394258376648f80b4b99250ba1900cfe68230b8385aeac153149d9ce56099" 44 | ] 45 | } 46 | x-commit-hash: "e9a4cecb8294c1839db18b1d0c30e755ec85ed5e" 47 | -------------------------------------------------------------------------------- /esy.lock/opam/result.1.5/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/result" 5 | dev-repo: "git+https://github.com/janestreet/result.git" 6 | bug-reports: "https://github.com/janestreet/result/issues" 7 | license: "BSD-3-Clause" 8 | build: [["dune" "build" "-p" name "-j" jobs]] 9 | depends: [ 10 | "ocaml" 11 | "dune" {>= "1.0"} 12 | ] 13 | synopsis: "Compatibility Result module" 14 | description: """ 15 | Projects that want to use the new result type defined in OCaml >= 4.03 16 | while staying compatible with older version of OCaml should use the 17 | Result module defined in this library.""" 18 | url { 19 | src: 20 | "https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz" 21 | checksum: "md5=1b82dec78849680b49ae9a8a365b831b" 22 | } 23 | -------------------------------------------------------------------------------- /esy.lock/opam/seq.base/files/META.seq: -------------------------------------------------------------------------------- 1 | name="seq" 2 | version="[distributed with OCaml 4.07 or above]" 3 | description="dummy backward-compatibility package for iterators" 4 | requires="" 5 | -------------------------------------------------------------------------------- /esy.lock/opam/seq.base/files/seq.install: -------------------------------------------------------------------------------- 1 | lib:[ 2 | "META.seq" {"META"} 3 | ] 4 | -------------------------------------------------------------------------------- /esy.lock/opam/seq.base/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: " " 3 | authors: " " 4 | homepage: " " 5 | depends: [ 6 | "ocaml" {>= "4.07.0"} 7 | ] 8 | dev-repo: "git+https://github.com/ocaml/ocaml.git" 9 | bug-reports: "https://caml.inria.fr/mantis/main_page.php" 10 | synopsis: 11 | "Compatibility package for OCaml's standard iterator type starting from 4.07." 12 | extra-files: [ 13 | ["seq.install" "md5=026b31e1df290373198373d5aaa26e42"] 14 | ["META.seq" "md5=b33c8a1a6c7ed797816ce27df4855107"] 15 | ] 16 | -------------------------------------------------------------------------------- /esy.lock/opam/sexplib0.v0.15.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/sexplib0" 5 | bug-reports: "https://github.com/janestreet/sexplib0/issues" 6 | dev-repo: "git+https://github.com/janestreet/sexplib0.git" 7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/sexplib0/index.html" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "4.04.2"} 14 | "dune" {>= "2.0.0"} 15 | ] 16 | synopsis: "Library containing the definition of S-expressions and some base converters" 17 | description: " 18 | Part of Jane Street's Core library 19 | The Core suite of libraries is an industrial strength alternative to 20 | OCaml's standard library that was developed by Jane Street, the 21 | largest industrial user of OCaml. 22 | " 23 | url { 24 | src: "https://ocaml.janestreet.com/ocaml-core/v0.15/files/sexplib0-v0.15.0.tar.gz" 25 | checksum: "sha256=94462c00416403d2778493ac01ced5439bc388a68ac4097208159d62434aefba" 26 | } 27 | -------------------------------------------------------------------------------- /esy.lock/opam/spawn.v0.15.1/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Spawning sub-processes" 3 | description: """ 4 | Spawn is a small library exposing only one functionality: spawning sub-process. 5 | 6 | It has three main goals: 7 | 8 | 1. provide missing features of Unix.create_process such as providing a 9 | working directory 10 | 11 | 2. provide better errors when a system call fails in the 12 | sub-process. For instance if a command is not found, you get a proper 13 | [Unix.Unix_error] exception 14 | 15 | 3. improve performance by using vfork when available. It is often 16 | claimed that nowadays fork is as fast as vfork, however in practice 17 | fork takes time proportional to the process memory while vfork is 18 | constant time. In application using a lot of memory, vfork can be 19 | thousands of times faster than fork. 20 | """ 21 | maintainer: ["Jane Street developers"] 22 | authors: ["Jane Street Group, LLC"] 23 | license: "MIT" 24 | homepage: "https://github.com/janestreet/spawn" 25 | doc: "https://janestreet.github.io/spawn/" 26 | bug-reports: "https://github.com/janestreet/spawn/issues" 27 | depends: [ 28 | "dune" {>= "2.8"} 29 | "ppx_expect" {with-test} 30 | "ocaml" {>= "4.05"} 31 | "odoc" {with-doc} 32 | ] 33 | build: [ 34 | ["dune" "subst"] {dev} 35 | [ 36 | "dune" 37 | "build" 38 | "-p" 39 | name 40 | "-j" 41 | jobs 42 | "@install" 43 | "@runtest" {with-test} 44 | "@doc" {with-doc} 45 | ] 46 | ] 47 | dev-repo: "git+https://github.com/janestreet/spawn.git" 48 | x-commit-hash: "13d279ebfa8c40d4bafe18cddfdff0de54b4eaff" 49 | url { 50 | src: 51 | "https://github.com/janestreet/spawn/archive/v0.15.1.tar.gz" 52 | checksum: [ 53 | "sha256=9afdee314fab6c3fcd689ab6eb5608d6b78078e6dede3953a47debde06c19d50" 54 | "sha512=efdb31d5ec5ea36d0bc80224d4ee04e46ce3428d1662870e6cebece92bc313d6eebee378802c0c059dd6e0cafea515308c31b7dfaf04a098eb4566583c1e9ed4" 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /esy.lock/opam/stdio.v0.15.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "Jane Street developers" 3 | authors: ["Jane Street Group, LLC"] 4 | homepage: "https://github.com/janestreet/stdio" 5 | bug-reports: "https://github.com/janestreet/stdio/issues" 6 | dev-repo: "git+https://github.com/janestreet/stdio.git" 7 | doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/stdio/index.html" 8 | license: "MIT" 9 | build: [ 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | depends: [ 13 | "ocaml" {>= "4.08.0"} 14 | "base" {>= "v0.15" & < "v0.16"} 15 | "dune" {>= "2.0.0"} 16 | ] 17 | synopsis: "Standard IO library for OCaml" 18 | description: " 19 | Stdio implements simple input/output functionalities for OCaml. 20 | 21 | It re-exports the input/output functions of the OCaml standard 22 | libraries using a more consistent API. 23 | " 24 | url { 25 | src: "https://ocaml.janestreet.com/ocaml-core/v0.15/files/stdio-v0.15.0.tar.gz" 26 | checksum: "sha256=c37292921dc6a88425f773eba6bdbeac1dedacd1f55917fa4bcd9c4b25795e4b" 27 | } 28 | -------------------------------------------------------------------------------- /esy.lock/opam/stdlib-shims.0.3.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "The stdlib-shims programmers" 3 | authors: "The stdlib-shims programmers" 4 | homepage: "https://github.com/ocaml/stdlib-shims" 5 | doc: "https://ocaml.github.io/stdlib-shims/" 6 | dev-repo: "git+https://github.com/ocaml/stdlib-shims.git" 7 | bug-reports: "https://github.com/ocaml/stdlib-shims/issues" 8 | tags: ["stdlib" "compatibility" "org:ocaml"] 9 | license: ["LGPL-2.1-only WITH OCaml-LGPL-linking-exception"] 10 | depends: [ 11 | "dune" 12 | "ocaml" {>= "4.02.3"} 13 | ] 14 | build: [ "dune" "build" "-p" name "-j" jobs ] 15 | synopsis: "Backport some of the new stdlib features to older compiler" 16 | description: """ 17 | Backport some of the new stdlib features to older compiler, 18 | such as the Stdlib module. 19 | 20 | This allows projects that require compatibility with older compiler to 21 | use these new features in their code. 22 | """ 23 | x-commit-hash: "fb6815e5d745f07fd567c11671149de6ef2e74c8" 24 | url { 25 | src: 26 | "https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz" 27 | checksum: [ 28 | "sha256=babf72d3917b86f707885f0c5528e36c63fccb698f4b46cf2bab5c7ccdd6d84a" 29 | "sha512=1151d7edc8923516e9a36995a3f8938d323aaade759ad349ed15d6d8501db61ffbe63277e97c4d86149cf371306ac23df0f581ec7e02611f58335126e1870980" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /esy.lock/opam/stdune.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "Dune's unstable standard library" 3 | description: 4 | "This library offers no backwards compatibility guarantees. Use at your own risk." 5 | maintainer: ["Jane Street Group, LLC "] 6 | authors: ["Jane Street Group, LLC "] 7 | license: "MIT" 8 | homepage: "https://github.com/ocaml/dune" 9 | doc: "https://dune.readthedocs.io/" 10 | bug-reports: "https://github.com/ocaml/dune/issues" 11 | depends: [ 12 | "dune" {>= "3.0"} 13 | "ocaml" {>= "4.08.0"} 14 | "dyn" {= version} 15 | "ordering" {= version} 16 | "pp" {>= "1.1.0"} 17 | "csexp" {>= "1.5.0"} 18 | "odoc" {with-doc} 19 | ] 20 | dev-repo: "git+https://github.com/ocaml/dune.git" 21 | build: [ 22 | ["dune" "subst"] {dev} 23 | ["rm" "-rf" "vendor/csexp"] 24 | ["rm" "-rf" "vendor/pp"] 25 | [ 26 | "dune" 27 | "build" 28 | "-p" 29 | name 30 | "-j" 31 | jobs 32 | "@install" 33 | "@doc" {with-doc} 34 | ] 35 | ] 36 | url { 37 | src: 38 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 39 | checksum: [ 40 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 41 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 42 | ] 43 | } 44 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 45 | -------------------------------------------------------------------------------- /esy.lock/opam/topkg.1.0.5/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: """The transitory OCaml software packager""" 3 | maintainer: ["Daniel Bünzli "] 4 | authors: ["The topkg programmers"] 5 | homepage: "https://erratique.ch/software/topkg" 6 | doc: "https://erratique.ch/software/topkg/doc" 7 | dev-repo: "git+https://erratique.ch/repos/topkg.git" 8 | bug-reports: "https://github.com/dbuenzli/topkg/issues" 9 | license: ["ISC"] 10 | tags: ["packaging" "ocamlbuild" "org:erratique"] 11 | depends: ["ocaml" {>= "4.05.0"} 12 | "ocamlfind" {build & >= "1.6.1"} 13 | "ocamlbuild"] 14 | build: [["ocaml" "pkg/pkg.ml" "build" "--pkg-name" name 15 | "--dev-pkg" "%{dev}%"]] 16 | url { 17 | src: "https://erratique.ch/software/topkg/releases/topkg-1.0.5.tbz" 18 | checksum: "sha512=9450e9139209aacd8ddb4ba18e4225770837e526a52a56d94fd5c9c4c9941e83e0e7102e2292b440104f4c338fabab47cdd6bb51d69b41cc92cc7a551e6fefab"} 19 | description: """ 20 | Topkg is a packager for distributing OCaml software. It provides an 21 | API to describe the files a package installs in a given build 22 | configuration and to specify information about the package's 23 | distribution, creation and publication procedures. 24 | 25 | The optional topkg-care package provides the `topkg` command line tool 26 | which helps with various aspects of a package's life cycle: creating 27 | and linting a distribution, releasing it on the WWW, publish its 28 | documentation, add it to the OCaml opam repository, etc. 29 | 30 | Topkg is distributed under the ISC license and has **no** 31 | dependencies. This is what your packages will need as a *build* 32 | dependency. 33 | 34 | Topkg-care is distributed under the ISC license it depends on 35 | [fmt][fmt], [logs][logs], [bos][bos], [cmdliner][cmdliner], 36 | [webbrowser][webbrowser] and `opam-format`. 37 | 38 | [fmt]: http://erratique.ch/software/fmt 39 | [logs]: http://erratique.ch/software/logs 40 | [bos]: http://erratique.ch/software/bos 41 | [cmdliner]: http://erratique.ch/software/cmdliner 42 | [webbrowser]: http://erratique.ch/software/webbrowser 43 | 44 | Home page: http://erratique.ch/software/topkg""" -------------------------------------------------------------------------------- /esy.lock/opam/uucp.14.0.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: """Unicode character properties for OCaml""" 3 | maintainer: ["Daniel Bünzli "] 4 | authors: ["The uucp programmers"] 5 | homepage: "https://erratique.ch/software/uucp" 6 | doc: "https://erratique.ch/software/uucp/doc/" 7 | dev-repo: "git+https://erratique.ch/repos/uucp.git" 8 | bug-reports: "https://github.com/dbuenzli/uucp/issues" 9 | license: ["ISC"] 10 | tags: ["unicode" "text" "character" "org:erratique"] 11 | depends: ["ocaml" {>= "4.03.0"} 12 | "ocamlfind" {build} 13 | "ocamlbuild" {build} 14 | "topkg" {build & >= "1.0.3"} 15 | "uucd" {with-test} 16 | "uunf" {with-test} 17 | "uutf" {with-test}] 18 | depopts: ["uutf" 19 | "uunf" 20 | "cmdliner"] 21 | conflicts: ["uutf" {< "1.0.1"} 22 | "cmdliner" {< "1.0.0"}] 23 | build: [["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%" 24 | "--with-uutf" "%{uutf:installed}%" 25 | "--with-uunf" "%{uunf:installed}%" 26 | "--with-cmdliner" "%{cmdliner:installed}%" ]] 27 | description: """ 28 | Uucp is an OCaml library providing efficient access to a selection of 29 | character properties of the [Unicode character database][1]. 30 | 31 | Uucp is independent from any Unicode text data structure and has no 32 | dependencies. It is distributed under the ISC license. 33 | 34 | [1]: http://www.unicode.org/reports/tr44/ 35 | 36 | Home page: http://erratique.ch/software/uucp""" 37 | url { 38 | src: "https://erratique.ch/software/uucp/releases/uucp-14.0.0.tbz" 39 | checksum: "sha512=2d0224aed5d5accbb121624898f08598e8c74a2415942f159a54221c0cdac62ed64fc70a039c833e50110cefce77754ada9ac2d58f79a6fc9331135326fe6899"} 40 | post-messages: ["If the build fails with \"ocamlopt.opt got signal and exited\", issue 'ulimit -s unlimited' and retry." 41 | {failure & (arch = "ppc64" | arch = "arm64")}] -------------------------------------------------------------------------------- /esy.lock/opam/uuseg.14.0.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: """Unicode text segmentation for OCaml""" 3 | maintainer: ["Daniel Bünzli "] 4 | authors: ["The uuseg programmers"] 5 | homepage: "https://erratique.ch/software/uuseg" 6 | doc: "https://erratique.ch/software/uuseg/doc/" 7 | dev-repo: "git+https://erratique.ch/repos/uuseg.git" 8 | bug-reports: "https://github.com/dbuenzli/uuseg/issues" 9 | license: ["ISC"] 10 | tags: ["unicode" "text" "segmentation" "org:erratique"] 11 | depends: ["ocaml" {>= "4.03.0"} 12 | "ocamlfind" {build} 13 | "ocamlbuild" {build} 14 | "topkg" {build & >= "1.0.3"} 15 | "uucp" {>= "14.0.0" & < "15.0.0"}] 16 | depopts: ["uutf" 17 | "cmdliner"] 18 | conflicts: ["uutf" {< "1.0.0"}] 19 | build: [["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%" 20 | "--with-uutf" "%{uutf:installed}%" 21 | "--with-cmdliner" "%{cmdliner:installed}%" ]] 22 | url { 23 | src: "https://erratique.ch/software/uuseg/releases/uuseg-14.0.0.tbz" 24 | checksum: "sha512=3f089baf95f010663a0c2f060b2911395d9b396f478efb10fd979815f527c9e61e0a70b3192f2e921f59287bfde0da6e25109d4a1825554e2e4a50c0535e97aa"} 25 | description: """ 26 | Uuseg is an OCaml library for segmenting Unicode text. It implements 27 | the locale independent [Unicode text segmentation algorithms][1] to 28 | detect grapheme cluster, word and sentence boundaries and the 29 | [Unicode line breaking algorithm][2] to detect line break 30 | opportunities. 31 | 32 | The library is independent from any IO mechanism or Unicode text data 33 | structure and it can process text without a complete in-memory 34 | representation. 35 | 36 | Uuseg depends on [Uucp](http://erratique.ch/software/uucp) and 37 | optionally on [Uutf](http://erratique.ch/software/uutf) for support on 38 | OCaml UTF-X encoded strings. It is distributed under the ISC license. 39 | 40 | [1]: http://www.unicode.org/reports/tr29/ 41 | [2]: http://www.unicode.org/reports/tr14/ 42 | 43 | Homepage: http://erratique.ch/software/uuseg""" -------------------------------------------------------------------------------- /esy.lock/opam/uutf.1.0.3/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: """Non-blocking streaming Unicode codec for OCaml""" 3 | maintainer: ["Daniel Bünzli "] 4 | authors: ["The uutf programmers"] 5 | homepage: "https://erratique.ch/software/uutf" 6 | doc: "https://erratique.ch/software/uutf/doc/" 7 | dev-repo: "git+https://erratique.ch/repos/uutf.git" 8 | bug-reports: "https://github.com/dbuenzli/uutf/issues" 9 | license: ["ISC"] 10 | tags: ["unicode" "text" "utf-8" "utf-16" "codec" "org:erratique"] 11 | depends: ["ocaml" {>= "4.03.0"} 12 | "ocamlfind" {build} 13 | "ocamlbuild" {build} 14 | "topkg" {build & >= "1.0.3"}] 15 | depopts: ["cmdliner"] 16 | conflicts: ["cmdliner" {< "0.9.8"}] 17 | build: [["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%" 18 | "--with-cmdliner" "%{cmdliner:installed}%"]] 19 | url { 20 | src: "https://erratique.ch/software/uutf/releases/uutf-1.0.3.tbz" 21 | checksum: "sha512=50cc4486021da46fb08156e9daec0d57b4ca469b07309c508d5a9a41e9dbcf1f32dec2ed7be027326544453dcaf9c2534919395fd826dc7768efc6cc4bfcc9f8"} 22 | description: """ 23 | Uutf is a non-blocking streaming codec to decode and encode the UTF-8, 24 | UTF-16, UTF-16LE and UTF-16BE encoding schemes. It can efficiently 25 | work character by character without blocking on IO. Decoders perform 26 | character position tracking and support newline normalization. 27 | 28 | Functions are also provided to fold over the characters of UTF encoded 29 | OCaml string values and to directly encode characters in OCaml 30 | Buffer.t values. **Note** that since OCaml 4.14, that functionality 31 | can be found in the Stdlib and you are encouraged to migrate to it. 32 | 33 | Uutf has no dependency and is distributed under the ISC license. 34 | 35 | Home page: http://erratique.ch/software/uutf 36 | Contact: Daniel Bünzli ``""" -------------------------------------------------------------------------------- /esy.lock/opam/xdg.3.2.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "XDG Base Directory Specification" 3 | description: 4 | "https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html" 5 | maintainer: ["Jane Street Group, LLC "] 6 | authors: ["Jane Street Group, LLC "] 7 | license: "MIT" 8 | homepage: "https://github.com/ocaml/dune" 9 | doc: "https://dune.readthedocs.io/" 10 | bug-reports: "https://github.com/ocaml/dune/issues" 11 | depends: [ 12 | "dune" {>= "3.0"} 13 | "ocaml" {>= "4.08"} 14 | "odoc" {with-doc} 15 | ] 16 | dev-repo: "git+https://github.com/ocaml/dune.git" 17 | build: [ 18 | ["dune" "subst"] {dev} 19 | ["rm" "-rf" "vendor/csexp"] 20 | ["rm" "-rf" "vendor/pp"] 21 | [ 22 | "dune" 23 | "build" 24 | "-p" 25 | name 26 | "-j" 27 | jobs 28 | "@install" 29 | "@doc" {with-doc} 30 | ] 31 | ] 32 | url { 33 | src: 34 | "https://github.com/ocaml/dune/releases/download/3.2.0/chrome-trace-3.2.0.tbz" 35 | checksum: [ 36 | "sha256=bd1fbce6ae79ed1eb26fa89bb2e2e23978afceb3f53f5578cf1bdab08a1ad5bc" 37 | "sha512=b99e82d7e2233a9dd8c1fae591a03f9470fcdf9750d0e428cee2d4c8bcfa4da1595e9e10af2f234279a6ca8a120a773b247d4761d2c39210fc6101076631690e" 38 | ] 39 | } 40 | x-commit-hash: "43af00f79e41ce9101d42b36dab13e1f68d49a7a" 41 | -------------------------------------------------------------------------------- /esy.lock/opam/yojson.1.7.0/opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | maintainer: "martin@mjambon.com" 3 | authors: ["Martin Jambon"] 4 | homepage: "https://github.com/ocaml-community/yojson" 5 | bug-reports: "https://github.com/ocaml-community/yojson/issues" 6 | dev-repo: "git+https://github.com/ocaml-community/yojson.git" 7 | doc: "https://ocaml-community.github.io/yojson/" 8 | build: [ 9 | ["dune" "subst"] {dev} 10 | ["dune" "build" "-p" name "-j" jobs] 11 | ] 12 | run-test: [["dune" "runtest" "-p" name "-j" jobs]] 13 | depends: [ 14 | "ocaml" {>= "4.02.3"} 15 | "dune" 16 | "cppo" {build} 17 | "easy-format" 18 | "biniou" {>= "1.2.0"} 19 | "alcotest" {with-test & >= "0.8.5"} 20 | ] 21 | synopsis: 22 | "Yojson is an optimized parsing and printing library for the JSON format" 23 | description: """ 24 | Yojson is an optimized parsing and printing library for the JSON format. 25 | 26 | It addresses a few shortcomings of json-wheel including 2x speedup, 27 | polymorphic variants and optional syntax for tuples and variants. 28 | 29 | ydump is a pretty-printing command-line program provided with the 30 | yojson package. 31 | 32 | The program atdgen can be used to derive OCaml-JSON serializers and 33 | deserializers from type definitions.""" 34 | url { 35 | src: 36 | "https://github.com/ocaml-community/yojson/releases/download/1.7.0/yojson-1.7.0.tbz" 37 | checksum: "md5=b89d39ca3f8c532abe5f547ad3b8f84d" 38 | } 39 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__easy_format_opam__c__1.3.3_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": "dune build -p easy-format" 3 | } 4 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.1_opam_override/files/winpatch.patch: -------------------------------------------------------------------------------- 1 | --- ./Makefile 2 | +++ ./Makefile 3 | @@ -271,7 +271,7 @@ 4 | echo ' "ocamlbuild.byte" {"ocamlbuild.byte"}' >> ocamlbuild.install 5 | ifeq ($(OCAML_NATIVE), true) 6 | echo ' "ocamlbuild.native" {"ocamlbuild.native"}' >> ocamlbuild.install 7 | - echo ' "ocamlbuild.native" {"ocamlbuild"}' >> ocamlbuild.install 8 | + echo " \"ocamlbuild.native\" {\"ocamlbuild${EXE}\"}" >> ocamlbuild.install 9 | else 10 | echo ' "ocamlbuild.byte" {"ocamlbuild"}' >> ocamlbuild.install 11 | endif 12 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.1_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": [ 3 | [ 4 | "bash", 5 | "-c", 6 | "#{os == 'windows' ? 'patch -p1 < winpatch.patch' : 'true'}" 7 | ], 8 | [ 9 | "make", 10 | "-f", 11 | "configure.make", 12 | "all", 13 | "OCAMLBUILD_PREFIX=#{self.install}", 14 | "OCAMLBUILD_BINDIR=#{self.bin}", 15 | "OCAMLBUILD_LIBDIR=#{self.lib}", 16 | "OCAMLBUILD_MANDIR=#{self.man}", 17 | "OCAMLBUILD_NATIVE=true", 18 | "OCAMLBUILD_NATIVE_TOOLS=true", 19 | "EXE=#{os == 'windows' ? '.exe': ''}" 20 | ], 21 | [ 22 | "make", 23 | "check-if-preinstalled", 24 | "all", 25 | "EXE=#{os == 'windows' ? '.exe': ''}", 26 | "opam-install" 27 | ] 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.3_opam_override/files/findlib.patch: -------------------------------------------------------------------------------- 1 | --- ./Makefile 2 | +++ ./Makefile 3 | @@ -57,16 +57,16 @@ 4 | cat findlib.conf.in | \ 5 | $(SH) tools/patch '@SITELIB@' '$(OCAML_SITELIB)' >findlib.conf 6 | if ./tools/cmd_from_same_dir ocamlc; then \ 7 | - echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \ 8 | + echo 'ocamlc="ocamlc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ 9 | fi 10 | if ./tools/cmd_from_same_dir ocamlopt; then \ 11 | - echo 'ocamlopt="ocamlopt.opt"' >>findlib.conf; \ 12 | + echo 'ocamlopt="ocamlopt.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ 13 | fi 14 | if ./tools/cmd_from_same_dir ocamldep; then \ 15 | - echo 'ocamldep="ocamldep.opt"' >>findlib.conf; \ 16 | + echo 'ocamldep="ocamldep.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ 17 | fi 18 | if ./tools/cmd_from_same_dir ocamldoc; then \ 19 | - echo 'ocamldoc="ocamldoc.opt"' >>findlib.conf; \ 20 | + echo 'ocamldoc="ocamldoc.opt$(EXEC_SUFFIX)"' >>findlib.conf; \ 21 | fi 22 | 23 | .PHONY: install-doc 24 | --- ./src/findlib/findlib_config.mlp 25 | +++ ./src/findlib/findlib_config.mlp 26 | @@ -24,3 +24,5 @@ 27 | | "MacOS" -> "" (* don't know *) 28 | | _ -> failwith "Unknown Sys.os_type" 29 | ;; 30 | + 31 | +let exec_suffix = "@EXEC_SUFFIX@";; 32 | --- ./src/findlib/findlib.ml 33 | +++ ./src/findlib/findlib.ml 34 | @@ -28,15 +28,20 @@ 35 | let conf_ldconf = ref "";; 36 | let conf_ignore_dups_in = ref ([] : string list);; 37 | 38 | -let ocamlc_default = "ocamlc";; 39 | -let ocamlopt_default = "ocamlopt";; 40 | -let ocamlcp_default = "ocamlcp";; 41 | -let ocamloptp_default = "ocamloptp";; 42 | -let ocamlmklib_default = "ocamlmklib";; 43 | -let ocamlmktop_default = "ocamlmktop";; 44 | -let ocamldep_default = "ocamldep";; 45 | -let ocamlbrowser_default = "ocamlbrowser";; 46 | -let ocamldoc_default = "ocamldoc";; 47 | +let add_exec str = 48 | + match Findlib_config.exec_suffix with 49 | + | "" -> str 50 | + | a -> str ^ a ;; 51 | +let ocamlc_default = add_exec "ocamlc";; 52 | +let ocamlopt_default = add_exec "ocamlopt";; 53 | +let ocamlcp_default = add_exec "ocamlcp";; 54 | +let ocamloptp_default = add_exec "ocamloptp";; 55 | +let ocamlmklib_default = add_exec "ocamlmklib";; 56 | +let ocamlmktop_default = add_exec "ocamlmktop";; 57 | +let ocamldep_default = add_exec "ocamldep";; 58 | +let ocamlbrowser_default = add_exec "ocamlbrowser";; 59 | +let ocamldoc_default = add_exec "ocamldoc";; 60 | + 61 | 62 | 63 | let init_manually 64 | --- ./src/findlib/fl_package_base.ml 65 | +++ ./src/findlib/fl_package_base.ml 66 | @@ -133,7 +133,15 @@ 67 | List.find (fun def -> def.def_var = "exists_if") p.package_defs in 68 | let files = Fl_split.in_words def.def_value in 69 | List.exists 70 | - (fun file -> Sys.file_exists (Filename.concat d' file)) 71 | + (fun file -> 72 | + let fln = Filename.concat d' file in 73 | + let e = Sys.file_exists fln in 74 | + (* necessary for ppx executables *) 75 | + if e || Sys.os_type <> "Win32" || Filename.check_suffix fln ".exe" then 76 | + e 77 | + else 78 | + Sys.file_exists (fln ^ ".exe") 79 | + ) 80 | files 81 | with Not_found -> true in 82 | 83 | --- ./src/findlib/fl_split.ml 84 | +++ ./src/findlib/fl_split.ml 85 | @@ -126,10 +126,17 @@ 86 | | '/' | '\\' -> true 87 | | _ -> false in 88 | let norm_dir_win() = 89 | - if l >= 1 && s.[0] = '/' then 90 | - Buffer.add_char b '\\' else Buffer.add_char b s.[0]; 91 | - if l >= 2 && s.[1] = '/' then 92 | - Buffer.add_char b '\\' else Buffer.add_char b s.[1]; 93 | + if l >= 1 then ( 94 | + if s.[0] = '/' then 95 | + Buffer.add_char b '\\' 96 | + else 97 | + Buffer.add_char b s.[0] ; 98 | + if l >= 2 then 99 | + if s.[1] = '/' then 100 | + Buffer.add_char b '\\' 101 | + else 102 | + Buffer.add_char b s.[1]; 103 | + ); 104 | for k = 2 to l - 1 do 105 | let c = s.[k] in 106 | if is_slash c then ( 107 | --- ./src/findlib/frontend.ml 108 | +++ ./src/findlib/frontend.ml 109 | @@ -31,10 +31,18 @@ 110 | else 111 | Sys_error (arg ^ ": " ^ Unix.error_message code) 112 | 113 | +let is_win = Sys.os_type = "Win32" 114 | + 115 | +let () = 116 | + match Findlib_config.system with 117 | + | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" -> 118 | + (try set_binary_mode_out stdout true with _ -> ()); 119 | + (try set_binary_mode_out stderr true with _ -> ()); 120 | + | _ -> () 121 | 122 | let slashify s = 123 | match Findlib_config.system with 124 | - | "mingw" | "mingw64" | "cygwin" -> 125 | + | "win32" | "win64" | "mingw" | "cygwin" | "mingw64" | "cygwin64" -> 126 | let b = Buffer.create 80 in 127 | String.iter 128 | (function 129 | @@ -49,7 +57,7 @@ 130 | 131 | let out_path ?(prefix="") s = 132 | match Findlib_config.system with 133 | - | "mingw" | "mingw64" | "cygwin" -> 134 | + | "win32" | "win64" | "mingw" | "mingw64" | "cygwin" -> 135 | let u = slashify s in 136 | prefix ^ 137 | (if String.contains u ' ' then 138 | @@ -273,11 +281,9 @@ 139 | 140 | 141 | let identify_dir d = 142 | - match Sys.os_type with 143 | - | "Win32" -> 144 | - failwith "identify_dir" (* not available *) 145 | - | _ -> 146 | - let s = Unix.stat d in 147 | + if is_win then 148 | + failwith "identify_dir"; (* not available *) 149 | + let s = Unix.stat d in 150 | (s.Unix.st_dev, s.Unix.st_ino) 151 | ;; 152 | 153 | @@ -459,6 +465,96 @@ 154 | ) 155 | packages 156 | 157 | +let rewrite_cmd s = 158 | + if s = "" || not is_win then 159 | + s 160 | + else 161 | + let s = 162 | + let l = String.length s in 163 | + let b = Buffer.create l in 164 | + for i = 0 to pred l do 165 | + match s.[i] with 166 | + | '/' -> Buffer.add_char b '\\' 167 | + | x -> Buffer.add_char b x 168 | + done; 169 | + Buffer.contents b 170 | + in 171 | + if (Filename.is_implicit s && String.contains s '\\' = false) || 172 | + Filename.check_suffix (String.lowercase s) ".exe" then 173 | + s 174 | + else 175 | + let s' = s ^ ".exe" in 176 | + if Sys.file_exists s' then 177 | + s' 178 | + else 179 | + s 180 | + 181 | +let rewrite_cmd s = 182 | + if s = "" || not is_win then s else 183 | + let s = 184 | + let l = String.length s in 185 | + let b = Buffer.create l in 186 | + for i = 0 to pred l do 187 | + match s.[i] with 188 | + | '/' -> Buffer.add_char b '\\' 189 | + | x -> Buffer.add_char b x 190 | + done; 191 | + Buffer.contents b 192 | + in 193 | + if (Filename.is_implicit s && String.contains s '\\' = false) || 194 | + Filename.check_suffix (String.lowercase s) ".exe" then 195 | + s 196 | + else 197 | + let s' = s ^ ".exe" in 198 | + if Sys.file_exists s' then 199 | + s' 200 | + else 201 | + s 202 | + 203 | +let rewrite_pp cmd = 204 | + if not is_win then cmd else 205 | + let module T = struct exception Keep end in 206 | + let is_whitespace = function 207 | + | ' ' | '\011' | '\012' | '\n' | '\r' | '\t' -> true 208 | + | _ -> false in 209 | + (* characters that triggers special behaviour (cmd.exe, not unix shell) *) 210 | + let is_unsafe_char = function 211 | + | '(' | ')' | '%' | '!' | '^' | '<' | '>' | '&' -> true 212 | + | _ -> false in 213 | + let len = String.length cmd in 214 | + let buf = Buffer.create (len + 4) in 215 | + let buf_cmd = Buffer.create len in 216 | + let rec iter_ws i = 217 | + if i >= len then () else 218 | + let cur = cmd.[i] in 219 | + if is_whitespace cur then ( 220 | + Buffer.add_char buf cur; 221 | + iter_ws (succ i) 222 | + ) 223 | + else 224 | + iter_cmd i 225 | + and iter_cmd i = 226 | + if i >= len then add_buf_cmd () else 227 | + let cur = cmd.[i] in 228 | + if is_unsafe_char cur || cur = '"' || cur = '\'' then 229 | + raise T.Keep; 230 | + if is_whitespace cur then ( 231 | + add_buf_cmd (); 232 | + Buffer.add_substring buf cmd i (len - i) 233 | + ) 234 | + else ( 235 | + Buffer.add_char buf_cmd cur; 236 | + iter_cmd (succ i) 237 | + ) 238 | + and add_buf_cmd () = 239 | + if Buffer.length buf_cmd > 0 then 240 | + Buffer.add_string buf (rewrite_cmd (Buffer.contents buf_cmd)) 241 | + in 242 | + try 243 | + iter_ws 0; 244 | + Buffer.contents buf 245 | + with 246 | + | T.Keep -> cmd 247 | 248 | let process_pp_spec syntax_preds packages pp_opts = 249 | (* Returns: pp_command *) 250 | @@ -549,7 +645,7 @@ 251 | None -> [] 252 | | Some cmd -> 253 | ["-pp"; 254 | - cmd ^ " " ^ 255 | + (rewrite_cmd cmd) ^ " " ^ 256 | String.concat " " (List.map Filename.quote pp_i_options) ^ " " ^ 257 | String.concat " " (List.map Filename.quote pp_archives) ^ " " ^ 258 | String.concat " " (List.map Filename.quote pp_opts)] 259 | @@ -625,9 +721,11 @@ 260 | in 261 | try 262 | let preprocessor = 263 | + rewrite_cmd ( 264 | resolve_path 265 | ~base ~explicit:true 266 | - (package_property predicates pname "ppx") in 267 | + (package_property predicates pname "ppx") ) 268 | + in 269 | ["-ppx"; String.concat " " (preprocessor :: options)] 270 | with Not_found -> [] 271 | ) 272 | @@ -895,6 +993,14 @@ 273 | switch (e.g. -L instead of -L ) 274 | *) 275 | 276 | +(* We may need to remove files on which we do not have complete control. 277 | + On Windows, removing a read-only file fails so try to change the 278 | + mode of the file first. *) 279 | +let remove_file fname = 280 | + try Sys.remove fname 281 | + with Sys_error _ when is_win -> 282 | + (try Unix.chmod fname 0o666 with Unix.Unix_error _ -> ()); 283 | + Sys.remove fname 284 | 285 | let ocamlc which () = 286 | 287 | @@ -1022,9 +1128,12 @@ 288 | 289 | "-intf", 290 | Arg.String (fun s -> pass_files := !pass_files @ [ Intf(slashify s) ]); 291 | - 292 | + 293 | "-pp", 294 | - Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" s); 295 | + Arg.String (fun s -> pp_specified := true; add_spec_fn "-pp" (rewrite_pp s)); 296 | + 297 | + "-ppx", 298 | + Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s)); 299 | 300 | "-thread", 301 | Arg.Unit (fun _ -> threads := threads_default); 302 | @@ -1237,7 +1346,7 @@ 303 | with 304 | any -> 305 | close_out initl; 306 | - Sys.remove initl_file_name; 307 | + remove_file initl_file_name; 308 | raise any 309 | end; 310 | 311 | @@ -1245,9 +1354,9 @@ 312 | at_exit 313 | (fun () -> 314 | let tr f x = try f x with _ -> () in 315 | - tr Sys.remove initl_file_name; 316 | - tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmi"); 317 | - tr Sys.remove (Filename.chop_extension initl_file_name ^ ".cmo"); 318 | + tr remove_file initl_file_name; 319 | + tr remove_file (Filename.chop_extension initl_file_name ^ ".cmi"); 320 | + tr remove_file (Filename.chop_extension initl_file_name ^ ".cmo"); 321 | ); 322 | 323 | let exclude_list = [ stdlibdir; threads_dir; vmthreads_dir ] in 324 | @@ -1493,7 +1602,9 @@ 325 | [ "-v", Arg.Unit (fun () -> verbose := Verbose); 326 | "-pp", Arg.String (fun s -> 327 | pp_specified := true; 328 | - options := !options @ ["-pp"; s]); 329 | + options := !options @ ["-pp"; rewrite_pp s]); 330 | + "-ppx", Arg.String (fun s -> 331 | + options := !options @ ["-ppx"; rewrite_pp s]); 332 | ] 333 | ) 334 | ) 335 | @@ -1672,7 +1783,9 @@ 336 | Arg.String (fun s -> add_spec_fn "-I" (slashify (resolve_path s))); 337 | 338 | "-pp", Arg.String (fun s -> pp_specified := true; 339 | - add_spec_fn "-pp" s); 340 | + add_spec_fn "-pp" (rewrite_pp s)); 341 | + "-ppx", Arg.String (fun s -> add_spec_fn "-ppx" (rewrite_pp s)); 342 | + 343 | ] 344 | ) 345 | ) 346 | @@ -1830,7 +1943,10 @@ 347 | output_string ch_out append; 348 | close_out ch_out; 349 | close_in ch_in; 350 | - Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime; 351 | + (try Unix.utimes outpath s.Unix.st_mtime s.Unix.st_mtime 352 | + with Unix.Unix_error(e,_,_) -> 353 | + prerr_endline("Warning: setting utimes for " ^ outpath 354 | + ^ ": " ^ Unix.error_message e)); 355 | 356 | prerr_endline("Installed " ^ outpath); 357 | with 358 | @@ -1882,6 +1998,8 @@ 359 | Unix.openfile (Filename.concat dir owner_file) [Unix.O_RDONLY] 0 in 360 | let f = 361 | Unix.in_channel_of_descr fd in 362 | + if is_win then 363 | + set_binary_mode_in f false; 364 | try 365 | let line = input_line f in 366 | let is_my_file = (line = pkg) in 367 | @@ -2208,7 +2326,7 @@ 368 | let lines = read_ldconf !ldconf in 369 | let dlldir_norm = Fl_split.norm_dir dlldir in 370 | let dlldir_norm_lc = string_lowercase_ascii dlldir_norm in 371 | - let ci_filesys = (Sys.os_type = "Win32") in 372 | + let ci_filesys = is_win in 373 | let check_dir d = 374 | let d' = Fl_split.norm_dir d in 375 | (d' = dlldir_norm) || 376 | @@ -2356,7 +2474,7 @@ 377 | List.iter 378 | (fun file -> 379 | let absfile = Filename.concat dlldir file in 380 | - Sys.remove absfile; 381 | + remove_file absfile; 382 | prerr_endline ("Removed " ^ absfile) 383 | ) 384 | dll_files 385 | @@ -2365,7 +2483,7 @@ 386 | (* Remove the files from the package directory: *) 387 | if Sys.file_exists pkgdir then begin 388 | let files = Sys.readdir pkgdir in 389 | - Array.iter (fun f -> Sys.remove (Filename.concat pkgdir f)) files; 390 | + Array.iter (fun f -> remove_file (Filename.concat pkgdir f)) files; 391 | Unix.rmdir pkgdir; 392 | prerr_endline ("Removed " ^ pkgdir) 393 | end 394 | @@ -2415,7 +2533,9 @@ 395 | 396 | 397 | let print_configuration() = 398 | + let sl = slashify in 399 | let dir s = 400 | + let s = sl s in 401 | if Sys.file_exists s then 402 | s 403 | else 404 | @@ -2453,27 +2573,27 @@ 405 | if md = "" then "the corresponding package directories" else dir md 406 | ); 407 | Printf.printf "The standard library is assumed to reside in:\n %s\n" 408 | - (Findlib.ocaml_stdlib()); 409 | + (sl (Findlib.ocaml_stdlib())); 410 | Printf.printf "The ld.conf file can be found here:\n %s\n" 411 | - (Findlib.ocaml_ldconf()); 412 | + (sl (Findlib.ocaml_ldconf())); 413 | flush stdout 414 | | Some "conf" -> 415 | - print_endline (Findlib.config_file()) 416 | + print_endline (sl (Findlib.config_file())) 417 | | Some "path" -> 418 | - List.iter print_endline (Findlib.search_path()) 419 | + List.iter ( fun x -> print_endline (sl x)) (Findlib.search_path()) 420 | | Some "destdir" -> 421 | - print_endline (Findlib.default_location()) 422 | + print_endline ( sl (Findlib.default_location())) 423 | | Some "metadir" -> 424 | - print_endline (Findlib.meta_directory()) 425 | + print_endline ( sl (Findlib.meta_directory())) 426 | | Some "metapath" -> 427 | let mdir = Findlib.meta_directory() in 428 | let ddir = Findlib.default_location() in 429 | - print_endline 430 | - (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META") 431 | + print_endline ( sl 432 | + (if mdir <> "" then mdir ^ "/META.%s" else ddir ^ "/%s/META")) 433 | | Some "stdlib" -> 434 | - print_endline (Findlib.ocaml_stdlib()) 435 | + print_endline ( sl (Findlib.ocaml_stdlib())) 436 | | Some "ldconf" -> 437 | - print_endline (Findlib.ocaml_ldconf()) 438 | + print_endline ( sl (Findlib.ocaml_ldconf())) 439 | | _ -> 440 | assert false 441 | ;; 442 | @@ -2481,7 +2601,7 @@ 443 | 444 | let ocamlcall pkg cmd = 445 | let dir = package_directory pkg in 446 | - let path = Filename.concat dir cmd in 447 | + let path = rewrite_cmd (Filename.concat dir cmd) in 448 | begin 449 | try Unix.access path [ Unix.X_OK ] 450 | with 451 | @@ -2647,6 +2767,10 @@ 452 | | Sys_error f -> 453 | prerr_endline ("ocamlfind: " ^ f); 454 | exit 2 455 | + | Unix.Unix_error (e, fn, f) -> 456 | + prerr_endline ("ocamlfind: " ^ fn ^ " " ^ f 457 | + ^ ": " ^ Unix.error_message e); 458 | + exit 2 459 | | Findlib.No_such_package(pkg,info) -> 460 | prerr_endline ("ocamlfind: Package `" ^ pkg ^ "' not found" ^ 461 | (if info <> "" then " - " ^ info else "")); 462 | --- ./src/findlib/Makefile 463 | +++ ./src/findlib/Makefile 464 | @@ -90,6 +90,7 @@ 465 | cat findlib_config.mlp | \ 466 | $(SH) $(TOP)/tools/patch '@CONFIGFILE@' '$(OCAMLFIND_CONF)' | \ 467 | $(SH) $(TOP)/tools/patch '@STDLIB@' '$(OCAML_CORE_STDLIB)' | \ 468 | + $(SH) $(TOP)/tools/patch '@EXEC_SUFFIX@' '$(EXEC_SUFFIX)' | \ 469 | sed -e 's;@AUTOLINK@;$(OCAML_AUTOLINK);g' \ 470 | -e 's;@SYSTEM@;$(SYSTEM);g' \ 471 | >findlib_config.ml 472 | --- ./src/findlib/frontend.ml 473 | +++ ./src/findlib/frontend.ml 474 | @@ -281,10 +281,8 @@ 475 | 476 | 477 | let identify_dir d = 478 | - if is_win then 479 | - failwith "identify_dir"; (* not available *) 480 | let s = Unix.stat d in 481 | - (s.Unix.st_dev, s.Unix.st_ino) 482 | + (s.Unix.st_dev, s.Unix.st_ino) 483 | ;; 484 | 485 | 486 | -------------------------------------------------------------------------------- /esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.3_opam_override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": [ 3 | [ 4 | "bash", 5 | "-c", 6 | "#{os == 'windows' ? 'patch -p1 < findlib.patch' : 'true'}" 7 | ], 8 | [ 9 | "./configure", 10 | "-bindir", 11 | "#{self.bin}", 12 | "-sitelib", 13 | "#{self.lib}", 14 | "-mandir", 15 | "#{self.man}", 16 | "-config", 17 | "#{self.lib}/findlib.conf", 18 | "-no-custom", 19 | "-no-topfind" 20 | ], 21 | [ 22 | "make", 23 | "all" 24 | ], 25 | [ 26 | "make", 27 | "opt" 28 | ] 29 | ], 30 | "install": [ 31 | [ 32 | "make", 33 | "install" 34 | ], 35 | [ 36 | "install", 37 | "-m", 38 | "0755", 39 | "ocaml-stub", 40 | "#{self.bin}/ocaml" 41 | ], 42 | [ 43 | "mkdir", 44 | "-p", 45 | "#{self.toplevel}" 46 | ], 47 | [ 48 | "install", 49 | "-m", 50 | "0644", 51 | "src/findlib/topfind", 52 | "#{self.toplevel}/topfind" 53 | ] 54 | ], 55 | "exportedEnv": { 56 | "OCAML_TOPLEVEL_PATH": { 57 | "val": "#{self.toplevel}", 58 | "scope": "global" 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ocaml-migrate-types.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | depends: [ 4 | "dune" {>= "2.8"} 5 | "ocaml" {>= "4.08.0" & < "4.14.0"} 6 | "ocaml-migrate-parsetree" 7 | "ppx_optcomp" 8 | "odoc" {with-doc} 9 | ] 10 | build: [ 11 | ["dune" "subst"] {dev} 12 | [ 13 | "dune" 14 | "build" 15 | "-p" 16 | name 17 | "-j" 18 | jobs 19 | "@install" 20 | "@runtest" {with-test} 21 | "@doc" {with-doc} 22 | ] 23 | ] 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ocaml-migrate-types", 3 | "esy": { 4 | "build": "dune build -p ocaml-migrate-types", 5 | "install": "esy-installer ocaml-migrate-types.install" 6 | }, 7 | "dependencies": { 8 | "ocaml": ">= 4.8.x", 9 | "@opam/dune": "*", 10 | "@opam/ocaml-migrate-parsetree": "*", 11 | "@opam/ppx_optcomp": "*" 12 | }, 13 | "devDependencies": { 14 | "ocaml": "4.14.x", 15 | "@opam/ocaml-lsp-server": "*", 16 | "@opam/ocamlformat": "*" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/.ocamlformat: -------------------------------------------------------------------------------- 1 | version=0.21.0 2 | module-item-spacing=preserve 3 | -------------------------------------------------------------------------------- /src/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name migrate_types) 3 | (public_name ocaml-migrate-types) 4 | (libraries ocaml-migrate-parsetree) 5 | (preprocess 6 | (pps ppx_optcomp))) 7 | -------------------------------------------------------------------------------- /src/shape_414.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Ulysse Gérard, Thomas Refis, Tarides *) 6 | (* *) 7 | (* Copyright 2021 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | [%%if ocaml_version >= (4, 14, 0) && ocaml_version < (4, 15, 0)] 16 | module Shape = Shape 17 | [%%else] 18 | module Shape : sig 19 | 20 | module Uid : sig 21 | type t = private 22 | | Compilation_unit of string 23 | | Item of { comp_unit: string; id: int } 24 | | Internal 25 | | Predef of string 26 | 27 | val reinit : unit -> unit 28 | 29 | val mk : current_unit:string -> t 30 | val of_compilation_unit_id : Ident.t -> t 31 | val of_predef_id : Ident.t -> t 32 | val internal_not_actually_unique : t 33 | 34 | val for_actual_declaration : t -> bool 35 | 36 | include Identifiable.S with type t := t 37 | end 38 | 39 | module Sig_component_kind : sig 40 | type t = 41 | | Value 42 | | Type 43 | | Module 44 | | Module_type 45 | | Extension_constructor 46 | | Class 47 | | Class_type 48 | 49 | val to_string : t -> string 50 | 51 | (** Whether the name of a component of that kind can appear in a type. *) 52 | val can_appear_in_types : t -> bool 53 | end 54 | 55 | module Item : sig 56 | type t 57 | 58 | val make : string -> Sig_component_kind.t -> t 59 | 60 | val value : Ident.t -> t 61 | val type_ : Ident.t -> t 62 | val module_ : Ident.t -> t 63 | val module_type : Ident.t -> t 64 | val extension_constructor : Ident.t -> t 65 | val class_ : Ident.t -> t 66 | val class_type : Ident.t -> t 67 | 68 | module Map : Map.S with type key = t 69 | end 70 | 71 | type var = Ident.t 72 | type t = { uid: Uid.t option; desc: desc } 73 | and desc = 74 | | Var of var 75 | | Abs of var * t 76 | | App of t * t 77 | | Struct of t Item.Map.t 78 | | Leaf 79 | | Proj of t * Item.t 80 | | Comp_unit of string 81 | 82 | val print : Format.formatter -> t -> unit 83 | 84 | (* Smart constructors *) 85 | 86 | val for_unnamed_functor_param : var 87 | val fresh_var : ?name:string -> Uid.t -> var * t 88 | 89 | val var : Uid.t -> Ident.t -> t 90 | val abs : ?uid:Uid.t -> var -> t -> t 91 | val app : ?uid:Uid.t -> t -> arg:t -> t 92 | val str : ?uid:Uid.t -> t Item.Map.t -> t 93 | val proj : ?uid:Uid.t -> t -> Item.t -> t 94 | val leaf : Uid.t -> t 95 | 96 | val decompose_abs : t -> (var * t) option 97 | 98 | val for_persistent_unit : string -> t 99 | val leaf_for_unpack : t 100 | 101 | module Map : sig 102 | type shape = t 103 | type nonrec t = t Item.Map.t 104 | 105 | val empty : t 106 | 107 | val add : t -> Item.t -> shape -> t 108 | 109 | val add_value : t -> Ident.t -> Uid.t -> t 110 | val add_value_proj : t -> Ident.t -> shape -> t 111 | 112 | val add_type : t -> Ident.t -> Uid.t -> t 113 | val add_type_proj : t -> Ident.t -> shape -> t 114 | 115 | val add_module : t -> Ident.t -> shape -> t 116 | val add_module_proj : t -> Ident.t -> shape -> t 117 | 118 | val add_module_type : t -> Ident.t -> Uid.t -> t 119 | val add_module_type_proj : t -> Ident.t -> shape -> t 120 | 121 | val add_extcons : t -> Ident.t -> Uid.t -> t 122 | val add_extcons_proj : t -> Ident.t -> shape -> t 123 | 124 | val add_class : t -> Ident.t -> Uid.t -> t 125 | val add_class_proj : t -> Ident.t -> shape -> t 126 | 127 | val add_class_type : t -> Ident.t -> Uid.t -> t 128 | val add_class_type_proj : t -> Ident.t -> shape -> t 129 | end 130 | 131 | val dummy_mod : t 132 | 133 | val of_path : 134 | find_shape:(Sig_component_kind.t -> Ident.t -> t) -> 135 | namespace:Sig_component_kind.t -> Path.t -> t 136 | 137 | val set_uid_if_none : t -> Uid.t -> t 138 | 139 | (** The [Make_reduce] functor is used to generate a reduction function for 140 | shapes. 141 | 142 | It is parametrized by: 143 | - an environment and a function to find shapes by path in that environment 144 | - a function to load the shape of an external compilation unit 145 | - some fuel, which is used to bound recursion when dealing with recursive 146 | shapes introduced by recursive modules. (FTR: merlin currently uses a 147 | fuel of 10, which seems to be enough for most practical examples) 148 | *) 149 | module Make_reduce(Context : sig 150 | type env 151 | 152 | val fuel : int 153 | 154 | val read_unit_shape : unit_name:string -> t option 155 | 156 | val find_shape : env -> Ident.t -> t 157 | end) : sig 158 | val reduce : Context.env -> t -> t 159 | end 160 | 161 | val local_reduce : t -> t 162 | end 163 | [%%endif] 164 | -------------------------------------------------------------------------------- /src/type_immediacy_410.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2019 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | [%%if ocaml_version >= (4, 10, 0) && ocaml_version < (4, 11, 0)] 15 | include Type_immediacy 16 | [%%else];; 17 | 18 | (** Immediacy status of a type *) 19 | 20 | type t = 21 | | Unknown 22 | (** We don't know anything *) 23 | | Always 24 | (** We know for sure that values of this type are always immediate *) 25 | | Always_on_64bits 26 | (** We know for sure that values of this type are always immediate 27 | on 64 bit platforms. For other platforms, we know nothing. *) 28 | 29 | module Violation = struct 30 | type t = Not_always_immediate | Not_always_immediate_on_64bits 31 | end 32 | [%%endif] 33 | -------------------------------------------------------------------------------- /src/type_immediacy_411.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2019 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | [%%if ocaml_version >= (4, 11, 0) && ocaml_version < (4, 12, 0)] 15 | include Type_immediacy 16 | [%%else];; 17 | 18 | (** Immediacy status of a type *) 19 | 20 | type t = 21 | | Unknown 22 | (** We don't know anything *) 23 | | Always 24 | (** We know for sure that values of this type are always immediate *) 25 | | Always_on_64bits 26 | (** We know for sure that values of this type are always immediate 27 | on 64 bit platforms. For other platforms, we know nothing. *) 28 | 29 | module Violation = struct 30 | type t = Type_immediacy_410.Violation.t = 31 | | Not_always_immediate 32 | | Not_always_immediate_on_64bits 33 | end 34 | [%%endif] 35 | -------------------------------------------------------------------------------- /src/type_immediacy_412.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2019 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | [%%if ocaml_version >= (4, 12, 0) && ocaml_version < (4, 13, 0)] 15 | include Type_immediacy 16 | [%%else];; 17 | 18 | (** Immediacy status of a type *) 19 | 20 | type t = 21 | | Unknown 22 | (** We don't know anything *) 23 | | Always 24 | (** We know for sure that values of this type are always immediate *) 25 | | Always_on_64bits 26 | (** We know for sure that values of this type are always immediate 27 | on 64 bit platforms. For other platforms, we know nothing. *) 28 | 29 | module Violation = struct 30 | type t = Type_immediacy_411.Violation.t = 31 | | Not_always_immediate 32 | | Not_always_immediate_on_64bits 33 | end 34 | [%%endif] 35 | -------------------------------------------------------------------------------- /src/type_immediacy_413.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2019 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | [%%if ocaml_version >= (4, 13, 0) && ocaml_version < (4, 14, 0)] 15 | include Type_immediacy 16 | [%%else];; 17 | 18 | type t = 19 | | Unknown 20 | | Always 21 | | Always_on_64bits 22 | 23 | module Violation = struct 24 | type t = 25 | | Not_always_immediate 26 | | Not_always_immediate_on_64bits 27 | end 28 | [%%endif] 29 | -------------------------------------------------------------------------------- /src/type_immediacy_414.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Jeremie Dimino, Jane Street Europe *) 6 | (* *) 7 | (* Copyright 2019 Jane Street Group LLC *) 8 | (* *) 9 | (* All rights reserved. This file is distributed under the terms of *) 10 | (* the GNU Lesser General Public License version 2.1, with the *) 11 | (* special exception on linking described in the file LICENSE. *) 12 | (* *) 13 | (**************************************************************************) 14 | 15 | [%%if ocaml_version >= (4, 14, 0) && ocaml_version < (4, 15, 0)] 16 | include Type_immediacy 17 | [%%else];; 18 | 19 | type t = 20 | | Unknown 21 | | Always 22 | | Always_on_64bits 23 | 24 | module Violation = struct 25 | type t = 26 | | Not_always_immediate 27 | | Not_always_immediate_on_64bits 28 | end 29 | [%%endif] 30 | -------------------------------------------------------------------------------- /src/types_408.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | [@@@warning "-9"] 16 | [%%if ocaml_version >= (4, 08, 0) && ocaml_version < (4, 09, 0)] 17 | module Types = Types 18 | [%%else] 19 | module Types = struct 20 | open Migrate_parsetree.Ast_408 21 | 22 | (* Representation of types and declarations *) 23 | 24 | open Asttypes 25 | 26 | (* Type expressions for the core language *) 27 | 28 | type type_expr = 29 | { mutable desc: type_desc; 30 | mutable level: int; 31 | mutable scope: int; 32 | id: int } 33 | 34 | and type_desc = 35 | Tvar of string option 36 | | Tarrow of arg_label * type_expr * type_expr * commutable 37 | | Ttuple of type_expr list 38 | | Tconstr of Path.t * type_expr list * abbrev_memo ref 39 | | Tobject of type_expr * (Path.t * type_expr list) option ref 40 | | Tfield of string * field_kind * type_expr * type_expr 41 | | Tnil 42 | | Tlink of type_expr 43 | | Tsubst of type_expr (* for copying *) 44 | | Tvariant of row_desc 45 | | Tunivar of string option 46 | | Tpoly of type_expr * type_expr list 47 | | Tpackage of Path.t * Longident.t list * type_expr list 48 | 49 | and row_desc = 50 | { row_fields: (label * row_field) list; 51 | row_more: type_expr; 52 | row_bound: unit; 53 | row_closed: bool; 54 | row_fixed: bool; 55 | row_name: (Path.t * type_expr list) option } 56 | 57 | and row_field = 58 | Rpresent of type_expr option 59 | | Reither of bool * type_expr list * bool * row_field option ref 60 | (* 1st true denotes a constant constructor *) 61 | (* 2nd true denotes a tag in a pattern matching, and 62 | is erased later *) 63 | | Rabsent 64 | 65 | and abbrev_memo = 66 | Mnil 67 | | Mcons of private_flag * Path.t * type_expr * type_expr * abbrev_memo 68 | | Mlink of abbrev_memo ref 69 | 70 | and field_kind = 71 | Fvar of field_kind option ref 72 | | Fpresent 73 | | Fabsent 74 | 75 | and commutable = 76 | Cok 77 | | Cunknown 78 | | Clink of commutable ref 79 | 80 | module TypeOps = struct 81 | type t = type_expr 82 | let compare t1 t2 = t1.id - t2.id 83 | let hash t = t.id 84 | let equal t1 t2 = t1 == t2 85 | end 86 | 87 | (* Maps of methods and instance variables *) 88 | 89 | module Meths = Misc.Stdlib.String.Map 90 | module Vars = Meths 91 | 92 | (* Value descriptions *) 93 | 94 | type value_description = 95 | { val_type: type_expr; (* Type of the value *) 96 | val_kind: value_kind; 97 | val_loc: Location.t; 98 | val_attributes: Parsetree.attributes; 99 | } 100 | 101 | and value_kind = 102 | Val_reg (* Regular value *) 103 | | Val_prim of Primitive.description (* Primitive *) 104 | | Val_ivar of mutable_flag * string (* Instance variable (mutable ?) *) 105 | | Val_self of (Ident.t * type_expr) Meths.t ref * 106 | (Ident.t * Asttypes.mutable_flag * 107 | Asttypes.virtual_flag * type_expr) Vars.t ref * 108 | string * type_expr 109 | (* Self *) 110 | | Val_anc of (string * Ident.t) list * string 111 | (* Ancestor *) 112 | | Val_unbound of value_unbound_reason (* Unbound variable *) 113 | 114 | and value_unbound_reason = 115 | | Val_unbound_instance_variable 116 | | Val_unbound_ghost_recursive 117 | 118 | (* Variance *) 119 | 120 | module Variance = struct 121 | type t = int 122 | type f = May_pos | May_neg | May_weak | Inj | Pos | Neg | Inv 123 | let single = function 124 | | May_pos -> 1 125 | | May_neg -> 2 126 | | May_weak -> 4 127 | | Inj -> 8 128 | | Pos -> 16 129 | | Neg -> 32 130 | | Inv -> 64 131 | let union v1 v2 = v1 lor v2 132 | let inter v1 v2 = v1 land v2 133 | let subset v1 v2 = (v1 land v2 = v1) 134 | let eq (v1 : t) v2 = (v1 = v2) 135 | let set x b v = 136 | if b then v lor single x else v land (lnot (single x)) 137 | let mem x = subset (single x) 138 | let null = 0 139 | let may_inv = 7 140 | let full = 127 141 | let covariant = single May_pos lor single Pos lor single Inj 142 | let swap f1 f2 v = 143 | let v' = set f1 (mem f2 v) v in set f2 (mem f1 v) v' 144 | let conjugate v = swap May_pos May_neg (swap Pos Neg v) 145 | let get_upper v = (mem May_pos v, mem May_neg v) 146 | let get_lower v = (mem Pos v, mem Neg v, mem Inv v, mem Inj v) 147 | end 148 | 149 | (* Type definitions *) 150 | 151 | type type_declaration = 152 | { type_params: type_expr list; 153 | type_arity: int; 154 | type_kind: type_kind; 155 | type_private: private_flag; 156 | type_manifest: type_expr option; 157 | type_variance: Variance.t list; 158 | type_is_newtype: bool; 159 | type_expansion_scope: int; 160 | type_loc: Location.t; 161 | type_attributes: Parsetree.attributes; 162 | type_immediate: bool; 163 | type_unboxed: unboxed_status; 164 | } 165 | 166 | and type_kind = 167 | Type_abstract 168 | | Type_record of label_declaration list * record_representation 169 | | Type_variant of constructor_declaration list 170 | | Type_open 171 | 172 | and record_representation = 173 | Record_regular (* All fields are boxed / tagged *) 174 | | Record_float (* All fields are floats *) 175 | | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) 176 | | Record_inlined of int (* Inlined record *) 177 | | Record_extension of Path.t (* Inlined record under extension *) 178 | 179 | and label_declaration = 180 | { 181 | ld_id: Ident.t; 182 | ld_mutable: mutable_flag; 183 | ld_type: type_expr; 184 | ld_loc: Location.t; 185 | ld_attributes: Parsetree.attributes; 186 | } 187 | 188 | and constructor_declaration = 189 | { 190 | cd_id: Ident.t; 191 | cd_args: constructor_arguments; 192 | cd_res: type_expr option; 193 | cd_loc: Location.t; 194 | cd_attributes: Parsetree.attributes; 195 | } 196 | 197 | and constructor_arguments = 198 | | Cstr_tuple of type_expr list 199 | | Cstr_record of label_declaration list 200 | 201 | and unboxed_status = 202 | { 203 | unboxed: bool; 204 | default: bool; (* False if the unboxed field was set from an attribute. *) 205 | } 206 | 207 | let unboxed_false_default_false = {unboxed = false; default = false} 208 | let unboxed_false_default_true = {unboxed = false; default = true} 209 | let unboxed_true_default_false = {unboxed = true; default = false} 210 | let unboxed_true_default_true = {unboxed = true; default = true} 211 | 212 | type extension_constructor = 213 | { ext_type_path: Path.t; 214 | ext_type_params: type_expr list; 215 | ext_args: constructor_arguments; 216 | ext_ret_type: type_expr option; 217 | ext_private: private_flag; 218 | ext_loc: Location.t; 219 | ext_attributes: Parsetree.attributes; } 220 | 221 | and type_transparence = 222 | Type_public (* unrestricted expansion *) 223 | | Type_new (* "new" type *) 224 | | Type_private (* private type *) 225 | 226 | (* Type expressions for the class language *) 227 | 228 | module Concr = Misc.Stdlib.String.Set 229 | 230 | type class_type = 231 | Cty_constr of Path.t * type_expr list * class_type 232 | | Cty_signature of class_signature 233 | | Cty_arrow of arg_label * type_expr * class_type 234 | 235 | and class_signature = 236 | { csig_self: type_expr; 237 | csig_vars: 238 | (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) Vars.t; 239 | csig_concr: Concr.t; 240 | csig_inher: (Path.t * type_expr list) list } 241 | 242 | type class_declaration = 243 | { cty_params: type_expr list; 244 | mutable cty_type: class_type; 245 | cty_path: Path.t; 246 | cty_new: type_expr option; 247 | cty_variance: Variance.t list; 248 | cty_loc: Location.t; 249 | cty_attributes: Parsetree.attributes; 250 | } 251 | 252 | type class_type_declaration = 253 | { clty_params: type_expr list; 254 | clty_type: class_type; 255 | clty_path: Path.t; 256 | clty_variance: Variance.t list; 257 | clty_loc: Location.t; 258 | clty_attributes: Parsetree.attributes; 259 | } 260 | 261 | (* Type expressions for the module language *) 262 | 263 | type visibility = 264 | | Exported 265 | | Hidden 266 | 267 | type module_type = 268 | Mty_ident of Path.t 269 | | Mty_signature of signature 270 | | Mty_functor of Ident.t * module_type option * module_type 271 | | Mty_alias of Path.t 272 | 273 | and module_presence = 274 | | Mp_present 275 | | Mp_absent 276 | 277 | and signature = signature_item list 278 | 279 | and signature_item = 280 | Sig_value of Ident.t * value_description * visibility 281 | | Sig_type of Ident.t * type_declaration * rec_status * visibility 282 | | Sig_typext of Ident.t * extension_constructor * ext_status * visibility 283 | | Sig_module of 284 | Ident.t * module_presence * module_declaration * rec_status * visibility 285 | | Sig_modtype of Ident.t * modtype_declaration * visibility 286 | | Sig_class of Ident.t * class_declaration * rec_status * visibility 287 | | Sig_class_type of Ident.t * class_type_declaration * rec_status * visibility 288 | 289 | and module_declaration = 290 | { 291 | md_type: module_type; 292 | md_attributes: Parsetree.attributes; 293 | md_loc: Location.t; 294 | } 295 | 296 | and modtype_declaration = 297 | { 298 | mtd_type: module_type option; (* Note: abstract *) 299 | mtd_attributes: Parsetree.attributes; 300 | mtd_loc: Location.t; 301 | } 302 | 303 | and rec_status = 304 | Trec_not (* first in a nonrecursive group *) 305 | | Trec_first (* first in a recursive group *) 306 | | Trec_next (* not first in a recursive/nonrecursive group *) 307 | 308 | and ext_status = 309 | Text_first (* first constructor of an extension *) 310 | | Text_next (* not first constructor of an extension *) 311 | | Text_exception (* an exception *) 312 | 313 | 314 | (* Constructor and record label descriptions inserted held in typing 315 | environments *) 316 | 317 | type constructor_description = 318 | { cstr_name: string; (* Constructor name *) 319 | cstr_res: type_expr; (* Type of the result *) 320 | cstr_existentials: type_expr list; (* list of existentials *) 321 | cstr_args: type_expr list; (* Type of the arguments *) 322 | cstr_arity: int; (* Number of arguments *) 323 | cstr_tag: constructor_tag; (* Tag for heap blocks *) 324 | cstr_consts: int; (* Number of constant constructors *) 325 | cstr_nonconsts: int; (* Number of non-const constructors *) 326 | cstr_normal: int; (* Number of non generalized constrs *) 327 | cstr_generalized: bool; (* Constrained return type? *) 328 | cstr_private: private_flag; (* Read-only constructor? *) 329 | cstr_loc: Location.t; 330 | cstr_attributes: Parsetree.attributes; 331 | cstr_inlined: type_declaration option; 332 | } 333 | 334 | and constructor_tag = 335 | Cstr_constant of int (* Constant constructor (an int) *) 336 | | Cstr_block of int (* Regular constructor (a block) *) 337 | | Cstr_unboxed (* Constructor of an unboxed type *) 338 | | Cstr_extension of Path.t * bool (* Extension constructor 339 | true if a constant false if a block*) 340 | 341 | let equal_tag t1 t2 = 342 | match (t1, t2) with 343 | | Cstr_constant i1, Cstr_constant i2 -> i2 = i1 344 | | Cstr_block i1, Cstr_block i2 -> i2 = i1 345 | | Cstr_unboxed, Cstr_unboxed -> true 346 | | Cstr_extension (path1, b1), Cstr_extension (path2, b2) -> 347 | Path.same path1 path2 && b1 = b2 348 | | (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false 349 | 350 | let may_equal_constr c1 c2 = match c1.cstr_tag,c2.cstr_tag with 351 | | Cstr_extension _,Cstr_extension _ -> c1.cstr_arity = c2.cstr_arity 352 | | tag1,tag2 -> equal_tag tag1 tag2 353 | 354 | type label_description = 355 | { lbl_name: string; (* Short name *) 356 | lbl_res: type_expr; (* Type of the result *) 357 | lbl_arg: type_expr; (* Type of the argument *) 358 | lbl_mut: mutable_flag; (* Is this a mutable field? *) 359 | lbl_pos: int; (* Position in block *) 360 | lbl_all: label_description array; (* All the labels in this type *) 361 | lbl_repres: record_representation; (* Representation for this record *) 362 | lbl_private: private_flag; (* Read-only field? *) 363 | lbl_loc: Location.t; 364 | lbl_attributes: Parsetree.attributes; 365 | } 366 | 367 | let rec bound_value_identifiers = function 368 | [] -> [] 369 | | Sig_value(id, {val_kind = Val_reg}, _) :: rem -> 370 | id :: bound_value_identifiers rem 371 | | Sig_typext(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 372 | | Sig_module(id, Mp_present, _, _, _) :: rem -> 373 | id :: bound_value_identifiers rem 374 | | Sig_class(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 375 | | _ :: rem -> bound_value_identifiers rem 376 | 377 | let signature_item_id = function 378 | | Sig_value (id, _, _) 379 | | Sig_type (id, _, _, _) 380 | | Sig_typext (id, _, _, _) 381 | | Sig_module (id, _, _, _, _) 382 | | Sig_modtype (id, _, _) 383 | | Sig_class (id, _, _, _) 384 | | Sig_class_type (id, _, _, _) 385 | -> id 386 | end 387 | [%%endif] 388 | -------------------------------------------------------------------------------- /src/types_409.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | [@@@warning "-9"] 16 | [%%if ocaml_version >= (4, 09, 0) && ocaml_version < (4, 10, 0)] 17 | module Types = Types 18 | [%%else] 19 | module Types = struct 20 | open Migrate_parsetree.Ast_409 21 | 22 | (* Representation of types and declarations *) 23 | 24 | open Asttypes 25 | 26 | (* Type expressions for the core language *) 27 | 28 | type type_expr = 29 | { mutable desc: type_desc; 30 | mutable level: int; 31 | mutable scope: int; 32 | id: int } 33 | 34 | and type_desc = 35 | Tvar of string option 36 | | Tarrow of arg_label * type_expr * type_expr * commutable 37 | | Ttuple of type_expr list 38 | | Tconstr of Path.t * type_expr list * abbrev_memo ref 39 | | Tobject of type_expr * (Path.t * type_expr list) option ref 40 | | Tfield of string * field_kind * type_expr * type_expr 41 | | Tnil 42 | | Tlink of type_expr 43 | | Tsubst of type_expr (* for copying *) 44 | | Tvariant of row_desc 45 | | Tunivar of string option 46 | | Tpoly of type_expr * type_expr list 47 | | Tpackage of Path.t * Longident.t list * type_expr list 48 | 49 | and row_desc = 50 | { row_fields: (label * row_field) list; 51 | row_more: type_expr; 52 | row_bound: unit; 53 | row_closed: bool; 54 | row_fixed: bool; 55 | row_name: (Path.t * type_expr list) option } 56 | 57 | and row_field = 58 | Rpresent of type_expr option 59 | | Reither of bool * type_expr list * bool * row_field option ref 60 | (* 1st true denotes a constant constructor *) 61 | (* 2nd true denotes a tag in a pattern matching, and 62 | is erased later *) 63 | | Rabsent 64 | 65 | and abbrev_memo = 66 | Mnil 67 | | Mcons of private_flag * Path.t * type_expr * type_expr * abbrev_memo 68 | | Mlink of abbrev_memo ref 69 | 70 | and field_kind = 71 | Fvar of field_kind option ref 72 | | Fpresent 73 | | Fabsent 74 | 75 | and commutable = 76 | Cok 77 | | Cunknown 78 | | Clink of commutable ref 79 | 80 | module TypeOps = struct 81 | type t = type_expr 82 | let compare t1 t2 = t1.id - t2.id 83 | let hash t = t.id 84 | let equal t1 t2 = t1 == t2 85 | end 86 | 87 | (* Maps of methods and instance variables *) 88 | 89 | module Meths = Misc.Stdlib.String.Map 90 | module Vars = Meths 91 | 92 | (* Value descriptions *) 93 | 94 | type value_description = 95 | { val_type: type_expr; (* Type of the value *) 96 | val_kind: value_kind; 97 | val_loc: Location.t; 98 | val_attributes: Parsetree.attributes; 99 | } 100 | 101 | and value_kind = 102 | Val_reg (* Regular value *) 103 | | Val_prim of Primitive.description (* Primitive *) 104 | | Val_ivar of mutable_flag * string (* Instance variable (mutable ?) *) 105 | | Val_self of (Ident.t * type_expr) Meths.t ref * 106 | (Ident.t * Asttypes.mutable_flag * 107 | Asttypes.virtual_flag * type_expr) Vars.t ref * 108 | string * type_expr 109 | (* Self *) 110 | | Val_anc of (string * Ident.t) list * string 111 | (* Ancestor *) 112 | | Val_unbound of value_unbound_reason (* Unbound variable *) 113 | 114 | and value_unbound_reason = 115 | | Val_unbound_instance_variable 116 | | Val_unbound_ghost_recursive 117 | 118 | (* Variance *) 119 | 120 | module Variance = struct 121 | type t = int 122 | type f = May_pos | May_neg | May_weak | Inj | Pos | Neg | Inv 123 | let single = function 124 | | May_pos -> 1 125 | | May_neg -> 2 126 | | May_weak -> 4 127 | | Inj -> 8 128 | | Pos -> 16 129 | | Neg -> 32 130 | | Inv -> 64 131 | let union v1 v2 = v1 lor v2 132 | let inter v1 v2 = v1 land v2 133 | let subset v1 v2 = (v1 land v2 = v1) 134 | let eq (v1 : t) v2 = (v1 = v2) 135 | let set x b v = 136 | if b then v lor single x else v land (lnot (single x)) 137 | let mem x = subset (single x) 138 | let null = 0 139 | let may_inv = 7 140 | let full = 127 141 | let covariant = single May_pos lor single Pos lor single Inj 142 | let swap f1 f2 v = 143 | let v' = set f1 (mem f2 v) v in set f2 (mem f1 v) v' 144 | let conjugate v = swap May_pos May_neg (swap Pos Neg v) 145 | let get_upper v = (mem May_pos v, mem May_neg v) 146 | let get_lower v = (mem Pos v, mem Neg v, mem Inv v, mem Inj v) 147 | end 148 | 149 | (* Type definitions *) 150 | 151 | type type_declaration = 152 | { type_params: type_expr list; 153 | type_arity: int; 154 | type_kind: type_kind; 155 | type_private: private_flag; 156 | type_manifest: type_expr option; 157 | type_variance: Variance.t list; 158 | type_is_newtype: bool; 159 | type_expansion_scope: int; 160 | type_loc: Location.t; 161 | type_attributes: Parsetree.attributes; 162 | type_immediate: bool; 163 | type_unboxed: unboxed_status; 164 | } 165 | 166 | and type_kind = 167 | Type_abstract 168 | | Type_record of label_declaration list * record_representation 169 | | Type_variant of constructor_declaration list 170 | | Type_open 171 | 172 | and record_representation = 173 | Record_regular (* All fields are boxed / tagged *) 174 | | Record_float (* All fields are floats *) 175 | | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) 176 | | Record_inlined of int (* Inlined record *) 177 | | Record_extension of Path.t (* Inlined record under extension *) 178 | 179 | and label_declaration = 180 | { 181 | ld_id: Ident.t; 182 | ld_mutable: mutable_flag; 183 | ld_type: type_expr; 184 | ld_loc: Location.t; 185 | ld_attributes: Parsetree.attributes; 186 | } 187 | 188 | and constructor_declaration = 189 | { 190 | cd_id: Ident.t; 191 | cd_args: constructor_arguments; 192 | cd_res: type_expr option; 193 | cd_loc: Location.t; 194 | cd_attributes: Parsetree.attributes; 195 | } 196 | 197 | and constructor_arguments = 198 | | Cstr_tuple of type_expr list 199 | | Cstr_record of label_declaration list 200 | 201 | and unboxed_status = 202 | { 203 | unboxed: bool; 204 | default: bool; (* False if the unboxed field was set from an attribute. *) 205 | } 206 | 207 | let unboxed_false_default_false = {unboxed = false; default = false} 208 | let unboxed_false_default_true = {unboxed = false; default = true} 209 | let unboxed_true_default_false = {unboxed = true; default = false} 210 | let unboxed_true_default_true = {unboxed = true; default = true} 211 | 212 | type extension_constructor = 213 | { ext_type_path: Path.t; 214 | ext_type_params: type_expr list; 215 | ext_args: constructor_arguments; 216 | ext_ret_type: type_expr option; 217 | ext_private: private_flag; 218 | ext_loc: Location.t; 219 | ext_attributes: Parsetree.attributes; } 220 | 221 | and type_transparence = 222 | Type_public (* unrestricted expansion *) 223 | | Type_new (* "new" type *) 224 | | Type_private (* private type *) 225 | 226 | (* Type expressions for the class language *) 227 | 228 | module Concr = Misc.Stdlib.String.Set 229 | 230 | type class_type = 231 | Cty_constr of Path.t * type_expr list * class_type 232 | | Cty_signature of class_signature 233 | | Cty_arrow of arg_label * type_expr * class_type 234 | 235 | and class_signature = 236 | { csig_self: type_expr; 237 | csig_vars: 238 | (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) Vars.t; 239 | csig_concr: Concr.t; 240 | csig_inher: (Path.t * type_expr list) list } 241 | 242 | type class_declaration = 243 | { cty_params: type_expr list; 244 | mutable cty_type: class_type; 245 | cty_path: Path.t; 246 | cty_new: type_expr option; 247 | cty_variance: Variance.t list; 248 | cty_loc: Location.t; 249 | cty_attributes: Parsetree.attributes; 250 | } 251 | 252 | type class_type_declaration = 253 | { clty_params: type_expr list; 254 | clty_type: class_type; 255 | clty_path: Path.t; 256 | clty_variance: Variance.t list; 257 | clty_loc: Location.t; 258 | clty_attributes: Parsetree.attributes; 259 | } 260 | 261 | (* Type expressions for the module language *) 262 | 263 | type visibility = 264 | | Exported 265 | | Hidden 266 | 267 | type module_type = 268 | Mty_ident of Path.t 269 | | Mty_signature of signature 270 | | Mty_functor of Ident.t * module_type option * module_type 271 | | Mty_alias of Path.t 272 | 273 | and module_presence = 274 | | Mp_present 275 | | Mp_absent 276 | 277 | and signature = signature_item list 278 | 279 | and signature_item = 280 | Sig_value of Ident.t * value_description * visibility 281 | | Sig_type of Ident.t * type_declaration * rec_status * visibility 282 | | Sig_typext of Ident.t * extension_constructor * ext_status * visibility 283 | | Sig_module of 284 | Ident.t * module_presence * module_declaration * rec_status * visibility 285 | | Sig_modtype of Ident.t * modtype_declaration * visibility 286 | | Sig_class of Ident.t * class_declaration * rec_status * visibility 287 | | Sig_class_type of Ident.t * class_type_declaration * rec_status * visibility 288 | 289 | and module_declaration = 290 | { 291 | md_type: module_type; 292 | md_attributes: Parsetree.attributes; 293 | md_loc: Location.t; 294 | } 295 | 296 | and modtype_declaration = 297 | { 298 | mtd_type: module_type option; (* Note: abstract *) 299 | mtd_attributes: Parsetree.attributes; 300 | mtd_loc: Location.t; 301 | } 302 | 303 | and rec_status = 304 | Trec_not (* first in a nonrecursive group *) 305 | | Trec_first (* first in a recursive group *) 306 | | Trec_next (* not first in a recursive/nonrecursive group *) 307 | 308 | and ext_status = 309 | Text_first (* first constructor of an extension *) 310 | | Text_next (* not first constructor of an extension *) 311 | | Text_exception (* an exception *) 312 | 313 | 314 | (* Constructor and record label descriptions inserted held in typing 315 | environments *) 316 | 317 | type constructor_description = 318 | { cstr_name: string; (* Constructor name *) 319 | cstr_res: type_expr; (* Type of the result *) 320 | cstr_existentials: type_expr list; (* list of existentials *) 321 | cstr_args: type_expr list; (* Type of the arguments *) 322 | cstr_arity: int; (* Number of arguments *) 323 | cstr_tag: constructor_tag; (* Tag for heap blocks *) 324 | cstr_consts: int; (* Number of constant constructors *) 325 | cstr_nonconsts: int; (* Number of non-const constructors *) 326 | cstr_normal: int; (* Number of non generalized constrs *) 327 | cstr_generalized: bool; (* Constrained return type? *) 328 | cstr_private: private_flag; (* Read-only constructor? *) 329 | cstr_loc: Location.t; 330 | cstr_attributes: Parsetree.attributes; 331 | cstr_inlined: type_declaration option; 332 | } 333 | 334 | and constructor_tag = 335 | Cstr_constant of int (* Constant constructor (an int) *) 336 | | Cstr_block of int (* Regular constructor (a block) *) 337 | | Cstr_unboxed (* Constructor of an unboxed type *) 338 | | Cstr_extension of Path.t * bool (* Extension constructor 339 | true if a constant false if a block*) 340 | 341 | let equal_tag t1 t2 = 342 | match (t1, t2) with 343 | | Cstr_constant i1, Cstr_constant i2 -> i2 = i1 344 | | Cstr_block i1, Cstr_block i2 -> i2 = i1 345 | | Cstr_unboxed, Cstr_unboxed -> true 346 | | Cstr_extension (path1, b1), Cstr_extension (path2, b2) -> 347 | Path.same path1 path2 && b1 = b2 348 | | (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false 349 | 350 | let may_equal_constr c1 c2 = match c1.cstr_tag,c2.cstr_tag with 351 | | Cstr_extension _,Cstr_extension _ -> c1.cstr_arity = c2.cstr_arity 352 | | tag1,tag2 -> equal_tag tag1 tag2 353 | 354 | type label_description = 355 | { lbl_name: string; (* Short name *) 356 | lbl_res: type_expr; (* Type of the result *) 357 | lbl_arg: type_expr; (* Type of the argument *) 358 | lbl_mut: mutable_flag; (* Is this a mutable field? *) 359 | lbl_pos: int; (* Position in block *) 360 | lbl_all: label_description array; (* All the labels in this type *) 361 | lbl_repres: record_representation; (* Representation for this record *) 362 | lbl_private: private_flag; (* Read-only field? *) 363 | lbl_loc: Location.t; 364 | lbl_attributes: Parsetree.attributes; 365 | } 366 | 367 | let rec bound_value_identifiers = function 368 | [] -> [] 369 | | Sig_value(id, {val_kind = Val_reg}, _) :: rem -> 370 | id :: bound_value_identifiers rem 371 | | Sig_typext(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 372 | | Sig_module(id, Mp_present, _, _, _) :: rem -> 373 | id :: bound_value_identifiers rem 374 | | Sig_class(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 375 | | _ :: rem -> bound_value_identifiers rem 376 | 377 | let signature_item_id = function 378 | | Sig_value (id, _, _) 379 | | Sig_type (id, _, _, _) 380 | | Sig_typext (id, _, _, _) 381 | | Sig_module (id, _, _, _, _) 382 | | Sig_modtype (id, _, _) 383 | | Sig_class (id, _, _, _) 384 | | Sig_class_type (id, _, _, _) 385 | -> id 386 | end 387 | [%%endif] 388 | -------------------------------------------------------------------------------- /src/types_410.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | [@@@ocaml.warning "-9"] 16 | [%%if ocaml_version >= (4, 10, 0) && ocaml_version < (4, 11, 0)] 17 | module Types = Types 18 | [%%else] 19 | module Types = struct 20 | open Migrate_parsetree.Ast_410 21 | 22 | module Type_immediacy = Type_immediacy_410 23 | (* Representation of types and declarations *) 24 | 25 | open Asttypes 26 | 27 | (* Type expressions for the core language *) 28 | 29 | type type_expr = 30 | { mutable desc: type_desc; 31 | mutable level: int; 32 | mutable scope: int; 33 | id: int } 34 | 35 | and type_desc = 36 | Tvar of string option 37 | | Tarrow of arg_label * type_expr * type_expr * commutable 38 | | Ttuple of type_expr list 39 | | Tconstr of Path.t * type_expr list * abbrev_memo ref 40 | | Tobject of type_expr * (Path.t * type_expr list) option ref 41 | | Tfield of string * field_kind * type_expr * type_expr 42 | | Tnil 43 | | Tlink of type_expr 44 | | Tsubst of type_expr (* for copying *) 45 | | Tvariant of row_desc 46 | | Tunivar of string option 47 | | Tpoly of type_expr * type_expr list 48 | | Tpackage of Path.t * Longident.t list * type_expr list 49 | 50 | and row_desc = 51 | { row_fields: (label * row_field) list; 52 | row_more: type_expr; 53 | row_bound: unit; 54 | row_closed: bool; 55 | row_fixed: fixed_explanation option; 56 | row_name: (Path.t * type_expr list) option } 57 | and fixed_explanation = 58 | | Univar of type_expr | Fixed_private | Reified of Path.t | Rigid 59 | and row_field = 60 | Rpresent of type_expr option 61 | | Reither of bool * type_expr list * bool * row_field option ref 62 | (* 1st true denotes a constant constructor *) 63 | (* 2nd true denotes a tag in a pattern matching, and 64 | is erased later *) 65 | | Rabsent 66 | 67 | and abbrev_memo = 68 | Mnil 69 | | Mcons of private_flag * Path.t * type_expr * type_expr * abbrev_memo 70 | | Mlink of abbrev_memo ref 71 | 72 | and field_kind = 73 | Fvar of field_kind option ref 74 | | Fpresent 75 | | Fabsent 76 | 77 | and commutable = 78 | Cok 79 | | Cunknown 80 | | Clink of commutable ref 81 | 82 | module TypeOps = struct 83 | type t = type_expr 84 | let compare t1 t2 = t1.id - t2.id 85 | let hash t = t.id 86 | let equal t1 t2 = t1 == t2 87 | end 88 | 89 | (* Maps of methods and instance variables *) 90 | 91 | module Meths = Misc.Stdlib.String.Map 92 | module Vars = Meths 93 | 94 | (* Value descriptions *) 95 | 96 | type value_description = 97 | { val_type: type_expr; (* Type of the value *) 98 | val_kind: value_kind; 99 | val_loc: Location.t; 100 | val_attributes: Parsetree.attributes; 101 | } 102 | 103 | and value_kind = 104 | Val_reg (* Regular value *) 105 | | Val_prim of Primitive.description (* Primitive *) 106 | | Val_ivar of mutable_flag * string (* Instance variable (mutable ?) *) 107 | | Val_self of (Ident.t * type_expr) Meths.t ref * 108 | (Ident.t * Asttypes.mutable_flag * 109 | Asttypes.virtual_flag * type_expr) Vars.t ref * 110 | string * type_expr 111 | (* Self *) 112 | | Val_anc of (string * Ident.t) list * string 113 | (* Ancestor *) 114 | 115 | (* Variance *) 116 | 117 | module Variance = struct 118 | type t = int 119 | type f = May_pos | May_neg | May_weak | Inj | Pos | Neg | Inv 120 | let single = function 121 | | May_pos -> 1 122 | | May_neg -> 2 123 | | May_weak -> 4 124 | | Inj -> 8 125 | | Pos -> 16 126 | | Neg -> 32 127 | | Inv -> 64 128 | let union v1 v2 = v1 lor v2 129 | let inter v1 v2 = v1 land v2 130 | let subset v1 v2 = (v1 land v2 = v1) 131 | let eq (v1 : t) v2 = (v1 = v2) 132 | let set x b v = 133 | if b then v lor single x else v land (lnot (single x)) 134 | let mem x = subset (single x) 135 | let null = 0 136 | let may_inv = 7 137 | let full = 127 138 | let covariant = single May_pos lor single Pos lor single Inj 139 | let swap f1 f2 v = 140 | let v' = set f1 (mem f2 v) v in set f2 (mem f1 v) v' 141 | let conjugate v = swap May_pos May_neg (swap Pos Neg v) 142 | let get_upper v = (mem May_pos v, mem May_neg v) 143 | let get_lower v = (mem Pos v, mem Neg v, mem Inv v, mem Inj v) 144 | end 145 | 146 | (* Type definitions *) 147 | 148 | type type_declaration = 149 | { type_params: type_expr list; 150 | type_arity: int; 151 | type_kind: type_kind; 152 | type_private: private_flag; 153 | type_manifest: type_expr option; 154 | type_variance: Variance.t list; 155 | type_is_newtype: bool; 156 | type_expansion_scope: int; 157 | type_loc: Location.t; 158 | type_attributes: Parsetree.attributes; 159 | type_immediate: Type_immediacy.t; 160 | type_unboxed: unboxed_status; 161 | } 162 | 163 | and type_kind = 164 | Type_abstract 165 | | Type_record of label_declaration list * record_representation 166 | | Type_variant of constructor_declaration list 167 | | Type_open 168 | 169 | and record_representation = 170 | Record_regular (* All fields are boxed / tagged *) 171 | | Record_float (* All fields are floats *) 172 | | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) 173 | | Record_inlined of int (* Inlined record *) 174 | | Record_extension of Path.t (* Inlined record under extension *) 175 | 176 | and label_declaration = 177 | { 178 | ld_id: Ident.t; 179 | ld_mutable: mutable_flag; 180 | ld_type: type_expr; 181 | ld_loc: Location.t; 182 | ld_attributes: Parsetree.attributes; 183 | } 184 | 185 | and constructor_declaration = 186 | { 187 | cd_id: Ident.t; 188 | cd_args: constructor_arguments; 189 | cd_res: type_expr option; 190 | cd_loc: Location.t; 191 | cd_attributes: Parsetree.attributes; 192 | } 193 | 194 | and constructor_arguments = 195 | | Cstr_tuple of type_expr list 196 | | Cstr_record of label_declaration list 197 | 198 | and unboxed_status = 199 | { 200 | unboxed: bool; 201 | default: bool; (* False if the unboxed field was set from an attribute. *) 202 | } 203 | 204 | let unboxed_false_default_false = {unboxed = false; default = false} 205 | let unboxed_false_default_true = {unboxed = false; default = true} 206 | let unboxed_true_default_false = {unboxed = true; default = false} 207 | let unboxed_true_default_true = {unboxed = true; default = true} 208 | 209 | type extension_constructor = 210 | { ext_type_path: Path.t; 211 | ext_type_params: type_expr list; 212 | ext_args: constructor_arguments; 213 | ext_ret_type: type_expr option; 214 | ext_private: private_flag; 215 | ext_loc: Location.t; 216 | ext_attributes: Parsetree.attributes; } 217 | 218 | and type_transparence = 219 | Type_public (* unrestricted expansion *) 220 | | Type_new (* "new" type *) 221 | | Type_private (* private type *) 222 | 223 | (* Type expressions for the class language *) 224 | 225 | module Concr = Misc.Stdlib.String.Set 226 | 227 | type class_type = 228 | Cty_constr of Path.t * type_expr list * class_type 229 | | Cty_signature of class_signature 230 | | Cty_arrow of arg_label * type_expr * class_type 231 | 232 | and class_signature = 233 | { csig_self: type_expr; 234 | csig_vars: 235 | (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) Vars.t; 236 | csig_concr: Concr.t; 237 | csig_inher: (Path.t * type_expr list) list } 238 | 239 | type class_declaration = 240 | { cty_params: type_expr list; 241 | mutable cty_type: class_type; 242 | cty_path: Path.t; 243 | cty_new: type_expr option; 244 | cty_variance: Variance.t list; 245 | cty_loc: Location.t; 246 | cty_attributes: Parsetree.attributes; 247 | } 248 | 249 | type class_type_declaration = 250 | { clty_params: type_expr list; 251 | clty_type: class_type; 252 | clty_path: Path.t; 253 | clty_variance: Variance.t list; 254 | clty_loc: Location.t; 255 | clty_attributes: Parsetree.attributes; 256 | } 257 | 258 | (* Type expressions for the module language *) 259 | 260 | type visibility = 261 | | Exported 262 | | Hidden 263 | 264 | type module_type = 265 | Mty_ident of Path.t 266 | | Mty_signature of signature 267 | | Mty_functor of functor_parameter * module_type 268 | | Mty_alias of Path.t 269 | 270 | and functor_parameter = 271 | | Unit 272 | | Named of Ident.t option * module_type 273 | 274 | and module_presence = 275 | | Mp_present 276 | | Mp_absent 277 | 278 | and signature = signature_item list 279 | 280 | and signature_item = 281 | Sig_value of Ident.t * value_description * visibility 282 | | Sig_type of Ident.t * type_declaration * rec_status * visibility 283 | | Sig_typext of Ident.t * extension_constructor * ext_status * visibility 284 | | Sig_module of 285 | Ident.t * module_presence * module_declaration * rec_status * visibility 286 | | Sig_modtype of Ident.t * modtype_declaration * visibility 287 | | Sig_class of Ident.t * class_declaration * rec_status * visibility 288 | | Sig_class_type of Ident.t * class_type_declaration * rec_status * visibility 289 | 290 | and module_declaration = 291 | { 292 | md_type: module_type; 293 | md_attributes: Parsetree.attributes; 294 | md_loc: Location.t; 295 | } 296 | 297 | and modtype_declaration = 298 | { 299 | mtd_type: module_type option; (* Note: abstract *) 300 | mtd_attributes: Parsetree.attributes; 301 | mtd_loc: Location.t; 302 | } 303 | 304 | and rec_status = 305 | Trec_not (* first in a nonrecursive group *) 306 | | Trec_first (* first in a recursive group *) 307 | | Trec_next (* not first in a recursive/nonrecursive group *) 308 | 309 | and ext_status = 310 | Text_first (* first constructor of an extension *) 311 | | Text_next (* not first constructor of an extension *) 312 | | Text_exception (* an exception *) 313 | 314 | 315 | (* Constructor and record label descriptions inserted held in typing 316 | environments *) 317 | 318 | type constructor_description = 319 | { cstr_name: string; (* Constructor name *) 320 | cstr_res: type_expr; (* Type of the result *) 321 | cstr_existentials: type_expr list; (* list of existentials *) 322 | cstr_args: type_expr list; (* Type of the arguments *) 323 | cstr_arity: int; (* Number of arguments *) 324 | cstr_tag: constructor_tag; (* Tag for heap blocks *) 325 | cstr_consts: int; (* Number of constant constructors *) 326 | cstr_nonconsts: int; (* Number of non-const constructors *) 327 | cstr_normal: int; (* Number of non generalized constrs *) 328 | cstr_generalized: bool; (* Constrained return type? *) 329 | cstr_private: private_flag; (* Read-only constructor? *) 330 | cstr_loc: Location.t; 331 | cstr_attributes: Parsetree.attributes; 332 | cstr_inlined: type_declaration option; 333 | } 334 | 335 | and constructor_tag = 336 | Cstr_constant of int (* Constant constructor (an int) *) 337 | | Cstr_block of int (* Regular constructor (a block) *) 338 | | Cstr_unboxed (* Constructor of an unboxed type *) 339 | | Cstr_extension of Path.t * bool (* Extension constructor 340 | true if a constant false if a block*) 341 | 342 | let equal_tag t1 t2 = 343 | match (t1, t2) with 344 | | Cstr_constant i1, Cstr_constant i2 -> i2 = i1 345 | | Cstr_block i1, Cstr_block i2 -> i2 = i1 346 | | Cstr_unboxed, Cstr_unboxed -> true 347 | | Cstr_extension (path1, b1), Cstr_extension (path2, b2) -> 348 | Path.same path1 path2 && b1 = b2 349 | | (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false 350 | 351 | let may_equal_constr c1 c2 = match c1.cstr_tag,c2.cstr_tag with 352 | | Cstr_extension _,Cstr_extension _ -> c1.cstr_arity = c2.cstr_arity 353 | | tag1,tag2 -> equal_tag tag1 tag2 354 | 355 | type label_description = 356 | { lbl_name: string; (* Short name *) 357 | lbl_res: type_expr; (* Type of the result *) 358 | lbl_arg: type_expr; (* Type of the argument *) 359 | lbl_mut: mutable_flag; (* Is this a mutable field? *) 360 | lbl_pos: int; (* Position in block *) 361 | lbl_all: label_description array; (* All the labels in this type *) 362 | lbl_repres: record_representation; (* Representation for this record *) 363 | lbl_private: private_flag; (* Read-only field? *) 364 | lbl_loc: Location.t; 365 | lbl_attributes: Parsetree.attributes; 366 | } 367 | 368 | let rec bound_value_identifiers = function 369 | [] -> [] 370 | | Sig_value(id, {val_kind = Val_reg}, _) :: rem -> 371 | id :: bound_value_identifiers rem 372 | | Sig_typext(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 373 | | Sig_module(id, Mp_present, _, _, _) :: rem -> 374 | id :: bound_value_identifiers rem 375 | | Sig_class(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 376 | | _ :: rem -> bound_value_identifiers rem 377 | 378 | let signature_item_id = function 379 | | Sig_value (id, _, _) 380 | | Sig_type (id, _, _, _) 381 | | Sig_typext (id, _, _, _) 382 | | Sig_module (id, _, _, _, _) 383 | | Sig_modtype (id, _, _) 384 | | Sig_class (id, _, _, _) 385 | | Sig_class_type (id, _, _, _) 386 | -> id 387 | end 388 | [%%endif] 389 | -------------------------------------------------------------------------------- /src/types_411.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | [@@@ocaml.warning "-9"] 16 | [%%if ocaml_version >= (4, 11, 0) && ocaml_version < (4, 12, 0)] 17 | module Types = Types 18 | [%%else] 19 | module Types = struct 20 | module Asttypes = Migrate_parsetree.Ast_411.Asttypes 21 | module Parsetree = Migrate_parsetree.Ast_411.Parsetree 22 | 23 | module Type_immediacy = Type_immediacy_411 24 | (* Representation of types and declarations *) 25 | 26 | open Asttypes 27 | 28 | (* Type expressions for the core language *) 29 | 30 | type type_expr = 31 | { mutable desc: type_desc; 32 | mutable level: int; 33 | mutable scope: int; 34 | id: int } 35 | 36 | and type_desc = 37 | Tvar of string option 38 | | Tarrow of arg_label * type_expr * type_expr * commutable 39 | | Ttuple of type_expr list 40 | | Tconstr of Path.t * type_expr list * abbrev_memo ref 41 | | Tobject of type_expr * (Path.t * type_expr list) option ref 42 | | Tfield of string * field_kind * type_expr * type_expr 43 | | Tnil 44 | | Tlink of type_expr 45 | | Tsubst of type_expr (* for copying *) 46 | | Tvariant of row_desc 47 | | Tunivar of string option 48 | | Tpoly of type_expr * type_expr list 49 | | Tpackage of Path.t * Longident.t list * type_expr list 50 | 51 | and row_desc = 52 | { row_fields: (label * row_field) list; 53 | row_more: type_expr; 54 | row_bound: unit; 55 | row_closed: bool; 56 | row_fixed: fixed_explanation option; 57 | row_name: (Path.t * type_expr list) option } 58 | and fixed_explanation = 59 | | Univar of type_expr | Fixed_private | Reified of Path.t | Rigid 60 | and row_field = 61 | Rpresent of type_expr option 62 | | Reither of bool * type_expr list * bool * row_field option ref 63 | (* 1st true denotes a constant constructor *) 64 | (* 2nd true denotes a tag in a pattern matching, and 65 | is erased later *) 66 | | Rabsent 67 | 68 | and abbrev_memo = 69 | Mnil 70 | | Mcons of private_flag * Path.t * type_expr * type_expr * abbrev_memo 71 | | Mlink of abbrev_memo ref 72 | 73 | and field_kind = 74 | Fvar of field_kind option ref 75 | | Fpresent 76 | | Fabsent 77 | 78 | and commutable = 79 | Cok 80 | | Cunknown 81 | | Clink of commutable ref 82 | 83 | module TypeOps = struct 84 | type t = type_expr 85 | let compare t1 t2 = t1.id - t2.id 86 | let hash t = t.id 87 | let equal t1 t2 = t1 == t2 88 | end 89 | 90 | (* *) 91 | 92 | [%%if ocaml_version >= (4, 12, 0)] 93 | module Uid = Types_412.Types.Uid 94 | [%%else] 95 | module Uid = struct 96 | type t = 97 | | Compilation_unit of string 98 | | Item of { comp_unit: string; id: int } 99 | | Internal 100 | | Predef of string 101 | 102 | include Identifiable.Make(struct 103 | type nonrec t = t 104 | 105 | let equal (x : t) y = x = y 106 | let compare (x : t) y = compare x y 107 | let hash (x : t) = Hashtbl.hash x 108 | 109 | let print fmt = function 110 | | Internal -> Format.pp_print_string fmt "" 111 | | Predef name -> Format.fprintf fmt "" name 112 | | Compilation_unit s -> Format.pp_print_string fmt s 113 | | Item { comp_unit; id } -> Format.fprintf fmt "%s.%d" comp_unit id 114 | 115 | let output oc t = 116 | let fmt = Format.formatter_of_out_channel oc in 117 | print fmt t 118 | end) 119 | 120 | let id = ref (-1) 121 | 122 | let reinit () = id := (-1) 123 | 124 | let mk ~current_unit = 125 | incr id; 126 | Item { comp_unit = current_unit; id = !id } 127 | 128 | let of_compilation_unit_id id = 129 | if not (Ident.persistent id) then 130 | Misc.fatal_errorf "Types.Uid.of_compilation_unit_id %S" (Ident.name id); 131 | Compilation_unit (Ident.name id) 132 | 133 | let of_predef_id id = 134 | if not (Ident.is_predef id) then 135 | Misc.fatal_errorf "Types.Uid.of_predef_id %S" (Ident.name id); 136 | Predef (Ident.name id) 137 | 138 | let internal_not_actually_unique = Internal 139 | 140 | let for_actual_declaration = function 141 | | Item _ -> true 142 | | _ -> false 143 | end 144 | [%%endif] 145 | 146 | (* Maps of methods and instance variables *) 147 | 148 | module Meths = Misc.Stdlib.String.Map 149 | module Vars = Meths 150 | 151 | (* Value descriptions *) 152 | 153 | type value_description = 154 | { val_type: type_expr; (* Type of the value *) 155 | val_kind: value_kind; 156 | val_loc: Location.t; 157 | val_attributes: Parsetree.attributes; 158 | val_uid: Uid.t; 159 | } 160 | 161 | and value_kind = 162 | Val_reg (* Regular value *) 163 | | Val_prim of Primitive.description (* Primitive *) 164 | | Val_ivar of mutable_flag * string (* Instance variable (mutable ?) *) 165 | | Val_self of (Ident.t * type_expr) Meths.t ref * 166 | (Ident.t * Asttypes.mutable_flag * 167 | Asttypes.virtual_flag * type_expr) Vars.t ref * 168 | string * type_expr 169 | (* Self *) 170 | | Val_anc of (string * Ident.t) list * string 171 | (* Ancestor *) 172 | 173 | (* Variance *) 174 | 175 | module Variance = struct 176 | type t = int 177 | type f = May_pos | May_neg | May_weak | Inj | Pos | Neg | Inv 178 | let single = function 179 | | May_pos -> 1 180 | | May_neg -> 2 181 | | May_weak -> 4 182 | | Inj -> 8 183 | | Pos -> 16 184 | | Neg -> 32 185 | | Inv -> 64 186 | let union v1 v2 = v1 lor v2 187 | let inter v1 v2 = v1 land v2 188 | let subset v1 v2 = (v1 land v2 = v1) 189 | let eq (v1 : t) v2 = (v1 = v2) 190 | let set x b v = 191 | if b then v lor single x else v land (lnot (single x)) 192 | let mem x = subset (single x) 193 | let null = 0 194 | let may_inv = 7 195 | let full = 127 196 | let covariant = single May_pos lor single Pos lor single Inj 197 | let swap f1 f2 v = 198 | let v' = set f1 (mem f2 v) v in set f2 (mem f1 v) v' 199 | let conjugate v = swap May_pos May_neg (swap Pos Neg v) 200 | let get_upper v = (mem May_pos v, mem May_neg v) 201 | let get_lower v = (mem Pos v, mem Neg v, mem Inv v, mem Inj v) 202 | end 203 | 204 | module Separability = struct 205 | type t = Ind | Sep | Deepsep 206 | type signature = t list 207 | let eq (m1 : t) m2 = (m1 = m2) 208 | let rank = function 209 | | Ind -> 0 210 | | Sep -> 1 211 | | Deepsep -> 2 212 | let compare m1 m2 = compare (rank m1) (rank m2) 213 | let max m1 m2 = if rank m1 >= rank m2 then m1 else m2 214 | 215 | let print ppf = function 216 | | Ind -> Format.fprintf ppf "Ind" 217 | | Sep -> Format.fprintf ppf "Sep" 218 | | Deepsep -> Format.fprintf ppf "Deepsep" 219 | 220 | let print_signature ppf modes = 221 | let pp_sep ppf () = Format.fprintf ppf ",@," in 222 | Format.fprintf ppf "@[(%a)@]" 223 | (Format.pp_print_list ~pp_sep print) modes 224 | 225 | let default_signature ~arity = 226 | let default_mode = if Config.flat_float_array then Deepsep else Ind in 227 | List.init arity (fun _ -> default_mode) 228 | end 229 | 230 | (* Type definitions *) 231 | 232 | type type_declaration = 233 | { type_params: type_expr list; 234 | type_arity: int; 235 | type_kind: type_kind; 236 | type_private: private_flag; 237 | type_manifest: type_expr option; 238 | type_variance: Variance.t list; 239 | type_separability: Separability.t list; 240 | type_is_newtype: bool; 241 | type_expansion_scope: int; 242 | type_loc: Location.t; 243 | type_attributes: Parsetree.attributes; 244 | type_immediate: Type_immediacy.t; 245 | type_unboxed: unboxed_status; 246 | type_uid: Uid.t; 247 | } 248 | 249 | and type_kind = 250 | Type_abstract 251 | | Type_record of label_declaration list * record_representation 252 | | Type_variant of constructor_declaration list 253 | | Type_open 254 | 255 | and record_representation = 256 | Record_regular (* All fields are boxed / tagged *) 257 | | Record_float (* All fields are floats *) 258 | | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) 259 | | Record_inlined of int (* Inlined record *) 260 | | Record_extension of Path.t (* Inlined record under extension *) 261 | 262 | and label_declaration = 263 | { 264 | ld_id: Ident.t; 265 | ld_mutable: mutable_flag; 266 | ld_type: type_expr; 267 | ld_loc: Location.t; 268 | ld_attributes: Parsetree.attributes; 269 | ld_uid: Uid.t; 270 | } 271 | 272 | and constructor_declaration = 273 | { 274 | cd_id: Ident.t; 275 | cd_args: constructor_arguments; 276 | cd_res: type_expr option; 277 | cd_loc: Location.t; 278 | cd_attributes: Parsetree.attributes; 279 | cd_uid: Uid.t; 280 | } 281 | 282 | and constructor_arguments = 283 | | Cstr_tuple of type_expr list 284 | | Cstr_record of label_declaration list 285 | 286 | and unboxed_status = 287 | { 288 | unboxed: bool; 289 | default: bool; (* False if the unboxed field was set from an attribute. *) 290 | } 291 | 292 | let unboxed_false_default_false = {unboxed = false; default = false} 293 | let unboxed_false_default_true = {unboxed = false; default = true} 294 | let unboxed_true_default_false = {unboxed = true; default = false} 295 | let unboxed_true_default_true = {unboxed = true; default = true} 296 | 297 | type extension_constructor = 298 | { ext_type_path: Path.t; 299 | ext_type_params: type_expr list; 300 | ext_args: constructor_arguments; 301 | ext_ret_type: type_expr option; 302 | ext_private: private_flag; 303 | ext_loc: Location.t; 304 | ext_attributes: Parsetree.attributes; 305 | ext_uid: Uid.t; 306 | } 307 | 308 | and type_transparence = 309 | Type_public (* unrestricted expansion *) 310 | | Type_new (* "new" type *) 311 | | Type_private (* private type *) 312 | 313 | (* Type expressions for the class language *) 314 | 315 | module Concr = Misc.Stdlib.String.Set 316 | 317 | type class_type = 318 | Cty_constr of Path.t * type_expr list * class_type 319 | | Cty_signature of class_signature 320 | | Cty_arrow of arg_label * type_expr * class_type 321 | 322 | and class_signature = 323 | { csig_self: type_expr; 324 | csig_vars: 325 | (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) Vars.t; 326 | csig_concr: Concr.t; 327 | csig_inher: (Path.t * type_expr list) list } 328 | 329 | type class_declaration = 330 | { cty_params: type_expr list; 331 | mutable cty_type: class_type; 332 | cty_path: Path.t; 333 | cty_new: type_expr option; 334 | cty_variance: Variance.t list; 335 | cty_loc: Location.t; 336 | cty_attributes: Parsetree.attributes; 337 | cty_uid: Uid.t; 338 | } 339 | 340 | type class_type_declaration = 341 | { clty_params: type_expr list; 342 | clty_type: class_type; 343 | clty_path: Path.t; 344 | clty_variance: Variance.t list; 345 | clty_loc: Location.t; 346 | clty_attributes: Parsetree.attributes; 347 | clty_uid: Uid.t; 348 | } 349 | 350 | (* Type expressions for the module language *) 351 | 352 | type visibility = 353 | | Exported 354 | | Hidden 355 | 356 | type module_type = 357 | Mty_ident of Path.t 358 | | Mty_signature of signature 359 | | Mty_functor of functor_parameter * module_type 360 | | Mty_alias of Path.t 361 | 362 | and functor_parameter = 363 | | Unit 364 | | Named of Ident.t option * module_type 365 | 366 | and module_presence = 367 | | Mp_present 368 | | Mp_absent 369 | 370 | and signature = signature_item list 371 | 372 | and signature_item = 373 | Sig_value of Ident.t * value_description * visibility 374 | | Sig_type of Ident.t * type_declaration * rec_status * visibility 375 | | Sig_typext of Ident.t * extension_constructor * ext_status * visibility 376 | | Sig_module of 377 | Ident.t * module_presence * module_declaration * rec_status * visibility 378 | | Sig_modtype of Ident.t * modtype_declaration * visibility 379 | | Sig_class of Ident.t * class_declaration * rec_status * visibility 380 | | Sig_class_type of Ident.t * class_type_declaration * rec_status * visibility 381 | 382 | and module_declaration = 383 | { 384 | md_type: module_type; 385 | md_attributes: Parsetree.attributes; 386 | md_loc: Location.t; 387 | md_uid: Uid.t; 388 | } 389 | 390 | and modtype_declaration = 391 | { 392 | mtd_type: module_type option; (* Note: abstract *) 393 | mtd_attributes: Parsetree.attributes; 394 | mtd_loc: Location.t; 395 | mtd_uid: Uid.t; 396 | } 397 | 398 | and rec_status = 399 | Trec_not (* first in a nonrecursive group *) 400 | | Trec_first (* first in a recursive group *) 401 | | Trec_next (* not first in a recursive/nonrecursive group *) 402 | 403 | and ext_status = 404 | Text_first (* first constructor of an extension *) 405 | | Text_next (* not first constructor of an extension *) 406 | | Text_exception (* an exception *) 407 | 408 | 409 | (* Constructor and record label descriptions inserted held in typing 410 | environments *) 411 | 412 | type constructor_description = 413 | { cstr_name: string; (* Constructor name *) 414 | cstr_res: type_expr; (* Type of the result *) 415 | cstr_existentials: type_expr list; (* list of existentials *) 416 | cstr_args: type_expr list; (* Type of the arguments *) 417 | cstr_arity: int; (* Number of arguments *) 418 | cstr_tag: constructor_tag; (* Tag for heap blocks *) 419 | cstr_consts: int; (* Number of constant constructors *) 420 | cstr_nonconsts: int; (* Number of non-const constructors *) 421 | cstr_normal: int; (* Number of non generalized constrs *) 422 | cstr_generalized: bool; (* Constrained return type? *) 423 | cstr_private: private_flag; (* Read-only constructor? *) 424 | cstr_loc: Location.t; 425 | cstr_attributes: Parsetree.attributes; 426 | cstr_inlined: type_declaration option; 427 | cstr_uid: Uid.t; 428 | } 429 | 430 | and constructor_tag = 431 | Cstr_constant of int (* Constant constructor (an int) *) 432 | | Cstr_block of int (* Regular constructor (a block) *) 433 | | Cstr_unboxed (* Constructor of an unboxed type *) 434 | | Cstr_extension of Path.t * bool (* Extension constructor 435 | true if a constant false if a block*) 436 | 437 | let equal_tag t1 t2 = 438 | match (t1, t2) with 439 | | Cstr_constant i1, Cstr_constant i2 -> i2 = i1 440 | | Cstr_block i1, Cstr_block i2 -> i2 = i1 441 | | Cstr_unboxed, Cstr_unboxed -> true 442 | | Cstr_extension (path1, b1), Cstr_extension (path2, b2) -> 443 | Path.same path1 path2 && b1 = b2 444 | | (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false 445 | 446 | let may_equal_constr c1 c2 = match c1.cstr_tag,c2.cstr_tag with 447 | | Cstr_extension _,Cstr_extension _ -> c1.cstr_arity = c2.cstr_arity 448 | | tag1,tag2 -> equal_tag tag1 tag2 449 | 450 | type label_description = 451 | { lbl_name: string; (* Short name *) 452 | lbl_res: type_expr; (* Type of the result *) 453 | lbl_arg: type_expr; (* Type of the argument *) 454 | lbl_mut: mutable_flag; (* Is this a mutable field? *) 455 | lbl_pos: int; (* Position in block *) 456 | lbl_all: label_description array; (* All the labels in this type *) 457 | lbl_repres: record_representation; (* Representation for this record *) 458 | lbl_private: private_flag; (* Read-only field? *) 459 | lbl_loc: Location.t; 460 | lbl_attributes: Parsetree.attributes; 461 | lbl_uid: Uid.t; 462 | } 463 | 464 | let rec bound_value_identifiers = function 465 | [] -> [] 466 | | Sig_value(id, {val_kind = Val_reg}, _) :: rem -> 467 | id :: bound_value_identifiers rem 468 | | Sig_typext(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 469 | | Sig_module(id, Mp_present, _, _, _) :: rem -> 470 | id :: bound_value_identifiers rem 471 | | Sig_class(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 472 | | _ :: rem -> bound_value_identifiers rem 473 | 474 | let signature_item_id = function 475 | | Sig_value (id, _, _) 476 | | Sig_type (id, _, _, _) 477 | | Sig_typext (id, _, _, _) 478 | | Sig_module (id, _, _, _, _) 479 | | Sig_modtype (id, _, _) 480 | | Sig_class (id, _, _, _) 481 | | Sig_class_type (id, _, _, _) 482 | -> id 483 | end 484 | [%%endif] 485 | -------------------------------------------------------------------------------- /src/types_412.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | [@@@ocaml.warning "-9"] 16 | [%%if ocaml_version >= (4, 12, 0) && ocaml_version < (4, 13, 0)] 17 | module Types = Types 18 | [%%else] 19 | module Types = struct 20 | module Ocaml_config = Config 21 | open Migrate_parsetree.Ast_412 22 | 23 | module Type_immediacy = Type_immediacy_412 24 | (* Representation of types and declarations *) 25 | 26 | open Asttypes 27 | 28 | (* Type expressions for the core language *) 29 | 30 | type type_expr = 31 | { mutable desc: type_desc; 32 | mutable level: int; 33 | mutable scope: int; 34 | id: int } 35 | 36 | and type_desc = 37 | Tvar of string option 38 | | Tarrow of arg_label * type_expr * type_expr * commutable 39 | | Ttuple of type_expr list 40 | | Tconstr of Path.t * type_expr list * abbrev_memo ref 41 | | Tobject of type_expr * (Path.t * type_expr list) option ref 42 | | Tfield of string * field_kind * type_expr * type_expr 43 | | Tnil 44 | | Tlink of type_expr 45 | | Tsubst of type_expr (* for copying *) 46 | | Tvariant of row_desc 47 | | Tunivar of string option 48 | | Tpoly of type_expr * type_expr list 49 | | Tpackage of Path.t * Longident.t list * type_expr list 50 | 51 | and row_desc = 52 | { row_fields: (label * row_field) list; 53 | row_more: type_expr; 54 | row_bound: unit; 55 | row_closed: bool; 56 | row_fixed: fixed_explanation option; 57 | row_name: (Path.t * type_expr list) option } 58 | and fixed_explanation = 59 | | Univar of type_expr | Fixed_private | Reified of Path.t | Rigid 60 | and row_field = 61 | Rpresent of type_expr option 62 | | Reither of bool * type_expr list * bool * row_field option ref 63 | (* 1st true denotes a constant constructor *) 64 | (* 2nd true denotes a tag in a pattern matching, and 65 | is erased later *) 66 | | Rabsent 67 | 68 | and abbrev_memo = 69 | Mnil 70 | | Mcons of private_flag * Path.t * type_expr * type_expr * abbrev_memo 71 | | Mlink of abbrev_memo ref 72 | 73 | and field_kind = 74 | Fvar of field_kind option ref 75 | | Fpresent 76 | | Fabsent 77 | 78 | and commutable = 79 | Cok 80 | | Cunknown 81 | | Clink of commutable ref 82 | 83 | module TypeOps = struct 84 | type t = type_expr 85 | let compare t1 t2 = t1.id - t2.id 86 | let hash t = t.id 87 | let equal t1 t2 = t1 == t2 88 | end 89 | 90 | (* *) 91 | 92 | [%%if ocaml_version < (4, 12, 0)] 93 | module Uid = Types_411.Types.Uid 94 | [%%else] 95 | [%%if ocaml_version >= (4, 13, 0)] 96 | module Uid = Types_413.Types.Uid 97 | [%%else] 98 | module Uid = struct 99 | type t = 100 | | Compilation_unit of string 101 | | Item of { comp_unit: string; id: int } 102 | | Internal 103 | | Predef of string 104 | 105 | include Identifiable.Make(struct 106 | type nonrec t = t 107 | 108 | let equal (x : t) y = x = y 109 | let compare (x : t) y = compare x y 110 | let hash (x : t) = Hashtbl.hash x 111 | 112 | let print fmt = function 113 | | Internal -> Format.pp_print_string fmt "" 114 | | Predef name -> Format.fprintf fmt "" name 115 | | Compilation_unit s -> Format.pp_print_string fmt s 116 | | Item { comp_unit; id } -> Format.fprintf fmt "%s.%d" comp_unit id 117 | 118 | let output oc t = 119 | let fmt = Format.formatter_of_out_channel oc in 120 | print fmt t 121 | end) 122 | 123 | let id = ref (-1) 124 | 125 | let reinit () = id := (-1) 126 | 127 | let mk ~current_unit = 128 | incr id; 129 | Item { comp_unit = current_unit; id = !id } 130 | 131 | let of_compilation_unit_id id = 132 | if not (Ident.persistent id) then 133 | Misc.fatal_errorf "Types.Uid.of_compilation_unit_id %S" (Ident.name id); 134 | Compilation_unit (Ident.name id) 135 | 136 | let of_predef_id id = 137 | if not (Ident.is_predef id) then 138 | Misc.fatal_errorf "Types.Uid.of_predef_id %S" (Ident.name id); 139 | Predef (Ident.name id) 140 | 141 | let internal_not_actually_unique = Internal 142 | 143 | let for_actual_declaration = function 144 | | Item _ -> true 145 | | _ -> false 146 | end 147 | [%%endif] 148 | [%%endif] 149 | 150 | (* Maps of methods and instance variables *) 151 | 152 | module Meths = Misc.Stdlib.String.Map 153 | module Vars = Meths 154 | 155 | (* Value descriptions *) 156 | 157 | type value_description = 158 | { val_type: type_expr; (* Type of the value *) 159 | val_kind: value_kind; 160 | val_loc: Location.t; 161 | val_attributes: Parsetree.attributes; 162 | val_uid: Uid.t; 163 | } 164 | 165 | and value_kind = 166 | Val_reg (* Regular value *) 167 | | Val_prim of Primitive.description (* Primitive *) 168 | | Val_ivar of mutable_flag * string (* Instance variable (mutable ?) *) 169 | | Val_self of (Ident.t * type_expr) Meths.t ref * 170 | (Ident.t * Asttypes.mutable_flag * 171 | Asttypes.virtual_flag * type_expr) Vars.t ref * 172 | string * type_expr 173 | (* Self *) 174 | | Val_anc of (string * Ident.t) list * string 175 | (* Ancestor *) 176 | 177 | (* Variance *) 178 | 179 | module Variance = struct 180 | type t = int 181 | type f = May_pos | May_neg | May_weak | Inj | Pos | Neg | Inv 182 | let single = function 183 | | May_pos -> 1 184 | | May_neg -> 2 185 | | May_weak -> 4 186 | | Inj -> 8 187 | | Pos -> 16 188 | | Neg -> 32 189 | | Inv -> 64 190 | let union v1 v2 = v1 lor v2 191 | let inter v1 v2 = v1 land v2 192 | let subset v1 v2 = (v1 land v2 = v1) 193 | let eq (v1 : t) v2 = (v1 = v2) 194 | let set x b v = 195 | if b then v lor single x else v land (lnot (single x)) 196 | let mem x = subset (single x) 197 | let null = 0 198 | let unknown = 7 199 | let full = 127 200 | let covariant = single May_pos lor single Pos lor single Inj 201 | let swap f1 f2 v = 202 | let v' = set f1 (mem f2 v) v in set f2 (mem f1 v) v' 203 | let conjugate v = swap May_pos May_neg (swap Pos Neg v) 204 | let get_upper v = (mem May_pos v, mem May_neg v) 205 | let get_lower v = (mem Pos v, mem Neg v, mem Inv v, mem Inj v) 206 | let unknown_signature ~injective ~arity = 207 | let v = if injective then set Inj true unknown else unknown in 208 | Misc.replicate_list v arity 209 | end 210 | 211 | module Separability = struct 212 | type t = Ind | Sep | Deepsep 213 | type signature = t list 214 | let eq (m1 : t) m2 = (m1 = m2) 215 | let rank = function 216 | | Ind -> 0 217 | | Sep -> 1 218 | | Deepsep -> 2 219 | let compare m1 m2 = compare (rank m1) (rank m2) 220 | let max m1 m2 = if rank m1 >= rank m2 then m1 else m2 221 | 222 | let print ppf = function 223 | | Ind -> Format.fprintf ppf "Ind" 224 | | Sep -> Format.fprintf ppf "Sep" 225 | | Deepsep -> Format.fprintf ppf "Deepsep" 226 | 227 | let print_signature ppf modes = 228 | let pp_sep ppf () = Format.fprintf ppf ",@," in 229 | Format.fprintf ppf "@[(%a)@]" 230 | (Format.pp_print_list ~pp_sep print) modes 231 | 232 | let default_signature ~arity = 233 | let default_mode = if Ocaml_config.flat_float_array then Deepsep else Ind in 234 | Misc.replicate_list default_mode arity 235 | end 236 | 237 | (* Type definitions *) 238 | 239 | type type_declaration = 240 | { type_params: type_expr list; 241 | type_arity: int; 242 | type_kind: type_kind; 243 | type_private: private_flag; 244 | type_manifest: type_expr option; 245 | type_variance: Variance.t list; 246 | type_separability: Separability.t list; 247 | type_is_newtype: bool; 248 | type_expansion_scope: int; 249 | type_loc: Location.t; 250 | type_attributes: Parsetree.attributes; 251 | type_immediate: Type_immediacy.t; 252 | type_unboxed: unboxed_status; 253 | type_uid: Uid.t; 254 | } 255 | 256 | and type_kind = 257 | Type_abstract 258 | | Type_record of label_declaration list * record_representation 259 | | Type_variant of constructor_declaration list 260 | | Type_open 261 | 262 | and record_representation = 263 | Record_regular (* All fields are boxed / tagged *) 264 | | Record_float (* All fields are floats *) 265 | | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) 266 | | Record_inlined of int (* Inlined record *) 267 | | Record_extension of Path.t (* Inlined record under extension *) 268 | 269 | and label_declaration = 270 | { 271 | ld_id: Ident.t; 272 | ld_mutable: mutable_flag; 273 | ld_type: type_expr; 274 | ld_loc: Location.t; 275 | ld_attributes: Parsetree.attributes; 276 | ld_uid: Uid.t; 277 | } 278 | 279 | and constructor_declaration = 280 | { 281 | cd_id: Ident.t; 282 | cd_args: constructor_arguments; 283 | cd_res: type_expr option; 284 | cd_loc: Location.t; 285 | cd_attributes: Parsetree.attributes; 286 | cd_uid: Uid.t; 287 | } 288 | 289 | and constructor_arguments = 290 | | Cstr_tuple of type_expr list 291 | | Cstr_record of label_declaration list 292 | 293 | and unboxed_status = 294 | { 295 | unboxed: bool; 296 | default: bool; (* False if the unboxed field was set from an attribute. *) 297 | } 298 | 299 | let unboxed_false_default_false = {unboxed = false; default = false} 300 | let unboxed_false_default_true = {unboxed = false; default = true} 301 | let unboxed_true_default_false = {unboxed = true; default = false} 302 | let unboxed_true_default_true = {unboxed = true; default = true} 303 | 304 | type extension_constructor = 305 | { ext_type_path: Path.t; 306 | ext_type_params: type_expr list; 307 | ext_args: constructor_arguments; 308 | ext_ret_type: type_expr option; 309 | ext_private: private_flag; 310 | ext_loc: Location.t; 311 | ext_attributes: Parsetree.attributes; 312 | ext_uid: Uid.t; 313 | } 314 | 315 | and type_transparence = 316 | Type_public (* unrestricted expansion *) 317 | | Type_new (* "new" type *) 318 | | Type_private (* private type *) 319 | 320 | (* Type expressions for the class language *) 321 | 322 | module Concr = Misc.Stdlib.String.Set 323 | 324 | type class_type = 325 | Cty_constr of Path.t * type_expr list * class_type 326 | | Cty_signature of class_signature 327 | | Cty_arrow of arg_label * type_expr * class_type 328 | 329 | and class_signature = 330 | { csig_self: type_expr; 331 | csig_vars: 332 | (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) Vars.t; 333 | csig_concr: Concr.t; 334 | csig_inher: (Path.t * type_expr list) list } 335 | 336 | type class_declaration = 337 | { cty_params: type_expr list; 338 | mutable cty_type: class_type; 339 | cty_path: Path.t; 340 | cty_new: type_expr option; 341 | cty_variance: Variance.t list; 342 | cty_loc: Location.t; 343 | cty_attributes: Parsetree.attributes; 344 | cty_uid: Uid.t; 345 | } 346 | 347 | type class_type_declaration = 348 | { clty_params: type_expr list; 349 | clty_type: class_type; 350 | clty_path: Path.t; 351 | clty_variance: Variance.t list; 352 | clty_loc: Location.t; 353 | clty_attributes: Parsetree.attributes; 354 | clty_uid: Uid.t; 355 | } 356 | 357 | (* Type expressions for the module language *) 358 | 359 | type visibility = 360 | | Exported 361 | | Hidden 362 | 363 | type module_type = 364 | Mty_ident of Path.t 365 | | Mty_signature of signature 366 | | Mty_functor of functor_parameter * module_type 367 | | Mty_alias of Path.t 368 | 369 | and functor_parameter = 370 | | Unit 371 | | Named of Ident.t option * module_type 372 | 373 | and module_presence = 374 | | Mp_present 375 | | Mp_absent 376 | 377 | and signature = signature_item list 378 | 379 | and signature_item = 380 | Sig_value of Ident.t * value_description * visibility 381 | | Sig_type of Ident.t * type_declaration * rec_status * visibility 382 | | Sig_typext of Ident.t * extension_constructor * ext_status * visibility 383 | | Sig_module of 384 | Ident.t * module_presence * module_declaration * rec_status * visibility 385 | | Sig_modtype of Ident.t * modtype_declaration * visibility 386 | | Sig_class of Ident.t * class_declaration * rec_status * visibility 387 | | Sig_class_type of Ident.t * class_type_declaration * rec_status * visibility 388 | 389 | and module_declaration = 390 | { 391 | md_type: module_type; 392 | md_attributes: Parsetree.attributes; 393 | md_loc: Location.t; 394 | md_uid: Uid.t; 395 | } 396 | 397 | and modtype_declaration = 398 | { 399 | mtd_type: module_type option; (* Note: abstract *) 400 | mtd_attributes: Parsetree.attributes; 401 | mtd_loc: Location.t; 402 | mtd_uid: Uid.t; 403 | } 404 | 405 | and rec_status = 406 | Trec_not (* first in a nonrecursive group *) 407 | | Trec_first (* first in a recursive group *) 408 | | Trec_next (* not first in a recursive/nonrecursive group *) 409 | 410 | and ext_status = 411 | Text_first (* first constructor of an extension *) 412 | | Text_next (* not first constructor of an extension *) 413 | | Text_exception (* an exception *) 414 | 415 | 416 | (* Constructor and record label descriptions inserted held in typing 417 | environments *) 418 | 419 | type constructor_description = 420 | { cstr_name: string; (* Constructor name *) 421 | cstr_res: type_expr; (* Type of the result *) 422 | cstr_existentials: type_expr list; (* list of existentials *) 423 | cstr_args: type_expr list; (* Type of the arguments *) 424 | cstr_arity: int; (* Number of arguments *) 425 | cstr_tag: constructor_tag; (* Tag for heap blocks *) 426 | cstr_consts: int; (* Number of constant constructors *) 427 | cstr_nonconsts: int; (* Number of non-const constructors *) 428 | cstr_normal: int; (* Number of non generalized constrs *) 429 | cstr_generalized: bool; (* Constrained return type? *) 430 | cstr_private: private_flag; (* Read-only constructor? *) 431 | cstr_loc: Location.t; 432 | cstr_attributes: Parsetree.attributes; 433 | cstr_inlined: type_declaration option; 434 | cstr_uid: Uid.t; 435 | } 436 | 437 | and constructor_tag = 438 | Cstr_constant of int (* Constant constructor (an int) *) 439 | | Cstr_block of int (* Regular constructor (a block) *) 440 | | Cstr_unboxed (* Constructor of an unboxed type *) 441 | | Cstr_extension of Path.t * bool (* Extension constructor 442 | true if a constant false if a block*) 443 | 444 | let equal_tag t1 t2 = 445 | match (t1, t2) with 446 | | Cstr_constant i1, Cstr_constant i2 -> i2 = i1 447 | | Cstr_block i1, Cstr_block i2 -> i2 = i1 448 | | Cstr_unboxed, Cstr_unboxed -> true 449 | | Cstr_extension (path1, b1), Cstr_extension (path2, b2) -> 450 | Path.same path1 path2 && b1 = b2 451 | | (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false 452 | 453 | let may_equal_constr c1 c2 = 454 | c1.cstr_arity = c2.cstr_arity 455 | && (match c1.cstr_tag,c2.cstr_tag with 456 | | Cstr_extension _,Cstr_extension _ -> 457 | (* extension constructors may be rebindings of each other *) 458 | true 459 | | tag1, tag2 -> 460 | equal_tag tag1 tag2) 461 | 462 | type label_description = 463 | { lbl_name: string; (* Short name *) 464 | lbl_res: type_expr; (* Type of the result *) 465 | lbl_arg: type_expr; (* Type of the argument *) 466 | lbl_mut: mutable_flag; (* Is this a mutable field? *) 467 | lbl_pos: int; (* Position in block *) 468 | lbl_all: label_description array; (* All the labels in this type *) 469 | lbl_repres: record_representation; (* Representation for this record *) 470 | lbl_private: private_flag; (* Read-only field? *) 471 | lbl_loc: Location.t; 472 | lbl_attributes: Parsetree.attributes; 473 | lbl_uid: Uid.t; 474 | } 475 | 476 | let rec bound_value_identifiers = function 477 | [] -> [] 478 | | Sig_value(id, {val_kind = Val_reg}, _) :: rem -> 479 | id :: bound_value_identifiers rem 480 | | Sig_typext(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 481 | | Sig_module(id, Mp_present, _, _, _) :: rem -> 482 | id :: bound_value_identifiers rem 483 | | Sig_class(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 484 | | _ :: rem -> bound_value_identifiers rem 485 | 486 | let signature_item_id = function 487 | | Sig_value (id, _, _) 488 | | Sig_type (id, _, _, _) 489 | | Sig_typext (id, _, _, _) 490 | | Sig_module (id, _, _, _, _) 491 | | Sig_modtype (id, _, _) 492 | | Sig_class (id, _, _, _) 493 | | Sig_class_type (id, _, _, _) 494 | -> id 495 | end 496 | [%%endif] 497 | -------------------------------------------------------------------------------- /src/types_413.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* *) 3 | (* OCaml *) 4 | (* *) 5 | (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) 6 | (* *) 7 | (* Copyright 1996 Institut National de Recherche en Informatique et *) 8 | (* en Automatique. *) 9 | (* *) 10 | (* All rights reserved. This file is distributed under the terms of *) 11 | (* the GNU Lesser General Public License version 2.1, with the *) 12 | (* special exception on linking described in the file LICENSE. *) 13 | (* *) 14 | (**************************************************************************) 15 | [@@@ocaml.warning "-9"] 16 | [%%if ocaml_version >= (4, 13, 0) && ocaml_version < (4, 14, 0)] 17 | module Types = Types 18 | [%%else] 19 | module Types = struct 20 | module Ocaml_config = Config 21 | open Migrate_parsetree.Ast_413 22 | 23 | module Type_immediacy = Type_immediacy_413 24 | (* Representation of types and declarations *) 25 | 26 | open Asttypes 27 | 28 | (* Type expressions for the core language *) 29 | 30 | type type_expr = 31 | { mutable desc: type_desc; 32 | mutable level: int; 33 | mutable scope: int; 34 | id: int } 35 | 36 | and type_desc = 37 | Tvar of string option 38 | | Tarrow of arg_label * type_expr * type_expr * commutable 39 | | Ttuple of type_expr list 40 | | Tconstr of Path.t * type_expr list * abbrev_memo ref 41 | | Tobject of type_expr * (Path.t * type_expr list) option ref 42 | | Tfield of string * field_kind * type_expr * type_expr 43 | | Tnil 44 | | Tlink of type_expr 45 | | Tsubst of type_expr * type_expr option 46 | | Tvariant of row_desc 47 | | Tunivar of string option 48 | | Tpoly of type_expr * type_expr list 49 | | Tpackage of Path.t * (Longident.t * type_expr) list 50 | 51 | and row_desc = 52 | { row_fields: (label * row_field) list; 53 | row_more: type_expr; 54 | row_bound: unit; 55 | row_closed: bool; 56 | row_fixed: fixed_explanation option; 57 | row_name: (Path.t * type_expr list) option } 58 | and fixed_explanation = 59 | | Univar of type_expr | Fixed_private | Reified of Path.t | Rigid 60 | and row_field = 61 | Rpresent of type_expr option 62 | | Reither of bool * type_expr list * bool * row_field option ref 63 | (* 1st true denotes a constant constructor *) 64 | (* 2nd true denotes a tag in a pattern matching, and 65 | is erased later *) 66 | | Rabsent 67 | 68 | and abbrev_memo = 69 | Mnil 70 | | Mcons of private_flag * Path.t * type_expr * type_expr * abbrev_memo 71 | | Mlink of abbrev_memo ref 72 | 73 | and field_kind = 74 | Fvar of field_kind option ref 75 | | Fpresent 76 | | Fabsent 77 | 78 | and commutable = 79 | Cok 80 | | Cunknown 81 | | Clink of commutable ref 82 | 83 | module TypeOps = struct 84 | type t = type_expr 85 | let compare t1 t2 = t1.id - t2.id 86 | let hash t = t.id 87 | let equal t1 t2 = t1 == t2 88 | end 89 | 90 | module Private_type_expr = struct 91 | let create desc ~level ~scope ~id = {desc; level; scope; id} 92 | let set_desc ty d = ty.desc <- d 93 | let set_level ty lv = ty.level <- lv 94 | let set_scope ty sc = ty.scope <- sc 95 | end 96 | (* *) 97 | 98 | [%%if ocaml_version < (4, 13, 0)] 99 | module Uid = Types_412.Types.Uid 100 | [%%else] 101 | [%%if ocaml_version >= (4, 14, 0)] 102 | module Uid = Types_414.Types.Uid 103 | [%%else] 104 | module Uid = struct 105 | type t = 106 | | Compilation_unit of string 107 | | Item of { comp_unit: string; id: int } 108 | | Internal 109 | | Predef of string 110 | 111 | include Identifiable.Make(struct 112 | type nonrec t = t 113 | 114 | let equal (x : t) y = x = y 115 | let compare (x : t) y = compare x y 116 | let hash (x : t) = Hashtbl.hash x 117 | 118 | let print fmt = function 119 | | Internal -> Format.pp_print_string fmt "" 120 | | Predef name -> Format.fprintf fmt "" name 121 | | Compilation_unit s -> Format.pp_print_string fmt s 122 | | Item { comp_unit; id } -> Format.fprintf fmt "%s.%d" comp_unit id 123 | 124 | let output oc t = 125 | let fmt = Format.formatter_of_out_channel oc in 126 | print fmt t 127 | end) 128 | 129 | let id = ref (-1) 130 | 131 | let reinit () = id := (-1) 132 | 133 | let mk ~current_unit = 134 | incr id; 135 | Item { comp_unit = current_unit; id = !id } 136 | 137 | let of_compilation_unit_id id = 138 | if not (Ident.persistent id) then 139 | Misc.fatal_errorf "Types.Uid.of_compilation_unit_id %S" (Ident.name id); 140 | Compilation_unit (Ident.name id) 141 | 142 | let of_predef_id id = 143 | if not (Ident.is_predef id) then 144 | Misc.fatal_errorf "Types.Uid.of_predef_id %S" (Ident.name id); 145 | Predef (Ident.name id) 146 | 147 | let internal_not_actually_unique = Internal 148 | 149 | let for_actual_declaration = function 150 | | Item _ -> true 151 | | _ -> false 152 | end 153 | [%%endif] 154 | [%%endif] 155 | 156 | (* Maps of methods and instance variables *) 157 | 158 | module Meths = Misc.Stdlib.String.Map 159 | module Vars = Meths 160 | 161 | (* Value descriptions *) 162 | 163 | type value_description = 164 | { val_type: type_expr; (* Type of the value *) 165 | val_kind: value_kind; 166 | val_loc: Location.t; 167 | val_attributes: Parsetree.attributes; 168 | val_uid: Uid.t; 169 | } 170 | 171 | and value_kind = 172 | Val_reg (* Regular value *) 173 | | Val_prim of Primitive.description (* Primitive *) 174 | | Val_ivar of mutable_flag * string (* Instance variable (mutable ?) *) 175 | | Val_self of (Ident.t * type_expr) Meths.t ref * 176 | (Ident.t * Asttypes.mutable_flag * 177 | Asttypes.virtual_flag * type_expr) Vars.t ref * 178 | string * type_expr 179 | (* Self *) 180 | | Val_anc of (string * Ident.t) list * string 181 | (* Ancestor *) 182 | 183 | (* Variance *) 184 | 185 | module Variance = struct 186 | type t = int 187 | type f = May_pos | May_neg | May_weak | Inj | Pos | Neg | Inv 188 | let single = function 189 | | May_pos -> 1 190 | | May_neg -> 2 191 | | May_weak -> 4 192 | | Inj -> 8 193 | | Pos -> 16 194 | | Neg -> 32 195 | | Inv -> 64 196 | let union v1 v2 = v1 lor v2 197 | let inter v1 v2 = v1 land v2 198 | let subset v1 v2 = (v1 land v2 = v1) 199 | let eq (v1 : t) v2 = (v1 = v2) 200 | let set x b v = 201 | if b then v lor single x else v land (lnot (single x)) 202 | let mem x = subset (single x) 203 | let null = 0 204 | let unknown = 7 205 | let full = 127 206 | let covariant = single May_pos lor single Pos lor single Inj 207 | let swap f1 f2 v = 208 | let v' = set f1 (mem f2 v) v in set f2 (mem f1 v) v' 209 | let conjugate v = swap May_pos May_neg (swap Pos Neg v) 210 | let get_upper v = (mem May_pos v, mem May_neg v) 211 | let get_lower v = (mem Pos v, mem Neg v, mem Inv v, mem Inj v) 212 | let unknown_signature ~injective ~arity = 213 | let v = if injective then set Inj true unknown else unknown in 214 | Misc.replicate_list v arity 215 | end 216 | 217 | module Separability = struct 218 | type t = Ind | Sep | Deepsep 219 | type signature = t list 220 | let eq (m1 : t) m2 = (m1 = m2) 221 | let rank = function 222 | | Ind -> 0 223 | | Sep -> 1 224 | | Deepsep -> 2 225 | let compare m1 m2 = compare (rank m1) (rank m2) 226 | let max m1 m2 = if rank m1 >= rank m2 then m1 else m2 227 | 228 | let print ppf = function 229 | | Ind -> Format.fprintf ppf "Ind" 230 | | Sep -> Format.fprintf ppf "Sep" 231 | | Deepsep -> Format.fprintf ppf "Deepsep" 232 | 233 | let print_signature ppf modes = 234 | let pp_sep ppf () = Format.fprintf ppf ",@," in 235 | Format.fprintf ppf "@[(%a)@]" 236 | (Format.pp_print_list ~pp_sep print) modes 237 | 238 | let default_signature ~arity = 239 | let default_mode = if Ocaml_config.flat_float_array then Deepsep else Ind in 240 | Misc.replicate_list default_mode arity 241 | end 242 | 243 | (* Type definitions *) 244 | 245 | type type_declaration = 246 | { type_params: type_expr list; 247 | type_arity: int; 248 | type_kind: type_decl_kind; 249 | type_private: private_flag; 250 | type_manifest: type_expr option; 251 | type_variance: Variance.t list; 252 | type_separability: Separability.t list; 253 | type_is_newtype: bool; 254 | type_expansion_scope: int; 255 | type_loc: Location.t; 256 | type_attributes: Parsetree.attributes; 257 | type_immediate: Type_immediacy.t; 258 | type_unboxed_default: bool; 259 | type_uid: Uid.t; 260 | } 261 | 262 | and type_decl_kind = (label_declaration, constructor_declaration) type_kind 263 | 264 | and ('lbl, 'cstr) type_kind = 265 | Type_abstract 266 | | Type_record of 'lbl list * record_representation 267 | | Type_variant of 'cstr list * variant_representation 268 | | Type_open 269 | 270 | and record_representation = 271 | Record_regular (* All fields are boxed / tagged *) 272 | | Record_float (* All fields are floats *) 273 | | Record_unboxed of bool (* Unboxed single-field record, inlined or not *) 274 | | Record_inlined of int (* Inlined record *) 275 | | Record_extension of Path.t (* Inlined record under extension *) 276 | 277 | and variant_representation = 278 | Variant_regular (* Constant or boxed constructors *) 279 | | Variant_unboxed (* One unboxed single-field constructor *) 280 | 281 | and label_declaration = 282 | { 283 | ld_id: Ident.t; 284 | ld_mutable: mutable_flag; 285 | ld_type: type_expr; 286 | ld_loc: Location.t; 287 | ld_attributes: Parsetree.attributes; 288 | ld_uid: Uid.t; 289 | } 290 | 291 | and constructor_declaration = 292 | { 293 | cd_id: Ident.t; 294 | cd_args: constructor_arguments; 295 | cd_res: type_expr option; 296 | cd_loc: Location.t; 297 | cd_attributes: Parsetree.attributes; 298 | cd_uid: Uid.t; 299 | } 300 | 301 | and constructor_arguments = 302 | | Cstr_tuple of type_expr list 303 | | Cstr_record of label_declaration list 304 | 305 | type extension_constructor = 306 | { ext_type_path: Path.t; 307 | ext_type_params: type_expr list; 308 | ext_args: constructor_arguments; 309 | ext_ret_type: type_expr option; 310 | ext_private: private_flag; 311 | ext_loc: Location.t; 312 | ext_attributes: Parsetree.attributes; 313 | ext_uid: Uid.t; 314 | } 315 | 316 | and type_transparence = 317 | Type_public (* unrestricted expansion *) 318 | | Type_new (* "new" type *) 319 | | Type_private (* private type *) 320 | 321 | (* Type expressions for the class language *) 322 | 323 | module Concr = Misc.Stdlib.String.Set 324 | 325 | type class_type = 326 | Cty_constr of Path.t * type_expr list * class_type 327 | | Cty_signature of class_signature 328 | | Cty_arrow of arg_label * type_expr * class_type 329 | 330 | and class_signature = 331 | { csig_self: type_expr; 332 | csig_vars: 333 | (Asttypes.mutable_flag * Asttypes.virtual_flag * type_expr) Vars.t; 334 | csig_concr: Concr.t; 335 | csig_inher: (Path.t * type_expr list) list } 336 | 337 | type class_declaration = 338 | { cty_params: type_expr list; 339 | mutable cty_type: class_type; 340 | cty_path: Path.t; 341 | cty_new: type_expr option; 342 | cty_variance: Variance.t list; 343 | cty_loc: Location.t; 344 | cty_attributes: Parsetree.attributes; 345 | cty_uid: Uid.t; 346 | } 347 | 348 | type class_type_declaration = 349 | { clty_params: type_expr list; 350 | clty_type: class_type; 351 | clty_path: Path.t; 352 | clty_variance: Variance.t list; 353 | clty_loc: Location.t; 354 | clty_attributes: Parsetree.attributes; 355 | clty_uid: Uid.t; 356 | } 357 | 358 | (* Type expressions for the module language *) 359 | 360 | type visibility = 361 | | Exported 362 | | Hidden 363 | 364 | type module_type = 365 | Mty_ident of Path.t 366 | | Mty_signature of signature 367 | | Mty_functor of functor_parameter * module_type 368 | | Mty_alias of Path.t 369 | 370 | and functor_parameter = 371 | | Unit 372 | | Named of Ident.t option * module_type 373 | 374 | and module_presence = 375 | | Mp_present 376 | | Mp_absent 377 | 378 | and signature = signature_item list 379 | 380 | and signature_item = 381 | Sig_value of Ident.t * value_description * visibility 382 | | Sig_type of Ident.t * type_declaration * rec_status * visibility 383 | | Sig_typext of Ident.t * extension_constructor * ext_status * visibility 384 | | Sig_module of 385 | Ident.t * module_presence * module_declaration * rec_status * visibility 386 | | Sig_modtype of Ident.t * modtype_declaration * visibility 387 | | Sig_class of Ident.t * class_declaration * rec_status * visibility 388 | | Sig_class_type of Ident.t * class_type_declaration * rec_status * visibility 389 | 390 | and module_declaration = 391 | { 392 | md_type: module_type; 393 | md_attributes: Parsetree.attributes; 394 | md_loc: Location.t; 395 | md_uid: Uid.t; 396 | } 397 | 398 | and modtype_declaration = 399 | { 400 | mtd_type: module_type option; (* Note: abstract *) 401 | mtd_attributes: Parsetree.attributes; 402 | mtd_loc: Location.t; 403 | mtd_uid: Uid.t; 404 | } 405 | 406 | and rec_status = 407 | Trec_not (* first in a nonrecursive group *) 408 | | Trec_first (* first in a recursive group *) 409 | | Trec_next (* not first in a recursive/nonrecursive group *) 410 | 411 | and ext_status = 412 | Text_first (* first constructor of an extension *) 413 | | Text_next (* not first constructor of an extension *) 414 | | Text_exception (* an exception *) 415 | 416 | 417 | (* Constructor and record label descriptions inserted held in typing 418 | environments *) 419 | 420 | type constructor_description = 421 | { cstr_name: string; (* Constructor name *) 422 | cstr_res: type_expr; (* Type of the result *) 423 | cstr_existentials: type_expr list; (* list of existentials *) 424 | cstr_args: type_expr list; (* Type of the arguments *) 425 | cstr_arity: int; (* Number of arguments *) 426 | cstr_tag: constructor_tag; (* Tag for heap blocks *) 427 | cstr_consts: int; (* Number of constant constructors *) 428 | cstr_nonconsts: int; (* Number of non-const constructors *) 429 | cstr_normal: int; (* Number of non generalized constrs *) 430 | cstr_generalized: bool; (* Constrained return type? *) 431 | cstr_private: private_flag; (* Read-only constructor? *) 432 | cstr_loc: Location.t; 433 | cstr_attributes: Parsetree.attributes; 434 | cstr_inlined: type_declaration option; 435 | cstr_uid: Uid.t; 436 | } 437 | 438 | and constructor_tag = 439 | Cstr_constant of int (* Constant constructor (an int) *) 440 | | Cstr_block of int (* Regular constructor (a block) *) 441 | | Cstr_unboxed (* Constructor of an unboxed type *) 442 | | Cstr_extension of Path.t * bool (* Extension constructor 443 | true if a constant false if a block*) 444 | 445 | let equal_tag t1 t2 = 446 | match (t1, t2) with 447 | | Cstr_constant i1, Cstr_constant i2 -> i2 = i1 448 | | Cstr_block i1, Cstr_block i2 -> i2 = i1 449 | | Cstr_unboxed, Cstr_unboxed -> true 450 | | Cstr_extension (path1, b1), Cstr_extension (path2, b2) -> 451 | Path.same path1 path2 && b1 = b2 452 | | (Cstr_constant _|Cstr_block _|Cstr_unboxed|Cstr_extension _), _ -> false 453 | 454 | let may_equal_constr c1 c2 = 455 | c1.cstr_arity = c2.cstr_arity 456 | && (match c1.cstr_tag,c2.cstr_tag with 457 | | Cstr_extension _,Cstr_extension _ -> 458 | (* extension constructors may be rebindings of each other *) 459 | true 460 | | tag1, tag2 -> 461 | equal_tag tag1 tag2) 462 | 463 | type label_description = 464 | { lbl_name: string; (* Short name *) 465 | lbl_res: type_expr; (* Type of the result *) 466 | lbl_arg: type_expr; (* Type of the argument *) 467 | lbl_mut: mutable_flag; (* Is this a mutable field? *) 468 | lbl_pos: int; (* Position in block *) 469 | lbl_all: label_description array; (* All the labels in this type *) 470 | lbl_repres: record_representation; (* Representation for this record *) 471 | lbl_private: private_flag; (* Read-only field? *) 472 | lbl_loc: Location.t; 473 | lbl_attributes: Parsetree.attributes; 474 | lbl_uid: Uid.t; 475 | } 476 | 477 | let rec bound_value_identifiers = function 478 | [] -> [] 479 | | Sig_value(id, {val_kind = Val_reg}, _) :: rem -> 480 | id :: bound_value_identifiers rem 481 | | Sig_typext(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 482 | | Sig_module(id, Mp_present, _, _, _) :: rem -> 483 | id :: bound_value_identifiers rem 484 | | Sig_class(id, _, _, _) :: rem -> id :: bound_value_identifiers rem 485 | | _ :: rem -> bound_value_identifiers rem 486 | 487 | let signature_item_id = function 488 | | Sig_value (id, _, _) 489 | | Sig_type (id, _, _, _) 490 | | Sig_typext (id, _, _, _) 491 | | Sig_module (id, _, _, _, _) 492 | | Sig_modtype (id, _, _) 493 | | Sig_class (id, _, _, _) 494 | | Sig_class_type (id, _, _, _) 495 | -> id 496 | end 497 | [%%endif] 498 | -------------------------------------------------------------------------------- /tools/.ocamlformat: -------------------------------------------------------------------------------- 1 | version=0.19.0 2 | -------------------------------------------------------------------------------- /tools/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name make_copies) 3 | (libraries ppxlib) 4 | (preprocess 5 | (pps ppxlib.metaquot))) 6 | -------------------------------------------------------------------------------- /tools/make_copies.ml: -------------------------------------------------------------------------------- 1 | open Ppxlib 2 | (** 3 | #how to use 4 | 5 | dune exec tools/make_copies.exe x.mli > y.ml 6 | *) 7 | 8 | let loc = Location.none 9 | 10 | open Ast_builder.Make (struct 11 | let loc = loc 12 | end) 13 | 14 | let to_lid { txt; loc } = { txt = Lident txt; loc } 15 | 16 | module Var = struct 17 | let counter = ref 0 18 | 19 | let reset () = counter := 0 20 | 21 | let next () = 22 | incr counter; 23 | Printf.sprintf "param_%d" !counter 24 | end 25 | 26 | let mk_copy name = "copy_" ^ name 27 | 28 | module From_core_type = struct 29 | let should_ignore name = 30 | List.exists (( = ) name) 31 | [ 32 | "int"; 33 | "string"; 34 | "bool"; 35 | "mutable_flag"; 36 | "private_flag"; 37 | "arg_label"; 38 | "unit"; 39 | ] 40 | 41 | let function_to_apply constr = 42 | List.find_opt 43 | (fun (typ, _f) -> typ = constr) 44 | [ ("array", "Array.map"); ("list", "List.map"); ("option", "Option.map") ] 45 | |> Option.map snd 46 | 47 | let should_apply constr = function_to_apply constr <> None 48 | 49 | let function_to_copy = function 50 | | Ldot (Lident "Uid", "t") -> Some (Ldot (Lident "Uid", mk_copy "t")) 51 | | _ -> None 52 | 53 | let should_copy lid = function_to_copy lid <> None 54 | 55 | let rec pattern (typ : core_type) = 56 | match typ.ptyp_desc with 57 | | Ptyp_tuple types -> ppat_tuple (List.map pattern types) 58 | | _ -> pvar (Var.next ()) 59 | 60 | let rec expression (typ : core_type) = 61 | match typ.ptyp_desc with 62 | | Ptyp_tuple types -> pexp_tuple (List.map expression types) 63 | | Ptyp_constr ({ txt = Lident name; _ }, []) when not (should_ignore name) 64 | -> 65 | eapply (evar (mk_copy name)) [ evar (Var.next ()) ] 66 | | Ptyp_constr 67 | ( { txt = Lident constr; _ }, 68 | [ { ptyp_desc = Ptyp_constr ({ txt = Lident name; _ }, []); _ } ] ) 69 | when should_apply constr && not (should_ignore name) -> 70 | let f = Option.get (function_to_apply constr) in 71 | eapply (evar f) [ evar (mk_copy name); evar (Var.next ()) ] 72 | | Ptyp_constr 73 | ( { txt = Lident "ref"; _ }, 74 | [ { ptyp_desc = Ptyp_constr ({ txt = Lident name; _ }, []); _ } ] ) 75 | when not (should_ignore name) -> 76 | let param = evar (Var.next ()) in 77 | [%expr ref ([%e evar (mk_copy name)] ![%e param])] 78 | | Ptyp_constr ({ txt = lid; _ }, []) when should_copy lid -> 79 | let f = Option.get (function_to_copy lid) in 80 | eapply (pexp_ident { txt = f; loc }) [ evar (Var.next ()) ] 81 | | _ -> evar (Var.next ()) 82 | end 83 | 84 | module From_variant = struct 85 | let pattern decl = 86 | Var.reset (); 87 | let args = 88 | match decl.pcd_args with 89 | | Pcstr_tuple [] -> None 90 | | Pcstr_tuple types -> 91 | Some (ppat_tuple (List.map From_core_type.pattern types)) 92 | (* TODO: Pcstr_record *) 93 | | Pcstr_record _ -> None 94 | in 95 | ppat_construct (to_lid decl.pcd_name) args 96 | 97 | let expression decl = 98 | Var.reset (); 99 | let args = 100 | match decl.pcd_args with 101 | | Pcstr_tuple [] -> None 102 | | Pcstr_tuple types -> 103 | Some (pexp_tuple (List.map From_core_type.expression types)) 104 | (* TODO: Pcstr_record *) 105 | | Pcstr_record _ -> None 106 | in 107 | pexp_construct (to_lid decl.pcd_name) args 108 | 109 | let case decl = case ~guard:None ~lhs:(pattern decl) ~rhs:(expression decl) 110 | 111 | let copy decl = pexp_function (List.map case decl) 112 | end 113 | 114 | module From_record = struct 115 | let pattern field = 116 | (to_lid field.pld_name, From_core_type.pattern field.pld_type) 117 | 118 | let expression field = 119 | (to_lid field.pld_name, From_core_type.expression field.pld_type) 120 | 121 | let copy decl = 122 | Var.reset (); 123 | let pattern = ppat_record (List.map pattern decl) Closed in 124 | Var.reset (); 125 | let expression = pexp_record (List.map expression decl) None in 126 | pexp_fun Nolabel None pattern expression 127 | end 128 | 129 | module From_type = struct 130 | let binding decl = 131 | let ( let+ ) v f = Option.map f v in 132 | let+ expr = 133 | match decl.ptype_kind with 134 | | Ptype_variant decl -> Some (From_variant.copy decl) 135 | | Ptype_record decl -> Some (From_record.copy decl) 136 | | _ -> None 137 | in 138 | let name = decl.ptype_name.txt in 139 | let typ = 140 | ptyp_arrow Nolabel 141 | (ptyp_constr { txt = Ldot (Lident "From", name); loc } []) 142 | (ptyp_constr { txt = Ldot (Lident "To", name); loc } []) 143 | in 144 | let pat_name = mk_copy name in 145 | let pat = ppat_constraint (pvar pat_name) (Ast_helper.Typ.poly [] typ) in 146 | let expr = pexp_constraint expr typ in 147 | value_binding ~pat ~expr 148 | end 149 | 150 | module From_signature = struct 151 | let structure_item signature = 152 | let open Ocaml_common in 153 | let bindings = ref [] in 154 | let iterate = 155 | { 156 | Ast_iterator.default_iterator with 157 | type_declaration = 158 | (fun _ decl -> 159 | let decl = Selected_ast.Of_ocaml.copy_type_declaration decl in 160 | match From_type.binding decl with 161 | | Some binding -> bindings := binding :: !bindings 162 | | None -> ()); 163 | } 164 | in 165 | iterate.signature iterate signature; 166 | pstr_value Recursive !bindings 167 | end 168 | 169 | let file = Sys.argv.(1) 170 | 171 | let signature = Ocaml_common.Pparse.parse_interface ~tool_name:"" file 172 | (* 173 | let () = 174 | Format.printf "%a\n%!" Ocaml_common.Printast.implementation 175 | [%str let x : int -> int = fun a -> a] 176 | 177 | let () = 178 | Format.printf "%a\n%!" Pprintast.structure_item 179 | [%stri let x : int -> int = fun a -> a] *) 180 | 181 | let () = 182 | Format.printf "%a\n%!" Pprintast.structure_item 183 | (From_signature.structure_item signature) 184 | --------------------------------------------------------------------------------