diff --git a/changelogs/3.2.1-RC1.md b/changelogs/3.2.1-RC1.md new file mode 100644 index 000000000000..217152fed9b2 --- /dev/null +++ b/changelogs/3.2.1-RC1.md @@ -0,0 +1,189 @@ +# Highlights of the release + +- Add experimental capture checking [#15877](https://github.com/lampepfl/dotty/pull/15877) +- Scaladoc: New UI design [#15697](https://github.com/lampepfl/dotty/pull/15697) + +# Other changes and fixes + +## Backend + +- Set ACC_FINAL access flag to final variable accessors [#15707](https://github.com/lampepfl/dotty/pull/15707) + +## Coverage + +- Avoid instrumentation of inline and erased definitions [#15504](https://github.com/lampepfl/dotty/pull/15504) + +## Erasure + +- Fix #15199: Exclude JavaDefined Modules from bridge generation. [#15499](https://github.com/lampepfl/dotty/pull/15499) + +## Extension Methods + +- Merge nested polytypes in more cases in resolveOverloaded [#15636](https://github.com/lampepfl/dotty/pull/15636) + +## GADTs + +- Fix GADT casting when typing if expressions [#15646](https://github.com/lampepfl/dotty/pull/15646) +- Use GADT constraints in maximiseType [#15544](https://github.com/lampepfl/dotty/pull/15544) +- Add the expected type to Poly's desugaring [#15570](https://github.com/lampepfl/dotty/pull/15570) +- Allow refineUsingParent to infer GADT bounds [#15706](https://github.com/lampepfl/dotty/pull/15706) +- Avoid leaking internal types in GadtConstraint.approximation [#15558](https://github.com/lampepfl/dotty/pull/15558) +- Improve GADT usage tracing for MatchType reduction [#15872](https://github.com/lampepfl/dotty/pull/15872) +- Add `gadtAddBound` to ExplainingTypeComparer tracing [#15819](https://github.com/lampepfl/dotty/pull/15819) + +## IDE Support + +- Recover from TypeErrors in isErroneous [#15442](https://github.com/lampepfl/dotty/pull/15442) +- Add a guard against empty ident [#15542](https://github.com/lampepfl/dotty/pull/15542) + +## Initialization + +- Fix #15465: Use resolveThis for outerSelect resolution [#15606](https://github.com/lampepfl/dotty/pull/15606) +- Fix #15459: Display uninitialized fields in promotion error [#15488](https://github.com/lampepfl/dotty/pull/15488) +- Fix #15363: Improve error messages for leaking of this [#15364](https://github.com/lampepfl/dotty/pull/15364) +- Make sure inner classes are checked first [#15527](https://github.com/lampepfl/dotty/pull/15527) +- Handle super accessors in initialization checker [#15703](https://github.com/lampepfl/dotty/pull/15703) + +## Inline + +- Check is inline unapply has leading implicits [#15583](https://github.com/lampepfl/dotty/pull/15583) +- Fix #15374: Make sure prefix of outer select has the correct class symbol [#15592](https://github.com/lampepfl/dotty/pull/15592) + +## Java Interoperability + +- Don't check import selectors for Java code [#15617](https://github.com/lampepfl/dotty/pull/15617) + +## JS Interoperability + +- Fix #15701: Implement js.dynamicImport for dynamic module loading. [#15720](https://github.com/lampepfl/dotty/pull/15720) +- Implement support for js.`new`.target. [#15734](https://github.com/lampepfl/dotty/pull/15734) +- Fix #14488: Scala.js: Add compiler support for scala.Enumeration. [#15770](https://github.com/lampepfl/dotty/pull/15770) + +## Match Types + +- Avoid null types when reducing match types [#15748](https://github.com/lampepfl/dotty/pull/15748) +- Avoid references to unbound parameters in applied type patterns [#15710](https://github.com/lampepfl/dotty/pull/15710) + +## Nullability + +- Fix checking ctx to carry correct modes [#15350](https://github.com/lampepfl/dotty/pull/15350) + +## Pattern Matching + +- Teach provablyDisjoint to handle FromJavaObject [#15769](https://github.com/lampepfl/dotty/pull/15769) +- Don't trust case class extractors with explicit type arguments [#15669](https://github.com/lampepfl/dotty/pull/15669) +- Space: Fix how sealed abstract classes decompose [#15553](https://github.com/lampepfl/dotty/pull/15553) +- Local classes are uncheckable (type tests) [#15134](https://github.com/lampepfl/dotty/pull/15134) +- Fix ValDef span assignment in PatternMatcher [#15783](https://github.com/lampepfl/dotty/pull/15783) +- Reject all explicitly written type references with bad bounds [#15577](https://github.com/lampepfl/dotty/pull/15577) + +## Pickling + +- Make simplify replace type parameters inside method types [#15430](https://github.com/lampepfl/dotty/pull/15430) + +## Quotes + +- Ignore types in macro runtime dependencies [#15529](https://github.com/lampepfl/dotty/pull/15529) + +## REPL + +- ReplDriver.run and :load take complete input [#15811](https://github.com/lampepfl/dotty/pull/15811) +- REPL goes through a phase [#15663](https://github.com/lampepfl/dotty/pull/15663) +- Avoid assertion failure for illegal trait inheritance [#15631](https://github.com/lampepfl/dotty/pull/15631) + +## Reporting + +- Underline assignment correctly in error message [#15584](https://github.com/lampepfl/dotty/pull/15584) +- Better error message for "implicit search must be more specific" [#15747](https://github.com/lampepfl/dotty/pull/15747) +- Provide better info on compiler crashes [#15890](https://github.com/lampepfl/dotty/pull/15890) + +## SemanticDB + +- Handle colons in file names when producing SemanticDB [#15863](https://github.com/lampepfl/dotty/pull/15863) + +## Standard Library + +- Fix `throwReturn` of `NonLocalReturns` to allow wider usage [#15495](https://github.com/lampepfl/dotty/pull/15495) + +## Tooling + +- Fix scala runner exit codes [#15604](https://github.com/lampepfl/dotty/pull/15604) +- Command line parser respects outer escaped quote [#15497](https://github.com/lampepfl/dotty/pull/15497) +- Added quotes to Scala home paths in scala and scalac scripts [#15824](https://github.com/lampepfl/dotty/pull/15824) +- Retain partial type params typying information on error [#15825](https://github.com/lampepfl/dotty/pull/15825) + +## Transform + +- Implementation restriction: No partial functions with CFT results [#15744](https://github.com/lampepfl/dotty/pull/15744) +- Fix treatment of parameter selections via this in constructors. [#15737](https://github.com/lampepfl/dotty/pull/15737) +- Fix expansion and unexpansion of mixin qualified names [#15712](https://github.com/lampepfl/dotty/pull/15712) +- Fix #15514 in Parser [#15524](https://github.com/lampepfl/dotty/pull/15524) +- Check type arguments for bad bounds [#15571](https://github.com/lampepfl/dotty/pull/15571) + +## Typer + +- Fix swapKey [#15894](https://github.com/lampepfl/dotty/pull/15894) +- Insert GADT casts for needy match types [#15851](https://github.com/lampepfl/dotty/pull/15851) +- Add missing dealias in isContextFunctionRef [#15742](https://github.com/lampepfl/dotty/pull/15742) +- Look for synthetic applies also under type applications [#15572](https://github.com/lampepfl/dotty/pull/15572) +- Optimize isSameType for invariant applied types with the same structure [#15556](https://github.com/lampepfl/dotty/pull/15556) +- Fix cycle detection for type aliases with wildcard arguments [#15508](https://github.com/lampepfl/dotty/pull/15508) +- Handle recursions in isFullyDefined [#15443](https://github.com/lampepfl/dotty/pull/15443) +- Do level checking on instantiation [#15746](https://github.com/lampepfl/dotty/pull/15746) +- Use fullyDefinedType for mirror synthesis [#15814](https://github.com/lampepfl/dotty/pull/15814) +- Instantiate more type variables to hard unions [#15632](https://github.com/lampepfl/dotty/pull/15632) +- Simplify level fixing scheme [#15936](https://github.com/lampepfl/dotty/pull/15936) +- Don't normalize in `AppliedType#superType` [#15453](https://github.com/lampepfl/dotty/pull/15453) +- Try promotion while widening arguments [#15467](https://github.com/lampepfl/dotty/pull/15467) +- Check import selectors at Typer [#15477](https://github.com/lampepfl/dotty/pull/15477) +- Turn some calls to `underlying` into `superType`. [#15455](https://github.com/lampepfl/dotty/pull/15455) +- Find more looping implicits [#15481](https://github.com/lampepfl/dotty/pull/15481) +- Fix `findFunctionType` for `OrTypes` [#15478](https://github.com/lampepfl/dotty/pull/15478) +- Fix looping implicits check [#15655](https://github.com/lampepfl/dotty/pull/15655) +- Try to avoid static symbols if leaving them would make a leak [#15548](https://github.com/lampepfl/dotty/pull/15548) +- Do not fold `IsConst` applied to dependent parameters [#15759](https://github.com/lampepfl/dotty/pull/15759) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.1.3..3.2.0` these are: + +``` + 204 Martin Odersky + 94 Filip Łukasik + 69 Fengyun Liu + 57 Filip Zybała + 31 Dale Wijnand + 14 Sébastien Doeraene + 10 Guillaume Raffin + 9 rochala + 8 Chris Kipp + 8 Paweł Marks + 8 Som Snytt + 7 Jędrzej Rochala + 7 Nicolas Stucki + 7 Yichen Xu + 6 Jamie Thompson + 6 Tom Grigg + 5 noti0na1 + 2 Arman Bilge + 2 Kacper Korban + 2 Matt Bovel + 2 Ondrej Lhotak + 2 Quentin Bernet + 2 Tomasz Godzik + 1 Adrien Piquerez + 1 Florian3k + 1 Gagandeep Kalra + 1 Jentsch + 1 Kieren Davies + 1 Michał Pałka + 1 Naveen + 1 Oron Port + 1 Rubin Simons + 1 Seth Tisue + 1 Wojciech Mazur + 1 esteban marin + 1 naveen +``` diff --git a/changelogs/3.2.1-RC2.md b/changelogs/3.2.1-RC2.md new file mode 100644 index 000000000000..5242481120d6 --- /dev/null +++ b/changelogs/3.2.1-RC2.md @@ -0,0 +1,18 @@ +# Backported fixes + +- Only look for synthetic applies under `TypeApply` with inferred arguments [#15970](https://github.com/lampepfl/dotty/pull/15970) +- Improvements for implicit searches with top-level type variables [#16001](https://github.com/lampepfl/dotty/pull/16001) +- Better types for class type parameters [#15951](https://github.com/lampepfl/dotty/pull/15951) +- Avoid adding `NoSymbol` to gadt constraints in `TypeOps.instantiateToSubType` [#15965](https://github.com/lampepfl/dotty/pull/15965) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.2.1-RC1..3.2.1-RC2` these are: + +``` + 7 Martin Odersky + 3 Kacper Korban + 2 Paweł Marks +``` diff --git a/changelogs/3.2.1-RC3.md b/changelogs/3.2.1-RC3.md new file mode 100644 index 000000000000..13a186432c97 --- /dev/null +++ b/changelogs/3.2.1-RC3.md @@ -0,0 +1,16 @@ +# Backported fixes + +- Fix tuple casting [#16113](https://github.com/lampepfl/dotty/pull/16113) +- Be even more careful when combining argument and info in `computeAsSeenFrom` [#16070](https://github.com/lampepfl/dotty/pull/16070) +- Be still more careful when computing denotations of class parameters [#16112](https://github.com/lampepfl/dotty/pull/16112) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.2.1-RC2..3.2.1-RC3` these are: + +``` + 4 Martin Odersky + 2 Paweł Marks +``` diff --git a/changelogs/3.2.1-RC4.md b/changelogs/3.2.1-RC4.md new file mode 100644 index 000000000000..89957185c508 --- /dev/null +++ b/changelogs/3.2.1-RC4.md @@ -0,0 +1,14 @@ +# Backported fixes + +- Update Scala 2 library dependency to 2.13.10 [#16074](https://github.com/lampepfl/dotty/pull/16074) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.2.1-RC3..3.2.1-RC4` these are: + +``` + 2 Paweł Marks + 1 Seth Tisue +``` diff --git a/changelogs/3.2.1.md b/changelogs/3.2.1.md new file mode 100644 index 000000000000..c0292ca6a977 --- /dev/null +++ b/changelogs/3.2.1.md @@ -0,0 +1,198 @@ +# Highlights of the release + +- Add experimental capture checking [#15877](https://github.com/lampepfl/dotty/pull/15877) +- Scaladoc: New UI design [#15697](https://github.com/lampepfl/dotty/pull/15697) + +# Other changes and fixes + +## Backend + +- Set ACC_FINAL access flag to final variable accessors [#15707](https://github.com/lampepfl/dotty/pull/15707) + +## Coverage + +- Avoid instrumentation of inline and erased definitions [#15504](https://github.com/lampepfl/dotty/pull/15504) + +## Erasure + +- Fix #15199: Exclude JavaDefined Modules from bridge generation. [#15499](https://github.com/lampepfl/dotty/pull/15499) + +## Extension Methods + +- Merge nested polytypes in more cases in resolveOverloaded [#15636](https://github.com/lampepfl/dotty/pull/15636) + +## GADTs + +- Fix GADT casting when typing if expressions [#15646](https://github.com/lampepfl/dotty/pull/15646) +- Use GADT constraints in maximiseType [#15544](https://github.com/lampepfl/dotty/pull/15544) +- Add the expected type to Poly's desugaring [#15570](https://github.com/lampepfl/dotty/pull/15570) +- Allow refineUsingParent to infer GADT bounds [#15706](https://github.com/lampepfl/dotty/pull/15706) +- Avoid leaking internal types in GadtConstraint.approximation [#15558](https://github.com/lampepfl/dotty/pull/15558) +- Improve GADT usage tracing for MatchType reduction [#15872](https://github.com/lampepfl/dotty/pull/15872) +- Add `gadtAddBound` to ExplainingTypeComparer tracing [#15819](https://github.com/lampepfl/dotty/pull/15819) +- Avoid adding `NoSymbol` to gadt constraints in `TypeOps.instantiateToSubType` [#15965](https://github.com/lampepfl/dotty/pull/15965) + +## IDE Support + +- Recover from TypeErrors in isErroneous [#15442](https://github.com/lampepfl/dotty/pull/15442) +- Add a guard against empty ident [#15542](https://github.com/lampepfl/dotty/pull/15542) + +## Initialization + +- Fix #15465: Use resolveThis for outerSelect resolution [#15606](https://github.com/lampepfl/dotty/pull/15606) +- Fix #15459: Display uninitialized fields in promotion error [#15488](https://github.com/lampepfl/dotty/pull/15488) +- Fix #15363: Improve error messages for leaking of this [#15364](https://github.com/lampepfl/dotty/pull/15364) +- Make sure inner classes are checked first [#15527](https://github.com/lampepfl/dotty/pull/15527) +- Handle super accessors in initialization checker [#15703](https://github.com/lampepfl/dotty/pull/15703) + +## Inline + +- Check is inline unapply has leading implicits [#15583](https://github.com/lampepfl/dotty/pull/15583) +- Fix #15374: Make sure prefix of outer select has the correct class symbol [#15592](https://github.com/lampepfl/dotty/pull/15592) + +## Java Interoperability + +- Don't check import selectors for Java code [#15617](https://github.com/lampepfl/dotty/pull/15617) + +## JS Interoperability + +- Fix #15701: Implement js.dynamicImport for dynamic module loading. [#15720](https://github.com/lampepfl/dotty/pull/15720) +- Implement support for js.`new`.target. [#15734](https://github.com/lampepfl/dotty/pull/15734) +- Fix #14488: Scala.js: Add compiler support for scala.Enumeration. [#15770](https://github.com/lampepfl/dotty/pull/15770) + +## Match Types + +- Avoid null types when reducing match types [#15748](https://github.com/lampepfl/dotty/pull/15748) +- Avoid references to unbound parameters in applied type patterns [#15710](https://github.com/lampepfl/dotty/pull/15710) + +## Nullability + +- Fix checking ctx to carry correct modes [#15350](https://github.com/lampepfl/dotty/pull/15350) + +## Pattern Matching + +- Teach provablyDisjoint to handle FromJavaObject [#15769](https://github.com/lampepfl/dotty/pull/15769) +- Don't trust case class extractors with explicit type arguments [#15669](https://github.com/lampepfl/dotty/pull/15669) +- Space: Fix how sealed abstract classes decompose [#15553](https://github.com/lampepfl/dotty/pull/15553) +- Local classes are uncheckable (type tests) [#15134](https://github.com/lampepfl/dotty/pull/15134) +- Fix ValDef span assignment in PatternMatcher [#15783](https://github.com/lampepfl/dotty/pull/15783) +- Reject all explicitly written type references with bad bounds [#15577](https://github.com/lampepfl/dotty/pull/15577) + +## Pickling + +- Make simplify replace type parameters inside method types [#15430](https://github.com/lampepfl/dotty/pull/15430) + +## Quotes + +- Ignore types in macro runtime dependencies [#15529](https://github.com/lampepfl/dotty/pull/15529) + +## REPL + +- ReplDriver.run and :load take complete input [#15811](https://github.com/lampepfl/dotty/pull/15811) +- REPL goes through a phase [#15663](https://github.com/lampepfl/dotty/pull/15663) +- Avoid assertion failure for illegal trait inheritance [#15631](https://github.com/lampepfl/dotty/pull/15631) + +## Reporting + +- Underline assignment correctly in error message [#15584](https://github.com/lampepfl/dotty/pull/15584) +- Better error message for "implicit search must be more specific" [#15747](https://github.com/lampepfl/dotty/pull/15747) +- Provide better info on compiler crashes [#15890](https://github.com/lampepfl/dotty/pull/15890) + +## SemanticDB + +- Handle colons in file names when producing SemanticDB [#15863](https://github.com/lampepfl/dotty/pull/15863) + +## Standard Library + +- Fix `throwReturn` of `NonLocalReturns` to allow wider usage [#15495](https://github.com/lampepfl/dotty/pull/15495) +- Update Scala 2 library dependency to 2.13.10 [#16074](https://github.com/lampepfl/dotty/pull/16074) + +## Tooling + +- Fix scala runner exit codes [#15604](https://github.com/lampepfl/dotty/pull/15604) +- Command line parser respects outer escaped quote [#15497](https://github.com/lampepfl/dotty/pull/15497) +- Added quotes to Scala home paths in scala and scalac scripts [#15824](https://github.com/lampepfl/dotty/pull/15824) +- Retain partial type params typying information on error [#15825](https://github.com/lampepfl/dotty/pull/15825) + +## Transform + +- Implementation restriction: No partial functions with CFT results [#15744](https://github.com/lampepfl/dotty/pull/15744) +- Fix treatment of parameter selections via this in constructors. [#15737](https://github.com/lampepfl/dotty/pull/15737) +- Fix expansion and unexpansion of mixin qualified names [#15712](https://github.com/lampepfl/dotty/pull/15712) +- Fix #15514 in Parser [#15524](https://github.com/lampepfl/dotty/pull/15524) +- Check type arguments for bad bounds [#15571](https://github.com/lampepfl/dotty/pull/15571) + +## Typer + +- Fix swapKey [#15894](https://github.com/lampepfl/dotty/pull/15894) +- Insert GADT casts for needy match types [#15851](https://github.com/lampepfl/dotty/pull/15851) +- Add missing dealias in isContextFunctionRef [#15742](https://github.com/lampepfl/dotty/pull/15742) +- Look for synthetic applies also under type applications [#15572](https://github.com/lampepfl/dotty/pull/15572) +- Optimize isSameType for invariant applied types with the same structure [#15556](https://github.com/lampepfl/dotty/pull/15556) +- Fix cycle detection for type aliases with wildcard arguments [#15508](https://github.com/lampepfl/dotty/pull/15508) +- Handle recursions in isFullyDefined [#15443](https://github.com/lampepfl/dotty/pull/15443) +- Do level checking on instantiation [#15746](https://github.com/lampepfl/dotty/pull/15746) +- Use fullyDefinedType for mirror synthesis [#15814](https://github.com/lampepfl/dotty/pull/15814) +- Instantiate more type variables to hard unions [#15632](https://github.com/lampepfl/dotty/pull/15632) +- Simplify level fixing scheme [#15936](https://github.com/lampepfl/dotty/pull/15936) +- Don't normalize in `AppliedType#superType` [#15453](https://github.com/lampepfl/dotty/pull/15453) +- Try promotion while widening arguments [#15467](https://github.com/lampepfl/dotty/pull/15467) +- Check import selectors at Typer [#15477](https://github.com/lampepfl/dotty/pull/15477) +- Turn some calls to `underlying` into `superType`. [#15455](https://github.com/lampepfl/dotty/pull/15455) +- Find more looping implicits [#15481](https://github.com/lampepfl/dotty/pull/15481) +- Fix `findFunctionType` for `OrTypes` [#15478](https://github.com/lampepfl/dotty/pull/15478) +- Fix looping implicits check [#15655](https://github.com/lampepfl/dotty/pull/15655) +- Try to avoid static symbols if leaving them would make a leak [#15548](https://github.com/lampepfl/dotty/pull/15548) +- Do not fold `IsConst` applied to dependent parameters [#15759](https://github.com/lampepfl/dotty/pull/15759) +- Only look for synthetic applies under `TypeApply` with inferred arguments [#15970](https://github.com/lampepfl/dotty/pull/15970) +- Improvements for implicit searches with top-level type variables [#16001](https://github.com/lampepfl/dotty/pull/16001) +- Better types for class type parameters [#15951](https://github.com/lampepfl/dotty/pull/15951) +- Fix tuple casting [#16113](https://github.com/lampepfl/dotty/pull/16113) +- Be even more careful when combining argument and info in `computeAsSeenFrom` [#16070](https://github.com/lampepfl/dotty/pull/16070) +- Be still more careful when computing denotations of class parameters [#16112](https://github.com/lampepfl/dotty/pull/16112) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.2.0..3.2.1` these are: + +``` + 215 Martin Odersky + 94 Filip Łukasik + 69 Fengyun Liu + 57 Filip Zybała + 31 Dale Wijnand + 16 Paweł Marks + 14 Sébastien Doeraene + 10 Guillaume Raffin + 9 rochala + 8 Chris Kipp + 8 Som Snytt + 7 Jędrzej Rochala + 7 Nicolas Stucki + 7 Yichen Xu + 6 Jamie Thompson + 6 Tom Grigg + 5 Kacper Korban + 5 noti0na1 + 2 Arman Bilge + 2 Matt Bovel + 2 Ondrej Lhotak + 2 Quentin Bernet + 2 Seth Tisue + 2 Tomasz Godzik + 1 Adrien Piquerez + 1 Florian3k + 1 Gagandeep Kalra + 1 Jentsch + 1 Kieren Davies + 1 Michał Pałka + 1 Naveen + 1 Oron Port + 1 Rubin Simons + 1 Wojciech Mazur + 1 esteban marin + 1 naveen + +``` diff --git a/docs/_docs/reference/changed-features/pattern-matching.md b/docs/_docs/reference/changed-features/pattern-matching.md index 1106a0774121..fed76ff9260d 100644 --- a/docs/_docs/reference/changed-features/pattern-matching.md +++ b/docs/_docs/reference/changed-features/pattern-matching.md @@ -207,7 +207,7 @@ A usage of a variadic extractor is irrefutable if one of the following condition **Note:** The last rule is necessary because, for compatibility reasons, `isEmpty` on `Some` has return type `Boolean` rather than `false`, even though it always returns `false`. -**Note:** Be careful, by the first condition and the note above, it is possible to define an irrefutable extractor with a `def isEmpty: true`. +**Note:** Be careful, by the first condition and the note above, it is possible to define an irrefutable extractor with a `def isEmpty: true`. This is strongly discouraged and, if found in the wild, is almost certainly a bug. ### Sequence Match diff --git a/docs/_docs/reference/contextual/derivation.md b/docs/_docs/reference/contextual/derivation.md index 285c52e5dfd9..a9ca8b18e5b0 100644 --- a/docs/_docs/reference/contextual/derivation.md +++ b/docs/_docs/reference/contextual/derivation.md @@ -34,6 +34,9 @@ given [T: Ordering]: Ordering[Option[T]] = Ordering.derived It is discouraged to directly refer to the `derived` member if you can use a `derives` clause instead. +All data types can have a `derives` clause. This document focuses primarily on data types which also have a given instance +of the `Mirror` type class available. + ## Exact mechanism In the following, when type arguments are enumerated and the first index evaluates to a larger value than the last, then there are actually no arguments, for example: `A[T_2, ..., T_1]` means `A`. @@ -286,6 +289,8 @@ Note the following properties of `Mirror` types, As seen before, the signature and implementation of a `derived` method for a type class `TC[_]` are arbitrary, but we expect it to typically be of the following form: ```scala +import scala.deriving.Mirror + inline def derived[T](using Mirror.Of[T]): TC[T] = ... ``` diff --git a/project/Build.scala b/project/Build.scala index d735db6a8a5b..c901e899f238 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1322,6 +1322,7 @@ object Build { val generateSelfDocumentation = taskKey[Unit]("Generate example documentation") // 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 generateStableScala3Documentation = inputKey[Unit]("Generate documentation for stable dotty lib") val generateTestcasesDocumentation = taskKey[Unit]("Generate documentation for testcases, usefull for debugging tests") val generateReferenceDocumentation = inputKey[Unit]("Generate language reference documentation for Scala 3") @@ -1465,6 +1466,12 @@ object Build { writeAdditionalFiles.dependsOn(generateDocumentation(config)) }.evaluated, + generateStableScala3Documentation := Def.inputTaskDyn { + val extraArgs = spaceDelimited("").parsed + val config = stableScala3(extraArgs.head) + generateDocumentation(config) + }.evaluated, + generateTestcasesDocumentation := Def.taskDyn { generateDocumentation(Testcases) }.value, @@ -1501,7 +1508,7 @@ object Build { .add(OutputDir("scaladoc/output/reference")) .add(SiteRoot(s"${temp.getAbsolutePath}/docs")) .add(ProjectName("Scala 3 Reference")) - .add(ProjectVersion("3.2.0")) // TODO: Change that later to the current version tag. (This must happen on first forward this branch to stable release tag) + .add(ProjectVersion(baseVersion)) .remove[VersionsDictionaryUrl] .add(SourceLinks(List( s"${temp.getAbsolutePath}=github://lampepfl/dotty/language-reference-stable" @@ -1860,22 +1867,22 @@ object ScaladocConfigs { case None => s"${sourcesPrefix}github://lampepfl/dotty/$v$outputPrefix" } - lazy val DefaultGenerationConfig = Def.task { - def distLocation = (dist / pack).value - def projectVersion = version.value + def defaultSourceLinks(version: String = dottyNonBootstrappedVersion, refVersion: String = dottyVersion) = Def.task { def stdLibVersion = stdlibVersion(NonBootstrapped) - def scalaLib = findArtifactPath(externalCompilerClasspathTask.value, "scala-library") - def dottyLib = (`scala3-library` / Compile / classDirectory).value def srcManaged(v: String, s: String) = s"out/bootstrap/stdlib-bootstrapped/scala-$v/src_managed/main/$s-library-src" - - def defaultSourceLinks: SourceLinks = SourceLinks( + SourceLinks( List( - scalaSrcLink(stdLibVersion, srcManaged(dottyNonBootstrappedVersion, "scala") + "="), - dottySrcLink(referenceVersion, srcManaged(dottyNonBootstrappedVersion, "dotty") + "=", "#library/src"), - dottySrcLink(referenceVersion), + scalaSrcLink(stdLibVersion, srcManaged(version, "scala") + "="), + dottySrcLink(refVersion, srcManaged(version, "dotty") + "=", "#library/src"), + dottySrcLink(refVersion), "docs=github://lampepfl/dotty/main#docs" ) ) + } + + lazy val DefaultGenerationConfig = Def.task { + def distLocation = (dist / pack).value + def projectVersion = version.value def socialLinks = SocialLinks(List( "github::https://github.com/lampepfl/dotty", "discord::https://discord.com/invite/scala", @@ -1893,7 +1900,7 @@ object ScaladocConfigs { List(), ProjectVersion(projectVersion), GenerateInkuire(true), - defaultSourceLinks, + defaultSourceLinks().value, skipByRegex, skipById, projectLogo, @@ -1984,4 +1991,31 @@ object ScaladocConfigs { .add(ApiSubdirectory(true)) .withTargets(roots) } + + def stableScala3(version: String) = Def.task { + Scala3.value + .add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value) + .add(ProjectVersion(version)) + .add(SnippetCompiler( + List( + s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/quoted=compile", + s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/compiletime=compile" + ) + )) + .add(CommentSyntax(List( + s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src=markdown", + s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src=wiki", + "wiki" + ))) + .add(DocRootContent(s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src/rootdoc.txt")) + .withTargets( + Seq( + s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes", + s"tmp/interfaces/target/classes", + s"out/bootstrap/tasty-core-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes" + ) + ) + .remove[SiteRoot] + .remove[ApiSubdirectory] + } } diff --git a/project/resources/referenceReplacements/_layouts/static-site-main.html b/project/resources/referenceReplacements/_layouts/static-site-main.html index a9114aa455ac..f72bfdcd3b7b 100644 --- a/project/resources/referenceReplacements/_layouts/static-site-main.html +++ b/project/resources/referenceReplacements/_layouts/static-site-main.html @@ -2,59 +2,36 @@ layout: main --- -
- +
+ {{ content }} -