Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify syntax #70

Merged
merged 2 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/syntax/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ type_def:
| UNIT n=IDENT EQ
OR? vs=separated_list(OR, variant) %prec over_TOP
{ TDAdt (n, [], vs) }
| n=IDENT EQ
OR? vs=separated_list(OR, variant) %prec over_TOP
{ TDAdt (n, [], vs) }
| tv=TYPEVAR n=IDENT
EQ OR? vs=separated_list(OR, variant) %prec over_TOP
{ TDAdt (n, [ Ident.from tv ], vs) }
Expand Down Expand Up @@ -288,6 +291,8 @@ sig_comp:
{ SpecAbstTy (t, (List.map Ident.from tvs)) }
| TYPE UNIT t=IDENT
{ SpecAbstTy (t, []) }
| TYPE t=IDENT
{ SpecAbstTy (t, []) }
| def=type_def_group { SpecManiTy def }
| MODULE m_name=MIDENT COLON mt=mod_type { SpecMod (m_name, mt) }
| MODULE TYPE m_name=MIDENT EQ mt=mod_type { SpecModSig (m_name, mt) }
Expand Down
2 changes: 0 additions & 2 deletions lib/typing/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ let captured_scope (s : scope) (tpv : Types_in.tv ref) =

let captured (env : t) tpv = List.exists (fun s -> captured_scope s tpv) env

let size = List.length

(**********Debug Function*************)
let dbg (env : t) =
let scope_values s =
Expand Down
2 changes: 1 addition & 1 deletion tests/cram/test_dirs/interval_functor.t/test_interval.fun
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ external compare : int -> int -> int = "ff_builtin_minus"
external greater : int -> int -> bool = "ff_builtin_greater"

module type Comparable = sig
type () t
type t

val compare : t -> t -> int
end
Expand Down
10 changes: 5 additions & 5 deletions tests/cram/test_dirs/match.t/test_match.fun
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
external print_int : int -> int = "ff_builtin_print_int"

type () int_l
= Cons of int
| Nil
type int_l =
| Cons of int
| Nil

let x = Nil
let f = (fun x ->
Expand All @@ -15,8 +15,8 @@ let n = (f Nil)
let n = (f (Cons 998))


type () int_tu
= Tu of (int * int)
type int_tu =
| Tu of (int * int)


let n = Tu (10, 22)
Expand Down
2 changes: 1 addition & 1 deletion tests/cram/test_dirs/sort.t/test_sort.fun
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ external print_int : int -> unit = "ff_builtin_print_int"
external print_string : string -> unit = "ff_builtin_print_str"

module type Cmp = sig
type () t
type t

val compare : t -> t -> bool
end
Expand Down
14 changes: 13 additions & 1 deletion tests/regular/parse_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,19 @@ let x = 1
(start_loc ((pos_fname "") (pos_lnum 4) (pos_bol 33) (pos_cnum 41)))
(end_loc ((pos_fname "") (pos_lnum 4) (pos_bol 33) (pos_cnum 42)))
(attrs ()))))
|}]
|}];

print_parsed_program
{|
module type X = sig
type t
end
|};
[%expect {| ((TopModSig X (MTSig ((SpecAbstTy t ()))))) |}];
print_parsed_program {|
type t = | Nil
|};
[%expect {| ((TopTypeDef ((TDAdt t () ((Nil ())))))) |}]

let%expect_test "Test: path parsing" =
print_parsed_mod_expr {|X|};
Expand Down
Loading