# Manual examples #2008

Merged
merged 3 commits into from Sep 6, 2018

## Conversation

Projects
None yet
3 participants
Member

### gasche commented Aug 27, 2018

 This is a small followup to #1209, completing the Extension-migration work.

### pmetzger reviewed Aug 27, 2018

 type fragile = | Int of int [@warn_on_literal_pattern] | String of string [@warn_on_literal_pattern] let f = function | Int 0 | String "constant" -> () (* trigger warning 52 *) | Int 0 | String "constant" -> ()

#### pmetzger Aug 27, 2018

Member

I don't quite get why the comment was removed?

#### Octachron Aug 27, 2018

Contributor

Because the warning itself is printed by the example preprocessor at the end of the example. Moreover, the option warning=52 tells to the preprocessor that a warning 52 ought to be emitted, otherwise there was an error in the preprocessing.

#### pmetzger Aug 28, 2018

Member

Thanks for the clear explanation.

Contributor

### Octachron left a comment

 The PR looks good to me except two minor remarks.
 let x = begin[@warning "+9"] ... end in .... let x = begin[@warning "+9"] ()[@ellipsis] end

#### Octachron Sep 1, 2018

Contributor

There is a small technical issue here: begin[@warning "+9"] ()[@ellipsis] end is syntactically equivalent to ()[@warning "+9"][@ellipsis], thus everything get elided. A possible fix is to replace ()[@ellipsis] by [()[@ellipsis]] .

 type fragile = | Int of int [@warn_on_literal_pattern] | String of string [@warn_on_literal_pattern] let f = function | Int 0 | String "constant" -> () (* trigger warning 52 *) | Int 0 | String "constant" -> ()

#### Octachron Sep 1, 2018

Contributor

I would split the example in two with an Int and a String case: currently, the function f raises two identical warnings 52 due to the lack of warning locations. I fear that potential reader would miss the fact that two patterns are underlined. Splitting f into f and g seems clearer.

Member Author

### gasche commented Sep 6, 2018

 Thanks @Octachron for the feedback, I changed the examples accordingly and rebased.

### gasche added some commits Aug 27, 2018

 manual: convert more of exten.etex to {caml_example*} 
 14f29e0 
 caml_tex: also provide error output on Lexing errors 
I hit a Lexer error by mistakenly closing an environment with

\end{caml_example*}{verbatim}

\end{caml_example*}

and caml_tex would not quote the wrong input or indicate
at which line the error was, which makes debugging painful.
 549ec65 
 manual: more caml_examples in exten.etex 
 062e203 

### Octachron merged commit 0a05dc8 into ocaml:trunk Sep 6, 2018 1 of 2 checks passed

#### 1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

Closed