Commits

Peter Szilagyi committed 430900c

ocaml/contrib/ocp-indent/tests: Ah, provision resolution on the indentation of single-pattern "function"s.

  • Participants
  • Parent commits 7975a75

Comments (0)

Files changed (1)

ocaml/contrib/ocp-indent/tests/js-pattern.ml

 
 
 let check_price t = function
-  { Exec.
-    security_type = Some security_type;
-    symbol = Some full_symbol_hum;
-    currency = Some currency;
-    price = Some price;
-    trade_at_settlement = (None | Some false);
-    executing_exchange;
-    fill_id;
-  } -> ()
-(* CR pszilagyi: My initial thinking is: The record is a pattern, so it should be indented
-   at the same level as a simpler pattern, which should be indented 4 right (leaving room
-   for the "|" that would be indented 2 right if it were there).  That's a weird rule,
-   when applied to patterns without any "|", like this.
-
-   Maybe we actually want the indentation to be different depending on the presence of the
-   "|"?  That might make it difficult for ocp-indent, since that will be extra-syntactic.
-   I suppose ocp-indent already has that problem if its indenting different binary
-   operators differently?
-
-   Tuareg indents the record -2 from the above, which may be the right thing sans "|".  We
-   make a policy of including the "|" if we're matching alternatives, so do we care?
-   Like, the above wouldn't use "function", but "fun". *)
+    { Exec.
+      security_type = Some security_type;
+      symbol = Some full_symbol_hum;
+      currency = Some currency;
+      price = Some price;
+      trade_at_settlement = (None | Some false);
+      executing_exchange;
+      fill_id;
+    } -> ()
+(* This and the similar case below ("function" with one pattern) are intermediate states
+   of editing (you'd never write "function" with one pattern), but we want to indent them
+   to match subsequent cases we're going to add. *)
 
 let check_price t = function
   | { Exec.
   | simpler -> ()
 
 let check_price t = function
-  simpler -> ()                         (* Tuareg gets this 2 too far left? *)
+    simpler -> ()                       (* Tuareg gets this 4 too far left. *)
 
 let check_price t = function
     simpler -> ()                       (* Tuareg gets this 4 too far left. *)