summaryrefslogtreecommitdiff
path: root/testsuite/tests/parsing/arrow_ambiguity.ml
blob: 5af88afe2b0418d1c082d2ba288099c05dd86d3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(* TEST
   ocamlc_byte_exit_status = "2"
   * setup-ocamlc.byte-build-env
   ** ocamlc.byte
   *** check-ocamlc.byte-output
*)

(* A potential ambiguity arises because the arrow -> is used
   both in the syntax of core types and module types, and
   (furthermore) the construction "T with type t = ..." means
   that a module type can end with a core type. *)

module type T = sig type t end

(* This is OK *)
module type Foo =
  (T with type t = int) -> T

(* This is OK *)
module type Bar =
  T with type t = int -> int

(* This is not OK.
   Therefore the shift/reduce conflict on MINUSGREATER
   must be solved in favor of shifting. This is why
   MINUSGREATER is declared right-associative. *)
module type Bar =
  T with type t = int -> T