From d24ad908451e42925fe6be9995235bf2b4de1b39 Mon Sep 17 00:00:00 2001 From: Antoine Gourlay Date: Mon, 15 Sep 2014 14:08:17 +0200 Subject: 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. --- spec/01-lexical-syntax.md | 6 +++--- spec/03-types.md | 6 +++--- spec/05-classes-and-objects.md | 3 ++- spec/06-expressions.md | 8 ++++---- spec/07-implicit-parameters-and-views.md | 6 +++--- spec/08-pattern-matching.md | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/spec/01-lexical-syntax.md b/spec/01-lexical-syntax.md index 4bfef79ac5..d5752bbdf0 100644 --- a/spec/01-lexical-syntax.md +++ b/spec/01-lexical-syntax.md @@ -178,7 +178,7 @@ between the two tokens. However, if two tokens are separated by at least one completely blank line (i.e a line which contains no printable characters), then two `nl` tokens are inserted. -The Scala grammar (given in full [here](#scala-syntax-summary)) +The Scala grammar (given in full [here](13-syntax-summary.html)) contains productions where optional `nl` tokens, but not semicolons, are accepted. This has the effect that a newline in one of these positions does not terminate an expression or statement. These positions can @@ -202,7 +202,7 @@ A single new line token is accepted - in front of an opening brace ‘{’, if that brace is a legal continuation of the current statement or expression, -- after an [infix operator](06-expressions.html#prefix-infix-and-postfix-operations), +- after an [infix operator](06-expressions.html#prefix,-infix,-and-postfix-operations), if the first token on the next line can start an expression, - in front of a [parameter clause](04-basic-declarations-and-definitions.html#function-declarations-and-definitions), and - after an [annotation](11-user-defined-annotations.html#user-defined-annotations). @@ -498,7 +498,7 @@ lines. ``` Method `stripMargin` is defined in class -[scala.collection.immutable.StringLike](http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.StringLike). +[scala.collection.immutable.StringLike](http://www.scala-lang.org/api/current/#scala.collection.immutable.StringLike). Because there is a predefined [implicit conversion](06-expressions.html#implicit-conversions) from `String` to `StringLike`, the method is applicable to all strings. diff --git a/spec/03-types.md b/spec/03-types.md index 5cfb85e1fc..80200cdf33 100644 --- a/spec/03-types.md +++ b/spec/03-types.md @@ -178,7 +178,7 @@ well-formed if each actual type parameter _conforms to its bounds_, i.e. $\sigma L_i <: T_i <: \sigma U_i$ where $\sigma$ is the substitution $[ a_1 := T_1 , \ldots , a_n := T_n ]$. -### Example +### Example Parameterized Types Given the partial type definitions: ```scala @@ -204,7 +204,7 @@ G[S, String] ### Example -Given the [above type definitions](example-parameterized-types), +Given the [above type definitions](#example-parameterized-types), the following types are ill-formed: ```scala @@ -349,7 +349,7 @@ $T_2$. The type is equivalent to the type application arbitrary identifier. All type infix operators have the same precedence; parentheses have to -be used for grouping. The [associativity](06-expressions.html#prefix-infix-and-postfix-operations) +be used for grouping. The [associativity](06-expressions.html#prefix,-infix,-and-postfix-operations) of a type operator is determined as for term operators: type operators ending in a colon ‘:’ are right-associative; all other operators are left-associative. diff --git a/spec/05-classes-and-objects.md b/spec/05-classes-and-objects.md index 6ac4c8fdcf..ef854b2abb 100644 --- a/spec/05-classes-and-objects.md +++ b/spec/05-classes-and-objects.md @@ -220,7 +220,7 @@ Then the linearization of class `Iter` is Note that the linearization of a class refines the inheritance relation: if $C$ is a subclass of $D$, then $C$ precedes $D$ in any linearization where both $C$ and $D$ occur. -[Linearization](#definition-linearization) also satisfies the property that +[Linearization](#definition:-linearization) also satisfies the property that a linearization of a class always contains the linearization of its direct superclass as a suffix. For instance, the linearization of `StringIterator` is @@ -753,6 +753,7 @@ val c = new C(1, "abc", List()) c.z = c.y :: c.z ``` +### Example Private Constructor The following class can be created only from its companion module. ```scala diff --git a/spec/06-expressions.md b/spec/06-expressions.md index 96a2558e61..e1f8580313 100644 --- a/spec/06-expressions.md +++ b/spec/06-expressions.md @@ -108,11 +108,11 @@ A designator refers to a named term. It can be a _simple name_ or a _selection_. A simple name $x$ refers to a value as specified -[here](02-identifiers-names-and-scopes.html#identifiers-names-and-scopes). +[here](02-identifiers-names-and-scopes.html#identifiers,-names-and-scopes). If $x$ is bound by a definition or declaration in an enclosing class or object $C$, it is taken to be equivalent to the selection `$C$.this.$x$` where $C$ is taken to refer to the class containing $x$ -even if the type name $C$ is [shadowed](02-identifiers-names-and-scopes.html#identifiers-names-and-scopes) at the +even if the type name $C$ is [shadowed](02-identifiers-names-and-scopes.html#identifiers,-names-and-scopes) at the occurrence of $x$. 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. |`x.f(i) = e` | `x.f.update(i, e)` | |`x.f(i, j) = e` | `x.f.update(i, j, e)`| -### Example +### Example Imperative Matrix Multiplication Here is the usual imperative code for matrix multiplication. @@ -1115,7 +1115,7 @@ Expr1 ::= `try' `{' Block `}' [`catch' `{' CaseClauses `}'] A try expression is of the form `try { $b$ } catch $h$` where the handler $h$ is a -[pattern matching anonymous function](#pattern-matching-anonymous-functions) +[pattern matching anonymous function](08-pattern-matching.html#pattern-matching-anonymous-functions) ```scala { case $p_1$ => $b_1$ $\ldots$ case $p_n$ => $b_n$ } diff --git a/spec/07-implicit-parameters-and-views.md b/spec/07-implicit-parameters-and-views.md index 3a215e74fc..27a50cf058 100644 --- a/spec/07-implicit-parameters-and-views.md +++ b/spec/07-implicit-parameters-and-views.md @@ -19,7 +19,7 @@ and can be used as implicit conversions called [views](#views). The `implicit` modifier is illegal for all type members, as well as for [top-level objects](09-top-level-definitions.html#packagings). -### Example +### Example Monoid The following code defines an abstract class of monoids and two concrete implementations, `StringMonoid` and `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 dominate any of the other types in the set. Here, a core type $T$ _dominates_ a type $U$ if $T$ is -[equivalent](03-types.html#type-equivalence) +[equivalent](03-types.html#equivalence) to $U$, or if the top-level type constructors of $T$ and $U$ have a common element and $T$ is more complex than $U$. @@ -284,7 +284,7 @@ As for implicit parameters, overloading resolution is applied if there are several possible candidates (of either the call-by-value or the call-by-name category). -### Example +### Example Ordered Class `scala.Ordered[A]` contains a method ```scala diff --git a/spec/08-pattern-matching.md b/spec/08-pattern-matching.md index b23be5bbb6..8e224de8d2 100644 --- a/spec/08-pattern-matching.md +++ b/spec/08-pattern-matching.md @@ -268,7 +268,7 @@ p_n$. An infix operation pattern $p;\mathit{op};q$ is a shorthand for the constructor or extractor pattern $\mathit{op}(p, q)$. The precedence and associativity of operators in patterns is the same as in -[expressions](06-expressions.html#prefix-infix-and-postfix-operations). +[expressions](06-expressions.html#prefix,-infix,-and-postfix-operations). An infix operation pattern $p;\mathit{op};(q_1 , \ldots , q_n)$ is a shorthand for the constructor or extractor pattern $\mathit{op}(p, q_1 -- cgit v1.2.3