From 0d357b29f777f50d205f9a61022005f5afa46363 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Mon, 6 Dec 2021 11:49:45 +0100 Subject: [PATCH 1/4] Revert headers and links --- .gitignore | 7 -- docs/README.md | 4 - docs/docs/reference/changed-features.md | 6 +- .../changed-features/compiler-plugins.md | 6 +- .../changed-features/eta-expansion-spec.md | 4 +- .../changed-features/eta-expansion.md | 10 +- .../implicit-conversions-spec.md | 10 +- .../changed-features/implicit-conversions.md | 8 +- .../changed-features/implicit-resolution.md | 6 +- .../reference/changed-features/imports.md | 6 +- docs/docs/reference/changed-features/index.md | 7 ++ .../changed-features/interpolation-escapes.md | 4 +- .../changed-features/lazy-vals-init.md | 6 +- .../changed-features/main-functions.md | 8 +- .../changed-features/match-syntax.md | 6 +- .../changed-features/numeric-literals.md | 6 +- .../reference/changed-features/operators.md | 10 +- .../changed-features/overload-resolution.md | 8 +- .../changed-features/pattern-bindings.md | 6 +- .../changed-features/pattern-matching.md | 8 +- .../changed-features/structural-types-spec.md | 6 +- .../changed-features/structural-types.md | 8 +- .../changed-features/type-checking.md | 6 +- .../changed-features/type-inference.md | 6 +- .../changed-features/vararg-splices.md | 6 +- .../reference/changed-features/wildcards.md | 6 +- docs/docs/reference/contextual.md | 30 +++--- .../contextual/by-name-context-parameters.md | 6 +- .../reference/contextual/context-bounds.md | 6 +- .../contextual/context-functions-spec.md | 7 +- .../reference/contextual/context-functions.md | 8 +- docs/docs/reference/contextual/conversions.md | 6 +- .../reference/contextual/derivation-macro.md | 8 +- docs/docs/reference/contextual/derivation.md | 8 +- .../reference/contextual/extension-methods.md | 10 +- .../reference/contextual/given-imports.md | 6 +- docs/docs/reference/contextual/givens.md | 10 +- .../contextual/multiversal-equality.md | 8 +- .../contextual/relationship-implicits.md | 6 +- .../right-associative-extension-methods.md | 4 +- .../docs/reference/contextual/type-classes.md | 10 +- .../reference/contextual/using-clauses.md | 12 +-- docs/docs/reference/dropped-features.md | 6 +- .../reference/dropped-features/auto-apply.md | 6 +- .../dropped-features/class-shadowing-spec.md | 4 +- .../dropped-features/class-shadowing.md | 8 +- .../dropped-features/delayed-init.md | 8 +- .../reference/dropped-features/do-while.md | 8 +- .../dropped-features/early-initializers.md | 8 +- .../dropped-features/existential-types.md | 6 +- .../reference/dropped-features/limit22.md | 8 +- .../docs/reference/dropped-features/macros.md | 12 +-- .../dropped-features/nonlocal-returns.md | 5 +- .../dropped-features/package-objects.md | 6 +- .../dropped-features/procedure-syntax.md | 6 +- .../reference/dropped-features/symlits.md | 6 +- .../dropped-features/this-qualifier.md | 8 +- .../dropped-features/type-projection.md | 6 +- .../dropped-features/weak-conformance-spec.md | 4 +- .../dropped-features/weak-conformance.md | 8 +- .../dropped-features/wildcard-init.md | 6 +- docs/docs/reference/dropped-features/xml.md | 6 +- docs/docs/reference/enums.md | 6 +- docs/docs/reference/enums/adts.md | 10 +- docs/docs/reference/enums/desugarEnums.md | 8 +- docs/docs/reference/enums/enums.md | 8 +- docs/docs/reference/experimental/canthrow.md | 6 +- .../experimental/erased-defs-spec.md | 6 +- .../reference/experimental/erased-defs.md | 8 +- .../experimental/named-typeargs-spec.md | 4 +- .../reference/experimental/named-typeargs.md | 4 +- .../experimental/numeric-literals.md | 4 +- docs/docs/reference/experimental/overview.md | 5 +- .../docs/reference/features-classification.md | 84 ++++++++-------- docs/docs/reference/language-versions.md | 6 +- docs/docs/reference/metaprogramming.md | 18 ++-- .../metaprogramming/compiletime-ops.md | 6 +- docs/docs/reference/metaprogramming/inline.md | 8 +- .../reference/metaprogramming/macros-spec.md | 8 +- docs/docs/reference/metaprogramming/macros.md | 12 +-- .../reference/metaprogramming/reflection.md | 12 +-- .../reference/metaprogramming/simple-smp.md | 6 +- .../docs/reference/metaprogramming/staging.md | 8 +- .../metaprogramming/tasty-inspect.md | 6 +- docs/docs/reference/new-types.md | 6 +- .../dependent-function-types-spec.md | 6 +- .../new-types/dependent-function-types.md | 8 +- .../new-types/intersection-types-spec.md | 4 +- .../reference/new-types/intersection-types.md | 8 +- docs/docs/reference/new-types/match-types.md | 6 +- .../new-types/polymorphic-function-types.md | 8 +- .../reference/new-types/type-lambdas-spec.md | 8 +- docs/docs/reference/new-types/type-lambdas.md | 8 +- .../reference/new-types/union-types-spec.md | 8 +- docs/docs/reference/new-types/union-types.md | 8 +- docs/docs/reference/other-new-features.md | 6 +- .../other-new-features/control-syntax.md | 6 +- .../creator-applications.md | 6 +- .../other-new-features/experimental-defs.md | 6 +- .../other-new-features/explicit-nulls.md | 12 +-- .../reference/other-new-features/export.md | 6 +- .../indentation-experimental.md | 4 +- .../other-new-features/indentation.md | 10 +- .../other-new-features/kind-polymorphism.md | 6 +- .../reference/other-new-features/matchable.md | 8 +- .../other-new-features/opaques-details.md | 6 +- .../reference/other-new-features/opaques.md | 8 +- .../other-new-features/open-classes.md | 6 +- .../parameter-untupling-spec.md | 4 +- .../other-new-features/parameter-untupling.md | 8 +- .../other-new-features/safe-initialization.md | 8 +- .../other-new-features/targetName.md | 6 +- .../threadUnsafe-annotation.md | 6 +- .../other-new-features/trait-parameters.md | 6 +- .../other-new-features/transparent-traits.md | 8 +- .../reference/other-new-features/type-test.md | 6 +- docs/docs/reference/overview.md | 99 +++++++++---------- docs/docs/reference/soft-modifier.md | 4 +- docs/docs/reference/syntax.md | 9 +- docs/docs/usage/ide-support.md | 1 - docs/docs/usage/scaladoc/blog.md | 14 ++- docs/docs/usage/scaladoc/docstrings.md | 8 +- docs/docs/usage/scaladoc/index.md | 7 +- docs/docs/usage/scaladoc/linking.md | 6 +- docs/docs/usage/scaladoc/search-engine.md | 8 +- docs/docs/usage/scaladoc/settings.md | 5 +- docs/docs/usage/scaladoc/site-versioning.md | 8 +- docs/docs/usage/scaladoc/static-site.md | 8 +- .../worksheet-mode-implementation-details.md | 5 + 129 files changed, 445 insertions(+), 654 deletions(-) delete mode 100644 docs/README.md create mode 100644 docs/docs/reference/changed-features/index.md diff --git a/.gitignore b/.gitignore index fd9530725f5d..17a292e4c6a7 100644 --- a/.gitignore +++ b/.gitignore @@ -102,10 +102,3 @@ cs # Coursier test product compiler/test-coursier/run/*.jar - -# Docs -docs-for-dotty-page/* - -# docs.scala-lang deplyment temp dir -docsScalaLang/ -docs/_site/ diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index f6d95155126a..000000000000 --- a/docs/README.md +++ /dev/null @@ -1,4 +0,0 @@ -This directory is for keeping all the compiler related docs. - -For serving this files, one should notice that files under `docs/docs/reference` and `docs/docs/usage/scaladoc` are designed to be compatible with `docs.scala-lang` jekyll page. -Preprocessing the sources to be compatible with scaladoc static site is done via script at `project/CopyDocs.scala` diff --git a/docs/docs/reference/changed-features.md b/docs/docs/reference/changed-features.md index 7a8f717f2394..05a138b396fa 100644 --- a/docs/docs/reference/changed-features.md +++ b/docs/docs/reference/changed-features.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Other Changed Features" -type: chapter -num: 52 -previous-page: /scala3/reference/other-new-features/experimental-defs -next-page: /scala3/reference/changed-features/numeric-literals +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features.html --- The following pages document the features that have changed in Scala 3, compared to Scala 2. diff --git a/docs/docs/reference/changed-features/compiler-plugins.md b/docs/docs/reference/changed-features/compiler-plugins.md index b8e108c560c4..2a446e9cfb84 100644 --- a/docs/docs/reference/changed-features/compiler-plugins.md +++ b/docs/docs/reference/changed-features/compiler-plugins.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Changes in Compiler Plugins" -type: section -num: 68 -previous-page: /scala3/reference/changed-features/eta-expansion -next-page: /scala3/reference/changed-features/lazy-vals-init +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/compiler-plugins.html --- Compiler plugins are supported by Dotty (and Scala 3) since 0.9. There are two notable changes diff --git a/docs/docs/reference/changed-features/eta-expansion-spec.md b/docs/docs/reference/changed-features/eta-expansion-spec.md index 78d021003cc4..67f7606d5b15 100644 --- a/docs/docs/reference/changed-features/eta-expansion-spec.md +++ b/docs/docs/reference/changed-features/eta-expansion-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Automatic Eta Expansion - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/eta-expansion-spec.html --- ## Motivation diff --git a/docs/docs/reference/changed-features/eta-expansion.md b/docs/docs/reference/changed-features/eta-expansion.md index f21cb54406ad..2ae9af870a55 100644 --- a/docs/docs/reference/changed-features/eta-expansion.md +++ b/docs/docs/reference/changed-features/eta-expansion.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Automatic Eta Expansion" -type: section -num: 67 -previous-page: /scala3/reference/changed-features/pattern-matching -next-page: /scala3/reference/changed-features/compiler-plugins +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/eta-expansion.html --- The conversion of _methods_ into _functions_ has been improved and happens automatically for methods with one or more parameters. @@ -38,7 +36,7 @@ rather than `next _`. The reason for excluding nullary methods from automatic eta expansion is that Scala implicitly inserts the `()` argument, which would conflict with eta expansion. Automatic `()` insertion is -[limited](../dropped-features/auto-apply.html) in Scala 3, but the fundamental ambiguity +[limited](../dropped-features/auto-apply.md) in Scala 3, but the fundamental ambiguity remains. -[More details](eta-expansion-spec.html) +[More details](eta-expansion-spec.md) diff --git a/docs/docs/reference/changed-features/implicit-conversions-spec.md b/docs/docs/reference/changed-features/implicit-conversions-spec.md index 32bb641dbf74..47cfd941bf02 100644 --- a/docs/docs/reference/changed-features/implicit-conversions-spec.md +++ b/docs/docs/reference/changed-features/implicit-conversions-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Implicit Conversions - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/implicit-conversions-spec.html --- ## Implementation @@ -82,7 +82,7 @@ implicit val myConverter: Int => String = _.toString implicit val myConverter: Conversion[Int, String] = _.toString ``` -Note that implicit conversions are also affected by the [changes to implicit resolution](implicit-resolution.html) between Scala 2 and Scala 3. +Note that implicit conversions are also affected by the [changes to implicit resolution](implicit-resolution.md) between Scala 2 and Scala 3. ## Motivation for the changes @@ -109,9 +109,9 @@ will report a type error, because `Map` isn't an instance of Implicit values that are used as views should see their type changed to `Conversion`. For the migration of implicit conversions that are affected by the -changes to implicit resolution, refer to the [Changes in Implicit Resolution](implicit-resolution.html) for more information. +changes to implicit resolution, refer to the [Changes in Implicit Resolution](implicit-resolution.md) for more information. ## Reference -For more information about implicit resolution, see [Changes in Implicit Resolution](implicit-resolution.html). +For more information about implicit resolution, see [Changes in Implicit Resolution](implicit-resolution.md). Other details are available in [PR #2065](https://github.com/lampepfl/dotty/pull/2065). diff --git a/docs/docs/reference/changed-features/implicit-conversions.md b/docs/docs/reference/changed-features/implicit-conversions.md index aab1baa32373..2ee2583d3cd8 100644 --- a/docs/docs/reference/changed-features/implicit-conversions.md +++ b/docs/docs/reference/changed-features/implicit-conversions.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Implicit Conversions" -type: section -num: 61 -previous-page: /scala3/reference/changed-features/implicit-resolution -next-page: /scala3/reference/changed-features/overload-resolution +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/implicit-conversions.html --- An _implicit conversion_, also called _view_, is a conversion that @@ -63,4 +61,4 @@ implicitly[Ordering[A]] // Ok, will use the implicit conversion from // `A` to `Int` and the `Ordering` for `Int`. ``` -[More details](implicit-conversions-spec.html) +[More details](implicit-conversions-spec.md) diff --git a/docs/docs/reference/changed-features/implicit-resolution.md b/docs/docs/reference/changed-features/implicit-resolution.md index 2a563aceeb19..435104a12024 100644 --- a/docs/docs/reference/changed-features/implicit-resolution.md +++ b/docs/docs/reference/changed-features/implicit-resolution.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Changes in Implicit Resolution" -type: section -num: 60 -previous-page: /scala3/reference/changed-features/type-inference -next-page: /scala3/reference/changed-features/implicit-conversions +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/implicit-resolution.html --- This section describes changes to the implicit resolution that apply both to the new `given`s and to the old-style `implicit`s in Scala 3. diff --git a/docs/docs/reference/changed-features/imports.md b/docs/docs/reference/changed-features/imports.md index e46fbc8fc44b..7d364ce68b92 100644 --- a/docs/docs/reference/changed-features/imports.md +++ b/docs/docs/reference/changed-features/imports.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Imports" -type: section -num: 57 -previous-page: /scala3/reference/changed-features/wildcards -next-page: /scala3/reference/changed-features/type-checking +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/imports.html --- The syntax of wildcard and renaming imports (and exports) has changed. diff --git a/docs/docs/reference/changed-features/index.md b/docs/docs/reference/changed-features/index.md new file mode 100644 index 000000000000..70946645b06b --- /dev/null +++ b/docs/docs/reference/changed-features/index.md @@ -0,0 +1,7 @@ +--- +layout: doc-page +title: "Other Changed Features" +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/index.html +--- + +The following pages document the features that have changed in Scala 3, compared to Scala 2. diff --git a/docs/docs/reference/changed-features/interpolation-escapes.md b/docs/docs/reference/changed-features/interpolation-escapes.md index c61ef9828178..d5b3a82d94cc 100644 --- a/docs/docs/reference/changed-features/interpolation-escapes.md +++ b/docs/docs/reference/changed-features/interpolation-escapes.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Escapes in interpolations" +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/interpolation-escapes.html --- In Scala 2 there is no straightforward way to represent a single quote character `"` in a single quoted interpolation. A `\` character can't be used for that because interpolators themselves decide how to handle escaping, so the parser doesn't know whether the `"` should be escaped or used as a terminator. diff --git a/docs/docs/reference/changed-features/lazy-vals-init.md b/docs/docs/reference/changed-features/lazy-vals-init.md index f70ec622f6e1..c3b25cdc5ab3 100644 --- a/docs/docs/reference/changed-features/lazy-vals-init.md +++ b/docs/docs/reference/changed-features/lazy-vals-init.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: Lazy Vals Initialization -type: section -num: 69 -previous-page: /scala3/reference/changed-features/compiler-plugins -next-page: /scala3/reference/changed-features/main-functions +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/lazy-vals-init.html --- Scala 3 implements [Version 6](https://docs.scala-lang.org/sips/improved-lazy-val-initialization.html#version-6---no-synchronization-on-this-and-concurrent-initialization-of-fields) diff --git a/docs/docs/reference/changed-features/main-functions.md b/docs/docs/reference/changed-features/main-functions.md index 777532e7110b..e0e13a14f681 100644 --- a/docs/docs/reference/changed-features/main-functions.md +++ b/docs/docs/reference/changed-features/main-functions.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Main Methods" -type: section -num: 70 -previous-page: /scala3/reference/changed-features/lazy-vals-init -next-page: /scala3/reference/dropped-features +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/main-functions.html --- Scala 3 offers a new way to define programs that can be invoked from the command line: @@ -87,5 +85,5 @@ object happyBirthday extends App: ... ``` -The previous functionality of `App`, which relied on the "magic" [`DelayedInit`]({% link _scala3-reference/dropped-features/delayed-init.md %}) trait, is no longer available. [`App`](https://scala-lang.org/api/3.x/scala/App.html) still exists in limited form for now, but it does not support command line arguments and will be deprecated in the future. If programs need to cross-build +The previous functionality of `App`, which relied on the "magic" [`DelayedInit`]({% link _scala3-reference/dropped-features/delayed-init.md %}) trait, is no longer available. [`App`](https://scala-lang.org/api/3.x/scala/App.md) still exists in limited form for now, but it does not support command line arguments and will be deprecated in the future. If programs need to cross-build between Scala 2 and Scala 3, it is recommended to use an explicit `main` method with an `Array[String]` argument instead. diff --git a/docs/docs/reference/changed-features/match-syntax.md b/docs/docs/reference/changed-features/match-syntax.md index 12e35cfa94df..cff77262611b 100644 --- a/docs/docs/reference/changed-features/match-syntax.md +++ b/docs/docs/reference/changed-features/match-syntax.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Match Expressions" -type: section -num: 63 -previous-page: /scala3/reference/changed-features/overload-resolution -next-page: /scala3/reference/changed-features/vararg-splices +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/match-syntax.html --- The syntactical precedence of match expressions has been changed. diff --git a/docs/docs/reference/changed-features/numeric-literals.md b/docs/docs/reference/changed-features/numeric-literals.md index 1cc07e3b1c8e..758cc2e21373 100644 --- a/docs/docs/reference/changed-features/numeric-literals.md +++ b/docs/docs/reference/changed-features/numeric-literals.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Numeric Literals" -type: section -num: 53 -previous-page: /scala3/reference/changed-features -next-page: /scala3/reference/changed-features/structural-types +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/numeric-literals.html --- [Document was moved](../experimental/numeric-literals.md) diff --git a/docs/docs/reference/changed-features/operators.md b/docs/docs/reference/changed-features/operators.md index 953aa18c8408..495eb8c5ede9 100644 --- a/docs/docs/reference/changed-features/operators.md +++ b/docs/docs/reference/changed-features/operators.md @@ -1,15 +1,13 @@ --- +layout: doc-page title: "Rules for Operators" -type: section -num: 55 -previous-page: /scala3/reference/changed-features/structural-types -next-page: /scala3/reference/changed-features/wildcards +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/operators.html --- The rules for infix operators have changed in some parts: First, an alphanumeric method can be used as an infix operator only if its definition carries an `infix` modifier. Second, it is recommended (but not enforced) to -augment definitions of symbolic operators with [`@targetName` annotations](../other-new-features/targetName.html). Finally, +augment definitions of symbolic operators with [`@targetName` annotations](../other-new-features/targetName.md). Finally, a syntax change allows infix operators to be written on the left in a multi-line expression. ## The `infix` Modifier @@ -99,7 +97,7 @@ or if the `-source future` option is given in Dotty/Scala 3. ## The `@targetName` Annotation -It is recommended that definitions of symbolic operators carry a [`@targetName` annotation](../other-new-features/targetName.html) that provides an encoding of the operator with an alphanumeric name. This has several benefits: +It is recommended that definitions of symbolic operators carry a [`@targetName` annotation](../other-new-features/targetName.md) that provides an encoding of the operator with an alphanumeric name. This has several benefits: - It helps interoperability between Scala and other languages. One can call a Scala-defined symbolic operator from another language using its target name, diff --git a/docs/docs/reference/changed-features/overload-resolution.md b/docs/docs/reference/changed-features/overload-resolution.md index 4205acdd412f..e6c929f7a2ef 100644 --- a/docs/docs/reference/changed-features/overload-resolution.md +++ b/docs/docs/reference/changed-features/overload-resolution.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Changes in Overload Resolution" -type: section -num: 62 -previous-page: /scala3/reference/changed-features/implicit-conversions -next-page: /scala3/reference/changed-features/match-syntax +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/overload-resolution.html --- Overload resolution in Scala 3 improves on Scala 2 in two ways. @@ -44,7 +42,7 @@ resolution yields several competing alternatives when `n >= 1` parameter lists a into account, then resolution re-tried using `n + 1` argument lists. This change is motivated by the new language feature -[extension methods](../contextual/extension-methods.html), where emerges the need to do +[extension methods](../contextual/extension-methods.md), where emerges the need to do overload resolution based on additional argument blocks. ## Parameter Types of Function Values diff --git a/docs/docs/reference/changed-features/pattern-bindings.md b/docs/docs/reference/changed-features/pattern-bindings.md index a5eb39e98da6..978bff2d7d7e 100644 --- a/docs/docs/reference/changed-features/pattern-bindings.md +++ b/docs/docs/reference/changed-features/pattern-bindings.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Pattern Bindings" -type: section -num: 65 -previous-page: /scala3/reference/changed-features/vararg-splices -next-page: /scala3/reference/changed-features/pattern-matching +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/pattern-bindings.html --- In Scala 2, pattern bindings in `val` definitions and `for` expressions are diff --git a/docs/docs/reference/changed-features/pattern-matching.md b/docs/docs/reference/changed-features/pattern-matching.md index 93712f004307..b9115fe93233 100644 --- a/docs/docs/reference/changed-features/pattern-matching.md +++ b/docs/docs/reference/changed-features/pattern-matching.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Option-less pattern matching" -type: section -num: 66 -previous-page: /scala3/reference/changed-features/pattern-bindings -next-page: /scala3/reference/changed-features/eta-expansion +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/pattern-matching.html --- The implementation of pattern matching in Scala 3 was greatly simplified compared to Scala 2. From a user perspective, this means that Scala 3 generated patterns are a *lot* easier to debug, as variables all show up in debug modes and positions are correctly preserved. @@ -243,4 +241,4 @@ Abstract type testing with `ClassTag` is replaced with `TypeTest` or the alias ` - pattern `_: X` for an abstract type requires a `TypeTest` in scope - pattern `x @ X()` for an unapply that takes an abstract type requires a `TypeTest` in scope -[More details on `TypeTest`](../other-new-features/type-test.html) +[More details on `TypeTest`](../other-new-features/type-test.md) diff --git a/docs/docs/reference/changed-features/structural-types-spec.md b/docs/docs/reference/changed-features/structural-types-spec.md index eb7e653a780a..5c99afbcc1bb 100644 --- a/docs/docs/reference/changed-features/structural-types-spec.md +++ b/docs/docs/reference/changed-features/structural-types-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Programmatic Structural Types - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/structural-types-spec.html --- ## Syntax @@ -81,7 +81,7 @@ and `Rs` are structural refinement declarations, and given `v.a` of type `U`, we Note that `v`'s static type does not necessarily have to conform to `Selectable`, nor does it need to have `selectDynamic` and `applyDynamic` as members. It suffices that there is an implicit conversion that can turn `v` into a `Selectable`, and the selection methods could also be available as -[extension methods](../contextual/extension-methods.html). +[extension methods](../contextual/extension-methods.md). ## Limitations of Structural Types diff --git a/docs/docs/reference/changed-features/structural-types.md b/docs/docs/reference/changed-features/structural-types.md index 3ce3d6ac88bd..904525a4655d 100644 --- a/docs/docs/reference/changed-features/structural-types.md +++ b/docs/docs/reference/changed-features/structural-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Programmatic Structural Types" -type: section -num: 54 -previous-page: /scala3/reference/changed-features/numeric-literals -next-page: /scala3/reference/changed-features/operators +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/structural-types.html --- ## Motivation @@ -191,4 +189,4 @@ differences. `java.lang.Class` arguments indicating the method's formal parameter types. `Dynamic` comes with `updateDynamic`. -[More details](structural-types-spec.html) +[More details](structural-types-spec.md) diff --git a/docs/docs/reference/changed-features/type-checking.md b/docs/docs/reference/changed-features/type-checking.md index f647e57ac462..09a62698d4c7 100644 --- a/docs/docs/reference/changed-features/type-checking.md +++ b/docs/docs/reference/changed-features/type-checking.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Changes in Type Checking" -type: section -num: 58 -previous-page: /scala3/reference/changed-features/imports -next-page: /scala3/reference/changed-features/type-inference +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/type-checking.html --- *** **TO BE FILLED IN** *** diff --git a/docs/docs/reference/changed-features/type-inference.md b/docs/docs/reference/changed-features/type-inference.md index 2432cb8e4339..020878444914 100644 --- a/docs/docs/reference/changed-features/type-inference.md +++ b/docs/docs/reference/changed-features/type-inference.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Changes in Type Inference" -type: section -num: 59 -previous-page: /scala3/reference/changed-features/type-checking -next-page: /scala3/reference/changed-features/implicit-resolution +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/type-inference.html --- For more information, see the two presentations diff --git a/docs/docs/reference/changed-features/vararg-splices.md b/docs/docs/reference/changed-features/vararg-splices.md index 2da55ee79945..1d8b61408176 100644 --- a/docs/docs/reference/changed-features/vararg-splices.md +++ b/docs/docs/reference/changed-features/vararg-splices.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Vararg Splices" -type: section -num: 64 -previous-page: /scala3/reference/changed-features/match-syntax -next-page: /scala3/reference/changed-features/pattern-bindings +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/vararg-splices.html --- The syntax of vararg splices in patterns and function arguments has changed. The new syntax uses a postfix `*`, analogously to how a vararg parameter is declared. diff --git a/docs/docs/reference/changed-features/wildcards.md b/docs/docs/reference/changed-features/wildcards.md index 0a84ebbf2a48..3336f43c3795 100644 --- a/docs/docs/reference/changed-features/wildcards.md +++ b/docs/docs/reference/changed-features/wildcards.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: Wildcard Arguments in Types -type: section -num: 56 -previous-page: /scala3/reference/changed-features/operators -next-page: /scala3/reference/changed-features/imports +movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/wildcards.html --- The syntax of wildcard arguments in types has changed from `_` to `?`. Example: diff --git a/docs/docs/reference/contextual.md b/docs/docs/reference/contextual.md index 1dfc5e6baa97..de9046162c69 100644 --- a/docs/docs/reference/contextual.md +++ b/docs/docs/reference/contextual.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Contextual Abstractions" -type: chapter -num: 13 -previous-page: /scala3/reference/enums/desugarEnums -next-page: /scala3/reference/contextual/givens +movedTo: https://docs.scala-lang.org/scala3/reference/contextual.html --- ### Critique of the Status Quo @@ -52,25 +50,25 @@ Existing Scala programmers by and large have gotten used to the status quo and s The following pages introduce a redesign of contextual abstractions in Scala. They introduce four fundamental changes: -1. [Given Instances](./contextual/givens.html) are a new way to define basic terms that can be synthesized. They replace implicit definitions. The core principle of the proposal is that, rather than mixing the `implicit` modifier with a large number of features, we have a single way to define terms that can be synthesized for types. +1. [Given Instances](./contextual/givens.md) are a new way to define basic terms that can be synthesized. They replace implicit definitions. The core principle of the proposal is that, rather than mixing the `implicit` modifier with a large number of features, we have a single way to define terms that can be synthesized for types. -2. [Using Clauses](./contextual/using-clauses.html) are a new syntax for implicit _parameters_ and their _arguments_. It unambiguously aligns parameters and arguments, solving a number of language warts. It also allows us to have several `using` clauses in a definition. +2. [Using Clauses](./contextual/using-clauses.md) are a new syntax for implicit _parameters_ and their _arguments_. It unambiguously aligns parameters and arguments, solving a number of language warts. It also allows us to have several `using` clauses in a definition. -3. ["Given" Imports](./contextual/given-imports.html) are a new class of import selectors that specifically import +3. ["Given" Imports](./contextual/given-imports.md) are a new class of import selectors that specifically import givens and nothing else. -4. [Implicit Conversions](./contextual/conversions.html) are now expressed as given instances of a standard `Conversion` class. All other forms of implicit conversions will be phased out. +4. [Implicit Conversions](./contextual/conversions.md) are now expressed as given instances of a standard `Conversion` class. All other forms of implicit conversions will be phased out. This section also contains pages describing other language features that are related to context abstraction. These are: -- [Context Bounds](./contextual/context-bounds.html), which carry over unchanged. -- [Extension Methods](./contextual/extension-methods.html) replace implicit classes in a way that integrates better with type classes. -- [Implementing Type Classes](./contextual/type-classes.html) demonstrates how some common type classes can be implemented using the new constructs. -- [Type Class Derivation](./contextual/derivation.html) introduces constructs to automatically derive type class instances for ADTs. -- [Multiversal Equality](./contextual/multiversal-equality.html) introduces a special type class to support type safe equality. -- [Context Functions](./contextual/context-functions.html) provide a way to abstract over context parameters. -- [By-Name Context Parameters](./contextual/by-name-context-parameters.html) are an essential tool to define recursive synthesized values without looping. -- [Relationship with Scala 2 Implicits](./contextual/relationship-implicits.html) discusses the relationship between old-style implicits and new-style givens and how to migrate from one to the other. +- [Context Bounds](./contextual/context-bounds.md), which carry over unchanged. +- [Extension Methods](./contextual/extension-methods.md) replace implicit classes in a way that integrates better with type classes. +- [Implementing Type Classes](./contextual/type-classes.md) demonstrates how some common type classes can be implemented using the new constructs. +- [Type Class Derivation](./contextual/derivation.md) introduces constructs to automatically derive type class instances for ADTs. +- [Multiversal Equality](./contextual/multiversal-equality.md) introduces a special type class to support type safe equality. +- [Context Functions](./contextual/context-functions.md) provide a way to abstract over context parameters. +- [By-Name Context Parameters](./contextual/by-name-context-parameters.md) are an essential tool to define recursive synthesized values without looping. +- [Relationship with Scala 2 Implicits](./contextual/relationship-implicits.md) discusses the relationship between old-style implicits and new-style givens and how to migrate from one to the other. Overall, the new design achieves a better separation of term inference from the rest of the language: There is a single way to define givens instead of a multitude of forms all taking an `implicit` modifier. There is a single way to introduce implicit parameters and arguments instead of conflating implicit with normal arguments. There is a separate way to import givens that does not allow them to hide in a sea of normal imports. And there is a single way to define an implicit conversion which is clearly marked as such and does not require special syntax. diff --git a/docs/docs/reference/contextual/by-name-context-parameters.md b/docs/docs/reference/contextual/by-name-context-parameters.md index c1777b625912..8e8427f7457f 100644 --- a/docs/docs/reference/contextual/by-name-context-parameters.md +++ b/docs/docs/reference/contextual/by-name-context-parameters.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "By-Name Context Parameters" -type: section -num: 25 -previous-page: /scala3/reference/contextual/conversions -next-page: /scala3/reference/contextual/relationship-implicits +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/by-name-context-parameters.html --- Context parameters can be declared by-name to avoid a divergent inferred expansion. Example: diff --git a/docs/docs/reference/contextual/context-bounds.md b/docs/docs/reference/contextual/context-bounds.md index 5c7ea5cd5936..e336f00cc463 100644 --- a/docs/docs/reference/contextual/context-bounds.md +++ b/docs/docs/reference/contextual/context-bounds.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Context Bounds" -type: section -num: 17 -previous-page: /scala3/reference/contextual/using-clauses -next-page: /scala3/reference/contextual/given-imports +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/context-bounds.html --- A context bound is a shorthand for expressing the common pattern of a context parameter that depends on a type parameter. Using a context bound, the `maximum` function of the last section can be written like this: diff --git a/docs/docs/reference/contextual/context-functions-spec.md b/docs/docs/reference/contextual/context-functions-spec.md index 9267eea23f49..9e358ecede41 100644 --- a/docs/docs/reference/contextual/context-functions-spec.md +++ b/docs/docs/reference/contextual/context-functions-spec.md @@ -1,7 +1,8 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Context Functions - More Details" + +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/context-functions-spec.html --- ## Syntax @@ -66,7 +67,7 @@ itself a context function literal. This is analogous to the automatic insertion of `scala.Function0` around expressions in by-name argument position. Context function types generalize to `N > 22` in the same way that function types do, see [the corresponding -documentation](../dropped-features/limit22.html). +documentation](../dropped-features/limit22.md). ## Examples diff --git a/docs/docs/reference/contextual/context-functions.md b/docs/docs/reference/contextual/context-functions.md index 1b930b3c8dfc..c556a0cadf8f 100644 --- a/docs/docs/reference/contextual/context-functions.md +++ b/docs/docs/reference/contextual/context-functions.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Context Functions" -type: section -num: 23 -previous-page: /scala3/reference/contextual/multiversal-equality -next-page: /scala3/reference/contextual/conversions +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/context-functions.html --- _Context functions_ are functions with (only) context parameters. @@ -153,4 +151,4 @@ val s = For more information, see the [blog article](https://www.scala-lang.org/blog/2016/12/07/implicit-function-types.html), (which uses a different syntax that has been superseded). -[More details](./context-functions-spec.html) +[More details](./context-functions-spec.md) diff --git a/docs/docs/reference/contextual/conversions.md b/docs/docs/reference/contextual/conversions.md index 5a222515adea..9928719663e2 100644 --- a/docs/docs/reference/contextual/conversions.md +++ b/docs/docs/reference/contextual/conversions.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Implicit Conversions" -type: section -num: 24 -previous-page: /scala3/reference/contextual/context-functions -next-page: /scala3/reference/contextual/by-name-context-parameters +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/conversions.html --- Implicit conversions are defined by given instances of the `scala.Conversion` class. diff --git a/docs/docs/reference/contextual/derivation-macro.md b/docs/docs/reference/contextual/derivation-macro.md index c9c657d7804f..c75f0430ec9b 100644 --- a/docs/docs/reference/contextual/derivation-macro.md +++ b/docs/docs/reference/contextual/derivation-macro.md @@ -1,10 +1,10 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "How to write a type class `derived` method using macros" +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/derivation-macro.html --- -In the main [derivation](./derivation.html) documentation page, we explained the +In the main [derivation](./derivation.md) documentation page, we explained the details behind `Mirror`s and type class derivation. Here we demonstrate how to implement a type class `derived` method using macros only. We follow the same example of deriving `Eq` instances and for simplicity we support a `Product` @@ -109,7 +109,7 @@ and an age of type `Int`, the equality check we want to generate is the followin ## Calling the derived method inside the macro -Following the rules in [Macros](../metaprogramming.html) we create two methods. +Following the rules in [Macros](../metaprogramming.md) we create two methods. One that hosts the top-level splice `eqv` and one that is the implementation. Alternatively and what is shown below is that we can call the `eqv` method directly. The `eqGen` can trigger the derivation. diff --git a/docs/docs/reference/contextual/derivation.md b/docs/docs/reference/contextual/derivation.md index d7ec09c3705c..843116217d56 100644 --- a/docs/docs/reference/contextual/derivation.md +++ b/docs/docs/reference/contextual/derivation.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Type Class Derivation" -type: section -num: 21 -previous-page: /scala3/reference/contextual/type-classes -next-page: /scala3/reference/contextual/multiversal-equality +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/derivation.html --- Type class derivation is a way to automatically generate given instances for type classes which satisfy some simple @@ -338,7 +336,7 @@ inline def derived[A](using gen: K0.Generic[A]): Eq[A] = The framework described here enables all three of these approaches without mandating any of them. For a brief discussion on how to use macros to write a type class `derived` -method please read more at [How to write a type class `derived` method using macros](./derivation-macro.html). +method please read more at [How to write a type class `derived` method using macros](./derivation-macro.md). ### Deriving instances elsewhere diff --git a/docs/docs/reference/contextual/extension-methods.md b/docs/docs/reference/contextual/extension-methods.md index 06364baa507f..c2a12081cf99 100644 --- a/docs/docs/reference/contextual/extension-methods.md +++ b/docs/docs/reference/contextual/extension-methods.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Extension Methods" -type: section -num: 19 -previous-page: /scala3/reference/contextual/given-imports -next-page: /scala3/reference/contextual/type-classes +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/extension-methods.html --- Extension methods allow one to add methods to a type after the type is defined. Example: @@ -63,7 +61,7 @@ the right-associative operator `+:` to an extension method. This is analogous to the implementation of right binding operators as normal methods. The Scala compiler preprocesses an infix operation `x +: xs` to `xs.+:(x)`, so the extension method ends up being applied to the sequence as first argument (in other words, the -two swaps cancel each other out). See [here for details](./right-associative-extension-methods.html). +two swaps cancel each other out). See [here for details](./right-associative-extension-methods.md). ### Generic Extensions @@ -285,7 +283,7 @@ def position(s: String)(ch: Char, n: Int): Int = ### Syntax Here are the syntax changes for extension methods and collective extensions relative -to the [current syntax](../syntax.html). +to the [current syntax](../syntax.md). ``` BlockStat ::= ... | Extension diff --git a/docs/docs/reference/contextual/given-imports.md b/docs/docs/reference/contextual/given-imports.md index 7e498415888e..3e3bc3d275cc 100644 --- a/docs/docs/reference/contextual/given-imports.md +++ b/docs/docs/reference/contextual/given-imports.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Importing Givens" -type: section -num: 18 -previous-page: /scala3/reference/contextual/context-bounds -next-page: /scala3/reference/contextual/extension-methods +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/given-imports.html --- A special form of import wildcard selector is used to import given instances. Example: diff --git a/docs/docs/reference/contextual/givens.md b/docs/docs/reference/contextual/givens.md index 0ca25c068c93..caaa1990282b 100644 --- a/docs/docs/reference/contextual/givens.md +++ b/docs/docs/reference/contextual/givens.md @@ -1,13 +1,11 @@ --- +layout: doc-page title: "Given Instances" -type: section -num: 15 -previous-page: /scala3/reference/contextual -next-page: /scala3/reference/contextual/using-clauses +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/givens.html --- Given instances (or, simply, "givens") define "canonical" values of certain types -that serve for synthesizing arguments to [context parameters](./using-clauses.html). Example: +that serve for synthesizing arguments to [context parameters](./using-clauses.md). Example: ```scala trait Ord[T]: @@ -36,7 +34,7 @@ a given for the type `Ord[Int]` whereas `listOrd[T]` defines givens for `Ord[List[T]]` for all types `T` that come with a given instance for `Ord[T]` themselves. The `using` clause in `listOrd` defines a condition: There must be a given of type `Ord[T]` for a given of type `Ord[List[T]]` to exist. -Such conditions are expanded by the compiler to [context parameters](./using-clauses.html). +Such conditions are expanded by the compiler to [context parameters](./using-clauses.md). ## Anonymous Givens diff --git a/docs/docs/reference/contextual/multiversal-equality.md b/docs/docs/reference/contextual/multiversal-equality.md index 19b44c654494..1af1786374bc 100644 --- a/docs/docs/reference/contextual/multiversal-equality.md +++ b/docs/docs/reference/contextual/multiversal-equality.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Multiversal Equality" -type: section -num: 22 -previous-page: /scala3/reference/contextual/derivation -next-page: /scala3/reference/contextual/context-functions +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/multiversal-equality.html --- Previously, Scala had universal equality: Two values of any types @@ -106,7 +104,7 @@ Instead of defining `CanEqual` instances directly, it is often more convenient t class Box[T](x: T) derives CanEqual ``` -By the usual rules of [type class derivation](./derivation.html), +By the usual rules of [type class derivation](./derivation.md), this generates the following `CanEqual` instance in the companion object of `Box`: ```scala diff --git a/docs/docs/reference/contextual/relationship-implicits.md b/docs/docs/reference/contextual/relationship-implicits.md index 9be698affdd8..4a23e781bd70 100644 --- a/docs/docs/reference/contextual/relationship-implicits.md +++ b/docs/docs/reference/contextual/relationship-implicits.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Relationship with Scala 2 Implicits" -type: section -num: 26 -previous-page: /scala3/reference/contextual/by-name-context-parameters -next-page: /scala3/reference/metaprogramming +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/relationship-implicits.html --- Many, but not all, of the new contextual abstraction features in Scala 3 can be mapped to Scala 2's implicits. This page gives a rundown on the relationships between new and old features. diff --git a/docs/docs/reference/contextual/right-associative-extension-methods.md b/docs/docs/reference/contextual/right-associative-extension-methods.md index b77e6dccdd78..7c2cf6b02675 100644 --- a/docs/docs/reference/contextual/right-associative-extension-methods.md +++ b/docs/docs/reference/contextual/right-associative-extension-methods.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Right-Associative Extension Methods: Details" +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/right-associative-extension-methods.html --- The most general form of leading parameters of an extension method is as follows: diff --git a/docs/docs/reference/contextual/type-classes.md b/docs/docs/reference/contextual/type-classes.md index 4c80e7b53b14..c4648b3baf28 100644 --- a/docs/docs/reference/contextual/type-classes.md +++ b/docs/docs/reference/contextual/type-classes.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Implementing Type classes" -type: section -num: 20 -previous-page: /scala3/reference/contextual/extension-methods -next-page: /scala3/reference/contextual/derivation +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/type-classes.html --- A _type class_ is an abstract, parameterized type that lets you add new behavior to any closed data type without using sub-typing. This can be useful in multiple use-cases, for example: @@ -100,7 +98,7 @@ assertTransformation(List("a1", "b1"), List("a", "b"), elt => s"${elt}1") ``` That's a first step, but in practice we probably would like the `map` function to be a method directly accessible on the type `F`. So that we can call `map` directly on instances of `F`, and get rid of the `summon[Functor[F]]` part. -As in the previous example of Monoids, [`extension` methods](extension-methods.html) help achieving that. Let's re-define the `Functor` type class with extension methods. +As in the previous example of Monoids, [`extension` methods](extension-methods.md) help achieving that. Let's re-define the `Functor` type class with extension methods. ```scala trait Functor[F[_]]: @@ -237,7 +235,7 @@ given configDependentMonad: Monad[ConfigDependent] with end configDependentMonad ``` -The type `ConfigDependent` can be written using [type lambdas](../new-types/type-lambdas.html): +The type `ConfigDependent` can be written using [type lambdas](../new-types/type-lambdas.md): ```scala type ConfigDependent = [Result] =>> Config => Result diff --git a/docs/docs/reference/contextual/using-clauses.md b/docs/docs/reference/contextual/using-clauses.md index 4f98c760ffef..e8a077ccdc0a 100644 --- a/docs/docs/reference/contextual/using-clauses.md +++ b/docs/docs/reference/contextual/using-clauses.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Using Clauses" -type: section -num: 16 -previous-page: /scala3/reference/contextual/givens -next-page: /scala3/reference/contextual/context-bounds +movedTo: https://docs.scala-lang.org/scala3/reference/contextual/using-clauses.html --- Functional programming tends to express most dependencies as simple function parameterization. @@ -11,7 +9,7 @@ This is clean and powerful, but it sometimes leads to functions that take many p functions. Context parameters can help here since they enable the compiler to synthesize repetitive arguments instead of the programmer having to write them explicitly. -For example, with the [given instances](./givens.html) defined previously, +For example, with the [given instances](./givens.md) defined previously, a `max` function that works for any arguments for which an ordering exists can be defined as follows: ```scala @@ -66,7 +64,7 @@ class GivenIntBox2(using givenInt: Int): //def n = summon[Int] // ambiguous ``` -The `given` member is importable as explained in the section on [importing `given`s](./given-imports.html): +The `given` member is importable as explained in the section on [importing `given`s](./given-imports.md): ```scala val b = GivenIntBox(using 23) @@ -144,7 +142,7 @@ def summon[T](using x: T): x.type = x ## Syntax -Here is the new syntax of parameters and arguments seen as a delta from the [standard context free syntax of Scala 3](../syntax.html). `using` is a soft keyword, recognized only at the start of a parameter or argument list. It can be used as a normal identifier everywhere else. +Here is the new syntax of parameters and arguments seen as a delta from the [standard context free syntax of Scala 3](../syntax.md). `using` is a soft keyword, recognized only at the start of a parameter or argument list. It can be used as a normal identifier everywhere else. ``` ClsParamClause ::= ... | UsingClsParamClause diff --git a/docs/docs/reference/dropped-features.md b/docs/docs/reference/dropped-features.md index 6ccff5c40425..f4cd72942949 100644 --- a/docs/docs/reference/dropped-features.md +++ b/docs/docs/reference/dropped-features.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped Features" -type: chapter -num: 71 -previous-page: /scala3/reference/changed-features/main-functions -next-page: /scala3/reference/dropped-features/delayed-init +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features.html --- The following pages document the features of Scala 2 that have been dropped in Scala 3. diff --git a/docs/docs/reference/dropped-features/auto-apply.md b/docs/docs/reference/dropped-features/auto-apply.md index 6696bd8165d8..c5424ffff22d 100644 --- a/docs/docs/reference/dropped-features/auto-apply.md +++ b/docs/docs/reference/dropped-features/auto-apply.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Auto-Application" -type: section -num: 84 -previous-page: /scala3/reference/dropped-features/symlits -next-page: /scala3/reference/dropped-features/weak-conformance +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/auto-apply.html --- Previously an empty argument list `()` was implicitly inserted when diff --git a/docs/docs/reference/dropped-features/class-shadowing-spec.md b/docs/docs/reference/dropped-features/class-shadowing-spec.md index d1d5d4b34bb4..98acff828cd3 100644 --- a/docs/docs/reference/dropped-features/class-shadowing-spec.md +++ b/docs/docs/reference/dropped-features/class-shadowing-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Dropped: Class Shadowing - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/class-shadowing-spec.html --- Spec diff: in section [5.1.4 Overriding](https://www.scala-lang.org/files/archive/spec/2.13/05-classes-and-objects.html#Overriding), add *M' must not be a class*. diff --git a/docs/docs/reference/dropped-features/class-shadowing.md b/docs/docs/reference/dropped-features/class-shadowing.md index 50101bf1d0b4..839b40253169 100644 --- a/docs/docs/reference/dropped-features/class-shadowing.md +++ b/docs/docs/reference/dropped-features/class-shadowing.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Class Shadowing" -type: section -num: 80 -previous-page: /scala3/reference/dropped-features/early-initializers -next-page: /scala3/reference/dropped-features/limit22 +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/class-shadowing.html --- Scala 2 so far allowed patterns like this: @@ -32,4 +30,4 @@ other, but classes in Scala 2 cannot be overridden. To keep things clean (and its internal operations consistent) the Scala 3 compiler forces you to rename the inner classes so that their names are different. -[More details](./class-shadowing-spec.html) +[More details](./class-shadowing-spec.md) diff --git a/docs/docs/reference/dropped-features/delayed-init.md b/docs/docs/reference/dropped-features/delayed-init.md index f0b65a242c1a..875ccec5132e 100644 --- a/docs/docs/reference/dropped-features/delayed-init.md +++ b/docs/docs/reference/dropped-features/delayed-init.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: DelayedInit" -type: section -num: 72 -previous-page: /scala3/reference/dropped-features -next-page: /scala3/reference/dropped-features/macros +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/delayed-init.html --- The special handling of the `DelayedInit` trait is no longer supported. @@ -29,4 +27,4 @@ object Hello: ``` On the other hand, Scala 3 offers a convenient alternative to such "program" objects -with [`@main` methods](../changed-features/main-functions.html). +with [`@main` methods](../changed-features/main-functions.md). diff --git a/docs/docs/reference/dropped-features/do-while.md b/docs/docs/reference/dropped-features/do-while.md index 7bc3b73e0091..5f5ca5feeea2 100644 --- a/docs/docs/reference/dropped-features/do-while.md +++ b/docs/docs/reference/dropped-features/do-while.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Do-While" -type: section -num: 76 -previous-page: /scala3/reference/dropped-features/type-projection -next-page: /scala3/reference/dropped-features/procedure-syntax +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/do-while.html --- The syntax construct @@ -40,4 +38,4 @@ do print(".") ### Why Drop The Construct? - `do-while` is used relatively rarely and it can be expressed faithfully using just `while`. So there seems to be little point in having it as a separate syntax construct. - - Under the [new syntax rules](../other-new-features/control-syntax.html) `do` is used as a statement continuation, which would clash with its meaning as a statement introduction. + - Under the [new syntax rules](../other-new-features/control-syntax.md) `do` is used as a statement continuation, which would clash with its meaning as a statement introduction. diff --git a/docs/docs/reference/dropped-features/early-initializers.md b/docs/docs/reference/dropped-features/early-initializers.md index 234de159c30c..cb2ffea94376 100644 --- a/docs/docs/reference/dropped-features/early-initializers.md +++ b/docs/docs/reference/dropped-features/early-initializers.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Early Initializers" -type: section -num: 79 -previous-page: /scala3/reference/dropped-features/package-objects -next-page: /scala3/reference/dropped-features/class-shadowing +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/early-initializers.html --- Early initializers of the form @@ -13,6 +11,6 @@ class C extends { ... } with SuperClass ... ``` have been dropped. They were rarely used, and mostly to compensate for the lack of -[trait parameters](../other-new-features/trait-parameters.html), which are now directly supported in Scala 3. +[trait parameters](../other-new-features/trait-parameters.md), which are now directly supported in Scala 3. For more information, see [SLS §5.1.6](https://www.scala-lang.org/files/archive/spec/2.13/05-classes-and-objects.html#early-definitions). diff --git a/docs/docs/reference/dropped-features/existential-types.md b/docs/docs/reference/dropped-features/existential-types.md index ea176659fd77..4d7d9e2f8c10 100644 --- a/docs/docs/reference/dropped-features/existential-types.md +++ b/docs/docs/reference/dropped-features/existential-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Existential Types" -type: section -num: 74 -previous-page: /scala3/reference/dropped-features/macros -next-page: /scala3/reference/dropped-features/type-projection +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/existential-types.html --- Existential types using `forSome` (as in diff --git a/docs/docs/reference/dropped-features/limit22.md b/docs/docs/reference/dropped-features/limit22.md index 1c2bb0e2882a..514120fd2ce9 100644 --- a/docs/docs/reference/dropped-features/limit22.md +++ b/docs/docs/reference/dropped-features/limit22.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Limit 22" -type: section -num: 81 -previous-page: /scala3/reference/dropped-features/class-shadowing -next-page: /scala3/reference/dropped-features/xml +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/limit22.html --- The limits of 22 for the maximal number of parameters of function types and the @@ -13,7 +11,7 @@ maximal number of fields in tuple types have been dropped. [`scala.Function22`](https://www.scala-lang.org/api/current/scala/Function22.html) are erased to a new trait [`scala.runtime.FunctionXXL`](https://scala-lang.org/api/3.x/scala/runtime/FunctionXXL.html). * Tuples can also have an arbitrary number of fields. Tuples beyond [`scala.Tuple22`](https://www.scala-lang.org/api/current/scala/Tuple22.html) - are erased to a new class [`scala.runtime.TupleXXL`](https://scala-lang.org/api/3.x/scala/runtime/TupleXXL.html) (which extends the trait [`scala.Product`](https://scala-lang.org/api/3.x/scala/Product.html)). Furthermore, they support generic + are erased to a new class [`scala.runtime.TupleXXL`](https://scala-lang.org/api/3.x/scala/runtime/TupleXXL.html) (which extends the trait [`scala.Product`](https://scala-lang.org/api/3.x/scala/Product.md)). Furthermore, they support generic operation such as concatenation and indexing. Both of these are implemented using arrays. diff --git a/docs/docs/reference/dropped-features/macros.md b/docs/docs/reference/dropped-features/macros.md index 8208e8ee630c..e71bf120fe13 100644 --- a/docs/docs/reference/dropped-features/macros.md +++ b/docs/docs/reference/dropped-features/macros.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Scala 2 Macros" -type: section -num: 73 -previous-page: /scala3/reference/dropped-features/delayed-init -next-page: /scala3/reference/dropped-features/existential-types +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/macros.html --- The previous, experimental macro system has been dropped. @@ -13,6 +11,6 @@ Instead, there is a cleaner, more restricted system based on two complementary c In this setting, a definition marked as inlined containing a `${ ... }` is a macro, the code inside the `${ ... }` is executed at compile-time and produces code in the form of `'{ ... }`. Additionally, the contents of code can be inspected and created with a more complex reflection API as an extension of `'{ ... }`/`${ ... }` framework. -* `inline` has been [implemented](../metaprogramming/inline.html) in Scala 3. -* Quotes `'{ ... }` and splices `${ ... }` has been [implemented](../metaprogramming/macros.html) in Scala 3. -* [TASTy reflect](../metaprogramming/reflection.html) provides more complex tree based APIs to inspect or create quoted code. +* `inline` has been [implemented](../metaprogramming/inline.md) in Scala 3. +* Quotes `'{ ... }` and splices `${ ... }` has been [implemented](../metaprogramming/macros.md) in Scala 3. +* [TASTy reflect](../metaprogramming/reflection.md) provides more complex tree based APIs to inspect or create quoted code. diff --git a/docs/docs/reference/dropped-features/nonlocal-returns.md b/docs/docs/reference/dropped-features/nonlocal-returns.md index 89b244f122b4..99cdcdf0cd03 100644 --- a/docs/docs/reference/dropped-features/nonlocal-returns.md +++ b/docs/docs/reference/dropped-features/nonlocal-returns.md @@ -1,7 +1,8 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Deprecated: Nonlocal Returns" + +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/nonlocal-returns.html --- Returning from nested anonymous functions has been deprecated. diff --git a/docs/docs/reference/dropped-features/package-objects.md b/docs/docs/reference/dropped-features/package-objects.md index 12004c37dea3..e98c6c787a89 100644 --- a/docs/docs/reference/dropped-features/package-objects.md +++ b/docs/docs/reference/dropped-features/package-objects.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Package Objects" -type: section -num: 78 -previous-page: /scala3/reference/dropped-features/procedure-syntax -next-page: /scala3/reference/dropped-features/early-initializers +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/package-objects.html --- Package objects diff --git a/docs/docs/reference/dropped-features/procedure-syntax.md b/docs/docs/reference/dropped-features/procedure-syntax.md index d7a33cf374f8..cc82636d370d 100644 --- a/docs/docs/reference/dropped-features/procedure-syntax.md +++ b/docs/docs/reference/dropped-features/procedure-syntax.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Procedure Syntax" -type: section -num: 77 -previous-page: /scala3/reference/dropped-features/do-while -next-page: /scala3/reference/dropped-features/package-objects +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/procedure-syntax.html --- Procedure syntax diff --git a/docs/docs/reference/dropped-features/symlits.md b/docs/docs/reference/dropped-features/symlits.md index 1c71608f40fa..33c3e6ee0c39 100644 --- a/docs/docs/reference/dropped-features/symlits.md +++ b/docs/docs/reference/dropped-features/symlits.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Symbol Literals" -type: section -num: 83 -previous-page: /scala3/reference/dropped-features/xml -next-page: /scala3/reference/dropped-features/auto-apply +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/symlits.html --- Symbol literals are no longer supported. diff --git a/docs/docs/reference/dropped-features/this-qualifier.md b/docs/docs/reference/dropped-features/this-qualifier.md index baec0ae454f6..e1814e1d194e 100644 --- a/docs/docs/reference/dropped-features/this-qualifier.md +++ b/docs/docs/reference/dropped-features/this-qualifier.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: private[this] and protected[this]" -type: section -num: 86 -previous-page: /scala3/reference/dropped-features/weak-conformance -next-page: /scala3/reference/dropped-features/wildcard-init +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html --- The `private[this]` and `protected[this]` access modifiers are deprecated and will be phased out. @@ -33,5 +31,3 @@ This can cause problems if a program tries to access the missing private field v ``` - - diff --git a/docs/docs/reference/dropped-features/type-projection.md b/docs/docs/reference/dropped-features/type-projection.md index f2d2f215ed21..f45eff5c423f 100644 --- a/docs/docs/reference/dropped-features/type-projection.md +++ b/docs/docs/reference/dropped-features/type-projection.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: General Type Projection" -type: section -num: 75 -previous-page: /scala3/reference/dropped-features/existential-types -next-page: /scala3/reference/dropped-features/do-while +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/type-projection.html --- Scala so far allowed general type projection `T#A` where `T` is an arbitrary type diff --git a/docs/docs/reference/dropped-features/weak-conformance-spec.md b/docs/docs/reference/dropped-features/weak-conformance-spec.md index 147298f5573a..1432782a8e38 100644 --- a/docs/docs/reference/dropped-features/weak-conformance-spec.md +++ b/docs/docs/reference/dropped-features/weak-conformance-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Dropped: Weak Conformance - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/weak-conformance-spec.html --- To simplify the underlying type theory, Scala 3 drops the notion of diff --git a/docs/docs/reference/dropped-features/weak-conformance.md b/docs/docs/reference/dropped-features/weak-conformance.md index 1b6db185fad8..c2dabe39e7c7 100644 --- a/docs/docs/reference/dropped-features/weak-conformance.md +++ b/docs/docs/reference/dropped-features/weak-conformance.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Weak Conformance" -type: section -num: 85 -previous-page: /scala3/reference/dropped-features/auto-apply -next-page: /scala3/reference/dropped-features/this-qualifier +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/weak-conformance.html --- In some situations, Scala used a _weak conformance_ relation when @@ -46,4 +44,4 @@ Therefore, Scala 3 drops the general notion of weak conformance, and instead keeps one rule: `Int` literals are adapted to other numeric types if necessary. -[More details](weak-conformance-spec.html) +[More details](weak-conformance-spec.md) diff --git a/docs/docs/reference/dropped-features/wildcard-init.md b/docs/docs/reference/dropped-features/wildcard-init.md index 078ec138b3bb..c4b89674b11d 100644 --- a/docs/docs/reference/dropped-features/wildcard-init.md +++ b/docs/docs/reference/dropped-features/wildcard-init.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: Wildcard Initializer" -type: section -num: 87 -previous-page: /scala3/reference/dropped-features/this-qualifier -next-page: /scala3/reference/syntax +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/wildcard-init.html --- The syntax diff --git a/docs/docs/reference/dropped-features/xml.md b/docs/docs/reference/dropped-features/xml.md index c094408909f4..9de06ca30f2e 100644 --- a/docs/docs/reference/dropped-features/xml.md +++ b/docs/docs/reference/dropped-features/xml.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dropped: XML Literals" -type: section -num: 82 -previous-page: /scala3/reference/dropped-features/limit22 -next-page: /scala3/reference/dropped-features/symlits +movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features/xml.html --- XML Literals are still supported, but will be dropped in the near future, to diff --git a/docs/docs/reference/enums.md b/docs/docs/reference/enums.md index e8c63c237704..794c0130c9ec 100644 --- a/docs/docs/reference/enums.md +++ b/docs/docs/reference/enums.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Enums" -type: chapter -num: 9 -previous-page: /scala3/reference/new-types/polymorphic-function-types -next-page: /scala3/reference/enums/enums +movedTo: https://docs.scala-lang.org/scala3/reference/enums.html --- This chapter documents enums in Scala 3. diff --git a/docs/docs/reference/enums/adts.md b/docs/docs/reference/enums/adts.md index 10558707b543..6fc5be78d7b8 100644 --- a/docs/docs/reference/enums/adts.md +++ b/docs/docs/reference/enums/adts.md @@ -1,12 +1,10 @@ --- +layout: doc-page title: "Algebraic Data Types" -type: section -num: 11 -previous-page: /scala3/reference/enums/enums -next-page: /scala3/reference/enums/desugarEnums +movedTo: https://docs.scala-lang.org/scala3/reference/enums/adts.html --- -The [`enum` concept](./enums.html) is general enough to also support algebraic data +The [`enum` concept](./enums.md) is general enough to also support algebraic data types (ADTs) and their generalized version (GADTs). Here is an example how an `Option` type can be represented as an ADT: @@ -152,7 +150,7 @@ enum View[-T, +U] extends (T => U): ### Syntax of Enums Changes to the syntax fall in two categories: enum definitions and cases inside enums. -The changes are specified below as deltas with respect to the Scala syntax given [here](../syntax.html) +The changes are specified below as deltas with respect to the Scala syntax given [here](../syntax.md) 1. Enum definitions are defined as follows: diff --git a/docs/docs/reference/enums/desugarEnums.md b/docs/docs/reference/enums/desugarEnums.md index efcc41d5b2f6..95df1a7513ce 100644 --- a/docs/docs/reference/enums/desugarEnums.md +++ b/docs/docs/reference/enums/desugarEnums.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Translation of Enums and ADTs" -type: section -num: 12 -previous-page: /scala3/reference/enums/adts -next-page: /scala3/reference/contextual +movedTo: https://docs.scala-lang.org/scala3/reference/enums/desugarEnums.html --- The compiler expands enums and their cases to code that only uses @@ -157,7 +155,7 @@ map into `case class`es or `val`s. case C(ps) extends P1, ..., Pn ``` are treated specially. A call `C(ts)` of the apply method is ascribed the underlying type - `P1 & ... & Pn` (dropping any [transparent traits](../other-new-features/transparent-traits.html)) + `P1 & ... & Pn` (dropping any [transparent traits](../other-new-features/transparent-traits.md)) as long as that type is still compatible with the expected type at the point of application. A call `t.copy(ts)` of `C`'s `copy` method is treated in the same way. diff --git a/docs/docs/reference/enums/enums.md b/docs/docs/reference/enums/enums.md index 96d11e874212..e68f54fa0dd1 100644 --- a/docs/docs/reference/enums/enums.md +++ b/docs/docs/reference/enums/enums.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Enumerations" -type: section -num: 10 -previous-page: /scala3/reference/enums -next-page: /scala3/reference/enums/adts +movedTo: https://docs.scala-lang.org/scala3/reference/enums/enums.html --- An enumeration is used to define a type consisting of a set of named values. @@ -133,7 +131,7 @@ object Planet { } ``` -We could imagine that a library may use [type class derivation](../contextual/derivation.html) to automatically provide an instance for `Deprecations`. +We could imagine that a library may use [type class derivation](../contextual/derivation.md) to automatically provide an instance for `Deprecations`. ### Compatibility with Java Enums diff --git a/docs/docs/reference/experimental/canthrow.md b/docs/docs/reference/experimental/canthrow.md index 6377a040b515..3dd92c3fefba 100644 --- a/docs/docs/reference/experimental/canthrow.md +++ b/docs/docs/reference/experimental/canthrow.md @@ -1,8 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "CanThrow Abilities" -author: Martin Odersky +movedTo: https://docs.scala-lang.org/scala3/reference/experimental/canthrow.html --- This page describes experimental support for exception checking in Scala 3. It is enabled by the language import @@ -265,4 +264,3 @@ And it would have many other applications besides: Exceptions are a special case But even without these additional mechanisms, exception checking is already useful as it is. It gives a clear path forward to make code that uses exceptions safer, better documented, and easier to refactor. The only loophole arises for scoped capabilities - here we have to verify manually that these capabilities do not escape. Specifically, a `try` always has to be placed in the same computation stage as the throws that it enables. Put another way: If the status quo is 0% static checking since 100% is too painful, then an alternative that gives you 95% static checking with great ergonomics looks like a win. And we might still get to 100% in the future. - diff --git a/docs/docs/reference/experimental/erased-defs-spec.md b/docs/docs/reference/experimental/erased-defs-spec.md index 7905e4776fed..dc7922ddb10f 100644 --- a/docs/docs/reference/experimental/erased-defs-spec.md +++ b/docs/docs/reference/experimental/erased-defs-spec.md @@ -1,7 +1,8 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Erased Definitions: More Details" + +movedTo: https://docs.scala-lang.org/scala3/reference/experimental/erased-defs-spec.html --- TODO: complete @@ -62,4 +63,3 @@ TODO: complete 7. Overriding * Member definitions overriding each other must both be `erased` or not be `erased` * `def foo(x: T): U` cannot be overridden by `def foo(erased x: T): U` and vice-versa - diff --git a/docs/docs/reference/experimental/erased-defs.md b/docs/docs/reference/experimental/erased-defs.md index 47d25583b34c..4eb02b7b1de1 100644 --- a/docs/docs/reference/experimental/erased-defs.md +++ b/docs/docs/reference/experimental/erased-defs.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Erased Definitions" +movedTo: https://docs.scala-lang.org/scala3/reference/experimental/erased-defs.html --- `erased` is a modifier that expresses that some definition or expression is erased by the compiler instead of being represented in the compiled output. It is not yet part of the Scala language standard. To enable `erased`, turn on the language feature @@ -161,7 +161,7 @@ object Machine: // State must be Off ``` -Note that in [Inline](../metaprogramming/inline.html) we discussed `erasedValue` and inline +Note that in [Inline](../metaprogramming/inline.md) we discussed `erasedValue` and inline matches. `erasedValue` is implemented with `erased`, so the state machine above can be encoded as follows: @@ -228,4 +228,4 @@ val err: Any = CanRead() // error: illegal reference to erased class CanRead ``` Here, the type of `err` is `Any`, so `err` is not considered erased. Yet its initializing value is a reference to the erased class `CanRead`. -[More Details](./erased-defs-spec.html) +[More Details](./erased-defs-spec.md) diff --git a/docs/docs/reference/experimental/named-typeargs-spec.md b/docs/docs/reference/experimental/named-typeargs-spec.md index ddd808559825..e12743fe4656 100644 --- a/docs/docs/reference/experimental/named-typeargs-spec.md +++ b/docs/docs/reference/experimental/named-typeargs-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Named Type Arguments - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/experimental/named-typeargs-spec.html --- ## Syntax diff --git a/docs/docs/reference/experimental/named-typeargs.md b/docs/docs/reference/experimental/named-typeargs.md index 5e80a755293c..b9b4f7f33d69 100644 --- a/docs/docs/reference/experimental/named-typeargs.md +++ b/docs/docs/reference/experimental/named-typeargs.md @@ -1,8 +1,8 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Named Type Arguments" redirectFrom: reference/other-new-features/named-typeargs.html +movedTo: https://docs.scala-lang.org/scala3/reference/experimental/named-typeargs.html --- **Note:** This feature is implemented in Scala 3, but is not expected to be part of Scala 3.0. diff --git a/docs/docs/reference/experimental/numeric-literals.md b/docs/docs/reference/experimental/numeric-literals.md index da4a267784d1..40383787a2d0 100644 --- a/docs/docs/reference/experimental/numeric-literals.md +++ b/docs/docs/reference/experimental/numeric-literals.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Numeric Literals" +movedTo: https://docs.scala-lang.org/scala3/reference/experimental/numeric-literals.html --- **Note**: This feature is not yet part of the Scala 3 language definition. It can be made available by a language import: diff --git a/docs/docs/reference/experimental/overview.md b/docs/docs/reference/experimental/overview.md index a1dbde49f1cb..fdd44832fd8f 100644 --- a/docs/docs/reference/experimental/overview.md +++ b/docs/docs/reference/experimental/overview.md @@ -1,8 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Experimental language features" -author: Nicolas Stucki +movedTo: https://docs.scala-lang.org/scala3/reference/experimental/overview.html --- ### Experimental language features diff --git a/docs/docs/reference/features-classification.md b/docs/docs/reference/features-classification.md index 528b2ffccd70..21da1dfc065a 100644 --- a/docs/docs/reference/features-classification.md +++ b/docs/docs/reference/features-classification.md @@ -1,9 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "A Classification of Proposed Language Features" -date: April 6, 2019 -author: Martin Odersky +movedTo: https://docs.scala-lang.org/scala3/reference/features-classification.html --- This document provides an overview of the constructs proposed for Scala 3 with the aim to facilitate the discussion what to include and when to include it. It classifies features into eight groups: (1) essential foundations, (2) simplifications, (3) restrictions, (4) dropped features, (5) changed features, (6) new features, (7) features oriented towards metaprogramming with the aim to replace existing macros, and (8) changes to type checking and inference. @@ -17,11 +15,11 @@ The current document reflects the state of things as of April, 2019. It will be These new constructs directly model core features of [DOT](https://www.scala-lang.org/blog/2016/02/03/essence-of-scala.html), higher-kinded types, and the [SI calculus for implicit resolution](https://infoscience.epfl.ch/record/229878/files/simplicitly_1.pdf). - - [Intersection types](new-types/intersection-types.html), replacing compound types, - - [Union types](new-types/union-types.html), - - [Type lambdas](new-types/type-lambdas.html), + - [Intersection types](new-types/intersection-types.md), replacing compound types, + - [Union types](new-types/union-types.md), + - [Type lambdas](new-types/type-lambdas.md), replacing encodings using structural types and type projection. - - [Context functions](contextual/context-functions.html) offering abstraction over given parameters. + - [Context functions](contextual/context-functions.md) offering abstraction over given parameters. **Status: essential** @@ -35,19 +33,19 @@ Since these are additions, there's generally no migration cost for old code. An These constructs replace existing constructs with the aim of making the language safer and simpler to use, and to promote uniformity in code style. - - [Trait parameters](other-new-features/trait-parameters.html) replace [early initializers](dropped-features/early-initializers.html) with a more generally useful construct. - - [Given instances](contextual/givens.html) + - [Trait parameters](other-new-features/trait-parameters.md) replace [early initializers](dropped-features/early-initializers.md) with a more generally useful construct. + - [Given instances](contextual/givens.md) replace implicit objects and defs, focussing on intent over mechanism. - - [Using clauses](contextual/using-clauses.html) replace implicit parameters, avoiding their ambiguities. - - [Extension methods](contextual/extension-methods.html) replace implicit classes with a clearer and simpler mechanism. - - [Opaque type aliases](other-new-features/opaques.html) replace most uses + - [Using clauses](contextual/using-clauses.md) replace implicit parameters, avoiding their ambiguities. + - [Extension methods](contextual/extension-methods.md) replace implicit classes with a clearer and simpler mechanism. + - [Opaque type aliases](other-new-features/opaques.md) replace most uses of value classes while guaranteeing absence of boxing. - - [Top-level definitions](dropped-features/package-objects.html) replace package objects, dropping syntactic boilerplate. - - [Export clauses](other-new-features/export.html) + - [Top-level definitions](dropped-features/package-objects.md) replace package objects, dropping syntactic boilerplate. + - [Export clauses](other-new-features/export.md) provide a simple and general way to express aggregation, which can replace the previous facade pattern of package objects inheriting from classes. - - [Vararg splices](changed-features/vararg-splices.html) now use the form `*` instead of `@ _*`, mirroring vararg expressions, - - [Creator applications](other-new-features/creator-applications.html) allow using simple function call syntax + - [Vararg splices](changed-features/vararg-splices.md) now use the form `*` instead of `@ _*`, mirroring vararg expressions, + - [Creator applications](other-new-features/creator-applications.md) allow using simple function call syntax instead of `new` expressions. `new` expressions stay around as a fallback for the cases where creator applications cannot be used. @@ -70,10 +68,10 @@ For the next several versions, old features will remain available and deprecatio These constructs are restricted to make the language safer. - - [Implicit Conversions](contextual/conversions.html): there is only one way to define implicit conversions instead of many, and potentially surprising implicit conversions require a language import. - - [Given Imports](contextual/given-imports.html): implicits now require a special form of import, to make the import clearly visible. - - [Type Projection](dropped-features/type-projection.html): only classes can be used as prefix `C` of a type projection `C#A`. Type projection on abstract types is no longer supported since it is unsound. - - [Multiversal equality](contextual/multiversal-equality.html) implements an "opt-in" scheme to rule out nonsensical comparisons with `==` and `!=`. + - [Implicit Conversions](contextual/conversions.md): there is only one way to define implicit conversions instead of many, and potentially surprising implicit conversions require a language import. + - [Given Imports](contextual/given-imports.md): implicits now require a special form of import, to make the import clearly visible. + - [Type Projection](dropped-features/type-projection.md): only classes can be used as prefix `C` of a type projection `C#A`. Type projection on abstract types is no longer supported since it is unsound. + - [Multiversal equality](contextual/multiversal-equality.md) implements an "opt-in" scheme to rule out nonsensical comparisons with `==` and `!=`. - [infix](https://github.com/lampepfl/dotty/pull/5975) makes method application syntax uniform across code bases. @@ -93,15 +91,15 @@ These are essential restrictions. If we decide to adopt them, we should do it fo These constructs are proposed to be dropped without a new construct replacing them. The motivation for dropping these constructs is to simplify the language and its implementation. - - [DelayedInit](dropped-features/delayed-init.html), - - [Existential types](dropped-features/existential-types.html), - - [Procedure syntax](dropped-features/procedure-syntax.html), - - [Class shadowing](dropped-features/class-shadowing.html), - - [XML literals](dropped-features/xml.html), - - [Symbol literals](dropped-features/symlits.html), - - [Auto application](dropped-features/auto-apply.html), - - [Weak conformance](dropped-features/weak-conformance.html), - - [Compound types](new-types/intersection-types.html), + - [DelayedInit](dropped-features/delayed-init.md), + - [Existential types](dropped-features/existential-types.md), + - [Procedure syntax](dropped-features/procedure-syntax.md), + - [Class shadowing](dropped-features/class-shadowing.md), + - [XML literals](dropped-features/xml.md), + - [Symbol literals](dropped-features/symlits.md), + - [Auto application](dropped-features/auto-apply.md), + - [Weak conformance](dropped-features/weak-conformance.md), + - [Compound types](new-types/intersection-types.md), - [Auto tupling](https://github.com/lampepfl/dotty/pull/4311) (implemented, but not merged). The date when these constructs are dropped varies. The current status is: @@ -128,10 +126,10 @@ and sometimes need to be manual (e.g. class shadowing, auto tupling). Sometimes These constructs have undergone changes to make them more regular and useful. - - [Structural Types](changed-features/structural-types.html): They now allow pluggable implementations, which greatly increases their usefulness. Some usage patterns are restricted compared to the status quo. - - [Name-based pattern matching](changed-features/pattern-matching.html): The existing undocumented Scala 2 implementation has been codified in a slightly simplified form. - - [Eta expansion](changed-features/eta-expansion.html) is now performed universally also in the absence of an expected type. The postfix `_` operator is thus made redundant. It will be deprecated and dropped after Scala 3.0. - - [Implicit Resolution](changed-features/implicit-resolution.html): The implicit resolution rules have been cleaned up to make them more useful and less surprising. Implicit scope is restricted to no longer include package prefixes. + - [Structural Types](changed-features/structural-types.md): They now allow pluggable implementations, which greatly increases their usefulness. Some usage patterns are restricted compared to the status quo. + - [Name-based pattern matching](changed-features/pattern-matching.md): The existing undocumented Scala 2 implementation has been codified in a slightly simplified form. + - [Eta expansion](changed-features/eta-expansion.md) is now performed universally also in the absence of an expected type. The postfix `_` operator is thus made redundant. It will be deprecated and dropped after Scala 3.0. + - [Implicit Resolution](changed-features/implicit-resolution.md): The implicit resolution rules have been cleaned up to make them more useful and less surprising. Implicit scope is restricted to no longer include package prefixes. Most aspects of old-style implicit resolution are still available under `-source 3.0-migration`. The other changes in this list are applied unconditionally. @@ -147,11 +145,11 @@ Only a few programs should require changes, but some necessary changes might be These are additions to the language that make it more powerful or pleasant to use. - - [Enums](enums/enums.html) provide concise syntax for enumerations and [algebraic data types](enums/adts.html). - - [Parameter untupling](other-new-features/parameter-untupling.html) avoids having to use `case` for tupled parameter destructuring. - - [Dependent function types](new-types/dependent-function-types.html) generalize dependent methods to dependent function values and types. + - [Enums](enums/enums.md) provide concise syntax for enumerations and [algebraic data types](enums/adts.md). + - [Parameter untupling](other-new-features/parameter-untupling.md) avoids having to use `case` for tupled parameter destructuring. + - [Dependent function types](new-types/dependent-function-types.md) generalize dependent methods to dependent function values and types. - [Polymorphic function types](https://github.com/lampepfl/dotty/pull/4672) generalize polymorphic methods to dependent function values and types. _Current status_: There is a proposal, and a prototype implementation, but the implementation has not been finalized or merged yet. - - [Kind polymorphism](other-new-features/kind-polymorphism.html) allows the definition of operators working equally on types and type constructors. + - [Kind polymorphism](other-new-features/kind-polymorphism.md) allows the definition of operators working equally on types and type constructors. **Status: mixed** @@ -169,12 +167,12 @@ It's worth noting that macros were never included in the [Scala 2 language speci To enable porting most uses of macros, we are experimenting with the advanced language constructs listed below. These designs are more provisional than the rest of the proposed language constructs for Scala 3.0. There might still be some changes until the final release. Stabilizing the feature set needed for metaprogramming is our first priority. -- [Match types](new-types/match-types.html) allow computation on types. -- [Inline](metaprogramming/inline.html) provides +- [Match types](new-types/match-types.md) allow computation on types. +- [Inline](metaprogramming/inline.md) provides by itself a straightforward implementation of some simple macros and is at the same time an essential building block for the implementation of complex macros. -- [Quotes and splices](metaprogramming/macros.html) provide a principled way to express macros and staging with a unified set of abstractions. -- [Type class derivation](contextual/derivation.html) provides an in-language implementation of the `Gen` macro in Shapeless and other foundational libraries. The new implementation is more robust, efficient and easier to use than the macro. -- [Implicit by-name parameters](contextual/by-name-context-parameters.html) provide a more robust in-language implementation of the `Lazy` macro in Shapeless. +- [Quotes and splices](metaprogramming/macros.md) provide a principled way to express macros and staging with a unified set of abstractions. +- [Type class derivation](contextual/derivation.md) provides an in-language implementation of the `Gen` macro in Shapeless and other foundational libraries. The new implementation is more robust, efficient and easier to use than the macro. +- [Implicit by-name parameters](contextual/by-name-context-parameters.md) provide a more robust in-language implementation of the `Lazy` macro in Shapeless. **Status: not yet settled** diff --git a/docs/docs/reference/language-versions.md b/docs/docs/reference/language-versions.md index a17a567d7362..67659d1fe109 100644 --- a/docs/docs/reference/language-versions.md +++ b/docs/docs/reference/language-versions.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Language Versions" -type: chapter -description: This page lists the different flavours of language supported by the Scala 3 compiler. -num: 101 -previous-page: overview +movedTo: https://docs.scala-lang.org/scala3/reference/language-versions.html --- The default Scala language version currently supported by the Dotty compiler is `3.0`. There are also other language versions that can be specified instead: diff --git a/docs/docs/reference/metaprogramming.md b/docs/docs/reference/metaprogramming.md index 18664703a079..1d8fa83bae20 100644 --- a/docs/docs/reference/metaprogramming.md +++ b/docs/docs/reference/metaprogramming.md @@ -1,15 +1,13 @@ --- +layout: doc-page title: "Metaprogramming" -type: chapter -num: 27 -previous-page: /scala3/reference/contextual/relationship-implicits -next-page: /scala3/reference/metaprogramming/inline +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming.html --- The following pages introduce the redesign of metaprogramming in Scala. They introduce the following fundamental facilities: -1. [`inline`](./metaprogramming/inline.html) is a new modifier that guarantees that +1. [`inline`](./metaprogramming/inline.md) is a new modifier that guarantees that a definition will be inlined at the point of use. The primary motivation behind inline is to reduce the overhead behind function calls and access to values. The expansion will be performed by the Scala compiler during the @@ -20,10 +18,10 @@ introduce the following fundamental facilities: programming), macros (enabling compile-time, generative, metaprogramming) and runtime code generation (multi-stage programming). -2. [Compile-time ops](./metaprogramming/compiletime-ops.html) are helper definitions in the +2. [Compile-time ops](./metaprogramming/compiletime-ops.md) are helper definitions in the standard library that provide support for compile-time operations over values and types. -3. [Macros](./metaprogramming/macros.html) are built on two well-known fundamental +3. [Macros](./metaprogramming/macros.md) are built on two well-known fundamental operations: quotation and splicing. Quotation converts program code to data, specifically, a (tree-like) representation of this code. It is expressed as `'{...}` for expressions and as `'[...]` for types. Splicing, @@ -31,19 +29,19 @@ introduce the following fundamental facilities: to program code. Together with `inline`, these two abstractions allow to construct program code programmatically. -4. [Runtime Staging](./metaprogramming/staging.html) Where macros construct code at _compile-time_, +4. [Runtime Staging](./metaprogramming/staging.md) Where macros construct code at _compile-time_, staging lets programs construct new code at _runtime_. That way, code generation can depend not only on static data but also on data available at runtime. This splits the evaluation of the program in two or more phases or ... stages. Consequently, this method of generative programming is called "Multi-Stage Programming". Staging is built on the same foundations as macros. It uses quotes and splices, but leaves out `inline`. -5. [Reflection](./metaprogramming/reflection.html) Quotations are a "black-box" +5. [Reflection](./metaprogramming/reflection.md) Quotations are a "black-box" representation of code. They can be parameterized and composed using splices, but their structure cannot be analyzed from the outside. TASTy reflection gives a way to analyze code structure by partly revealing the representation type of a piece of code in a standard API. The representation type is a form of typed abstract syntax tree, which gives rise to the `TASTy` moniker. -6. [TASTy Inspection](./metaprogramming/tasty-inspect.html) Typed abstract syntax trees are serialized +6. [TASTy Inspection](./metaprogramming/tasty-inspect.md) Typed abstract syntax trees are serialized in a custom compressed binary format stored in `.tasty` files. TASTy inspection allows to load these files and analyze their content's tree structure. diff --git a/docs/docs/reference/metaprogramming/compiletime-ops.md b/docs/docs/reference/metaprogramming/compiletime-ops.md index 9bf0bc537930..944cdac5389a 100644 --- a/docs/docs/reference/metaprogramming/compiletime-ops.md +++ b/docs/docs/reference/metaprogramming/compiletime-ops.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Compile-time operations" -type: section -num: 29 -previous-page: /scala3/reference/metaprogramming/inline -next-page: /scala3/reference/metaprogramming/macros +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/compiletime-ops.html --- ## The `scala.compiletime` Package diff --git a/docs/docs/reference/metaprogramming/inline.md b/docs/docs/reference/metaprogramming/inline.md index 2e55b8e63cd0..8ccef49872b7 100644 --- a/docs/docs/reference/metaprogramming/inline.md +++ b/docs/docs/reference/metaprogramming/inline.md @@ -1,14 +1,12 @@ --- +layout: doc-page title: Inline -type: section -num: 28 -previous-page: /scala3/reference/metaprogramming -next-page: /scala3/reference/metaprogramming/compiletime-ops +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/inline.html --- ## Inline Definitions -`inline` is a new [soft modifier](../soft-modifier.html) that guarantees that a +`inline` is a new [soft modifier](../soft-modifier.md) that guarantees that a definition will be inlined at the point of use. Example: ```scala diff --git a/docs/docs/reference/metaprogramming/macros-spec.md b/docs/docs/reference/metaprogramming/macros-spec.md index aa819c5ecb52..d152377e6d62 100644 --- a/docs/docs/reference/metaprogramming/macros-spec.md +++ b/docs/docs/reference/metaprogramming/macros-spec.md @@ -1,14 +1,14 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Macros Spec" +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/macros-spec.html --- ## Implementation ### Syntax -Compared to the [Scala 3 reference grammar](../syntax.html) +Compared to the [Scala 3 reference grammar](../syntax.md) there are the following syntax changes: ``` SimpleExpr ::= ... @@ -159,7 +159,7 @@ environments and terms. Es |- 't: expr T ``` The meta theory of a slightly simplified 2-stage variant of this calculus -is studied [separately](./simple-smp.html). +is studied [separately](./simple-smp.md). ## Going Further diff --git a/docs/docs/reference/metaprogramming/macros.md b/docs/docs/reference/metaprogramming/macros.md index 9d70230c1356..e1267ea82a59 100644 --- a/docs/docs/reference/metaprogramming/macros.md +++ b/docs/docs/reference/metaprogramming/macros.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Macros" -type: section -num: 30 -previous-page: /scala3/reference/metaprogramming/compiletime-ops -next-page: /scala3/reference/metaprogramming/staging +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/macros.html --- > When developing macros enable `-Xcheck-macros` scalac option flag to have extra runtime checks. @@ -505,7 +503,7 @@ and allow for undefined compiler behavior if they are not. This is analogous to the status of pattern guards in Scala, which are also required, but not verified, to be pure. -[Multi-Stage Programming](./staging.html) introduces one additional method where +[Multi-Stage Programming](./staging.md) introduces one additional method where you can expand code at runtime with a method `run`. There is also a problem with that invocation of `run` in splices. Consider the following expression: @@ -627,7 +625,7 @@ def setForExpr[T: Type](using Quotes): Expr[Set[T]] = ## Relationship with Transparent Inline -[Inline](./inline.html) documents inlining. The code below introduces a transparent +[Inline](./inline.md) documents inlining. The code below introduces a transparent inline method that can calculate either a value of type `Int` or a value of type `String`. @@ -822,4 +820,4 @@ To match an actual application we can use braces on the function part `${b}(a1, ## More details -[More details](./macros-spec.html) +[More details](./macros-spec.md) diff --git a/docs/docs/reference/metaprogramming/reflection.md b/docs/docs/reference/metaprogramming/reflection.md index a7c65cff680a..74bb4f693e1b 100644 --- a/docs/docs/reference/metaprogramming/reflection.md +++ b/docs/docs/reference/metaprogramming/reflection.md @@ -1,22 +1,20 @@ --- +layout: doc-page title: "Reflection" -type: section -num: 32 -previous-page: /scala3/reference/metaprogramming/staging -next-page: /scala3/reference/metaprogramming/tasty-inspect +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/reflection.html --- Reflection enables inspection and construction of Typed Abstract Syntax Trees (Typed-AST). It may be used on quoted expressions (`quoted.Expr`) and quoted -types (`quoted.Type`) from [Macros](./macros.html) or on full TASTy files. +types (`quoted.Type`) from [Macros](./macros.md) or on full TASTy files. -If you are writing macros, please first read [Macros](./macros.html). +If you are writing macros, please first read [Macros](./macros.md). You may find all you need without using quote reflection. ## API: From quotes and splices to TASTy reflect trees and back With `quoted.Expr` and `quoted.Type` we can compute code but also analyze code -by inspecting the ASTs. [Macros](./macros.html) provide the guarantee that the +by inspecting the ASTs. [Macros](./macros.md) provide the guarantee that the generation of code will be type-correct. Using quote reflection will break these guarantees and may fail at macro expansion time, hence additional explicit checks must be done. diff --git a/docs/docs/reference/metaprogramming/simple-smp.md b/docs/docs/reference/metaprogramming/simple-smp.md index 6a7e2c0fbae1..78277987c874 100644 --- a/docs/docs/reference/metaprogramming/simple-smp.md +++ b/docs/docs/reference/metaprogramming/simple-smp.md @@ -1,11 +1,11 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "The Meta-theory of Symmetric Metaprogramming" +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/simple-smp.html --- This note presents a simplified variant of -[principled metaprogramming](./macros.html) +[principled metaprogramming](./macros.md) and sketches its soundness proof. The variant treats only dialogues between two stages. A program can have quotes which can contain splices (which can contain quotes, which can contain splices, and so diff --git a/docs/docs/reference/metaprogramming/staging.md b/docs/docs/reference/metaprogramming/staging.md index 0e90966c85b2..2b76df3f5fd5 100644 --- a/docs/docs/reference/metaprogramming/staging.md +++ b/docs/docs/reference/metaprogramming/staging.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Runtime Multi-Stage Programming" -type: section -num: 31 -previous-page: /scala3/reference/metaprogramming/macros -next-page: /scala3/reference/metaprogramming/reflection +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/staging.html --- The framework expresses at the same time compile-time metaprogramming and @@ -99,7 +97,7 @@ scala -with-compiler -classpath out Test ## Example -Now take exactly the same example as in [Macros](./macros.html). Assume that we +Now take exactly the same example as in [Macros](./macros.md). Assume that we do not want to pass an array statically but generate code at run-time and pass the value, also at run-time. Note, how we make a future-stage function of type `Expr[Array[Int] => Int]` in line 6 below. Using `staging.run { ... }` we can evaluate an diff --git a/docs/docs/reference/metaprogramming/tasty-inspect.md b/docs/docs/reference/metaprogramming/tasty-inspect.md index 32bc2efa4313..2ab2ce84c354 100644 --- a/docs/docs/reference/metaprogramming/tasty-inspect.md +++ b/docs/docs/reference/metaprogramming/tasty-inspect.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "TASTy Inspection" -type: section -num: 33 -previous-page: /scala3/reference/metaprogramming/reflection -next-page: /scala3/reference/other-new-features +movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/tasty-inspect.html --- ```scala diff --git a/docs/docs/reference/new-types.md b/docs/docs/reference/new-types.md index 61368808406e..dd2d1036d2e6 100644 --- a/docs/docs/reference/new-types.md +++ b/docs/docs/reference/new-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "New Types" -type: chapter -num: 2 -previous-page: /scala3/reference/overview -next-page: /scala3/reference/new-types/intersection-types +movedTo: https://docs.scala-lang.org/scala3/reference/new-types.html --- This chapter documents the new types introduced in Scala 3. diff --git a/docs/docs/reference/new-types/dependent-function-types-spec.md b/docs/docs/reference/new-types/dependent-function-types-spec.md index 07a07b74287c..aeca72fbe302 100644 --- a/docs/docs/reference/new-types/dependent-function-types-spec.md +++ b/docs/docs/reference/new-types/dependent-function-types-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Dependent Function Types - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/dependent-function-types-spec.html --- Initial implementation in [PR #3464](https://github.com/lampepfl/dotty/pull/3464). @@ -39,7 +39,7 @@ dependent function types for methods with dependent result types. Dependent functions can be implicit, and generalize to arity `N > 22` in the same way that other functions do, see -[the corresponding documentation](../dropped-features/limit22.html). +[the corresponding documentation](../dropped-features/limit22.md). ## Examples diff --git a/docs/docs/reference/new-types/dependent-function-types.md b/docs/docs/reference/new-types/dependent-function-types.md index ffa9012c4ad3..33f677276aac 100644 --- a/docs/docs/reference/new-types/dependent-function-types.md +++ b/docs/docs/reference/new-types/dependent-function-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Dependent Function Types" -type: section -num: 7 -previous-page: /scala3/reference/new-types/match-types -next-page: /scala3/reference/new-types/polymorphic-function-types +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/dependent-function-types.html --- A dependent function type is a function type whose result depends @@ -48,4 +46,4 @@ Function1[Entry, Entry#Key]: def apply(e: Entry): e.Key ``` -[More details](./dependent-function-types-spec.html) +[More details](./dependent-function-types-spec.md) diff --git a/docs/docs/reference/new-types/intersection-types-spec.md b/docs/docs/reference/new-types/intersection-types-spec.md index aeceeac04868..4d236c37dcc3 100644 --- a/docs/docs/reference/new-types/intersection-types-spec.md +++ b/docs/docs/reference/new-types/intersection-types-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Intersection Types - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/intersection-types-spec.html --- ## Syntax diff --git a/docs/docs/reference/new-types/intersection-types.md b/docs/docs/reference/new-types/intersection-types.md index e912ec699457..1854ce847896 100644 --- a/docs/docs/reference/new-types/intersection-types.md +++ b/docs/docs/reference/new-types/intersection-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: Intersection Types -type: section -num: 3 -previous-page: /scala3/reference/new-types -next-page: /scala3/reference/new-types/union-types +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/intersection-types.html --- Used on types, the `&` operator creates an intersection type. @@ -67,4 +65,4 @@ class C extends A, B: ``` -[More details](./intersection-types-spec.html) +[More details](./intersection-types-spec.md) diff --git a/docs/docs/reference/new-types/match-types.md b/docs/docs/reference/new-types/match-types.md index 804545fbff61..a2a086f3819e 100644 --- a/docs/docs/reference/new-types/match-types.md +++ b/docs/docs/reference/new-types/match-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Match Types" -type: section -num: 6 -previous-page: /scala3/reference/new-types/type-lambdas -next-page: /scala3/reference/new-types/dependent-function-types +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/match-types.html --- A match type reduces to one of its right-hand sides, depending on the type of diff --git a/docs/docs/reference/new-types/polymorphic-function-types.md b/docs/docs/reference/new-types/polymorphic-function-types.md index 58224ef0de43..2a803f5e65db 100644 --- a/docs/docs/reference/new-types/polymorphic-function-types.md +++ b/docs/docs/reference/new-types/polymorphic-function-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Polymorphic Function Types" -type: section -num: 8 -previous-page: /scala3/reference/new-types/dependent-function-types -next-page: /scala3/reference/enums +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/polymorphic-function-types.html --- A polymorphic function type is a function type which accepts type parameters. @@ -83,7 +81,7 @@ println(e1) // Apply(Apply(Var(wrap),Var(f)),Apply(Var(wrap),Var(a))) ## Relationship With Type Lambdas Polymorphic function types are not to be confused with -[_type lambdas_](type-lambdas.html). +[_type lambdas_](type-lambdas.md). While the former describes the _type_ of a polymorphic _value_, the latter is an actual function value _at the type level_. diff --git a/docs/docs/reference/new-types/type-lambdas-spec.md b/docs/docs/reference/new-types/type-lambdas-spec.md index 06bd314512c4..09fb9c76d6cf 100644 --- a/docs/docs/reference/new-types/type-lambdas-spec.md +++ b/docs/docs/reference/new-types/type-lambdas-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Type Lambdas - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/type-lambdas-spec.html --- ## Syntax @@ -105,7 +105,7 @@ would be treated as covariant, `X` is used covariantly on its right-hand side. **Note**: The decision to treat `Nothing` as universal bottom type is provisional, and might be changed after further discussion. -**Note**: Scala 2 and 3 differ in that Scala 2 also treats `Any` as universal top-type. This is not done in Scala 3. See also the discussion on [kind polymorphism](../other-new-features/kind-polymorphism.html) +**Note**: Scala 2 and 3 differ in that Scala 2 also treats `Any` as universal top-type. This is not done in Scala 3. See also the discussion on [kind polymorphism](../other-new-features/kind-polymorphism.md) ## Curried Type Parameters @@ -115,5 +115,3 @@ type TL = [X] =>> [Y] =>> (X, Y) ``` Currently, no special provision is made to infer type arguments to such curried type lambdas. This is left for future work. - - diff --git a/docs/docs/reference/new-types/type-lambdas.md b/docs/docs/reference/new-types/type-lambdas.md index 8b12fbcece57..8ede3f9305c7 100644 --- a/docs/docs/reference/new-types/type-lambdas.md +++ b/docs/docs/reference/new-types/type-lambdas.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Type Lambdas" -type: section -num: 5 -previous-page: /scala3/reference/new-types/union-types -next-page: /scala3/reference/new-types/match-types +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/type-lambdas.html --- A _type lambda_ lets one express a higher-kinded type directly, without @@ -16,4 +14,4 @@ a type definition. For instance, the type above defines a binary type constructor, which maps arguments `X` and `Y` to `Map[Y, X]`. Type parameters of type lambdas can have bounds, but they cannot carry `+` or `-` variance annotations. -[More details](./type-lambdas-spec.html) +[More details](./type-lambdas-spec.md) diff --git a/docs/docs/reference/new-types/union-types-spec.md b/docs/docs/reference/new-types/union-types-spec.md index 9cfa27f619c3..042dedea6954 100644 --- a/docs/docs/reference/new-types/union-types-spec.md +++ b/docs/docs/reference/new-types/union-types-spec.md @@ -1,13 +1,13 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Union Types - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/union-types-spec.html --- ## Syntax Syntactically, unions follow the same rules as intersections, but have a lower precedence, see -[Intersection Types - More Details](./intersection-types-spec.html). +[Intersection Types - More Details](./intersection-types-spec.md). ### Interaction with pattern matching syntax `|` is also used in pattern matching to separate pattern alternatives and has @@ -140,7 +140,7 @@ On the other hand, the following would be allowed ```scala trait C { def hello: String } -trait A extends C with D +trait A extends C with D trait B extends C with E def test(x: A | B) = x.hello // ok as `hello` is a member of the join of A | B which is C diff --git a/docs/docs/reference/new-types/union-types.md b/docs/docs/reference/new-types/union-types.md index 7b2922fe3415..9c52cff3864d 100644 --- a/docs/docs/reference/new-types/union-types.md +++ b/docs/docs/reference/new-types/union-types.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Union Types" -type: section -num: 4 -previous-page: /scala3/reference/new-types/intersection-types -next-page: /scala3/reference/new-types/type-lambdas +movedTo: https://docs.scala-lang.org/scala3/reference/new-types/union-types.html --- A union type `A | B` has as values all values of type `A` and also all values of type `B`. @@ -45,4 +43,4 @@ The type of `res2` is `Object & Product`, which is a supertype of UserName`. If we want the least supertype, we have to give it explicitly, as is done for the type of `either`. -[More details](./union-types-spec.html) +[More details](./union-types-spec.md) diff --git a/docs/docs/reference/other-new-features.md b/docs/docs/reference/other-new-features.md index faa2aefc6a91..85e768833a71 100644 --- a/docs/docs/reference/other-new-features.md +++ b/docs/docs/reference/other-new-features.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Other New Features" -type: chapter -num: 34 -previous-page: /scala3/reference/metaprogramming/tasty-inspect -next-page: /scala3/reference/other-new-features/trait-parameters +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features.html --- The following pages document new features of Scala 3. diff --git a/docs/docs/reference/other-new-features/control-syntax.md b/docs/docs/reference/other-new-features/control-syntax.md index 0fefba262bf5..2f0bbde41331 100644 --- a/docs/docs/reference/other-new-features/control-syntax.md +++ b/docs/docs/reference/other-new-features/control-syntax.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: New Control Syntax -type: section -num: 46 -previous-page: /scala3/reference/other-new-features/targetName -next-page: /scala3/reference/other-new-features/indentation +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/control-syntax.html --- Scala 3 has a new "quiet" syntax for control expressions that does not rely on diff --git a/docs/docs/reference/other-new-features/creator-applications.md b/docs/docs/reference/other-new-features/creator-applications.md index 0422bbfac77c..17bc1574f763 100644 --- a/docs/docs/reference/other-new-features/creator-applications.md +++ b/docs/docs/reference/other-new-features/creator-applications.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Universal Apply Methods" -type: section -num: 37 -previous-page: /scala3/reference/other-new-features/transparent-traits -next-page: /scala3/reference/other-new-features/export +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/creator-applications.html --- Scala case classes generate apply methods, so that values of case classes can be created using simple diff --git a/docs/docs/reference/other-new-features/experimental-defs.md b/docs/docs/reference/other-new-features/experimental-defs.md index 5060ffb889d5..a5c0bff378cd 100644 --- a/docs/docs/reference/other-new-features/experimental-defs.md +++ b/docs/docs/reference/other-new-features/experimental-defs.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Experimental definitions" -type: section -num: 51 -previous-page: /scala3/reference/other-new-features/type-test -next-page: /scala3/reference/changed-features +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/experimental-defs.html --- diff --git a/docs/docs/reference/other-new-features/explicit-nulls.md b/docs/docs/reference/other-new-features/explicit-nulls.md index a0dac187ae60..c1afe6a4e067 100644 --- a/docs/docs/reference/other-new-features/explicit-nulls.md +++ b/docs/docs/reference/other-new-features/explicit-nulls.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Explicit Nulls" -type: section -num: 48 -previous-page: /scala3/reference/other-new-features/indentation -next-page: /scala3/reference/other-new-features/safe-initialization +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/explicit-nulls.html --- Explicit nulls is an opt-in feature that modifies the Scala type system, which makes reference types @@ -15,7 +13,7 @@ This means the following code will no longer typecheck: val x: String = null // error: found `Null`, but required `String` ``` -Instead, to mark a type as nullable we use a [union type](../new-types/union-types.html) +Instead, to mark a type as nullable we use a [union type](../new-types/union-types.md) ```scala val x: String | Null = null // ok @@ -38,7 +36,7 @@ When explicit nulls are enabled, the type hierarchy changes so that `Null` is on This is the new type hierarchy: -!["Type Hierarchy for Explicit Nulls"](/resources/images/scala3/explicit-nulls/explicit-nulls-type-hierarchy.png) +!["Type Hierarchy for Explicit Nulls"](images/explicit-nulls/explicit-nulls-type-hierarchy.png) After erasure, `Null` remains a subtype of all reference types (as forced by the JVM). @@ -83,7 +81,7 @@ val c = new C() ``` The unsoundness above can be caught by the compiler with the option `-Ysafe-init`. -More details can be found in [safe initialization](./safe-initialization.html). +More details can be found in [safe initialization](./safe-initialization.md). ## Equality diff --git a/docs/docs/reference/other-new-features/export.md b/docs/docs/reference/other-new-features/export.md index 49a190c4c923..d21f6ed6d4cb 100644 --- a/docs/docs/reference/other-new-features/export.md +++ b/docs/docs/reference/other-new-features/export.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Export Clauses" -type: section -num: 38 -previous-page: /scala3/reference/other-new-features/creator-applications -next-page: /scala3/reference/other-new-features/opaques +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/export.html --- An export clause defines aliases for selected members of an object. Example: diff --git a/docs/docs/reference/other-new-features/indentation-experimental.md b/docs/docs/reference/other-new-features/indentation-experimental.md index 389219d8e877..cbdd41eeaf12 100644 --- a/docs/docs/reference/other-new-features/indentation-experimental.md +++ b/docs/docs/reference/other-new-features/indentation-experimental.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Fewer Braces" +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/indentation-experimental.html --- By and large, the possible indentation regions coincide with those regions where braces `{...}` are also legal, no matter whether the braces enclose an expression or a set of definitions. There is one exception, though: Arguments to function can be enclosed in braces but they cannot be simply indented instead. Making indentation always significant for function arguments would be too restrictive and fragile. diff --git a/docs/docs/reference/other-new-features/indentation.md b/docs/docs/reference/other-new-features/indentation.md index 6a71e351f3c1..c7a6fdbb7453 100644 --- a/docs/docs/reference/other-new-features/indentation.md +++ b/docs/docs/reference/other-new-features/indentation.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Optional Braces" -type: section -num: 47 -previous-page: /scala3/reference/other-new-features/control-syntax -next-page: /scala3/reference/other-new-features/explicit-nulls +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/indentation.html --- Scala 3 enforces some rules on indentation and allows some occurrences of braces `{...}` to be optional: @@ -87,7 +85,7 @@ There are two rules: then else do catch finally yield match ``` - if the first token on the next line is a - [leading infix operator](../changed-features/operators.html). + [leading infix operator](../changed-features/operators.md). then its indentation width is less then the current indentation width, and it either matches a previous indentation width or is also less than the enclosing indentation width. @@ -411,7 +409,7 @@ Significant indentation is enabled by default. It can be turned off by giving an The Scala 3 compiler can rewrite source code to indented code and back. When invoked with options `-rewrite -indent` it will rewrite braces to indented regions where possible. When invoked with options `-rewrite -no-indent` it will rewrite in the reverse direction, inserting braces for indentation regions. -The `-indent` option only works on [new-style syntax](./control-syntax.html). So to go from old-style syntax to new-style indented code one has to invoke the compiler twice, first with options `-rewrite -new-syntax`, then again with options +The `-indent` option only works on [new-style syntax](./control-syntax.md). So to go from old-style syntax to new-style indented code one has to invoke the compiler twice, first with options `-rewrite -new-syntax`, then again with options `-rewrite -indent`. To go in the opposite direction, from indented code to old-style syntax, it's `-rewrite -no-indent`, followed by `-rewrite -old-syntax`. ### Variant: Indentation Marker `:` diff --git a/docs/docs/reference/other-new-features/kind-polymorphism.md b/docs/docs/reference/other-new-features/kind-polymorphism.md index 7e69bca4ea51..7dbcf3e96927 100644 --- a/docs/docs/reference/other-new-features/kind-polymorphism.md +++ b/docs/docs/reference/other-new-features/kind-polymorphism.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Kind Polymorphism" -type: section -num: 42 -previous-page: /scala3/reference/other-new-features/parameter-untupling -next-page: /scala3/reference/other-new-features/matchable +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/kind-polymorphism.html --- Normally type parameters in Scala are partitioned into _kinds_. First-level types are types of values. Higher-kinded types are type constructors diff --git a/docs/docs/reference/other-new-features/matchable.md b/docs/docs/reference/other-new-features/matchable.md index 12b33e63f17d..fdce97dab8f0 100644 --- a/docs/docs/reference/other-new-features/matchable.md +++ b/docs/docs/reference/other-new-features/matchable.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "The Matchable Trait" -type: section -num: 43 -previous-page: /scala3/reference/other-new-features/kind-polymorphism -next-page: /scala3/reference/other-new-features/threadUnsafe-annotation +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/matchable.html --- A new trait `Matchable` controls the ability to pattern match. @@ -134,7 +132,7 @@ Here, universal `equals` will return true for Meter(10).equals(Second(10)) ``` -even though this is clearly false mathematically. With [multiversal equality](../contextual/multiversal-equality.html) one can mitigate that problem somewhat by turning +even though this is clearly false mathematically. With [multiversal equality](../contextual/multiversal-equality.md) one can mitigate that problem somewhat by turning ```scala Meter(10) == Second(10) diff --git a/docs/docs/reference/other-new-features/opaques-details.md b/docs/docs/reference/other-new-features/opaques-details.md index b7891a86c081..ecfb78db48b7 100644 --- a/docs/docs/reference/other-new-features/opaques-details.md +++ b/docs/docs/reference/other-new-features/opaques-details.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Opaque Type Aliases: More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/opaques-details.html --- ### Syntax @@ -11,7 +11,7 @@ Modifier ::= ... | ‘opaque’ ``` -`opaque` is a [soft modifier](../soft-modifier.html). It can still be used as a normal identifier when it is not in front of a definition keyword. +`opaque` is a [soft modifier](../soft-modifier.md). It can still be used as a normal identifier when it is not in front of a definition keyword. Opaque type aliases must be members of classes, traits, or objects, or they are defined at the top-level. They cannot be defined in local blocks. diff --git a/docs/docs/reference/other-new-features/opaques.md b/docs/docs/reference/other-new-features/opaques.md index cb4cf635678b..402440bad90c 100644 --- a/docs/docs/reference/other-new-features/opaques.md +++ b/docs/docs/reference/other-new-features/opaques.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Opaque Type Aliases" -type: section -num: 39 -previous-page: /scala3/reference/other-new-features/export -next-page: /scala3/reference/other-new-features/open-classes +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/opaques.html --- Opaque types aliases provide type abstraction without any overhead. Example: @@ -166,4 +164,4 @@ l1.mul(x, z) // error: found l2.Logarithm, required l1.Logarithm ``` In general, one can think of an opaque type as being only transparent in the scope of `private[this]`. -[More details](opaques-details.html) +[More details](opaques-details.md) diff --git a/docs/docs/reference/other-new-features/open-classes.md b/docs/docs/reference/other-new-features/open-classes.md index 342faed61ad4..f1ddcf8c190f 100644 --- a/docs/docs/reference/other-new-features/open-classes.md +++ b/docs/docs/reference/other-new-features/open-classes.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Open Classes" -type: section -num: 40 -previous-page: /scala3/reference/other-new-features/opaques -next-page: /scala3/reference/other-new-features/parameter-untupling +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/open-classes.html --- An `open` modifier on a class signals that the class is planned for extensions. Example: diff --git a/docs/docs/reference/other-new-features/parameter-untupling-spec.md b/docs/docs/reference/other-new-features/parameter-untupling-spec.md index dbabf9d5d7d7..feedb77aa774 100644 --- a/docs/docs/reference/other-new-features/parameter-untupling-spec.md +++ b/docs/docs/reference/other-new-features/parameter-untupling-spec.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Parameter Untupling - More Details" +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling-spec.html --- ## Motivation diff --git a/docs/docs/reference/other-new-features/parameter-untupling.md b/docs/docs/reference/other-new-features/parameter-untupling.md index de58f8c61fd0..1beed4968d4f 100644 --- a/docs/docs/reference/other-new-features/parameter-untupling.md +++ b/docs/docs/reference/other-new-features/parameter-untupling.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Parameter Untupling" -type: section -num: 41 -previous-page: /scala3/reference/other-new-features/open-classes -next-page: /scala3/reference/other-new-features/kind-polymorphism +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling.html --- Say you have a list of pairs @@ -44,5 +42,5 @@ function type of the form `((T_1, ..., T_n)) => U`. For more information see: -* [More details](./parameter-untupling-spec.html) +* [More details](./parameter-untupling-spec.md) * [Issue #897](https://github.com/lampepfl/dotty/issues/897). diff --git a/docs/docs/reference/other-new-features/safe-initialization.md b/docs/docs/reference/other-new-features/safe-initialization.md index 7ecafb9a2888..e56c640dd26b 100644 --- a/docs/docs/reference/other-new-features/safe-initialization.md +++ b/docs/docs/reference/other-new-features/safe-initialization.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Safe Initialization" -type: section -num: 49 -previous-page: /scala3/reference/other-new-features/explicit-nulls -next-page: /scala3/reference/other-new-features/type-test +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/safe-initialization.html --- Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Ysafe-init`. @@ -221,7 +219,7 @@ superclass is defined in another project, the crossing of project boundary cannot be avoided for soundness of the analysis. Meanwhile, inheritance across project boundary has been under scrutiny and the -introduction of [open classes](./open-classes.html) mitigate the concern here. +introduction of [open classes](./open-classes.md) mitigate the concern here. For example, the initialization check could enforce that the constructors of open classes may not contain method calls on `this` or introduce annotations as a contract. diff --git a/docs/docs/reference/other-new-features/targetName.md b/docs/docs/reference/other-new-features/targetName.md index 377bd2db10b0..a83c4247c1ef 100644 --- a/docs/docs/reference/other-new-features/targetName.md +++ b/docs/docs/reference/other-new-features/targetName.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "The @targetName annotation" -type: section -num: 45 -previous-page: /scala3/reference/other-new-features/threadUnsafe-annotation -next-page: /scala3/reference/other-new-features/control-syntax +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/targetName.html --- A `@targetName` annotation on a definition defines an alternate name for the implementation of that definition. Example: diff --git a/docs/docs/reference/other-new-features/threadUnsafe-annotation.md b/docs/docs/reference/other-new-features/threadUnsafe-annotation.md index 0916f6ff9b7b..99a16413f310 100644 --- a/docs/docs/reference/other-new-features/threadUnsafe-annotation.md +++ b/docs/docs/reference/other-new-features/threadUnsafe-annotation.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "The @threadUnsafe annotation" -type: section -num: 44 -previous-page: /scala3/reference/other-new-features/matchable -next-page: /scala3/reference/other-new-features/targetName +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/threadUnsafe-annotation.html --- A new annotation `@threadUnsafe` can be used on a field which defines diff --git a/docs/docs/reference/other-new-features/trait-parameters.md b/docs/docs/reference/other-new-features/trait-parameters.md index a3a692f91cc7..4013e87237dd 100644 --- a/docs/docs/reference/other-new-features/trait-parameters.md +++ b/docs/docs/reference/other-new-features/trait-parameters.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Trait Parameters" -type: section -num: 35 -previous-page: /scala3/reference/other-new-features -next-page: /scala3/reference/other-new-features/transparent-traits +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/trait-parameters.html --- Scala 3 allows traits to have parameters, just like classes have parameters. diff --git a/docs/docs/reference/other-new-features/transparent-traits.md b/docs/docs/reference/other-new-features/transparent-traits.md index 236f0c64d7b8..8f37f24174e1 100644 --- a/docs/docs/reference/other-new-features/transparent-traits.md +++ b/docs/docs/reference/other-new-features/transparent-traits.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "Transparent Traits" -type: section -num: 36 -previous-page: /scala3/reference/other-new-features/trait-parameters -next-page: /scala3/reference/other-new-features/creator-applications +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/transparent-traits.html --- Traits are used in two roles: @@ -22,7 +20,7 @@ val x = Set(if condition then Val else Var) Here, the inferred type of `x` is `Set[Kind & Product & Serializable]` whereas one would have hoped it to be `Set[Kind]`. The reasoning for this particular type to be inferred is as follows: -- The type of the conditional above is the [union type](../new-types/union-types.html) `Val | Var`. +- The type of the conditional above is the [union type](../new-types/union-types.md) `Val | Var`. - A union type is widened in type inference to the least supertype that is not a union type. In the example, this type is `Kind & Product & Serializable` since all three traits are traits of both `Val` and `Var`. So that type becomes the inferred element type of the set. diff --git a/docs/docs/reference/other-new-features/type-test.md b/docs/docs/reference/other-new-features/type-test.md index 62b8d59eec6d..da9fa6a1c2b3 100644 --- a/docs/docs/reference/other-new-features/type-test.md +++ b/docs/docs/reference/other-new-features/type-test.md @@ -1,9 +1,7 @@ --- +layout: doc-page title: "TypeTest" -type: section -num: 50 -previous-page: /scala3/reference/other-new-features/safe-initialization -next-page: /scala3/reference/other-new-features/experimental-defs +movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/type-test.html --- ## TypeTest diff --git a/docs/docs/reference/overview.md b/docs/docs/reference/overview.md index 8366ec10ddc2..051ba4b124cc 100644 --- a/docs/docs/reference/overview.md +++ b/docs/docs/reference/overview.md @@ -1,8 +1,7 @@ --- +layout: doc-page title: "Overview" -type: chapter -num: 1 -next-page: /scala3/reference/new-types +movedTo: https://docs.scala-lang.org/scala3/reference/overview.html --- Scala 3 implements many language changes and improvements over Scala 2. @@ -21,43 +20,43 @@ The language redesign was guided by three main goals: - Further improve the consistency and expressiveness of Scala's language constructs. Corresponding to these goals, the language changes fall into seven categories: -(1) Core constructs to strengthen foundations, (2) simplifications and (3) [restrictions](#restrictions), to make the language easier and safer to use, (4) [dropped constructs](#dropped-constructs) to make the language smaller and more regular, (5) [changed constructs](#changes) to remove warts, and increase consistency and usability, (6) [new constructs](#new-constructs) to fill gaps and increase expressiveness, (7) a new, principled approach to metaprogramming that replaces [Scala 2 experimental macros](https://docs.scala-lang.org/overviews/macros/overview.html). +(1) Core constructs to strengthen foundations, (2) simplifications and (3) [restrictions](#restrictions), to make the language easier and safer to use, (4) [dropped constructs](#dropped-constructs) to make the language smaller and more regular, (5) [changed constructs](#changes) to remove warts, and increase consistency and usability, (6) [new constructs](#new-constructs) to fill gaps and increase expressiveness, (7) a new, principled approach to metaprogramming that replaces [Scala 2 experimental macros](https://docs.scala-lang.org/overviews/macros/overview.md). ## Essential Foundations These new constructs directly model core features of DOT, higher-kinded types, and the [SI calculus for implicit resolution](https://infoscience.epfl.ch/record/229878/files/simplicitly_1.pdf). -- [Intersection types](new-types/intersection-types.html), replacing compound types, -- [Union types](new-types/union-types.html), -- [Type lambdas](new-types/type-lambdas.html), replacing encodings using structural types and type projection. -- [Context functions](contextual/context-functions.html), offering abstraction over given parameters. +- [Intersection types](new-types/intersection-types.md), replacing compound types, +- [Union types](new-types/union-types.md), +- [Type lambdas](new-types/type-lambdas.md), replacing encodings using structural types and type projection. +- [Context functions](contextual/context-functions.md), offering abstraction over given parameters. ## Simplifications These constructs replace existing constructs with the aim of making the language safer and simpler to use, and to promote uniformity in code style. -- [Trait parameters](other-new-features/trait-parameters.html) - replace [early initializers](dropped-features/early-initializers.html) with a more generally useful construct. -- [Given instances](contextual/givens.html) +- [Trait parameters](other-new-features/trait-parameters.md) + replace [early initializers](dropped-features/early-initializers.md) with a more generally useful construct. +- [Given instances](contextual/givens.md) replace implicit objects and defs, focussing on intent over mechanism. -- [Using clauses](contextual/using-clauses.html) +- [Using clauses](contextual/using-clauses.md) replace implicit parameters, avoiding their ambiguities. -- [Extension methods](contextual/extension-methods.html) +- [Extension methods](contextual/extension-methods.md) replace implicit classes with a clearer and simpler mechanism. -- [Opaque type aliases](other-new-features/opaques.html) +- [Opaque type aliases](other-new-features/opaques.md) replace most uses of value classes while guaranteeing absence of boxing. -- [Top-level definitions](dropped-features/package-objects.html) +- [Top-level definitions](dropped-features/package-objects.md) replace package objects, dropping syntactic boilerplate. -- [Export clauses](other-new-features/export.html) +- [Export clauses](other-new-features/export.md) provide a simple and general way to express aggregation, which can replace the previous facade pattern of package objects inheriting from classes. -- [Vararg splices](changed-features/vararg-splices.html) +- [Vararg splices](changed-features/vararg-splices.md) now use the form `xs*` in function arguments and patterns instead of `xs: _*` and `xs @ _*`, -- [Universal apply methods](other-new-features/creator-applications.html) +- [Universal apply methods](other-new-features/creator-applications.md) allow using simple function call syntax instead of `new` expressions. `new` expressions stay around as a fallback for the cases where creator applications cannot be used. -With the exception of [early initializers](dropped-features/early-initializers.html) and old-style vararg patterns, all superseded constructs continue to be available in Scala 3.0. The plan is to deprecate and phase them out later. +With the exception of [early initializers](dropped-features/early-initializers.md) and old-style vararg patterns, all superseded constructs continue to be available in Scala 3.0. The plan is to deprecate and phase them out later. Value classes (superseded by opaque type aliases) are a special case. There are currently no deprecation plans for value classes, since we might bring them back in a more general form if they are supported natively by the JVM as is planned by [project Valhalla](https://openjdk.java.net/projects/valhalla/). @@ -65,15 +64,15 @@ Value classes (superseded by opaque type aliases) are a special case. There are These constructs are restricted to make the language safer. -- [Implicit Conversions](contextual/conversions.html): +- [Implicit Conversions](contextual/conversions.md): there is only one way to define implicit conversions instead of many, and potentially surprising implicit conversions require a language import. -- [Given Imports](contextual/given-imports.html): +- [Given Imports](contextual/given-imports.md): implicits now require a special form of import, to make the import clearly visible. -- [Type Projection](dropped-features/type-projection.html): +- [Type Projection](dropped-features/type-projection.md): only classes can be used as prefix `C` of a type projection `C#A`. Type projection on abstract types is no longer supported since it is unsound. -- [Multiversal Equality](contextual/multiversal-equality.html): +- [Multiversal Equality](contextual/multiversal-equality.md): implement an "opt-in" scheme to rule out nonsensical comparisons with `==` and `!=`. -- [infix](changed-features/operators.html): +- [infix](changed-features/operators.md): make method application syntax uniform across code bases. Unrestricted implicit conversions continue to be available in Scala 3.0, but will be deprecated and removed later. Unrestricted versions of the other constructs in the list above are available only under `-source 3.0-migration`. @@ -82,15 +81,15 @@ Unrestricted implicit conversions continue to be available in Scala 3.0, but wil These constructs are proposed to be dropped without a new construct replacing them. The motivation for dropping these constructs is to simplify the language and its implementation. -- [DelayedInit](dropped-features/delayed-init.html), -- [Existential types](dropped-features/existential-types.html), -- [Procedure syntax](dropped-features/procedure-syntax.html), -- [Class shadowing](dropped-features/class-shadowing.html), -- [XML literals](dropped-features/xml.html), -- [Symbol literals](dropped-features/symlits.html), -- [Auto application](dropped-features/auto-apply.html), -- [Weak conformance](dropped-features/weak-conformance.html), -- Compound types (replaced by [Intersection types](new-types/intersection-types.html)), +- [DelayedInit](dropped-features/delayed-init.md), +- [Existential types](dropped-features/existential-types.md), +- [Procedure syntax](dropped-features/procedure-syntax.md), +- [Class shadowing](dropped-features/class-shadowing.md), +- [XML literals](dropped-features/xml.md), +- [Symbol literals](dropped-features/symlits.md), +- [Auto application](dropped-features/auto-apply.md), +- [Weak conformance](dropped-features/weak-conformance.md), +- Compound types (replaced by [Intersection types](new-types/intersection-types.md)), - [Auto tupling](https://github.com/lampepfl/dotty/pull/4311) (implemented, but not merged). The date when these constructs are dropped varies. The current status is: @@ -100,19 +99,19 @@ The date when these constructs are dropped varies. The current status is: - Supported under `-source 3.0-migration`: - procedure syntax, class shadowing, symbol literals, auto application, auto tupling in a restricted form. - Supported in 3.0, to be deprecated and phased out later: - - [XML literals](dropped-features/xml.html), compound types. + - [XML literals](dropped-features/xml.md), compound types. ## Changes These constructs have undergone changes to make them more regular and useful. -- [Structural Types](changed-features/structural-types.html): +- [Structural Types](changed-features/structural-types.md): They now allow pluggable implementations, which greatly increases their usefulness. Some usage patterns are restricted compared to the status quo. -- [Name-based pattern matching](changed-features/pattern-matching.html): +- [Name-based pattern matching](changed-features/pattern-matching.md): The existing undocumented Scala 2 implementation has been codified in a slightly simplified form. -- [Automatic Eta expansion](changed-features/eta-expansion.html): +- [Automatic Eta expansion](changed-features/eta-expansion.md): Eta expansion is now performed universally also in the absence of an expected type. The postfix `_` operator is thus made redundant. It will be deprecated and dropped after Scala 3.0. -- [Implicit Resolution](changed-features/implicit-resolution.html): +- [Implicit Resolution](changed-features/implicit-resolution.md): The implicit resolution rules have been cleaned up to make them more useful and less surprising. Implicit scope is restricted to no longer include package prefixes. Most aspects of old-style implicit resolution are still available under `-source 3.0-migration`. The other changes in this list are applied unconditionally. @@ -121,13 +120,13 @@ Most aspects of old-style implicit resolution are still available under `-source These are additions to the language that make it more powerful or pleasant to use. -- [Enums](enums/enums.html) provide concise syntax for enumerations and [algebraic data types](enums/adts.html). -- [Parameter untupling](other-new-features/parameter-untupling.html) avoids having to use `case` for tupled parameter destructuring. -- [Dependent function types](new-types/dependent-function-types.html) generalize dependent methods to dependent function values and types. -- [Polymorphic function types](new-types/polymorphic-function-types.html) generalize polymorphic methods to polymorphic function values and types. +- [Enums](enums/enums.md) provide concise syntax for enumerations and [algebraic data types](enums/adts.md). +- [Parameter untupling](other-new-features/parameter-untupling.md) avoids having to use `case` for tupled parameter destructuring. +- [Dependent function types](new-types/dependent-function-types.md) generalize dependent methods to dependent function values and types. +- [Polymorphic function types](new-types/polymorphic-function-types.md) generalize polymorphic methods to polymorphic function values and types. _Current status_: There is a proposal and a merged prototype implementation, but the implementation has not been finalized (it is notably missing type inference support). -- [Kind polymorphism](other-new-features/kind-polymorphism.html) allows the definition of operators working equally on types and type constructors. -- [`@targetName` annotations](other-new-features/targetName.html) make it easier to interoperate with code written in other languages and give more flexibility for avoiding name clashes. +- [Kind polymorphism](other-new-features/kind-polymorphism.md) allows the definition of operators working equally on types and type constructors. +- [`@targetName` annotations](other-new-features/targetName.md) make it easier to interoperate with code written in other languages and give more flexibility for avoiding name clashes. ## Metaprogramming @@ -137,19 +136,19 @@ It's worth noting that macros were never included in the [Scala 2 language speci To enable porting most uses of macros, we are experimenting with the advanced language constructs listed below. These designs are more provisional than the rest of the proposed language constructs for Scala 3.0. There might still be some changes until the final release. Stabilizing the feature set needed for metaprogramming is our first priority. -- [Match Types](new-types/match-types.html) +- [Match Types](new-types/match-types.md) allow computation on types. -- [Inline](metaprogramming/inline.html) +- [Inline](metaprogramming/inline.md) provides by itself a straightforward implementation of some simple macros and is at the same time an essential building block for the implementation of complex macros. -- [Quotes and Splices](metaprogramming/macros.html) +- [Quotes and Splices](metaprogramming/macros.md) provide a principled way to express macros and staging with a unified set of abstractions. -- [Type class derivation](contextual/derivation.html) +- [Type class derivation](contextual/derivation.md) provides an in-language implementation of the `Gen` macro in Shapeless and other foundational libraries. The new implementation is more robust, efficient and easier to use than the macro. -- [By-name context parameters](contextual/by-name-context-parameters.html) +- [By-name context parameters](contextual/by-name-context-parameters.md) provide a more robust in-language implementation of the `Lazy` macro in [Shapeless](https://github.com/milessabin/shapeless). ## See Also -[A classification of proposed language features](./features-classification.html) is +[A classification of proposed language features](./features-classification.md) is an expanded version of this page that adds the status (i.e. relative importance to be a part of Scala 3, and relative urgency when to decide this) and expected migration cost of each language construct. diff --git a/docs/docs/reference/soft-modifier.md b/docs/docs/reference/soft-modifier.md index 3e9bb73b7586..9706e18e3e5b 100644 --- a/docs/docs/reference/soft-modifier.md +++ b/docs/docs/reference/soft-modifier.md @@ -1,7 +1,7 @@ --- -layout: singlepage-overview -scala3: true +layout: doc-page title: "Soft Keywords" +movedTo: https://docs.scala-lang.org/scala3/reference/soft-modifier.html --- A soft modifier is one of the identifiers `opaque`, `inline`, `open`, `transparent`, and `infix`. diff --git a/docs/docs/reference/syntax.md b/docs/docs/reference/syntax.md index 4561ad7c91b6..0bf2ed86a164 100644 --- a/docs/docs/reference/syntax.md +++ b/docs/docs/reference/syntax.md @@ -1,8 +1,7 @@ --- +layout: doc-page title: "Scala 3 Syntax Summary" -type: chapter -num: 88 -previous-page: /scala3/reference/dropped-features/wildcard-init +movedTo: https://docs.scala-lang.org/scala3/reference/syntax.html --- The following description of Scala tokens uses literal characters `‘c’` when @@ -91,7 +90,7 @@ semi ::= ‘;’ | nl {nl} ## Optional Braces -The lexical analyzer also inserts `indent` and `outdent` tokens that represent regions of indented code [at certain points](./other-new-features/indentation.html). +The lexical analyzer also inserts `indent` and `outdent` tokens that represent regions of indented code [at certain points](./other-new-features/indentation.md). In the context-free productions below we use the notation `<<< ts >>>` to indicate a token sequence `ts` that is either enclosed in a pair of braces `{ ts }` or that constitutes an indented region `indent ts outdent`. Analogously, the @@ -126,7 +125,7 @@ type val var while with yield as derives end extension infix inline opaque open transparent using | * + - ``` -See the [separate section on soft keywords](./soft-modifier.html) for additional +See the [separate section on soft keywords](./soft-modifier.md) for additional details on where a soft keyword is recognized. ## Context-free Syntax diff --git a/docs/docs/usage/ide-support.md b/docs/docs/usage/ide-support.md index 25739b021b78..c0736090e2be 100644 --- a/docs/docs/usage/ide-support.md +++ b/docs/docs/usage/ide-support.md @@ -1,7 +1,6 @@ --- layout: doc-page title: "IDE support for Scala 3" -movedTo: https://docs.scala-lang.org/scala3/getting-started.html --- This page is deprecated. Please go to the [getting-started](https://docs.scala-lang.org/scala3/getting-started.html) diff --git a/docs/docs/usage/scaladoc/blog.md b/docs/docs/usage/scaladoc/blog.md index b80faf9bdb90..85c2d9fa044a 100644 --- a/docs/docs/usage/scaladoc/blog.md +++ b/docs/docs/usage/scaladoc/blog.md @@ -1,12 +1,12 @@ --- -layout: multipage-overview +layout: doc-page title: "Built-in blog" -partof: scala3-scaladoc -num: 5 -previous-page: static-site -next-page: site-versioning + + + --- + Scaladoc allows you to include a simple blog in your documentation. For now, it provides only basic features. In the future, we plan to include more advanced features like tagging or author pages. @@ -25,7 +25,7 @@ All your blogposts must be put under `blog/_posts` directory. │ └── index.html ``` -If you are using yaml [sidebar]({% link _overviews/scala3-scaladoc/static-site.md %}#sidebar) don't forget to place +If you are using yaml [sidebar](./static-site.md#sidebar) don't forget to place ``` sidebar: @@ -38,5 +38,3 @@ somewhere inside the `yaml` tree representing the sidebar sections. Scaladoc wil All the blogpost filenames should start with date in numeric format matching `YYYY-MM-DD`. Example name is `2015-10-23-dotty-compiler-bootstraps.md`. - - diff --git a/docs/docs/usage/scaladoc/docstrings.md b/docs/docs/usage/scaladoc/docstrings.md index 72a8f99c88b5..9935702e10bd 100644 --- a/docs/docs/usage/scaladoc/docstrings.md +++ b/docs/docs/usage/scaladoc/docstrings.md @@ -1,10 +1,6 @@ --- -layout: multipage-overview +layout: doc-page title: "Docstrings - specific Tags and Features" -partof: scala3-scaladoc -num: 2 -previous-page: index -next-page: linking --- This chapter describes how to correctly write docstrings and how to use all the available features of scaladoc. @@ -195,4 +191,4 @@ Further information on the formatting and style recommendations can be found in Scaladoc allows linking to API documentation with Wiki-style links. Linking to `scala.collection.immutable.List` is as simple as -`[[scala.collection.immutable.List]]`. For more information on the exact syntax, see [doc comment documentation]({% link _overviews/scala3-scaladoc/linking.md %}#definition-links). +`[[scala.collection.immutable.List]]`. For more information on the exact syntax, see [doc comment documentation](./linking.md#definition-links). diff --git a/docs/docs/usage/scaladoc/index.md b/docs/docs/usage/scaladoc/index.md index 1aac56b5735e..edb56fc7dea5 100644 --- a/docs/docs/usage/scaladoc/index.md +++ b/docs/docs/usage/scaladoc/index.md @@ -1,11 +1,8 @@ --- -layout: multipage-overview +layout: doc-page title: "Scaladoc" -partof: scala3-scaladoc -num: 1 -next-page: docstrings --- -![scaladoc logo]({{ site.baseurl }}/resources/images/scala3/scaladoc/logo.svg) +![scaladoc logo](images/scaladoc_logo.svg) scaladoc is a tool to generate the API documentation of your Scala 3 projects. It provides similar features to `javadoc` as well as `jekyll` or `docusaurus`. diff --git a/docs/docs/usage/scaladoc/linking.md b/docs/docs/usage/scaladoc/linking.md index bfac8b9cef22..daef312700fc 100644 --- a/docs/docs/usage/scaladoc/linking.md +++ b/docs/docs/usage/scaladoc/linking.md @@ -1,10 +1,6 @@ --- -layout: multipage-overview +layout: doc-page title: "Linking documentation" -partof: scala3-scaladoc -num: 3 -previous-page: docstrings -next-page: static-site --- Scaladoc's main feature is creating API documentation from code comments. diff --git a/docs/docs/usage/scaladoc/search-engine.md b/docs/docs/usage/scaladoc/search-engine.md index 1bac1d37635d..a586c25c0a21 100644 --- a/docs/docs/usage/scaladoc/search-engine.md +++ b/docs/docs/usage/scaladoc/search-engine.md @@ -1,10 +1,6 @@ --- -layout: multipage-overview +layout: doc-page title: "Type-based search" -partof: scala3-scaladoc -num: 7 -previous-page: site-versioning -next-page: settings --- Searching for functions by their symbolic names can be time-consuming. @@ -19,7 +15,7 @@ Instead of searching for `span` we can also search for `IArray[A] => (A => Boole To use this feature, type the signature of the member you are looking for in the scaladoc searchbar. This is how it works: -![]({{ site.baseurl }}/resources/images/scala3/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif) +![]({{ site.baseurl }}images/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif) This feature is provided by the [Inkuire](https://github.com/VirtusLab/Inkuire) search engine, which works for Scala 3 and Kotlin. To be up-to-date with the development of this feature, follow the [Inkuire repository](https://github.com/VirtusLab/Inkuire). diff --git a/docs/docs/usage/scaladoc/settings.md b/docs/docs/usage/scaladoc/settings.md index 803330d69eb0..396aef8b76fd 100644 --- a/docs/docs/usage/scaladoc/settings.md +++ b/docs/docs/usage/scaladoc/settings.md @@ -1,9 +1,6 @@ --- -layout: multipage-overview +layout: doc-page title: "Settings" -partof: scala3-scaladoc -num: 8 -previous-page: search-engine --- This chapter lists the configuration options that can be used when calling scaladoc. Some of the information shown here can be found by calling scaladoc with the `-help` flag. diff --git a/docs/docs/usage/scaladoc/site-versioning.md b/docs/docs/usage/scaladoc/site-versioning.md index f7424fc90657..8ce52d21b067 100644 --- a/docs/docs/usage/scaladoc/site-versioning.md +++ b/docs/docs/usage/scaladoc/site-versioning.md @@ -1,10 +1,6 @@ --- -layout: multipage-overview +layout: doc-page title: "Site versioning" -partof: scala3-scaladoc -num: 6 -previous-page: blog -next-page: search-engine --- Scaladoc provides a convenient way to switch between different versions of the documentation. The feature is useful if we want to expose older docs for users that didn't migrate to the new version of our library. @@ -36,4 +32,4 @@ doc / scalacOptions ++= Seq("-versions-dictionary-url", "https://dotty.epfl.ch/v Providing a JSON file via `-versions-dictionary-url` enables scaladoc to link between versions. It is also convenient to be able to change the revision label in the drop-down menu. Everything will change automatically. -![]({{ site.baseurl }}/resources/images/scala3/scaladoc/nightly.gif) +![]({{ site.baseurl }}images/scaladoc/nightly.gif) diff --git a/docs/docs/usage/scaladoc/static-site.md b/docs/docs/usage/scaladoc/static-site.md index 46bcdc018350..6a1f8db0824c 100644 --- a/docs/docs/usage/scaladoc/static-site.md +++ b/docs/docs/usage/scaladoc/static-site.md @@ -1,10 +1,6 @@ --- -layout: multipage-overview +layout: doc-page title: "Static documentation" -partof: scala3-scaladoc -num: 4 -previous-page: linking -next-page: blog --- Scaladoc can generate static sites, known from [Jekyll](http://jekyllrb.com/) or [Docusaurus](https://docusaurus.io/). @@ -145,7 +141,7 @@ The `page` property `subsection` accepts nested nodes, these can be either pages In `subsection`s, you can omit `title` or `index`, however not specifying any of these properties prevents you from specifying the title of the section. -`blog` is a special node represented by simple entry `- title: Blog` with no other attributes. All your blog posts will be automatically linked under this section. You can read more about the blog [here]({% link _overviews/scala3-scaladoc/blog.md %}). +`blog` is a special node represented by simple entry `- title: Blog` with no other attributes. All your blog posts will be automatically linked under this section. You can read more about the blog [here](./blog.md). ``` ├── blog diff --git a/docs/docs/usage/worksheet-mode-implementation-details.md b/docs/docs/usage/worksheet-mode-implementation-details.md index d06939d810ae..17c1cc3a2430 100644 --- a/docs/docs/usage/worksheet-mode-implementation-details.md +++ b/docs/docs/usage/worksheet-mode-implementation-details.md @@ -1,8 +1,13 @@ --- layout: doc-page title: "Worksheet Mode - Implementation details" + + + + --- + In brief, the worksheets extend the Language Server Protocol and rely on the Dotty REPL to evaluate code. From a5bc166d3a253f5a14ee969d94ba81c5ade6fd3b Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Mon, 6 Dec 2021 16:24:13 +0100 Subject: [PATCH 2/4] Add indexes to reference chapters --- .github/workflows/ci.yaml | 3 +- .gitignore | 4 + .../changed-features.md | 0 docs/docs/reference/changed-features/index.md | 7 -- .../reference/{ => contextual}/contextual.md | 24 ++--- .../reference/contextual/derivation-macro.md | 2 +- .../dropped-features.md | 0 .../{enums.md => enums/enums-index.md} | 0 .../{ => metaprogramming}/metaprogramming.md | 12 +-- .../reference/{ => new-types}/new-types.md | 0 .../other-new-types.md} | 0 docs/sidebar.yml | 9 +- project/Build.scala | 4 +- project/CopyDocs.scala | 94 ------------------- project/DocumentationWebsite.scala | 4 +- project/scripts/genDocsScalaLang | 58 ------------ 16 files changed, 35 insertions(+), 186 deletions(-) rename docs/docs/reference/{ => changed-features}/changed-features.md (100%) delete mode 100644 docs/docs/reference/changed-features/index.md rename docs/docs/reference/{ => contextual}/contextual.md (83%) rename docs/docs/reference/{ => dropped-features}/dropped-features.md (100%) rename docs/docs/reference/{enums.md => enums/enums-index.md} (100%) rename docs/docs/reference/{ => metaprogramming}/metaprogramming.md (82%) rename docs/docs/reference/{ => new-types}/new-types.md (100%) rename docs/docs/reference/{other-new-features.md => other-new-features/other-new-types.md} (100%) delete mode 100644 project/CopyDocs.scala delete mode 100755 project/scripts/genDocsScalaLang diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 712df11ca03b..3a19af2de801 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -473,7 +473,8 @@ jobs: DOTTY_WEBSITE_BOT_TOKEN: ${{ secrets.BOT_TOKEN }} # If you need to change this: # Generate one at https://github.com/settings/tokens # Make sure you have the write permissions to the repo: https://github.com/lampepfl/dotty-website - DOCS_SCALALANG_BOT_TOKEN: ${{ secrets.DOCS_SCALALANG_BOT_TOKEN }} # If you need to change this: + # Currently unused token, no need to deploy anything to docs.scala-lang + # DOCS_SCALALANG_BOT_TOKEN: ${{ secrets.DOCS_SCALALANG_BOT_TOKEN }} # If you need to change this: # Generate one at https://github.com/settings/tokens # Make sure you have the write permissions to the repo: https://github.com/scala/docs.scala-lang diff --git a/.gitignore b/.gitignore index 17a292e4c6a7..297d15748fdf 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,7 @@ cs # Coursier test product compiler/test-coursier/run/*.jar + +# docs related +contributors.js +content-contributors.css diff --git a/docs/docs/reference/changed-features.md b/docs/docs/reference/changed-features/changed-features.md similarity index 100% rename from docs/docs/reference/changed-features.md rename to docs/docs/reference/changed-features/changed-features.md diff --git a/docs/docs/reference/changed-features/index.md b/docs/docs/reference/changed-features/index.md deleted file mode 100644 index 70946645b06b..000000000000 --- a/docs/docs/reference/changed-features/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -layout: doc-page -title: "Other Changed Features" -movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/index.html ---- - -The following pages document the features that have changed in Scala 3, compared to Scala 2. diff --git a/docs/docs/reference/contextual.md b/docs/docs/reference/contextual/contextual.md similarity index 83% rename from docs/docs/reference/contextual.md rename to docs/docs/reference/contextual/contextual.md index de9046162c69..a2fe095c44c0 100644 --- a/docs/docs/reference/contextual.md +++ b/docs/docs/reference/contextual/contextual.md @@ -50,25 +50,25 @@ Existing Scala programmers by and large have gotten used to the status quo and s The following pages introduce a redesign of contextual abstractions in Scala. They introduce four fundamental changes: -1. [Given Instances](./contextual/givens.md) are a new way to define basic terms that can be synthesized. They replace implicit definitions. The core principle of the proposal is that, rather than mixing the `implicit` modifier with a large number of features, we have a single way to define terms that can be synthesized for types. +1. [Given Instances](./givens.md) are a new way to define basic terms that can be synthesized. They replace implicit definitions. The core principle of the proposal is that, rather than mixing the `implicit` modifier with a large number of features, we have a single way to define terms that can be synthesized for types. -2. [Using Clauses](./contextual/using-clauses.md) are a new syntax for implicit _parameters_ and their _arguments_. It unambiguously aligns parameters and arguments, solving a number of language warts. It also allows us to have several `using` clauses in a definition. +2. [Using Clauses](./using-clauses.md) are a new syntax for implicit _parameters_ and their _arguments_. It unambiguously aligns parameters and arguments, solving a number of language warts. It also allows us to have several `using` clauses in a definition. -3. ["Given" Imports](./contextual/given-imports.md) are a new class of import selectors that specifically import +3. ["Given" Imports](./given-imports.md) are a new class of import selectors that specifically import givens and nothing else. -4. [Implicit Conversions](./contextual/conversions.md) are now expressed as given instances of a standard `Conversion` class. All other forms of implicit conversions will be phased out. +4. [Implicit Conversions](./conversions.md) are now expressed as given instances of a standard `Conversion` class. All other forms of implicit conversions will be phased out. This section also contains pages describing other language features that are related to context abstraction. These are: -- [Context Bounds](./contextual/context-bounds.md), which carry over unchanged. -- [Extension Methods](./contextual/extension-methods.md) replace implicit classes in a way that integrates better with type classes. -- [Implementing Type Classes](./contextual/type-classes.md) demonstrates how some common type classes can be implemented using the new constructs. -- [Type Class Derivation](./contextual/derivation.md) introduces constructs to automatically derive type class instances for ADTs. -- [Multiversal Equality](./contextual/multiversal-equality.md) introduces a special type class to support type safe equality. -- [Context Functions](./contextual/context-functions.md) provide a way to abstract over context parameters. -- [By-Name Context Parameters](./contextual/by-name-context-parameters.md) are an essential tool to define recursive synthesized values without looping. -- [Relationship with Scala 2 Implicits](./contextual/relationship-implicits.md) discusses the relationship between old-style implicits and new-style givens and how to migrate from one to the other. +- [Context Bounds](./context-bounds.md), which carry over unchanged. +- [Extension Methods](./extension-methods.md) replace implicit classes in a way that integrates better with type classes. +- [Implementing Type Classes](./type-classes.md) demonstrates how some common type classes can be implemented using the new constructs. +- [Type Class Derivation](./derivation.md) introduces constructs to automatically derive type class instances for ADTs. +- [Multiversal Equality](./multiversal-equality.md) introduces a special type class to support type safe equality. +- [Context Functions](./context-functions.md) provide a way to abstract over context parameters. +- [By-Name Context Parameters](./by-name-context-parameters.md) are an essential tool to define recursive synthesized values without looping. +- [Relationship with Scala 2 Implicits](./relationship-implicits.md) discusses the relationship between old-style implicits and new-style givens and how to migrate from one to the other. Overall, the new design achieves a better separation of term inference from the rest of the language: There is a single way to define givens instead of a multitude of forms all taking an `implicit` modifier. There is a single way to introduce implicit parameters and arguments instead of conflating implicit with normal arguments. There is a separate way to import givens that does not allow them to hide in a sea of normal imports. And there is a single way to define an implicit conversion which is clearly marked as such and does not require special syntax. diff --git a/docs/docs/reference/contextual/derivation-macro.md b/docs/docs/reference/contextual/derivation-macro.md index c75f0430ec9b..5ff0007268dd 100644 --- a/docs/docs/reference/contextual/derivation-macro.md +++ b/docs/docs/reference/contextual/derivation-macro.md @@ -109,7 +109,7 @@ and an age of type `Int`, the equality check we want to generate is the followin ## Calling the derived method inside the macro -Following the rules in [Macros](../metaprogramming.md) we create two methods. +Following the rules in [Macros](../metaprogramming/metaprogramming.md) we create two methods. One that hosts the top-level splice `eqv` and one that is the implementation. Alternatively and what is shown below is that we can call the `eqv` method directly. The `eqGen` can trigger the derivation. diff --git a/docs/docs/reference/dropped-features.md b/docs/docs/reference/dropped-features/dropped-features.md similarity index 100% rename from docs/docs/reference/dropped-features.md rename to docs/docs/reference/dropped-features/dropped-features.md diff --git a/docs/docs/reference/enums.md b/docs/docs/reference/enums/enums-index.md similarity index 100% rename from docs/docs/reference/enums.md rename to docs/docs/reference/enums/enums-index.md diff --git a/docs/docs/reference/metaprogramming.md b/docs/docs/reference/metaprogramming/metaprogramming.md similarity index 82% rename from docs/docs/reference/metaprogramming.md rename to docs/docs/reference/metaprogramming/metaprogramming.md index 1d8fa83bae20..d2f210187337 100644 --- a/docs/docs/reference/metaprogramming.md +++ b/docs/docs/reference/metaprogramming/metaprogramming.md @@ -7,7 +7,7 @@ movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming.html The following pages introduce the redesign of metaprogramming in Scala. They introduce the following fundamental facilities: -1. [`inline`](./metaprogramming/inline.md) is a new modifier that guarantees that +1. [`inline`](./inline.md) is a new modifier that guarantees that a definition will be inlined at the point of use. The primary motivation behind inline is to reduce the overhead behind function calls and access to values. The expansion will be performed by the Scala compiler during the @@ -18,10 +18,10 @@ introduce the following fundamental facilities: programming), macros (enabling compile-time, generative, metaprogramming) and runtime code generation (multi-stage programming). -2. [Compile-time ops](./metaprogramming/compiletime-ops.md) are helper definitions in the +2. [Compile-time ops](./compiletime-ops.md) are helper definitions in the standard library that provide support for compile-time operations over values and types. -3. [Macros](./metaprogramming/macros.md) are built on two well-known fundamental +3. [Macros](./macros.md) are built on two well-known fundamental operations: quotation and splicing. Quotation converts program code to data, specifically, a (tree-like) representation of this code. It is expressed as `'{...}` for expressions and as `'[...]` for types. Splicing, @@ -29,19 +29,19 @@ introduce the following fundamental facilities: to program code. Together with `inline`, these two abstractions allow to construct program code programmatically. -4. [Runtime Staging](./metaprogramming/staging.md) Where macros construct code at _compile-time_, +4. [Runtime Staging](./staging.md) Where macros construct code at _compile-time_, staging lets programs construct new code at _runtime_. That way, code generation can depend not only on static data but also on data available at runtime. This splits the evaluation of the program in two or more phases or ... stages. Consequently, this method of generative programming is called "Multi-Stage Programming". Staging is built on the same foundations as macros. It uses quotes and splices, but leaves out `inline`. -5. [Reflection](./metaprogramming/reflection.md) Quotations are a "black-box" +5. [Reflection](./reflection.md) Quotations are a "black-box" representation of code. They can be parameterized and composed using splices, but their structure cannot be analyzed from the outside. TASTy reflection gives a way to analyze code structure by partly revealing the representation type of a piece of code in a standard API. The representation type is a form of typed abstract syntax tree, which gives rise to the `TASTy` moniker. -6. [TASTy Inspection](./metaprogramming/tasty-inspect.md) Typed abstract syntax trees are serialized +6. [TASTy Inspection](./tasty-inspect.md) Typed abstract syntax trees are serialized in a custom compressed binary format stored in `.tasty` files. TASTy inspection allows to load these files and analyze their content's tree structure. diff --git a/docs/docs/reference/new-types.md b/docs/docs/reference/new-types/new-types.md similarity index 100% rename from docs/docs/reference/new-types.md rename to docs/docs/reference/new-types/new-types.md diff --git a/docs/docs/reference/other-new-features.md b/docs/docs/reference/other-new-features/other-new-types.md similarity index 100% rename from docs/docs/reference/other-new-features.md rename to docs/docs/reference/other-new-features/other-new-types.md diff --git a/docs/sidebar.yml b/docs/sidebar.yml index 7a534eb42ae8..9ff759a98afe 100644 --- a/docs/sidebar.yml +++ b/docs/sidebar.yml @@ -10,6 +10,7 @@ sidebar: subsection: - page: docs/reference/overview.md - title: New Types + index: docs/reference/new-types/new-types.md subsection: - page: docs/reference/new-types/intersection-types.md - page: docs/reference/new-types/union-types.md @@ -18,13 +19,14 @@ sidebar: - page: docs/reference/new-types/dependent-function-types.md - page: docs/reference/new-types/polymorphic-function-types.md - title: Enums + index: docs/reference/enums/enums-index.md subsection: - page: docs/reference/enums/enums.md - page: docs/reference/enums/adts.md - page: docs/reference/enums/desugarEnums.md - title: Contextual Abstractions + index: docs/reference/contextual/contextual.md subsection: - - page: docs/reference/contextual.md - page: docs/reference/contextual/givens.md - page: docs/reference/contextual/using-clauses.md - page: docs/reference/contextual/context-bounds.md @@ -38,8 +40,8 @@ sidebar: - page: docs/reference/contextual/by-name-context-parameters.md - page: docs/reference/contextual/relationship-implicits.md - title: Metaprogramming + index: docs/reference/metaprogramming/metaprogramming.md subsection: - - page: docs/reference/metaprogramming.md - page: docs/reference/metaprogramming/inline.md - page: docs/reference/metaprogramming/compiletime-ops.md - page: docs/reference/metaprogramming/macros.md @@ -47,6 +49,7 @@ sidebar: - page: docs/reference/metaprogramming/reflection.md - page: docs/reference/metaprogramming/tasty-inspect.md - title: Other New Features + index: docs/reference/other-new-features/other-new-types.md subsection: - page: docs/reference/other-new-features/trait-parameters.md - page: docs/reference/other-new-features/transparent-traits.md @@ -66,6 +69,7 @@ sidebar: - page: docs/reference/other-new-features/type-test.md - page: docs/reference/other-new-features/experimental-defs.md - title: Other Changed Features + index: docs/reference/changed-features/changed-features.md subsection: - page: docs/reference/changed-features/numeric-literals.md - page: docs/reference/changed-features/structural-types.md @@ -86,6 +90,7 @@ sidebar: - page: docs/reference/changed-features/lazy-vals-init.md - page: docs/reference/changed-features/main-functions.md - title: Dropped Features + index: docs/reference/dropped-features/dropped-features.md subsection: - page: docs/reference/dropped-features/delayed-init.md - page: docs/reference/dropped-features/macros.md diff --git a/project/Build.scala b/project/Build.scala index fa9079362a50..03f69dd6f7e7 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1322,7 +1322,6 @@ object Build { name, scalaSrcLink(stdLibVersion, srcManaged(dottyNonBootstrappedVersion, "scala") + "="), dottySrcLink(referenceVersion, srcManaged(dottyNonBootstrappedVersion, "dotty") + "=", "#library/src"), - dottySrcLink(referenceVersion, "docs-for-dotty-page=", "#docs"), dottySrcLink(referenceVersion), "-Ygenerate-inkuire", ) ++ scalacOptionsDocSettings(includeExternalMappings) ++ revision ++ params ++ targets @@ -1383,7 +1382,6 @@ object Build { val dest = file(extraArgs.headOption.getOrElse("scaladoc/output/scala3")).getAbsoluteFile val justAPI = extraArgs.drop(1).headOption == Some("--justAPI") val majorVersion = (LocalProject("scala3-library-bootstrapped") / scalaBinaryVersion).value - CopyDocs.copyDocs() // invoke copying function form `project/CopyDocs.scala` val dottyJars: Seq[java.io.File] = Seq( (`stdlib-bootstrapped`/Compile/products).value, (`scala3-interfaces`/Compile/products).value, @@ -1414,7 +1412,7 @@ object Build { "https://scala-lang.org/api/versions.json", "-Ydocument-synthetic-types", s"-snippet-compiler:${dottyLibRoot}/scala/quoted=compile,${dottyLibRoot}/scala/compiletime=compile" - ) ++ (if (justAPI) Nil else Seq("-siteroot", "docs-for-dotty-page", "-Yapi-subdirectory")), includeExternalMappings = false) + ) ++ (if (justAPI) Nil else Seq("-siteroot", "docs", "-Yapi-subdirectory")), includeExternalMappings = false) if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") } else if (justAPI) generateDocTask diff --git a/project/CopyDocs.scala b/project/CopyDocs.scala deleted file mode 100644 index e9a7c59ecd01..000000000000 --- a/project/CopyDocs.scala +++ /dev/null @@ -1,94 +0,0 @@ -import scala.io.{ Codec, Source } -import java.nio.file.{ FileSystems, Files, Path, StandardCopyOption } -import java.io.PrintStream -import collection.JavaConverters._ - - -/** - * Object used for copying docs from docs to docs-for-dotty-page. More explenation can be found and [readme](../docs/README.md) - */ -object CopyDocs { - - /** - * Input directory from which we will take all the docs. - */ - val inputDir = FileSystems.getDefault.getPath("docs") - - /** - * Output directory. Most of the sources will be copied as they are, but some of the files will have headers and links processed. - */ - val outputDir = FileSystems.getDefault.getPath("docs-for-dotty-page") - - val jekyllLinkPattern = """\{\% link _overviews/scala3-reference(.*) %\}""" - val jekyllLinkSubstitution = "..$1" - val jekyllLinkPattern2 = """\{\% link _overviews/scala3-scaladoc(.*) %\}""" - val jekyllLinkSubstitution2 = ".$1" - val localLinkPattern = """\((?!http|www)(.*).html\)""" - val localLinkSubstitution = "($1.md)" - - val commonTransformations: Map[String, String] = Map( - jekyllLinkPattern -> jekyllLinkSubstitution, - jekyllLinkPattern2 -> jekyllLinkSubstitution2, - localLinkPattern -> localLinkSubstitution, - ) - - /** - * Structure for holding which transformations should be applied to which directories. - * The outer map is holding morphism `directory prefix` -> `List of transformations`. - * The inner list is a collection of pairs `regex pattern` -> `substitution value`. - */ - val transformationMap: Map[String, Map[String, String]] = Map( - "docs/docs/usage/scaladoc/index.md" -> Map( - ("""\{\{ site\.baseurl \}\}/resources/images/scala3/scaladoc/logo\.svg""" -> "images/scaladoc_logo.svg"), - ), - - "docs/docs/usage/scaladoc/site-versioning.md" -> Map( - ("""/resources/images/scala3/scaladoc/nightly\.gif""" -> "images/scaladoc/nightly.gif"), - ), - - "docs/docs/usage/scaladoc/search-engine.md" -> Map( - ("""/resources/images/scala3/scaladoc/inkuire-1\.0\.0-M2_js_flatMap\.gif""" -> "images/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif"), - ), - - "docs/docs/reference/other-new-features/explicit-nulls.md" -> Map( - ("""/resources/images/scala3/explicit-nulls/explicit-nulls-type-hierarchy\.png""" -> "images/explicit-nulls/explicit-nulls-type-hierarchy.png"), - ), - - "docs/docs/reference/" -> commonTransformations, - - "docs/docs/usage/scaladoc/" -> commonTransformations - ) - - def copyDocs() = { - def copyFile(path: Path): Unit = { - val newPath = outputDir.resolve(inputDir.relativize(path)) - Files.createDirectories(newPath.getParent()) - - path.toString match { - case s if s.startsWith("docs/docs/") && s.endsWith(".md") => - val inputStream = Source.fromFile(path.toFile)(Codec.UTF8) - val fileContent = inputStream.getLines().mkString("\n") - - new PrintStream(newPath.toFile) { - val patterns = transformationMap.filter { case (k, v) => path.toString.startsWith(k) }.flatMap(_._2) - val _ :: frontMatter :: actualContent :: Nil = fileContent.split("---", 3).toList - write("---".getBytes("UTF8")) - val frontMatterSplitted = frontMatter.split("\n(?=[^\\s])") - val frontMatterUpdated = List( - Some("layout: doc-page"), - frontMatterSplitted.find(_.startsWith("title")), - frontMatterSplitted.find(_.startsWith("redirectFrom")), - if (s.startsWith("docs/docs/reference/")) Some(s"movedTo: https://docs.scala-lang.org/scala3/reference/${s.stripPrefix("docs/docs/reference/").stripSuffix(".md")}.html") else None - ).flatten.mkString("\n", "\n", "\n") - write(frontMatterUpdated.getBytes("UTF8")) - write("---\n".getBytes("UTF8")) - val transformed = patterns.foldLeft(actualContent) { case (res, (pattern, substitution)) => res.replaceAll(pattern, substitution) } - write(transformed.getBytes("UTF8")) - } - case s => - Files.copy(path, newPath, StandardCopyOption.REPLACE_EXISTING); - } - } - Files.walk(inputDir).iterator().asScala.filter(Files.isRegularFile(_)).foreach(copyFile) - } -} diff --git a/project/DocumentationWebsite.scala b/project/DocumentationWebsite.scala index 6eee1ed02830..60a11e919e62 100644 --- a/project/DocumentationWebsite.scala +++ b/project/DocumentationWebsite.scala @@ -14,7 +14,7 @@ object DocumentationWebsite { val contributorsTestcasesDestinationFile = Paths.get("scaladoc-testcases", "docs", "js", "contributors.js").toFile - val contributorsDestinationFile = Paths.get("docs-for-dotty-page", "js", "contributors.js").toFile + val contributorsDestinationFile = Paths.get("docs", "js", "contributors.js").toFile sbt.IO.copyFile(contributorsFile, contributorsTestcasesDestinationFile) sbt.IO.copyFile(contributorsFile, contributorsDestinationFile) @@ -25,7 +25,7 @@ object DocumentationWebsite { val cssCodeSnippetsSourceFile = cssSourceFileBase / "code-snippets.css" sbt.IO.copyFile(cssCodeSnippetsSourceFile, cssCodeSnippetsDesitnationFile) - val cssContentContributorsTestcasesDesitnationFile = Paths.get("docs-for-dotty-page", "css", "content-contributors.css").toFile + val cssContentContributorsTestcasesDesitnationFile = Paths.get("docs", "css", "content-contributors.css").toFile val cssContentContributorsDesitnationFile = Paths.get("scaladoc-testcases", "docs", "css", "content-contributors.css").toFile val cssContentContributorsSourceFile = cssContentContributorsSourceBaseFile / "content-contributors.css" sbt.IO.copyFile(cssContentContributorsSourceFile, cssContentContributorsTestcasesDesitnationFile) diff --git a/project/scripts/genDocsScalaLang b/project/scripts/genDocsScalaLang deleted file mode 100755 index 1ce53899fd33..000000000000 --- a/project/scripts/genDocsScalaLang +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -set -e -shopt -s extglob # needed for rm everything but x -echo "Working directory: $PWD" - -GENDOC_EXTRA_ARGS=$@ -GIT_HEAD=$(git rev-parse HEAD) # save current head for commit message in gh-pages -PREVIOUS_SNAPSHOTS_DIR="$PWD/../prev_snapshots" -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >& /dev/null && pwd)" -SITE_OUT_DIR="$PWD/docs/_site" - -DOCS_SCALA_LANG_DIR="$PWD/docsScalaLang" - -rm -rf $DOCS_SCALA_LANG_DIR -mkdir -pv $DOCS_SCALA_LANG_DIR -git clone "https://github.com/scala/docs.scala-lang.git" $DOCS_SCALA_LANG_DIR - -SBT="$SCRIPT_DIR/sbt" -mkdir -pv $SITE_OUT_DIR - -env "scaladoc.projectFormat=md" "$SBT" "scaladoc/renderScaladocScalajsToFile $DOCS_SCALA_LANG_DIR/scripts/scaladoc-scalajs.js $DOCS_SCALA_LANG_DIR/resources/css code-snippets.css" - -DOTTY_NONBOOTSTRAPPED_VERSION_COMMAND="$SBT \"eval println(Build.dottyNonBootstrappedVersion)\"" -DOTTY_NONBOOTSTRAPPED_VERSION=$(eval $DOTTY_NONBOOTSTRAPPED_VERSION_COMMAND | tail -n 2 | head -n 1) - -DOTTY_BOOTSTRAPPED_VERSION_COMMAND="$SBT \"eval println(Build.dottyVersion)\"" -DOTTY_BOOTSTRAPPED_VERSION=$(eval $DOTTY_BOOTSTRAPPED_VERSION_COMMAND | tail -n 2 | head -n 1) - -GITHUB_REPOSITORY="lampepfl/dotty" -GITHUB_SHA="3.0.0" - -"bin/scaladoc" "-d" "$SITE_OUT_DIR" "-format" "md" "-siteroot" "docs" "/dev/null " \ - -source-links:out/bootstrap/stdlib-bootstrapped/scala-"${DOTTY_NONBOOTSTRAPPED_VERSION}"/src_managed/main/scala-library-src=github://scala/scala/v"${STDLIB_VERSION}"#src/library \ - -source-links:out/bootstrap/stdlib-bootstrapped/scala-"${DOTTY_NONBOOTSTRAPPED_VERSION}"/src_managed/main/dotty-library-src=github://"${GITHUB_REPOSITORY}"/"${GITHUB_SHA}"\#library/src \ - -source-links:github://"${GITHUB_REPOSITORY}"/"${GITHUB_SHA}" \ - -if [ ! -d "$SITE_OUT_DIR" ]; then - echo "Output directory did not exist: $SITE_OUT_DIR" 1>&2 - exit 1 -fi - -# Copy reference and scaladoc docs -cp -rf "$SITE_OUT_DIR/docs/reference"/* "$DOCS_SCALA_LANG_DIR/_scala3-reference" -cp -rf "$SITE_OUT_DIR/docs/usage/scaladoc"/* "$DOCS_SCALA_LANG_DIR/_overviews/scala3-scaladoc" - -# Copy csses and html importing these assets -cp -f "$SITE_OUT_DIR/styles/colors.css" "$DOCS_SCALA_LANG_DIR/resources/css/colors.css" -cp -f "$PWD/docs/docsScalaLangResources/scaladoc-assets.html" "$DOCS_SCALA_LANG_DIR/_includes/scaladoc-assets.html" - -# Copy images and resources -cp -f "$PWD/scaladoc/resources/dotty_res/images/scaladoc_logo.svg" "$DOCS_SCALA_LANG_DIR/resources/images/scala3/scaladoc/logo.svg" -cp -f "$PWD/docs/images/scaladoc/nightly.gif" "$DOCS_SCALA_LANG_DIR/resources/images/scala3/scaladoc/nightly.gif" -cp -f "$PWD/docs/images/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif" "$DOCS_SCALA_LANG_DIR/resources/images/scala3/scaladoc/inkuire-1\.0\.0-M2_js_flatMap.gif" -cp -f "$PWD/docs/images/explicit-nulls/explicit-nulls-type-hierarchy.png" "$DOCS_SCALA_LANG_DIR/resources/images/scala3/explicit-nulls/explicit-nulls-type-hierarchy.png" - -# Hack inclusion of these assests by the docs.scala-lang jekyll builder -echo "{% include scaladoc-assets.html %}" >> "$DOCS_SCALA_LANG_DIR/_layouts/inner-page-parent-dropdown.html" From 2856264f570d3d972663eb8609ae0cfa0ec7daa5 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Tue, 7 Dec 2021 15:03:43 +0100 Subject: [PATCH 3/4] Fix links --- docs/docs/reference/changed-features/main-functions.md | 2 +- docs/docs/reference/experimental/canthrow.md | 2 +- .../docs/reference/other-new-features/trait-parameters.md | 2 +- docs/docs/usage/scaladoc/settings.md | 2 +- scaladoc/src/dotty/tools/scaladoc/site/templates.scala | 8 +------- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/docs/reference/changed-features/main-functions.md b/docs/docs/reference/changed-features/main-functions.md index e0e13a14f681..f6f6067204a3 100644 --- a/docs/docs/reference/changed-features/main-functions.md +++ b/docs/docs/reference/changed-features/main-functions.md @@ -85,5 +85,5 @@ object happyBirthday extends App: ... ``` -The previous functionality of `App`, which relied on the "magic" [`DelayedInit`]({% link _scala3-reference/dropped-features/delayed-init.md %}) trait, is no longer available. [`App`](https://scala-lang.org/api/3.x/scala/App.md) still exists in limited form for now, but it does not support command line arguments and will be deprecated in the future. If programs need to cross-build +The previous functionality of `App`, which relied on the "magic" [`DelayedInit`](../dropped-features/delayed-init.md) trait, is no longer available. [`App`](https://scala-lang.org/api/3.x/scala/App.md) still exists in limited form for now, but it does not support command line arguments and will be deprecated in the future. If programs need to cross-build between Scala 2 and Scala 3, it is recommended to use an explicit `main` method with an `Array[String]` argument instead. diff --git a/docs/docs/reference/experimental/canthrow.md b/docs/docs/reference/experimental/canthrow.md index 3dd92c3fefba..1bfc52a4c3a7 100644 --- a/docs/docs/reference/experimental/canthrow.md +++ b/docs/docs/reference/experimental/canthrow.md @@ -60,7 +60,7 @@ In the _effects as capabilities_ model, an effect is expressed as an (implicit) ```scala erased class CanThrow[-E <: Exception] ``` -This shows another experimental Scala feature: [erased definitions]({% link _scala3-reference/experimental/erased-defs.md %}). Roughly speaking, values of an erased class do not generate runtime code; they are erased before code generation. This means that all `CanThrow` capabilities are compile-time only artifacts; they do not have a runtime footprint. +This shows another experimental Scala feature: [erased definitions](./erased-defs.md). Roughly speaking, values of an erased class do not generate runtime code; they are erased before code generation. This means that all `CanThrow` capabilities are compile-time only artifacts; they do not have a runtime footprint. Now, if the compiler sees a `throw Exc()` construct where `Exc` is a checked exception, it will check that there is a capability of type `CanThrow[Exc]` that can be summoned as a given. It's a compile-time error if that's not the case. diff --git a/docs/docs/reference/other-new-features/trait-parameters.md b/docs/docs/reference/other-new-features/trait-parameters.md index 4013e87237dd..6c833a097b21 100644 --- a/docs/docs/reference/other-new-features/trait-parameters.md +++ b/docs/docs/reference/other-new-features/trait-parameters.md @@ -56,7 +56,7 @@ class E extends Greeting("Bob"), FormalGreeting ### Traits With Context Parameters This "explicit extension required" rule is relaxed if the missing trait contains only -[context parameters]({% link _scala3-reference/contextual/using-clauses.md %}). In that case the trait reference is +[context parameters](../contextual/using-clauses.md). In that case the trait reference is implicitly inserted as an additional parent with inferred arguments. For instance, here's a variant of greetings where the addressee is a context parameter of type `ImpliedName`: diff --git a/docs/docs/usage/scaladoc/settings.md b/docs/docs/usage/scaladoc/settings.md index 396aef8b76fd..067967ee58cc 100644 --- a/docs/docs/usage/scaladoc/settings.md +++ b/docs/docs/usage/scaladoc/settings.md @@ -157,7 +157,7 @@ compile - Enables snippet checking. nocompile - Disables snippet checking. fail - Enables snippet checking, asserts that snippet doesn't compile. -The fail flag comes in handy for snippets that present that some action would eventually fail during compilation, e. g. [Opaques page]({% link _scala3-reference/other-new-features/opaques.md %}) +The fail flag comes in handy for snippets that present that some action would eventually fail during compilation, e. g. [Opaques page](../../reference/other-new-features/opaques.md) Example usage: diff --git a/scaladoc/src/dotty/tools/scaladoc/site/templates.scala b/scaladoc/src/dotty/tools/scaladoc/site/templates.scala index 0e8b0994595b..9b81f4e9957e 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/templates.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/templates.scala @@ -105,14 +105,8 @@ case class TemplateFile( // Library requires mutable maps.. val mutableProperties = new JHashMap(ctx.properties.transform((_, v) => asJavaElement(v)).asJava) - // Register escaping {% link ... %} in markdown - val tag = new Tag("link"): - override def render(context: TemplateContext, nodes: Array[? <: LNode]): Object = - val link = super.asString(nodes(0).render(context)) - s"{% link $link %}" - val rendered = ssctx.args.projectFormat match - case "html" => Template.parse(this.rawCode).`with`(tag).render(mutableProperties) + case "html" => Template.parse(this.rawCode).render(mutableProperties) case "md" => this.rawCode // We want to render markdown only if next template is html From fc8abc611d289c3a9fea00a4ef6749de7ed35ca5 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Tue, 7 Dec 2021 15:29:23 +0100 Subject: [PATCH 4/4] Remove preprocessor --- build.sbt | 1 - docs/docs/usage/ide-support.md | 1 + project/Build.scala | 29 +------------- scaladoc-js/markdown/src/Main.scala | 5 --- .../src/dotty/tools/scaladoc/Scaladoc.scala | 9 +---- .../tools/scaladoc/ScaladocSettings.scala | 10 ----- .../scaladoc/renderers/SiteRenderer.scala | 29 ++++---------- .../scaladoc/site/FrontMatterRenderer.scala | 24 ----------- .../dotty/tools/scaladoc/site/common.scala | 5 +-- .../dotty/tools/scaladoc/site/templates.scala | 15 ++----- .../markdown/SnippetFormattingExtension.scala | 40 ------------------- 11 files changed, 16 insertions(+), 152 deletions(-) delete mode 100644 scaladoc-js/markdown/src/Main.scala delete mode 100644 scaladoc/src/dotty/tools/scaladoc/site/FrontMatterRenderer.scala delete mode 100644 scaladoc/src/dotty/tools/scaladoc/tasty/comments/markdown/SnippetFormattingExtension.scala diff --git a/build.sbt b/build.sbt index 5add443e0a64..3ec2958324be 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,6 @@ val scaladoc = Build.scaladoc val `scaladoc-testcases` = Build.`scaladoc-testcases` val `scaladoc-js-common` = Build.`scaladoc-js-common` val `scaladoc-js-main` = Build.`scaladoc-js-main` -val `scaladoc-js-markdown` = Build.`scaladoc-js-markdown` val `scaladoc-js-contributors` = Build.`scaladoc-js-contributors` val `scala3-bench-run` = Build.`scala3-bench-run` val dist = Build.dist diff --git a/docs/docs/usage/ide-support.md b/docs/docs/usage/ide-support.md index c0736090e2be..25739b021b78 100644 --- a/docs/docs/usage/ide-support.md +++ b/docs/docs/usage/ide-support.md @@ -1,6 +1,7 @@ --- layout: doc-page title: "IDE support for Scala 3" +movedTo: https://docs.scala-lang.org/scala3/getting-started.html --- This page is deprecated. Please go to the [getting-started](https://docs.scala-lang.org/scala3/getting-started.html) diff --git a/project/Build.scala b/project/Build.scala index 03f69dd6f7e7..460fdd4ae89a 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1251,7 +1251,6 @@ object Build { // Note: the two tasks below should be one, but a bug in Tasty prevents that val generateScalaDocumentation = inputKey[Unit]("Generate documentation for dotty lib") val generateTestcasesDocumentation = taskKey[Unit]("Generate documentation for testcases, usefull for debugging tests") - val renderScaladocScalajsToFile = inputKey[Unit]("Copy the output of the scaladoc js files") lazy val `scaladoc-testcases` = project.in(file("scaladoc-testcases")). dependsOn(`scala3-compiler-bootstrapped`). @@ -1260,9 +1259,8 @@ object Build { /** * Collection of projects building targets for scaladoc, these are: - * - common - common module for javascript shared among html and markdown outpu + * - common - common module for javascript * - main - main target for default scaladoc producing html webpage - * - markdown - companion js for preprocessing features. Can be later used with some templating engine * - contributors - not related project to any of forementioned modules. Used for presenting contributors for static site. * Made as an indepented project to be scaladoc-agnostic. */ @@ -1279,14 +1277,6 @@ object Build { Test / fork := false ) - lazy val `scaladoc-js-markdown` = project.in(file("scaladoc-js/markdown")). - enablePlugins(DottyJSPlugin). - dependsOn(`scaladoc-js-common`). - settings( - scalaJSUseMainModuleInitializer := true, - Test / fork := false - ) - lazy val `scaladoc-js-contributors` = project.in(file("scaladoc-js/contributors")). enablePlugins(DottyJSPlugin). dependsOn(`scala3-library-bootstrappedJS`). @@ -1434,23 +1424,6 @@ object Build { ) }.value, - renderScaladocScalajsToFile := Def.inputTask { - val extraArgs = spaceDelimited("").parsed - val (destJS, destCSS, csses) = extraArgs match { - case js :: css :: tail => (js, css, tail) - case js :: Nil => (js, "", Nil) - case _ => throw new IllegalArgumentException("No js destination provided") - } - val jsDestinationFile: File = Paths.get(destJS).toFile - sbt.IO.copyFile((`scaladoc-js-markdown` / Compile / fullOptJS).value.data, jsDestinationFile) - csses.map { file => - val cssDesitnationFile = Paths.get(destCSS).toFile / file - val cssSourceFile = (`scaladoc-js-markdown` / Compile / resourceDirectory).value / file - sbt.IO.copyFile(cssSourceFile, cssDesitnationFile) - cssDesitnationFile - } - }.evaluated, - Test / buildInfoKeys := Seq[BuildInfoKey]( (Test / Build.testcasesOutputDir), (Test / Build.testcasesSourceRoot), diff --git a/scaladoc-js/markdown/src/Main.scala b/scaladoc-js/markdown/src/Main.scala deleted file mode 100644 index f7794057bfdf..000000000000 --- a/scaladoc-js/markdown/src/Main.scala +++ /dev/null @@ -1,5 +0,0 @@ -package dotty.tools.scaladoc -import scala.scalajs.js.annotation._ - -object Main extends App: - CodeSnippets() diff --git a/scaladoc/src/dotty/tools/scaladoc/Scaladoc.scala b/scaladoc/src/dotty/tools/scaladoc/Scaladoc.scala index 580acf9cb6ca..154209b5e1e5 100644 --- a/scaladoc/src/dotty/tools/scaladoc/Scaladoc.scala +++ b/scaladoc/src/dotty/tools/scaladoc/Scaladoc.scala @@ -60,7 +60,6 @@ object Scaladoc: generateInkuire : Boolean = false, apiSubdirectory : Boolean = false, scastieConfiguration: String = "", - projectFormat: String = "html", defaultTemplate: Option[String] = None, ) @@ -239,7 +238,6 @@ object Scaladoc: generateInkuire.get, apiSubdirectory.get, scastieConfiguration.get, - projectFormat.get, defaultTemplate.nonDefault ) (Some(docArgs), newContext) @@ -248,11 +246,6 @@ object Scaladoc: private [scaladoc] def run(args: Args)(using ctx: CompilerContext): DocContext = given docContext: DocContext = new DocContext(args, ctx) val module = ScalaModuleProvider.mkModule() - - val renderer = args.projectFormat match - case "html" => new dotty.tools.scaladoc.renderers.HtmlRenderer(module.rootPackage, module.members) - case "md" => new dotty.tools.scaladoc.renderers.MarkdownRenderer(module.rootPackage, module.members) - - renderer.render() + new dotty.tools.scaladoc.renderers.HtmlRenderer(module.rootPackage, module.members).render() report.inform("generation completed successfully") docContext diff --git a/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala b/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala index ea35ac0f9b8c..0d6bc60f281a 100644 --- a/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala +++ b/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala @@ -125,16 +125,6 @@ class ScaladocSettings extends SettingGroup with AllScalaSettings: val scastieConfiguration: Setting[String] = StringSetting("-scastie-configuration", "Scastie configuration", "Additional configuration passed to Scastie in code snippets", "") - val projectFormat: Setting[String] = - ChoiceSetting( - "-format", - "format of the static site output", - "Format of the static site output. The default value is html, which converts all static articles into a webpage. " + - "The md format only preprocess markdown files and should not be used as a direct output, but rather as a sources generator for an outer templating engine like Jekyll", - List("html", "md"), - "html" - ) - val defaultTemplate: Setting[String] = StringSetting( "-default-template", diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala index 396c7830d8dc..566ccd81ab62 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala @@ -56,24 +56,11 @@ trait SiteRenderer(using DocContext) extends Locations: else processLocalLink(str) - summon[DocContext].args.projectFormat match - case "html" => - val document = Jsoup.parse(content.resolved.code) - document.select("a").forEach(element => - element.attr("href", processLocalLinkWithGuard(element.attr("href"))) - ) - document.select("img").forEach { element => - element.attr("src", processLocalLink(element.attr("src"))) - } // foreach does not work here. Why? - raw(document.outerHtml()) - case "md" => - val links = """(? s"[${m.group(1)}](${processLocalLink(m.group(2))})" - ), - m => s"[${m.group(1)}](${processLocalLinkWithGuard(m.group(2))})" - )) + val document = Jsoup.parse(content.resolved.code) + document.select("a").forEach(element => + element.attr("href", processLocalLinkWithGuard(element.attr("href"))) + ) + document.select("img").forEach { element => + element.attr("src", processLocalLink(element.attr("src"))) + } // foreach does not work here. Why? + raw(document.outerHtml()) diff --git a/scaladoc/src/dotty/tools/scaladoc/site/FrontMatterRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/site/FrontMatterRenderer.scala deleted file mode 100644 index 2e02918b5b39..000000000000 --- a/scaladoc/src/dotty/tools/scaladoc/site/FrontMatterRenderer.scala +++ /dev/null @@ -1,24 +0,0 @@ -package dotty.tools.scaladoc -package site - - -/** - * Object for rendering yaml front-matter for preprocessed markdowns. - */ -object FrontMatterRenderer: - def render(properties: Map[String, Object]): String = - - def renderProperties(newProps: Map[String, Object]): List[String] = newProps.collect { - case (k: String, v: String) => s"$k: $v" - }.toList - - val rows = renderProperties(properties) ++ renderProperties(properties("page").asInstanceOf[Map[String, Object]]) - - rows.mkString("---\n", "\n", "\n---") + "\n\n\n\n" - - - diff --git a/scaladoc/src/dotty/tools/scaladoc/site/common.scala b/scaladoc/src/dotty/tools/scaladoc/site/common.scala index 5873863ed6c0..6c7677729e89 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/common.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/common.scala @@ -37,10 +37,7 @@ def defaultMarkdownOptions(using ctx: StaticSiteContext): DataHolder = YamlFrontMatterExtension.create(), StrikethroughExtension.create(), WikiLinkExtension.create(), - (ctx.args.projectFormat match - case "html" => tasty.comments.markdown.SnippetRenderingExtension - case "md" => tasty.comments.markdown.SnippetFormattingExtension - ), + tasty.comments.markdown.SnippetRenderingExtension )) def emptyTemplate(file: File, title: String): TemplateFile = TemplateFile( diff --git a/scaladoc/src/dotty/tools/scaladoc/site/templates.scala b/scaladoc/src/dotty/tools/scaladoc/site/templates.scala index 9b81f4e9957e..55eb30026fd4 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/templates.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/templates.scala @@ -92,7 +92,7 @@ case class TemplateFile( if (ctx.resolving.contains(file.getAbsolutePath)) throw new RuntimeException(s"Cycle in templates involving $file: ${ctx.resolving}") - val layoutTemplate = layout.filter(_ => ssctx.args.projectFormat == "html").map(name => + val layoutTemplate = layout.map(name => ctx.layouts.getOrElse(name, throw new RuntimeException(s"No layouts named $name in ${ctx.layouts}"))) def asJavaElement(o: Object): Object = o match @@ -105,9 +105,7 @@ case class TemplateFile( // Library requires mutable maps.. val mutableProperties = new JHashMap(ctx.properties.transform((_, v) => asJavaElement(v)).asJava) - val rendered = ssctx.args.projectFormat match - case "html" => Template.parse(this.rawCode).render(mutableProperties) - case "md" => this.rawCode + val rendered = Template.parse(this.rawCode).render(mutableProperties) // We want to render markdown only if next template is html val code = if (isHtml || layoutTemplate.exists(!_.isHtml)) rendered else @@ -115,14 +113,9 @@ case class TemplateFile( val parser: Parser = Parser.builder(defaultMarkdownOptions).build() val parsedMd = parser.parse(rendered) val processed = FlexmarkSnippetProcessor.processSnippets(parsedMd, None, snippetCheckingFunc, withContext = false)(using ssctx.outerCtx) + HtmlRenderer.builder(defaultMarkdownOptions).build().render(processed) - ssctx.args.projectFormat match - case "html" => HtmlRenderer.builder(defaultMarkdownOptions).build().render(processed) - case "md" => FrontMatterRenderer.render(ctx.properties ++ settings) + - Formatter.builder(defaultMarkdownOptions).build().render(processed) - - - if layoutTemplate.isEmpty || ssctx.args.projectFormat == "md" then + if layoutTemplate.isEmpty then ResolvedPage(code, resources ++ ctx.resources) else layoutTemplate.get.resolveInner(ctx.nest(code, file, resources)) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/markdown/SnippetFormattingExtension.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/markdown/SnippetFormattingExtension.scala deleted file mode 100644 index 7833c0c5d669..000000000000 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/markdown/SnippetFormattingExtension.scala +++ /dev/null @@ -1,40 +0,0 @@ -package dotty.tools.scaladoc -package tasty.comments.markdown - -import dotty.tools.scaladoc.snippets._ - -import com.vladsch.flexmark.formatter._ -import com.vladsch.flexmark.parser._ -import com.vladsch.flexmark.ext.wikilink._ -import com.vladsch.flexmark.ext.wikilink.internal.WikiLinkLinkRefProcessor -import com.vladsch.flexmark.util.ast._ -import com.vladsch.flexmark.util.options._ -import com.vladsch.flexmark.util.sequence.BasedSequence -import com.vladsch.flexmark._ - -/** - * SnippetFormattingExtension is a clone of the [[SnippetRenderingExtension]] used as a fallback strategy when the `-format` setting is set up to `md` - */ -object SnippetFormattingExtension extends Formatter.FormatterExtension: - - def rendererOptions(opt: MutableDataHolder): Unit = () - - object ExtendedFencedCodeBlockHandler extends CustomNodeFormatter[ExtendedFencedCodeBlock]: - override def render(node: ExtendedFencedCodeBlock, c: NodeFormatterContext, markdown: MarkdownWriter): Unit = - markdown.append( - SnippetRenderer.renderSnippetWithMessages(node) - ) - - object Format extends NodeFormatter: - override def getNodeFormattingHandlers: JSet[NodeFormattingHandler[?]] = - JSet( - new NodeFormattingHandler(classOf[ExtendedFencedCodeBlock], ExtendedFencedCodeBlockHandler), - ) - - def getNodeClasses: JSet[Class[?]] = null - - object Factory extends NodeFormatterFactory: - override def create(options: DataHolder): NodeFormatter = Format - - def extend(formatterBuilder: Formatter.Builder) = - formatterBuilder.nodeFormatterFactory(Factory)