Skip to content

Commit

Permalink
Print 'private' keyword for private type extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Oct 17, 2023
1 parent b8e4d23 commit c4cc629
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Tags:
- Add a tooltip to references with text (@Julow, #945)
- Add emoji to alerts in CSS (@yawaramin, #928)
- Add common language in shipped highlightjs (@Julow, #953)
- Display 'private' keyword for private type extensions (@gpetiot, #1019)

### Fixed
- Fix `--hidden` not always taken into account (@panglesd, #940)
Expand Down
3 changes: 3 additions & 0 deletions src/document/generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,9 @@ module Make (Syntax : SYNTAX) = struct
O.keyword "type" ++ O.txt " "
++ Link.from_path (t.type_path :> Paths.Path.t)
++ O.txt " +=" ++ O.sp
++
if t.private_ then O.keyword Syntax.Type.private_keyword ++ O.sp
else O.noop
in
let content =
O.documentedSrc prefix
Expand Down
3 changes: 2 additions & 1 deletion test/generators/html/Ocamlary.html
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,8 @@ <h4 id="advanced-type-stuff">
<div class="spec type extension anchored" id="extension-decl-ExtF">
<a href="#extension-decl-ExtF" class="anchor"></a>
<code>
<span><span class="keyword">type</span> <a href="#type-ext">ext</a> +=
<span><span class="keyword">type</span> <a href="#type-ext">ext</a>
+= <span class="keyword">private</span>
</span>
</code>
<ol>
Expand Down
2 changes: 1 addition & 1 deletion test/generators/latex/Ocamlary.tex
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ \subsubsection{Advanced Type Stuff\label{advanced-type-stuff}}%
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlcodefragment{| \ocamltag{extension}{ExtE}}\label{module-Ocamlary-extension-ExtE}\\
\end{ocamltabular}%
\\
\label{module-Ocamlary-extension-decl-ExtF}\ocamlcodefragment{\ocamltag{keyword}{type} \hyperref[module-Ocamlary-type-ext]{\ocamlinlinecode{ext}} += }\\
\label{module-Ocamlary-extension-decl-ExtF}\ocamlcodefragment{\ocamltag{keyword}{type} \hyperref[module-Ocamlary-type-ext]{\ocamlinlinecode{ext}} += \ocamltag{keyword}{private} }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlcodefragment{| \ocamltag{extension}{ExtF}}\label{module-Ocamlary-extension-ExtF}\\
\end{ocamltabular}%
\\
Expand Down
2 changes: 1 addition & 1 deletion test/generators/man/Ocamlary.3o
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ A mystery wrapped in an ellipsis
| \f[CB]ExtE\fR
.br
.sp
\f[CB]type\fR ext +=
\f[CB]type\fR ext += \f[CB]private\fR
.br
.ti +2
| \f[CB]ExtF\fR
Expand Down

0 comments on commit c4cc629

Please sign in to comment.