Skip to content

Commit d24ad90

Browse files
committed
spec: fix broken links and anchors, including examples
For examples, the "name" of the example (like "Example Ordered") is only used to derived its html id so that one can link to it (see `layouts/default.yml`). Ideally all examples should have a name; here I only added enough to satisfy existing links.
1 parent 3b0c71d commit d24ad90

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

spec/01-lexical-syntax.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ between the two tokens. However, if two tokens are separated by at
178178
least one completely blank line (i.e a line which contains no
179179
printable characters), then two `nl` tokens are inserted.
180180

181-
The Scala grammar (given in full [here](#scala-syntax-summary))
181+
The Scala grammar (given in full [here](13-syntax-summary.html))
182182
contains productions where optional `nl` tokens, but not
183183
semicolons, are accepted. This has the effect that a newline in one of these
184184
positions does not terminate an expression or statement. These positions can
@@ -202,7 +202,7 @@ A single new line token is accepted
202202

203203
- in front of an opening brace ‘{’, if that brace is a legal
204204
continuation of the current statement or expression,
205-
- after an [infix operator](06-expressions.html#prefix-infix-and-postfix-operations),
205+
- after an [infix operator](06-expressions.html#prefix,-infix,-and-postfix-operations),
206206
if the first token on the next line can start an expression,
207207
- in front of a [parameter clause](04-basic-declarations-and-definitions.html#function-declarations-and-definitions), and
208208
- after an [annotation](11-user-defined-annotations.html#user-defined-annotations).
@@ -498,7 +498,7 @@ lines.
498498
```
499499

500500
Method `stripMargin` is defined in class
501-
[scala.collection.immutable.StringLike](http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.StringLike).
501+
[scala.collection.immutable.StringLike](http://www.scala-lang.org/api/current/#scala.collection.immutable.StringLike).
502502
Because there is a predefined
503503
[implicit conversion](06-expressions.html#implicit-conversions) from `String` to
504504
`StringLike`, the method is applicable to all strings.

spec/03-types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ well-formed if each actual type parameter
178178
_conforms to its bounds_, i.e. $\sigma L_i <: T_i <: \sigma U_i$ where $\sigma$ is the
179179
substitution $[ a_1 := T_1 , \ldots , a_n := T_n ]$.
180180

181-
### Example
181+
### Example Parameterized Types
182182
Given the partial type definitions:
183183

184184
```scala
@@ -204,7 +204,7 @@ G[S, String]
204204

205205
### Example
206206

207-
Given the [above type definitions](example-parameterized-types),
207+
Given the [above type definitions](#example-parameterized-types),
208208
the following types are ill-formed:
209209

210210
```scala
@@ -349,7 +349,7 @@ $T_2$. The type is equivalent to the type application
349349
arbitrary identifier.
350350

351351
All type infix operators have the same precedence; parentheses have to
352-
be used for grouping. The [associativity](06-expressions.html#prefix-infix-and-postfix-operations)
352+
be used for grouping. The [associativity](06-expressions.html#prefix,-infix,-and-postfix-operations)
353353
of a type operator is determined as for term operators: type operators
354354
ending in a colon ‘:’ are right-associative; all other
355355
operators are left-associative.

spec/05-classes-and-objects.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Then the linearization of class `Iter` is
220220
Note that the linearization of a class refines the inheritance
221221
relation: if $C$ is a subclass of $D$, then $C$ precedes $D$ in any
222222
linearization where both $C$ and $D$ occur.
223-
[Linearization](#definition-linearization) also satisfies the property that
223+
[Linearization](#definition:-linearization) also satisfies the property that
224224
a linearization of a class always contains the linearization of its direct superclass as a suffix.
225225

226226
For instance, the linearization of `StringIterator` is
@@ -753,6 +753,7 @@ val c = new C(1, "abc", List())
753753
c.z = c.y :: c.z
754754
```
755755

756+
### Example Private Constructor
756757
The following class can be created only from its companion module.
757758

758759
```scala

spec/06-expressions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ A designator refers to a named term. It can be a _simple name_ or
108108
a _selection_.
109109

110110
A simple name $x$ refers to a value as specified
111-
[here](02-identifiers-names-and-scopes.html#identifiers-names-and-scopes).
111+
[here](02-identifiers-names-and-scopes.html#identifiers,-names-and-scopes).
112112
If $x$ is bound by a definition or declaration in an enclosing class
113113
or object $C$, it is taken to be equivalent to the selection
114114
`$C$.this.$x$` where $C$ is taken to refer to the class containing $x$
115-
even if the type name $C$ is [shadowed](02-identifiers-names-and-scopes.html#identifiers-names-and-scopes) at the
115+
even if the type name $C$ is [shadowed](02-identifiers-names-and-scopes.html#identifiers,-names-and-scopes) at the
116116
occurrence of $x$.
117117

118118
If $r$ is a [stable identifier](03-types.html#paths) of type $T$, the selection $r.x$ refers
@@ -802,7 +802,7 @@ Here are some assignment expressions and their equivalent expansions.
802802
|`x.f(i) = e` | `x.f.update(i, e)` |
803803
|`x.f(i, j) = e` | `x.f.update(i, j, e)`|
804804

805-
### Example
805+
### Example Imperative Matrix Multiplication
806806

807807
Here is the usual imperative code for matrix multiplication.
808808

@@ -1115,7 +1115,7 @@ Expr1 ::= `try' `{' Block `}' [`catch' `{' CaseClauses `}']
11151115

11161116
A try expression is of the form `try { $b$ } catch $h$`
11171117
where the handler $h$ is a
1118-
[pattern matching anonymous function](#pattern-matching-anonymous-functions)
1118+
[pattern matching anonymous function](08-pattern-matching.html#pattern-matching-anonymous-functions)
11191119

11201120
```scala
11211121
{ case $p_1$ => $b_1$ $\ldots$ case $p_n$ => $b_n$ }

spec/07-implicit-parameters-and-views.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ and can be used as implicit conversions called [views](#views).
1919
The `implicit` modifier is illegal for all
2020
type members, as well as for [top-level objects](09-top-level-definitions.html#packagings).
2121

22-
### Example
22+
### Example Monoid
2323
The following code defines an abstract class of monoids and
2424
two concrete implementations, `StringMonoid` and
2525
`IntMonoid`. The two implementations are marked implicit.
@@ -189,7 +189,7 @@ core type is added to the stack, it is checked that this type does not
189189
dominate any of the other types in the set.
190190

191191
Here, a core type $T$ _dominates_ a type $U$ if $T$ is
192-
[equivalent](03-types.html#type-equivalence)
192+
[equivalent](03-types.html#equivalence)
193193
to $U$, or if the top-level type constructors of $T$ and $U$ have a
194194
common element and $T$ is more complex than $U$.
195195

@@ -284,7 +284,7 @@ As for implicit parameters, overloading resolution is applied
284284
if there are several possible candidates (of either the call-by-value
285285
or the call-by-name category).
286286

287-
### Example
287+
### Example Ordered
288288
Class `scala.Ordered[A]` contains a method
289289

290290
```scala

spec/08-pattern-matching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ p_n$.
268268
An infix operation pattern $p;\mathit{op};q$ is a shorthand for the
269269
constructor or extractor pattern $\mathit{op}(p, q)$. The precedence and
270270
associativity of operators in patterns is the same as in
271-
[expressions](06-expressions.html#prefix-infix-and-postfix-operations).
271+
[expressions](06-expressions.html#prefix,-infix,-and-postfix-operations).
272272

273273
An infix operation pattern $p;\mathit{op};(q_1 , \ldots , q_n)$ is a
274274
shorthand for the constructor or extractor pattern $\mathit{op}(p, q_1

0 commit comments

Comments
 (0)