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

Print 'private' keyword for private type extensions #1019

Merged
merged 1 commit into from
Oct 17, 2023
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
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
Loading