Skip to content

Commit d5ac8e5

Browse files
authored
Adjust headers levels (#15933)
- Increase all header levels in files without h2 headers - Fix docs starting with h3 headers - Few other minor header fixes
2 parents a42fe2a + 8f18d67 commit d5ac8e5

34 files changed

+105
-105
lines changed

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/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.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For example, continuing with the previous definitions,
4848
g((ctx: ExecutionContext) ?=> f(3)(using ctx)) // is left as it is
4949
```
5050

51-
### Example: Builder Pattern
51+
## Example: Builder Pattern
5252

5353
Context function types have considerable expressive power. For
5454
instance, here is how they can support the "builder pattern", where
@@ -112,7 +112,7 @@ With that setup, the table construction code above compiles and expands to:
112112
}(using $t)
113113
}
114114
```
115-
### Example: Postconditions
115+
## Example: Postconditions
116116

117117
As a larger example, here is a way to define constructs for checking arbitrary postconditions using an extension method `ensuring` so that the checked result can be referred to simply by `result`. The example combines opaque type aliases, context function types, and extension methods to provide a zero-overhead abstraction.
118118

@@ -146,7 +146,7 @@ val s =
146146
assert(result == 6)
147147
result
148148
```
149-
### Reference
149+
## Reference
150150

151151
For more information, see the [blog article](https://www.scala-lang.org/blog/2016/12/07/implicit-function-types.html),
152152
(which uses a different syntax that has been superseded).

docs/_docs/reference/contextual/contextual.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: "Contextual Abstractions"
44
nightlyOf: https://docs.scala-lang.org/scala3/reference/contextual.html
55
---
66

7-
### Critique of the Status Quo
7+
## Critique of the Status Quo
88

99
Scala's implicits are its most distinguished feature. They are _the_ fundamental way to abstract over context. They represent a unified paradigm with a great variety of use cases, among them: implementing type classes, establishing context, dependency injection, expressing capabilities, computing new types and proving relationships between them.
1010

@@ -46,7 +46,7 @@ Historically, many of these shortcomings come from the way implicits were gradua
4646

4747
Existing Scala programmers by and large have gotten used to the status quo and see little need for change. But for newcomers this status quo presents a big hurdle. I believe if we want to overcome that hurdle, we should take a step back and allow ourselves to consider a radically new design.
4848

49-
### The New Design
49+
## The New Design
5050

5151
The following pages introduce a redesign of contextual abstractions in Scala. They introduce four fundamental changes:
5252

docs/_docs/reference/contextual/derivation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ given [T: Show] : Show[Tree[T]] = Show.derived
2626

2727
We say that `Tree` is the _deriving type_ and that the `Eq`, `Ordering` and `Show` instances are _derived instances_.
2828

29-
### Types supporting `derives` clauses
29+
## Types supporting `derives` clauses
3030

3131
All data types can have a `derives` clause. This document focuses primarily on data types which also have a given instance
3232
of the `Mirror` type class available.
@@ -158,7 +158,7 @@ Note the following properties of `Mirror` types,
158158
+ The methods `ordinal` and `fromProduct` are defined in terms of `MirroredMonoType` which is the type of kind-`*`
159159
which is obtained from `MirroredType` by wildcarding its type parameters.
160160

161-
### Type classes supporting automatic deriving
161+
## Type classes supporting automatic deriving
162162

163163
A trait or class can appear in a `derives` clause if its companion object defines a method named `derived`. The
164164
signature and implementation of a `derived` method for a type class `TC[_]` are arbitrary but it is typically of the
@@ -186,7 +186,7 @@ authors would normally implement a `derived` method in this way, however this wa
186186
authors of the higher level derivation libraries that we expect typical type class authors will use (for a fully
187187
worked out example of such a library, see [Shapeless 3](https://github.com/milessabin/shapeless/tree/shapeless-3)).
188188

189-
#### How to write a type class `derived` method using low level mechanisms
189+
## How to write a type class `derived` method using low level mechanisms
190190

191191
The low-level method we will use to implement a type class `derived` method in this example exploits three new
192192
type-level constructs in Scala 3: inline methods, inline matches, and implicit searches via `summonInline` or `summonFrom`. Given this definition of the
@@ -360,7 +360,7 @@ The framework described here enables all three of these approaches without manda
360360
For a brief discussion on how to use macros to write a type class `derived`
361361
method please read more at [How to write a type class `derived` method using macros](./derivation-macro.md).
362362

363-
### Deriving instances elsewhere
363+
## Deriving instances elsewhere
364364

365365
Sometimes one would like to derive a type class instance for an ADT after the ADT is defined, without being able to
366366
change the code of the ADT itself. To do this, simply define an instance using the `derived` method of the type class
@@ -374,7 +374,7 @@ Assuming the `Ordering.derived` method has a context parameter of type `Mirror[T
374374
compiler generated `Mirror` instance for `Option` and the derivation of the instance will be expanded on the right
375375
hand side of this definition in the same way as an instance defined in ADT companion objects.
376376

377-
### Syntax
377+
## Syntax
378378

379379
```
380380
Template ::= InheritClauses [TemplateBody]
@@ -397,7 +397,7 @@ It is equivalent to the old form
397397
class A extends B with C { ... }
398398
```
399399

400-
### Discussion
400+
## Discussion
401401

402402
This type class derivation framework is intentionally very small and low-level. There are essentially two pieces of
403403
infrastructure in compiler-generated `Mirror` instances,

docs/_docs/reference/contextual/extension-methods.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ val circle = Circle(0, 0, 1)
2020
circle.circumference
2121
```
2222

23-
### Translation of Extension Methods
23+
## Translation of Extension Methods
2424

2525
An extension method translates to a specially labelled method that takes the leading parameter section as its first argument list. The label, expressed
2626
as `<extension>` here, is compiler-internal. So, the definition of `circumference` above translates to the following method, and can also be invoked as such:
@@ -31,7 +31,7 @@ as `<extension>` here, is compiler-internal. So, the definition of `circumferenc
3131
assert(circle.circumference == circumference(circle))
3232
```
3333

34-
### Operators
34+
## Operators
3535

3636
The extension method syntax can also be used to define operators. Examples:
3737

@@ -63,7 +63,7 @@ compiler preprocesses an infix operation `x +: xs` to `xs.+:(x)`, so the extensi
6363
method ends up being applied to the sequence as first argument (in other words, the
6464
two swaps cancel each other out). See [here for details](./right-associative-extension-methods.md).
6565

66-
### Generic Extensions
66+
## Generic Extensions
6767

6868
It is also possible to extend generic types by adding type parameters to an extension. For instance:
6969

@@ -109,7 +109,7 @@ extension [T](x: T)(using n: Numeric[T])
109109
def + (y: T): T = n.plus(x, y)
110110
```
111111

112-
### Collective Extensions
112+
## Collective Extensions
113113

114114
Sometimes, one wants to define several extension methods that share the same
115115
left-hand parameter type. In this case one can "pull out" the common parameters into
@@ -166,7 +166,7 @@ extension [T](xs: List[T])(using Ordering[T])
166166
xs.zipWithIndex.collect { case (x, i) if x <= limit => i }
167167
```
168168

169-
### Translation of Calls to Extension Methods
169+
## Translation of Calls to Extension Methods
170170

171171
To convert a reference to an extension method, the compiler has to know about the extension
172172
method. We say in this case that the extension method is _applicable_ at the point of reference.
@@ -280,7 +280,7 @@ def position(s: String)(ch: Char, n: Int): Int =
280280
else n
281281
```
282282

283-
### Syntax
283+
## Syntax
284284

285285
Here are the syntax changes for extension methods and collective extensions relative
286286
to the [current syntax](../syntax.md).

0 commit comments

Comments
 (0)