Skip to content

Commit 44f8e03

Browse files
committed
Don't display inline if annots force it
1 parent e13fc2d commit 44f8e03

File tree

4 files changed

+57
-98
lines changed

4 files changed

+57
-98
lines changed

tastydoc/documentation/dotty/DottyPredef$.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ dotty
44
<pre><code class="language-scala" >final object DottyPredef extends Serializable</pre></code>
55
## Concrete Value Members:
66
### assert
7-
<pre><code class="language-scala" >@forceInline final inline def assert(assertion: => Boolean): Unit</pre></code>
7+
<pre><code class="language-scala" >@forceInline final def assert(assertion: => Boolean): Unit</pre></code>
88

99
### assert
10-
<pre><code class="language-scala" >@forceInline final inline def assert(assertion: => Boolean, message: => Any): Unit</pre></code>
10+
<pre><code class="language-scala" >@forceInline final def assert(assertion: => Boolean, message: => Any): Unit</pre></code>
1111

1212
### assertFail
1313
<pre><code class="language-scala" >def assertFail(message: => Any): Unit</pre></code>
@@ -16,10 +16,10 @@ dotty
1616
<pre><code class="language-scala" >def assertFail(): Unit</pre></code>
1717

1818
### implicitly
19-
<pre><code class="language-scala" >@forceInline final inline def implicitly[T](implicit ev: T): T</pre></code>
19+
<pre><code class="language-scala" >@forceInline final def implicitly[T](implicit ev: T): T</pre></code>
2020

2121
### locally
22-
<pre><code class="language-scala" >@forceInline inline def locally[T](body: => T): T</pre></code>
22+
<pre><code class="language-scala" >@forceInline def locally[T](body: => T): T</pre></code>
2323

2424
### the
2525
<pre><code class="language-scala" >inline def the[T](x: T): x</pre></code>
-53.5 KB
Binary file not shown.

tastydoc/report/presentation/presentation.tex

Lines changed: 45 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ \section{Introduction}
6262

6363
\begin{frame}
6464
\frametitle{What is Tastydoc ?}
65-
\pause
6665
\begin{itemize}
67-
\item Documentation tool for Dotty \pause
68-
\item Uses TASTy files \pause
66+
\item Documentation tool for Dotty
67+
\item Uses TASTy files
6968
\item Outputs Markdown
7069
\end{itemize}
7170
\end{frame}
@@ -74,43 +73,29 @@ \section{Features}
7473

7574
\begin{frame}
7675
\frametitle{Accessible information}
77-
\pause
7876
\begin{itemize}
79-
\item Annotations, modifiers (including scope modifiers), parameters, type parameters, and return types \pause
80-
\item Members, parents, constructors, known subclasses and companion \pause
77+
\item Annotations, modifiers (including scope modifiers), parameters, type parameters, and return types
78+
\item Members, parents, constructors, known subclasses and companion
8179
\item User documentation (Wiki-style \& Markdown)
80+
\item Reference for linking
8281
\end{itemize}
8382
\end{frame}
8483

8584
\begin{frame}
8685
\frametitle{TASTy}
87-
\pause
8886
\begin{itemize}
89-
\item Extract information from them \pause
87+
\item Extract information from them
9088
\item Independent from the compiler
9189
\end{itemize}
9290
\end{frame}
9391

94-
\begin{frame}
95-
\frametitle{Linking}
96-
\pause
97-
\begin{itemize}
98-
\item To types \pause
99-
\item Companion \pause
100-
\item Annotations \pause
101-
\item Scope modifiers \pause
102-
\item Parents
103-
\end{itemize}
104-
\end{frame}
105-
10692
\begin{frame}
10793
\frametitle{Markdown}
108-
\pause
10994
\begin{itemize}
110-
\item Easy to edit by hand \& preview \pause
111-
\item Easy to add own files \pause
112-
\item Easy for the user to make links \pause
113-
\item Git hosting services have built-in preview \pause
95+
\item Easy to edit by hand \& preview
96+
\item Easy to add own files
97+
\item Easy for the user to make links
98+
\item Git hosting services have built-in preview
11499
\item Easy to convert to another format (HTML, PDF, etc.)
115100
\end{itemize}
116101
\end{frame}
@@ -139,87 +124,61 @@ \section{Examples}
139124

140125
\section{Architecture}
141126

142-
\begin{frame}
143-
\frametitle{Representation}
144-
\pause
145-
\begin{itemize}
146-
\item Contain information about an entity \pause
147-
\item Easy to use, no knowledge of TASTy required \pause
148-
\item Code is easy to maintain \pause
149-
\item Similar to Dottydoc Entity \textrightarrow can reuse Dottydoc code
150-
\end{itemize}
151-
\end{frame}
152-
153-
\begin{frame}
154-
\frametitle{Reference}
155-
\pause
156-
\begin{itemize}
157-
\item Contain information about types \pause
158-
\item Necessary for linking \pause
159-
\item Inspired by Dottydoc
160-
\end{itemize}
161-
\end{frame}
162-
163-
\begin{frame}[fragile]
164-
\frametitle{User documentation}
165-
\pause
166-
\begin{itemize}
167-
\item Access to all @ except \texttt{@usecase} and \texttt{@define}\pause
168-
\item Support Wiki-style and Markdown \pause
169-
\item Uses Dottydoc code modified for:
170-
\begin{itemize}
171-
\item Markdown output
172-
\item Small changes in structure
173-
\end{itemize}
174-
\end{itemize}
175-
\end{frame}
176-
177127
\begin{frame}
178128
\frametitle{Workflow}
179-
\pause
129+
180130
\begin{center}
181131
\begin{tikzpicture}[node distance=2cm]
182-
\node (parse) [process] {Parse command line arguments};\pause
132+
\node (parse) [process] {Parse command line arguments};
183133
\node (convert) [process, below of=parse] {Convert TASTy files to Representations while keeping track of seen packages};
184-
\draw [arrow] (parse) -- (convert);\pause
134+
\draw [arrow] (parse) -- (convert);
185135
\node (output) [process, below of=convert] {Traverse Representations, parse user documentation, format output and write to files};
186136

187137
\draw [arrow] (convert) -- (output);
188138
\end{tikzpicture}
189139
\end{center}
190140
\end{frame}
191141

192-
\section{Dottydoc vs Tastydoc}
142+
\begin{frame}
143+
\frametitle{Representation}
144+
145+
\begin{itemize}
146+
\item Contain information about an entity
147+
\item Easy to use, no knowledge of TASTy required
148+
\item Code is easy to maintain
149+
\item Similar to Dottydoc Entity \textrightarrow can reuse Dottydoc code
150+
\end{itemize}
151+
\end{frame}
193152

194153
\begin{frame}
195-
\frametitle{General comparison}
196-
\pause
154+
\frametitle{Reference}
197155
\begin{itemize}
198-
\item Compiler internals \pause
199-
\item Markdown vs HTML/CSS
156+
\item Contain information about types
157+
\item Necessary for linking
158+
\item Inspired by Dottydoc
200159
\end{itemize}
201160
\end{frame}
202161

162+
\section{Dottydoc vs Tastydoc}
163+
203164
\begin{frame}
204165
\frametitle{Extra features}
205-
\pause
206166
\begin{itemize}
207-
\item Scope modifiers \pause
208-
\item Known subclasses \pause
167+
\item Scope modifiers
168+
\item Known subclasses
209169
\item Refined types
210170
\end{itemize}
211171
\end{frame}
212172

213173
\begin{frame}[fragile]
214174
\frametitle{Bugs fixed}
215-
\pause
216175
\begin{itemize}
217176
\item Buggy output
218177
\begin{lstlisting}
219178
final val BITS_PER_LAZY_VAL : [31m2L[0m
220-
\end{lstlisting}\pause
221-
\item Wrong parents \pause
222-
\item Annotations \pause
179+
\end{lstlisting}
180+
\item Wrong parents
181+
\item Annotations
223182
\item Compiler artifacts \pause
224183
\item potentially program breaking code
225184
\begin{lstlisting}[language=scala]
@@ -232,38 +191,37 @@ \section{Problems \& Further work}
232191

233192
\begin{frame}
234193
\frametitle{Problems}
235-
\pause
194+
236195
\begin{itemize}
237-
\item Markdown escaping \pause
238-
\item Linking inside code blocks \pause
239-
\item Sections \pause
196+
\item Markdown escaping
197+
\item Linking inside code blocks
198+
\item Sections
240199
\item IDs for linking
241200
\end{itemize}
242201
\end{frame}
243202

244203
\begin{frame}[fragile]
245204
\frametitle{Further work}
246-
\pause
205+
247206
\begin{itemize}
248-
\item Markdown escaping \pause
249-
\item Type lambdas \pause
207+
\item Markdown escaping
208+
\item Type lambdas
250209
\item Complex types
251210
\begin{lstlisting}[language=scala]
252211
class Graph {
253212
type Node = Int
254213
}
255214
def linkingGraph(g: Graph): g.Node = ???
256-
\end{lstlisting}\pause
257-
\item Default values \pause
258-
\item Extra user-documentation parsing \pause
215+
\end{lstlisting}
216+
\item Default values
217+
\item Extra user-documentation parsing
259218
\item HTML/CSS
260219
\end{itemize}
261220
\end{frame}
262221

263222
\begin{frame}
264-
\frametitle{Questions ?}
265223
\begin{center}
266-
\Huge{?}
224+
\Huge{Questions ?}
267225
\end{center}
268226
\end{frame}
269227

tastydoc/src/dotty/tastydoc/DocPrinter.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ class DocPrinter(mutablePackagesMap: scala.collection.mutable.HashMap[String, Em
9494
")"
9595
)
9696

97-
private def formatModifiers(modifiers: List[String], privateWithin: Option[Reference], protectedWithin: Option[Reference], declarationPath: List[String]): String = {
98-
val filteredModifiers = modifiers.filter(x => x != "private" && x != "protected")
97+
private def formatModifiers(modifiers: List[String], privateWithin: Option[Reference], protectedWithin: Option[Reference], annotations: List[TypeReference], declarationPath: List[String]): String = {
98+
val hasInlineAnnot = annotations.contains(TypeReference("forceInline", "/scala", Nil, true))
99+
val filteredModifiers = modifiers.filter(x => x != "private" && x != "protected" && (!hasInlineAnnot || x != "inline"))
99100

100101
(privateWithin match {
101102
case Some(r) => formatReferences(r, declarationPath).mkString("private[", "", "] ")
@@ -154,7 +155,7 @@ class DocPrinter(mutablePackagesMap: scala.collection.mutable.HashMap[String, Em
154155
def formatSimplifiedSignature(): String = {
155156
htmlPreCode(
156157
formatAnnotations(representation.annotations, declarationPath) +
157-
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, declarationPath) +
158+
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, representation.annotations, declarationPath) +
158159
representation.kind +
159160
" " +
160161
makeLink(representation.name, representation.path.mkString("/", "/", ""), true, declarationPath)
@@ -179,7 +180,7 @@ class DocPrinter(mutablePackagesMap: scala.collection.mutable.HashMap[String, Em
179180
}
180181

181182
def formatSignature(): String = {
182-
htmlPreCode(formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, representation.path) +
183+
htmlPreCode(formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, representation.annotations, representation.path) +
183184
representation.kind +
184185
" " +
185186
(if(representation.isObject) representation.name.stripSuffix("$") else representation.name) +
@@ -339,7 +340,7 @@ class DocPrinter(mutablePackagesMap: scala.collection.mutable.HashMap[String, Em
339340
private def formatDefRepresentation(representation: DefRepresentation, declarationPath: List[String]): String = {
340341
htmlPreCode(
341342
formatAnnotations(representation.annotations, declarationPath) +
342-
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, declarationPath) +
343+
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, representation.annotations, declarationPath) +
343344
"def " +
344345
representation.name +
345346
(if(representation.typeParams.nonEmpty) representation.typeParams.mkString("[", ", ", "]") else "") +
@@ -357,7 +358,7 @@ class DocPrinter(mutablePackagesMap: scala.collection.mutable.HashMap[String, Em
357358
private def formatValRepresentation(representation: ValRepresentation, declarationPath: List[String]): String = {
358359
htmlPreCode(
359360
formatAnnotations(representation.annotations, declarationPath) +
360-
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, declarationPath) +
361+
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, representation.annotations, declarationPath) +
361362
(if(representation.isVar) "var " else "val ") +
362363
representation.name +
363364
": " +
@@ -371,7 +372,7 @@ class DocPrinter(mutablePackagesMap: scala.collection.mutable.HashMap[String, Em
371372
private def formatTypeRepresentation(representation: TypeRepresentation, declarationPath: List[String]): String = {
372373
htmlPreCode(
373374
formatAnnotations(representation.annotations, declarationPath) +
374-
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, declarationPath) +
375+
formatModifiers(representation.modifiers, representation.privateWithin, representation.protectedWithin, representation.annotations, declarationPath) +
375376
"type " +
376377
representation.name +
377378
(if(representation.isAbstract) "" else ": " + formatReferences(representation.alias.get, declarationPath))

0 commit comments

Comments
 (0)