Skip to content

Commit

Permalink
Merge pull request #87 from upenn-cis1xx/ocaml-4.13.0-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
KeenWill authored Sep 30, 2022
2 parents 87d9a0b + 7d2114f commit 9292d92
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ jobs:
- macos-latest
- ubuntu-latest
ocaml-version:
- 4.10.0
- 4.10.1
- 4.11.0
- 4.11.1
- 4.13.0
- 4.13.1

runs-on: ${{ matrix.os }}

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.0.0 (2022-09-29)

Move from supporting OCaml 4.10.0 to instead support OCaml 4.13.0:
* Migrate from `Stream` in the stdlib to `camlp-streams`, an opam package with the same functionality.
* `Parsetree` was updated and required code changes:
* Support for `Pwith_modtype` and `Pwith_modtypesubst` variants.
* Support for `Psig_modtypesubst` variant.
* Rearranging some type deconstruction for `Ppat_construct` which was restructured slightly.

## 1.7.1 (2022-02-01)

Fixes:
Expand Down
5 changes: 3 additions & 2 deletions camelot.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.7.1"
version: "2.0.0"
synopsis: "An OCaml Linter / Style Checker"
maintainer: ["William Goeller <[email protected]>"]
authors: ["Vighnesh Vijay" "Daniel Like" "William Goeller"]
Expand All @@ -9,9 +9,10 @@ homepage: "https://github.com/upenn-cis1xx/camelot"
bug-reports: "https://github.com/upenn-cis1xx/camelot/issues"
depends: [
"dune" {>= "2.5"}
"ocaml" {>= "4.10.0" & < "4.13.0"}
"ocaml" {>= "4.13.0"}
"ANSITerminal" {>= "0.8"}
"yojson" {>= "1.7.0"}
"camlp-streams" {>= "5.0.1"}
"ppx_expect" {with-test & >= "v0.13.0"}
"odoc" {with-doc & >= "1.5.0"}
]
Expand Down
5 changes: 3 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(name camelot)
(generate_opam_files true)

(version 1.7.1)
(version 2.0.0)

(source (github upenn-cis1xx/camelot))
(license "Apache-2.0")
Expand All @@ -14,9 +14,10 @@
(synopsis "An OCaml Linter / Style Checker")
(depends
(dune (>= 2.5))
(ocaml (and (>= 4.10.0) (< 4.13.0)))
(ocaml (>= 4.13.0))
(ANSITerminal (>= 0.8))
(yojson (>= 1.7.0))
(camlp-streams (>= 5.0.1))
(ppx_expect (and :with-test (>= v0.13.0)))
(odoc (and :with-doc (>= 1.5.0)))
)
Expand Down
2 changes: 1 addition & 1 deletion lib/style/match.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module MatchListVerbose : EXPRCHECK = struct
(* Predicate for checking that a match case looks like x :: [] *)
let pat_pred (pat: Parsetree.pattern) : bool =
begin match pat.ppat_desc with
| Ppat_construct ({txt = Lident "::";_}, Some matchcase) ->
| Ppat_construct ({txt = Lident "::";_}, Some (_, matchcase)) ->
begin match matchcase.ppat_desc with
| Ppat_tuple ([_; cons_case]) -> is_pat_constr cons_case "[]"
| _ -> false
Expand Down
7 changes: 6 additions & 1 deletion lib/traverse/descent.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ module MT = struct
iter_loc sub lid; sub.type_declaration sub d
| Pwith_modsubst (s, lid) ->
iter_loc sub s; iter_loc sub lid
| Pwith_modtype (lid, m) ->
sub.module_type sub m; iter_loc sub lid
| Pwith_modtypesubst (lid, m) ->
sub.module_type sub m; iter_loc sub lid

let iter_signature_item sub {psig_desc = desc; psig_loc = loc} =
sub.location sub loc;
Expand All @@ -213,6 +217,7 @@ module MT = struct
| Psig_recmodule l ->
List.iter (sub.module_declaration sub) l
| Psig_modtype x -> sub.module_type_declaration sub x
| Psig_modtypesubst x -> sub.module_type_declaration sub x
| Psig_open x -> sub.open_description sub x
| Psig_include x -> sub.include_description sub x
| Psig_class l -> List.iter (sub.class_description sub) l
Expand Down Expand Up @@ -368,7 +373,7 @@ module P = struct
| Ppat_interval _ -> ()
| Ppat_tuple pl -> List.iter (sub.pat sub) pl
| Ppat_construct (l, p) ->
iter_loc sub l; iter_opt (sub.pat sub) p
iter_loc sub l; iter_opt (sub.pat sub) (Option.map snd p)
| Ppat_variant (_l, p) -> iter_opt (sub.pat sub) p
| Ppat_record (lpl, _cf) ->
List.iter (iter_tuple (iter_loc sub) (sub.pat sub)) lpl
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/astutils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ let ident_of_let (pat: Parsetree.value_binding) : string =

let binding_of_lcase (case: Parsetree.case) : string =
begin match case.pc_lhs.ppat_desc with
| Ppat_construct ({txt = Lident "::"; loc = _}, Some bound) ->
| Ppat_construct ({txt = Lident "::"; loc = _}, Some (_, bound)) ->
begin match bound.ppat_desc with
| Ppat_tuple [_; tail] ->
begin match tail.ppat_desc with
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(library
(name utils)
(libraries compiler-libs.common canonical))
(libraries compiler-libs.common canonical camlp-streams))

0 comments on commit 9292d92

Please sign in to comment.