Skip to content

Commit 8772756

Browse files
authored
New scaladoc version (#16310)
PR with new scaladoc version. We want to merge it to language-ref, because there is already a reference version generated with older scaladoc that is bugged in some places. It would be best to replace it fairly quickly. This version deployed: https://szymon-rd.github.io/dotty/scala3/index.html ## Major changes (broadly described): - New search engine and algorithm. It is faster and gives better results. We also fixed its UI and introduced no results page. - Adjustments in articles layout. - Packages now form a tree instead of a linear structure. The `scala` package is first and expanded by default. It also behaves differently now (it doesn't jump in a way that was confusing to the user anymore) - Removed flickering of the page. It now behaves as it was written with some framework with virtual DOMs. We made it by intercepting the event that would make the browser reload the page, and prerendering the page before replacing it. The navigation is also faster because of it. It required us to rework some parts of the website. - New layout of members section and their contents (more concise and with improved readability). - Quick Navigation in API members. ToC are sticky now. - Member section filters are now faster and sticky. Added no results page. - Reworked code snippets style and fonts. - Removed contributors (see comments) - Styled tables in the Docs. - Fixed flow of releasing ScalaDoc by modyfing the tasks. It should be now easier to generate the stable docs, and the versions are fixed in the testcases config. - A lot of minor changes in styling and structure of both docs and API sections. We've redesigned the majority of the page and analyzed the implementation side to side to make it strictly match the designs. - Introduced new icons. - More details pages are now visible (going to change that and make them not appear under `Next` instead) ## Fixed bugs with: - Search overlay not always disappearing when clicked outside. - Bad paths in search results. - Rendering of members filters. The `clear` icon now appears where it should and with fixed styling. Dropdown fixed as well. - Empty pages in docs - Rendering, updating and structure of ToC (`In this article`) - Missing pointer cursor - Article content shifting when no ToC. - Collapsing side nav items. - Page jumping when going directly to members. - Mobile menu not appearing on some resolutions. - Member details hiding on interaction with inheritance graph. - Missing spaces in search results. - Recent searches not working as intended. - Linking to a section that has its name duplicated in one doc. Now they get unique id on duplicates. - More minor ones. ## Additional fixes TODO (from @julienrf ) - [x] Instead of showing in the sidebar the previously hidden pages, hide them also from the “Next” buttons - [x] Don’t show all the super types of classes in the list view - [x] In the detailed view, show the super types of classes, but use a comma instead of with - [x] Bring back the “This is a nightly documentation. …” banner (with proper styling) - [x] Fix the “Uncaught TypeError”s - [x] Make the table of contents (“In this article” box) scrollable - [x] Make header names (long package names) scrollable - [ ] Bring back the list of contributors (use --ignore-revs-file)
2 parents 29639f9 + e27c7f9 commit 8772756

File tree

144 files changed

+2923
-1454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2923
-1454
lines changed

docs/_assets/css/frontpage.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ h1#main {
2828
/* navigation */
2929
header {
3030
font-size: 24px;
31+
margin-block-end: calc(2* var(--base-spacing));
3132
}
3233

3334
header .nav-item i {

docs/_assets/docsScalaLangResources/scaladoc-assets.html

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
layout: index
3+
title: Procedures
4+
---
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
layout: index
3+
title: IDEs and Tools
4+
---

docs/_docs/internals/backend.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ BCodeIdiomatic ----------------> utilities for code generation, e.g.
3030

3131
The `BTypes.scala` class contains the `BType` class and predefined BTypes
3232

33-
### Data Flow ###
33+
## Data Flow ##
3434
Compiler creates a `GenBCode` `Phase`, calls `runOn(compilationUnits)`,
3535
which calls `run(context)`. This:
3636

@@ -51,12 +51,12 @@ which calls `run(context)`. This:
5151
- `GenBCodePipeline.drainQ3` writes byte arrays to disk
5252

5353

54-
### Architecture ###
54+
## Architecture ##
5555
The architecture of `GenBCode` is the same as in Scalac. It can be partitioned
5656
into weakly coupled components (called "subsystems" below):
5757

5858

59-
#### (a) The queue subsystem ####
59+
### (a) The queue subsystem ###
6060
Queues mediate between processors, queues don't know what each processor does.
6161

6262
The first queue contains AST trees for compilation units, the second queue
@@ -70,7 +70,7 @@ serialization to disk.
7070

7171
This subsystem is described in detail in `GenBCode.scala`
7272

73-
#### (b) Bytecode-level types, BType ####
73+
### (b) Bytecode-level types, BType ###
7474
The previous bytecode emitter goes to great lengths to reason about
7575
bytecode-level types in terms of Symbols.
7676

@@ -89,7 +89,7 @@ spec (that's why they aren't documented in `GenBCode`, just read the [JVM 8 spec
8989

9090
All things `BType` can be found in `BCodeGlue.scala`
9191

92-
#### (c) Utilities offering a more "high-level" API to bytecode emission ####
92+
### (c) Utilities offering a more "high-level" API to bytecode emission ###
9393
Bytecode can be emitted one opcode at a time, but there are recurring patterns
9494
that call for a simpler API.
9595

@@ -100,7 +100,7 @@ of two strategies.
100100
All these utilities are encapsulated in file `BCodeIdiomatic.scala`. They know
101101
nothing about the type checker (because, just between us, they don't need to).
102102

103-
#### (d) Mapping between type-checker types and BTypes ####
103+
### (d) Mapping between type-checker types and BTypes ###
104104
So that (c) can remain oblivious to what AST trees contain, some bookkeepers
105105
are needed:
106106

@@ -115,7 +115,7 @@ final def exemplar(csym0: Symbol): Tracked = { ... }
115115

116116
Details in `BTypes.scala`
117117

118-
#### (e) More "high-level" utilities for bytecode emission ####
118+
### (e) More "high-level" utilities for bytecode emission ###
119119
In the spirit of `BCodeIdiomatic`, utilities are added in `BCodeHelpers` for
120120
emitting:
121121

@@ -125,5 +125,5 @@ emitting:
125125
- annotations
126126

127127

128-
#### (f) Building an ASM ClassNode given an AST TypeDef ####
128+
### (f) Building an ASM ClassNode given an AST TypeDef ###
129129
It's done by `PlainClassBuilder`(see `GenBCode.scala`).

docs/_docs/internals/contexts.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The `Context` contains the state of the compiler, for example
1616
* `typerState` (for example undetermined type variables)
1717
* ...
1818

19-
### Contexts in the typer ###
19+
## Contexts in the typer ##
2020
The type checker passes contexts through all methods and adapts fields where
2121
necessary, e.g.
2222

@@ -26,7 +26,7 @@ case tree: untpd.Block => typedBlock(desugar.block(tree), pt)(ctx.fresh.withNewS
2626

2727
A number of fields in the context are typer-specific (`mode`, `typerState`).
2828

29-
### In other phases ###
29+
## In other phases ##
3030
Other phases need a context for many things, for example to access the
3131
denotation of a symbols (depends on the period). However they typically don't
3232
need to modify / extend the context while traversing the AST. For these phases
@@ -36,7 +36,7 @@ all members.
3636
**Careful**: beware of memory leaks. Don't hold on to contexts in long lived
3737
objects.
3838

39-
### Using contexts ###
39+
## Using contexts ##
4040
Nested contexts should be named `ctx` to enable implicit shadowing:
4141

4242
```scala

docs/_docs/internals/dotc-scalac.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: "Differences between Scalac and Dotty"
66
Overview explanation how symbols, named types and denotations hang together:
77
[Denotations1]
88

9-
### Denotation ###
9+
## Denotation ##
1010
Comment with a few details: [Denotations2]
1111

1212
A `Denotation` is the result of a name lookup during a given period
@@ -21,7 +21,7 @@ A `Denotation` is the result of a name lookup during a given period
2121
Denotations of methods have a signature ([Signature1]), which
2222
uniquely identifies overloaded methods.
2323

24-
#### Denotation vs. SymDenotation ####
24+
### Denotation vs. SymDenotation ###
2525
A `SymDenotation` is an extended denotation that has symbol-specific properties
2626
(that may change over phases)
2727
* `flags`
@@ -31,7 +31,7 @@ A `SymDenotation` is an extended denotation that has symbol-specific properties
3131
`SymDenotation` implements lazy types (similar to scalac). The type completer
3232
assigns the denotation's `info`.
3333

34-
#### Implicit Conversion ####
34+
### Implicit Conversion ###
3535
There is an implicit conversion:
3636
```scala
3737
core.Symbols.toDenot(sym: Symbol)(implicit ctx: Context): SymDenotation
@@ -42,7 +42,7 @@ implicit conversion does **not** need to be imported, it is part of the
4242
implicit scope of the type `Symbol` (check the Scala spec). However, it can
4343
only be applied if an implicit `Context` is in scope.
4444

45-
### Symbol ###
45+
## Symbol ##
4646
* `Symbol` instances have a `SymDenotation`
4747
* Most symbol properties in the Scala 2 compiler are now in the denotation (in the Scala 3 compiler).
4848

@@ -57,7 +57,7 @@ if (sym is Flags.PackageClass) // Scala 3 (*)
5757
`(*)` Symbols are implicitly converted to their denotation, see above. Each
5858
`SymDenotation` has flags that can be queried using the `is` method.
5959

60-
### Flags ###
60+
## Flags ##
6161
* Flags are instances of the value class `FlagSet`, which encapsulates a
6262
`Long`
6363
* Each flag is either valid for types, terms, or both
@@ -74,7 +74,7 @@ if (sym is Flags.PackageClass) // Scala 3 (*)
7474
`ModuleVal` / `ModuleClass` for either of the two.
7575
* `flags.is(Method | Param)`: true if `flags` has either of the two
7676

77-
### Tree ###
77+
## Tree ##
7878
* Trees don't have symbols
7979
- `tree.symbol` is `tree.denot.symbol`
8080
- `tree.denot` is `tree.tpe.denot` where the `tpe` is a `NamdedType` (see
@@ -87,7 +87,7 @@ if (sym is Flags.PackageClass) // Scala 3 (*)
8787
using `prefix.member(name)`.
8888

8989

90-
### Type ###
90+
## Type ##
9191
* `MethodType(paramSyms, resultType)` from scalac =>
9292
`mt @ MethodType(paramNames, paramTypes)`. Result type is `mt.resultType`
9393

docs/_docs/internals/gadts.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# GADTs - Broad overview
1+
---
2+
layout: doc-page
3+
title: "GADTs - Broad overview"
4+
---
5+
6+
## Introduction
27

38
There are multiple levels to the implementation. They deal with slightly different problems. The most important levels are the following ones:
49

@@ -18,9 +23,9 @@ There are also other parts to supporting GADTs. Roughly in order of importance,
1823
1. Attachment key is named `inferredGadtConstraints`.
1924
4. When we select members on a type that may have GADT constraints, we perform special "healing" by approximating the type using those constraints. We cannot take the constraints into account because member lookup is cached, and GADT constraints are only valid for specific scopes.
2025

21-
# Useful widgets
26+
## Useful widgets
2227

23-
## Expr
28+
### Expr
2429

2530
This is the classical GADT example:
2631

@@ -36,7 +41,7 @@ enum Expr[T] {
3641
}
3742
```
3843

39-
## EQ
44+
### EQ
4045

4146
The following enum will result in an equality constraint between `S` and `T` if we match on it:
4247

@@ -46,7 +51,7 @@ enum EQ[S, T] {
4651
}
4752
```
4853

49-
## SUB
54+
### SUB
5055

5156
The following enum will result in a subtyping constraint `S <: T` if we match on it:
5257

@@ -56,9 +61,9 @@ enum SUB[-S, +T] {
5661
}
5762
```
5863

59-
# Details of above
64+
## Details of above
6065

61-
## What abstract types can have GADT constraints
66+
### What abstract types can have GADT constraints
6267

6368
Right now, we record GADT constraints for:
6469

@@ -67,9 +72,9 @@ Right now, we record GADT constraints for:
6772

6873
There is a branch on the way which will also record them for type members (so path-dependent types) and singleton types. It has a paper associated: "Implementing path-depepdent GADTs for Scala 3".
6974

70-
## What are necessary relationships? Any examples?
75+
### What are necessary relationships? Any examples?
7176

72-
### Covariance means no constraint is necessary
77+
#### Covariance means no constraint is necessary
7378

7479
Standard (non-case) classes allow "strange" inheritance which means that we cannot infer any information from covariant type parameters.
7580

@@ -90,7 +95,7 @@ class Weird(list: List[String]) extends IntList with Expr[Nothing]
9095

9196
Case classes have a special check which disallows inheritance like `Weird`. This means we can infer extra information from them.
9297

93-
## Breaking down the constraints
98+
### Breaking down the constraints
9499

95100
```scala
96101
class Expr[A]
@@ -113,9 +118,9 @@ def foo[T](e: Expr[List[T]]): T =
113118
}
114119
```
115120

116-
## Relation betweeen GadtConstraint and OrderingConstraint
121+
### Relation betweeen GadtConstraint and OrderingConstraint
117122

118-
### Internal and external types
123+
#### Internal and external types
119124

120125
GadtConstraint uses OrderingConstraint as the datastructure to record information about GADT constraints.
121126

@@ -127,9 +132,9 @@ To solve this, GadtConstraint internally creates TypeParamRefs which it adds to
127132

128133
The TypeParamRefs and TypeVars registered in one constraint cannot ever be present in types mentioned in the other type constraint. The internal TypeParamRefs and TypeVars cannot ever leak out of the GadtConstraint. We cannot ever record a bound in GadtConstraint which mentions TypeParamRefs used for type inference. (That part is ensured by the way TypeComparer is organised &#x2013; we will always try to record bounds in the "normal" constraint before recording a GADT bound.)
129134

130-
# Other details
135+
## Other details
131136

132-
## TypeComparer approximations
137+
### TypeComparer approximations
133138

134139
TypeComparer sometimes approximates the types it compares. Let's see an example based on these definitions:
135140

@@ -142,11 +147,11 @@ when comparing if `IntList <: Expr[Int]`, `TypeComparer` will approximate `IntLi
142147

143148
The variables which TypeComparer sets are `approxState` and `frozenGadt`.
144149

145-
## Necessary/sufficient either
150+
### Necessary/sufficient either
146151

147152
TypeComparer sometimes needs to approximate some constraints, specifically when dealing with intersection and union types. The way this approximation works changes if we're currently inferring GADT constraints. This is hopefully documented well in TypeComparer in doc comments for `necessaryEither` and `sufficientEither`.
148153

149-
## Types bound in patterns
154+
### Types bound in patterns
150155

151156
```scala
152157
(list : List[Int]) match {
@@ -161,7 +166,7 @@ TypeComparer sometimes needs to approximate some constraints, specifically when
161166
}
162167
```
163168

164-
## Internal structure of OrderingConstraint
169+
### Internal structure of OrderingConstraint
165170

166171
Imagine we have two type parameters in scope, `A` and `B`.
167172

@@ -184,19 +189,19 @@ B <: A
184189

185190
The first two constraints are "entries" &#x2013; they are easy to look up whenever we ask for bounds of `A` or `B`. The third constraint is an ordering &#x2013; it helps with correctly propagating the bounds we record.
186191

187-
# Possible broad improvements
192+
## Possible broad improvements
188193

189-
## Allow OrderingConstraint to record bounds for things other than TypeParamRefs
194+
### Allow OrderingConstraint to record bounds for things other than TypeParamRefs
190195

191196
This would mean we no longer need to keep the bidirectional mapping in GadtConstraint.
192197

193-
## Not mixing OrderingConstraint and ConstraintHandling in GadtConstraint
198+
### Not mixing OrderingConstraint and ConstraintHandling in GadtConstraint
194199

195200
GadtConstraint right now mixes OrderingConstraint and ConstraintHandling. The first one is supposed to be the immutable constraint datastructure. The second one implements mutable functionality around a variable containing the immutable datastructure.
196201

197202
GadtConstraint mixes them both. Things would be better organised if GadtConstraint was split like the normal constraint.
198203

199-
## Creating a separate TypeComparer for breaking down types into GADT constraints
204+
### Creating a separate TypeComparer for breaking down types into GADT constraints
200205

201206
TypeComparer is biased towards one specific way of approximating constraints. When we infer types, it's ok to be "optimistic". When inferring GADT constraints, we should be as pessimistic as possible, in order to only infer constraints which are necessary.
202207

docs/_docs/internals/syntax-3.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ hexDigit ::= ‘0’ | … | ‘9’ | ‘A’ | … | ‘F’ | ‘a’ |
1616

1717
Informal descriptions are typeset as `“some comment”`.
1818

19-
### Lexical Syntax
19+
## Lexical Syntax
2020
The lexical syntax of Scala is given by the following grammar in EBNF
2121
form.
2222

docs/_docs/internals/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ hexDigit ::= ‘0’ | … | ‘9’ | ‘A’ | … | ‘F’ | ‘a’ |
3030

3131
Informal descriptions are typeset as `“some comment”`.
3232

33-
### Lexical Syntax
33+
## Lexical Syntax
3434

3535
The lexical syntax of Scala is given by the following grammar in EBNF
3636
form.

docs/_docs/reference/changed-features/imports.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ import scala.annotation as ann
3838
import java as j
3939
```
4040

41-
### Migration
41+
## Migration
4242

4343
To support cross-building, Scala 3.0 supports the old import syntax with `_` for wildcards and `=>` for renamings in addition to the new one. The old syntax
4444
will be dropped in a future versions. Automatic rewritings from old to new syntax
4545
are offered under settings `-source 3.1-migration -rewrite`.
4646

47-
### Syntax
47+
## Syntax
4848

4949
```
5050
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}

docs/_docs/reference/changed-features/wildcards.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ List[?]
1010
Map[? <: AnyRef, ? >: Null]
1111
```
1212

13-
### Motivation
13+
## Motivation
1414

1515
We would like to use the underscore syntax `_` to stand for an anonymous type parameter, aligning it with its meaning in
1616
value parameter lists. So, just as `f(_)` is a shorthand for the lambda `x => f(x)`, in the future `C[_]` will be a shorthand
@@ -21,7 +21,7 @@ In the future, `F[_]` will mean the same thing, no matter where it is used.
2121
We pick `?` as a replacement syntax for wildcard types, since it aligns with
2222
[Java's syntax](https://docs.oracle.com/javase/tutorial/java/generics/wildcardGuidelines.html).
2323

24-
### Migration Strategy
24+
## Migration Strategy
2525

2626
The migration to the new scheme is complicated, in particular since the [kind projector](https://github.com/typelevel/kind-projector)
2727
compiler plugin still uses the reverse convention, with `?` meaning parameter placeholder instead of wildcard. Fortunately, kind projector has added `*` as an alternative syntax for `?`.

docs/_docs/reference/contextual/by-name-context-parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ val s = summon[Test.Codec[Option[Int]]](
5959

6060
No local given instance was generated because the synthesized argument is not recursive.
6161

62-
### Reference
62+
## Reference
6363

6464
For more information, see [Issue #1998](https://github.com/lampepfl/dotty/issues/1998)
6565
and the associated [Scala SIP](https://docs.scala-lang.org/sips/byname-implicits.html).

docs/_docs/reference/contextual/context-functions-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ See the section on Expressiveness from [Simplicitly: foundations and
7474
applications of implicit function
7575
types](https://dl.acm.org/citation.cfm?id=3158130).
7676

77-
### Type Checking
77+
## Type Checking
7878

7979
After desugaring no additional typing rules are required for context function types.

0 commit comments

Comments
 (0)