diff --git a/.github/workflows/lts-backport.yaml b/.github/workflows/lts-backport.yaml index ac9e3549bafa..376b8817b35e 100644 --- a/.github/workflows/lts-backport.yaml +++ b/.github/workflows/lts-backport.yaml @@ -16,7 +16,7 @@ jobs: with: fetch-depth: 0 - uses: coursier/cache-action@v6 - - uses: VirtusLab/scala-cli-setup@v1.8.1 + - uses: VirtusLab/scala-cli-setup@v1.8.4 - run: scala-cli ./project/scripts/addToBackportingProject.scala -- ${{ github.sha }} env: GRAPHQL_API_TOKEN: ${{ secrets.GRAPHQL_API_TOKEN }} diff --git a/.gitmodules b/.gitmodules index 8f87e992013a..6c3e826c4fa5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,9 +19,6 @@ [submodule "community-build/community-projects/fastparse"] path = community-build/community-projects/fastparse url = https://github.com/dotty-staging/fastparse -[submodule "community-build/community-projects/stdLib213"] - path = community-build/community-projects/stdLib213 - url = https://github.com/dotty-staging/scala213 [submodule "community-build/community-projects/sourcecode"] path = community-build/community-projects/sourcecode url = https://github.com/dotty-staging/sourcecode diff --git a/changelogs/3.7.2-RC1.md b/changelogs/3.7.2-RC1.md new file mode 100644 index 000000000000..7e1196e9e63b --- /dev/null +++ b/changelogs/3.7.2-RC1.md @@ -0,0 +1,156 @@ +# Highlights of the release + +- Implement applied constructor types [#22543](https://github.com/scala/scala3/pull/22543) +- Bump Scala CLI to v1.8.1 (was v1.8.0) [#23334](https://github.com/scala/scala3/pull/23334) + - Support for URLs in using file directives + - See full [Scala CLI changelog](https://github.com/VirtusLab/scala-cli/releases/tag/v1.8.1) + +# Other changes and fixes + +## Documentation + +- Mark `AnyRef::eq` and `AnyRef::ne` as infix instead of special casing when emitting the warning [#23252](https://github.com/scala/scala3/pull/23252) +- Mark `eq` and `ne` in Predef as `infix` [#23255](https://github.com/scala/scala3/pull/23255) + +## Experimental: Capture Checking + +- Allow caps in result types of functions to be mapped to reaches [#23275](https://github.com/scala/scala3/pull/23275) +- Adapt types according to read-only status [#23332](https://github.com/scala/scala3/pull/23332) +- Rename `mut` to `update` [#23335](https://github.com/scala/scala3/pull/23335) +- Change retains annotation from using term arguments to using type arguments [#22909](https://github.com/scala/scala3/pull/22909) +- New Syntax for Capture Variables and Explicit Capture Polymorphism v3 [#23063](https://github.com/scala/scala3/pull/23063) +- Fix #23223: Add handling for classes deriving from Capability during Setup [#23248](https://github.com/scala/scala3/pull/23248) +- Copy `@use` and `@consume` annotations to parameter types [#23324](https://github.com/scala/scala3/pull/23324) +- Fix handling of `@use` and `@consume` in class parameters [#23342](https://github.com/scala/scala3/pull/23342) +- Some usability improvements relating to errors [#23370](https://github.com/scala/scala3/pull/23370) +- Loosen the "does not match previously inferred" criterion [#23067](https://github.com/scala/scala3/pull/23067) +- Use level checking for Fresh instances [#23101](https://github.com/scala/scala3/pull/23101) +- Ensure all capture variables carry the attachment [#23162](https://github.com/scala/scala3/pull/23162) +- Cache ResultCaps [#23198](https://github.com/scala/scala3/pull/23198) +- Move separation checking to `-source:3.8` [#23249](https://github.com/scala/scala3/pull/23249) +- Refactorings for CC error reporting [#23260](https://github.com/scala/scala3/pull/23260) +- Standardize on log-based undo [#23357](https://github.com/scala/scala3/pull/23357) +- Flag nonsensical capturing types with pure parents as errors [#23367](https://github.com/scala/scala3/pull/23367) + +## Experimental: Erased Definitions + +- Erased fields are not nullable [#23311](https://github.com/scala/scala3/pull/23311) + +## Experimental: Explicit Nulls + +- Relax comparison between Null and reference types in explicit nulls [#23308](https://github.com/scala/scala3/pull/23308) +- Warn about unnecessary uses of .nn [#23327](https://github.com/scala/scala3/pull/23327) + +## Experimental: Global Initialization + +- Modified abstract domain in global initialization checker [#23138](https://github.com/scala/scala3/pull/23138) + +## Experimental: Into Modifier + +- Change `into` scheme to be fully type-based [#23014](https://github.com/scala/scala3/pull/23014) + +## Implicits + +- Try extensions for arguments with type mismatch error [#23212](https://github.com/scala/scala3/pull/23212) + +## Linting + +- Improve checking LHS of Assign [#22977](https://github.com/scala/scala3/pull/22977) +- Remove premature caching of lookups for unused lint [#22982](https://github.com/scala/scala3/pull/22982) +- Enclosing package p.q not visible as q [#23069](https://github.com/scala/scala3/pull/23069) +- Mention extension in unused param warning [#23132](https://github.com/scala/scala3/pull/23132) +- Improve Unit ascription escape hatch [#23147](https://github.com/scala/scala3/pull/23147) +- Dealias for unused param check [#23256](https://github.com/scala/scala3/pull/23256) +- Take inferred or explicit refinement result for unused check [#23325](https://github.com/scala/scala3/pull/23325) +- Nowarn receiver of extension taking params [#23351](https://github.com/scala/scala3/pull/23351) +- Improved edit span for import [#23083](https://github.com/scala/scala3/pull/23083) + +## Parser + +- Fix incorrect warning with -no-indent [#23216](https://github.com/scala/scala3/pull/23216) +- Patvar: adjust caret in error message [#23115](https://github.com/scala/scala3/pull/23115) +- Disallow empty parameter clauses in `extension` definition [#23143](https://github.com/scala/scala3/pull/23143) + +## Pattern Matching + +- Improve GADT reasoning for pattern alternatives [#23205](https://github.com/scala/scala3/pull/23205) + +## Pickling + +- Try to handle SkolemTypes in SingletonTypeTree during pickling [#23236](https://github.com/scala/scala3/pull/23236) +- Avoid creating constructors where not warranted [#23178](https://github.com/scala/scala3/pull/23178) + +## Presentation Compiler + +- Use untpd.Tree instead of tpd.Tree for SelectionRangeProvider [#22702](https://github.com/scala/scala3/pull/22702) +- Fix completion mode filtering + optimize scopeCompletions [#23172](https://github.com/scala/scala3/pull/23172) +- Handle multiple params lists in for infer type [#23197](https://github.com/scala/scala3/pull/23197) +- Add jpath to VirtualFile (for pc) [#23203](https://github.com/scala/scala3/pull/23203) +- Add selection ranges for more names [#23257](https://github.com/scala/scala3/pull/23257) +- Add inlay hints for by-name parameters [#23283](https://github.com/scala/scala3/pull/23283) +- Implement code action 'convert to named lambda parameters' [#22799](https://github.com/scala/scala3/pull/22799) +- Buffix: Make PC actions work for re-exported symbols [#22722](https://github.com/scala/scala3/pull/22722) +- Bugfix: Fix enumeration issues when Value is imported [#23124](https://github.com/scala/scala3/pull/23124) +- Bugfix: Check in the collector for empty arrays [#23341](https://github.com/scala/scala3/pull/23341) +- Bugfix: Don't check scope members if not needed [#23384](https://github.com/scala/scala3/pull/23384) +- Improvement: Don't dealias named tuples for type hints [#23013](https://github.com/scala/scala3/pull/23013) +- Improvement: Simplify match types when possible [#23146](https://github.com/scala/scala3/pull/23146) +- Improvement: Improve efficiency of completions [#23355](https://github.com/scala/scala3/pull/23355) +- Improvement: Cache compilation on . and don't add CURSOR [#23356](https://github.com/scala/scala3/pull/23356) + +## Private Options + +- Add an `-Yimplicit-to-given` flag for rewrites to easily test changes in the ecosystem [#22580](https://github.com/scala/scala3/pull/22580) +- Add `scala.language.2.13` [#23219](https://github.com/scala/scala3/pull/23219) + +## Rewrites + +- Remove empty parentheses when rewriting implicits to givens [#23339](https://github.com/scala/scala3/pull/23339) + +## Quotes + +- Preserve implicits in Quotes context [#23263](https://github.com/scala/scala3/pull/23263) +- Don't StackOverflow when printing RecursiveType structure. [#22859](https://github.com/scala/scala3/pull/22859) + +## Reflection + +- Forbid `StringConstant(null)` [#23064](https://github.com/scala/scala3/pull/23064) + +## Reporting + +- Fix incorrect warning on type ascription for backquoted identifiers [#23088](https://github.com/scala/scala3/pull/23088) +- Improve position of deprecation [#23052](https://github.com/scala/scala3/pull/23052) +- Have a better error message when context bounds are not allowed [#23190](https://github.com/scala/scala3/pull/23190) +- Avoid false warning when synthesising deferred givens [#23087](https://github.com/scala/scala3/pull/23087) +- Fix insufficient number width allocated when using `-print-lines` [#23336](https://github.com/scala/scala3/pull/23336) + +## SemanticDB + +- Fix SemantiDB production of method signature with shadowed parameters [#23161](https://github.com/scala/scala3/pull/23161) +- Check if symbol exists before calling methods on it [#23376](https://github.com/scala/scala3/pull/23376) + +## Settings + +- Filter allowed source versions by import and by settings [#23215](https://github.com/scala/scala3/pull/23215) + +## Tooling + +- Suggest to add using as a code action [#23079](https://github.com/scala/scala3/pull/23079) + +## Transform + +- Warn trivial recursion with module prefix [#23278](https://github.com/scala/scala3/pull/23278) +- Partial function synthesis changesOwner of selector [#23337](https://github.com/scala/scala3/pull/23337) + +## Typer + +- Compare TypeVar and TypeParamRef in mergeRefinedOrApplied [#23045](https://github.com/scala/scala3/pull/23045) +- Revert recent changes to opaque type proxy generation [#23059](https://github.com/scala/scala3/pull/23059) +- Only keep denotation for methods in IntegrateMap [#23226](https://github.com/scala/scala3/pull/23226) +- Tighten condition when to do SAM type conversion [#23246](https://github.com/scala/scala3/pull/23246) +- Revert "Make overload pruning based on result types less aggressive (#21744)" in main [#23331](https://github.com/scala/scala3/pull/23331) +- Tweak parameter dependency test when typing applications [#23346](https://github.com/scala/scala3/pull/23346) +- Ensure pt span exists in implicitParams migration [#23372](https://github.com/scala/scala3/pull/23372) +- Check for error before checking members of product type in getUnapplySelectors [#23358](https://github.com/scala/scala3/pull/23358) +- Synthesise value of `this.type` in `ValueOf` [#23094](https://github.com/scala/scala3/pull/23094) +- Hide constructor proxies at PostTyper [#23269](https://github.com/scala/scala3/pull/23269) diff --git a/changelogs/3.7.2-RC2.md b/changelogs/3.7.2-RC2.md new file mode 100644 index 000000000000..643d38e53784 --- /dev/null +++ b/changelogs/3.7.2-RC2.md @@ -0,0 +1,21 @@ +# Backported chnages + +- Backport "Bump Scala CLI to v1.8.4 (was v1.8.1)" to 3.7.2 [#23547](https://github.com/scala/scala3/pull/23547) +- Backport "Use result of lambda type of implicit in CheckUnused" to 3.7.2 [#23545](https://github.com/scala/scala3/pull/23545) +- Backport "Check path of module prefix for tailrec" to 3.7.2 [#23544](https://github.com/scala/scala3/pull/23544) +- Backport "Fix stale top level synthetic package object being used in later runs" to 3.7.2 [#23543](https://github.com/scala/scala3/pull/23543) +- Backport "Improve completions when a lot of exports are present" to 3.7.2 [#23542](https://github.com/scala/scala3/pull/23542) +- Backport "Fix regressions in asSeenFrom introduced in 3.7" [#23442](https://github.com/scala/scala3/pull/23442) + + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.7.2-RC1..3.7.2-RC2` these are: + +``` + 11 Wojciech Mazur + 1 Guillaume Martres + 1 Tomasz Godzik +``` diff --git a/changelogs/3.7.2.md b/changelogs/3.7.2.md new file mode 100644 index 000000000000..210751fbc788 --- /dev/null +++ b/changelogs/3.7.2.md @@ -0,0 +1,207 @@ +# Highlights of the release + +- Implement applied constructor types [#22543](https://github.com/scala/scala3/pull/22543) +- Bump Scala CLI to v1.8.4 (was v1.8.0) [#23538](https://github.com/scala/scala3/pull/23538) + - Support for URLs in using file directives + - Better support for the REPL with JDK 24+ + - experimental publish support for the Sonatype Central Portal + - See full [Scala CLI changelog](https://github.com/VirtusLab/scala-cli/releases/tag/v1.8.4) + +# Other changes and fixes + +## Documentation + +- Mark `AnyRef::eq` and `AnyRef::ne` as infix instead of special casing when emitting the warning [#23252](https://github.com/scala/scala3/pull/23252) +- Mark `eq` and `ne` in Predef as `infix` [#23255](https://github.com/scala/scala3/pull/23255) + +## Experimental: Capture Checking + +- Allow caps in result types of functions to be mapped to reaches [#23275](https://github.com/scala/scala3/pull/23275) +- Adapt types according to read-only status [#23332](https://github.com/scala/scala3/pull/23332) +- Rename `mut` to `update` [#23335](https://github.com/scala/scala3/pull/23335) +- Change retains annotation from using term arguments to using type arguments [#22909](https://github.com/scala/scala3/pull/22909) +- New Syntax for Capture Variables and Explicit Capture Polymorphism v3 [#23063](https://github.com/scala/scala3/pull/23063) +- Fix #23223: Add handling for classes deriving from Capability during Setup [#23248](https://github.com/scala/scala3/pull/23248) +- Copy `@use` and `@consume` annotations to parameter types [#23324](https://github.com/scala/scala3/pull/23324) +- Fix handling of `@use` and `@consume` in class parameters [#23342](https://github.com/scala/scala3/pull/23342) +- Some usability improvements relating to errors [#23370](https://github.com/scala/scala3/pull/23370) +- Loosen the "does not match previously inferred" criterion [#23067](https://github.com/scala/scala3/pull/23067) +- Use level checking for Fresh instances [#23101](https://github.com/scala/scala3/pull/23101) +- Ensure all capture variables carry the attachment [#23162](https://github.com/scala/scala3/pull/23162) +- Cache ResultCaps [#23198](https://github.com/scala/scala3/pull/23198) +- Move separation checking to `-source:3.8` [#23249](https://github.com/scala/scala3/pull/23249) +- Refactorings for CC error reporting [#23260](https://github.com/scala/scala3/pull/23260) +- Standardize on log-based undo [#23357](https://github.com/scala/scala3/pull/23357) +- Flag nonsensical capturing types with pure parents as errors [#23367](https://github.com/scala/scala3/pull/23367) + +## Experimental: Erased Definitions + +- Erased fields are not nullable [#23311](https://github.com/scala/scala3/pull/23311) + +## Experimental: Explicit Nulls + +- Relax comparison between Null and reference types in explicit nulls [#23308](https://github.com/scala/scala3/pull/23308) +- Warn about unnecessary uses of .nn [#23327](https://github.com/scala/scala3/pull/23327) + +## Experimental: Global Initialization + +- Modified abstract domain in global initialization checker [#23138](https://github.com/scala/scala3/pull/23138) + +## Experimental: Into Modifier + +- Change `into` scheme to be fully type-based [#23014](https://github.com/scala/scala3/pull/23014) + +## Implicits + +- Try extensions for arguments with type mismatch error [#23212](https://github.com/scala/scala3/pull/23212) + +## Linting + +- Improve checking LHS of Assign [#22977](https://github.com/scala/scala3/pull/22977) +- Remove premature caching of lookups for unused lint [#22982](https://github.com/scala/scala3/pull/22982) +- Enclosing package p.q not visible as q [#23069](https://github.com/scala/scala3/pull/23069) +- Mention extension in unused param warning [#23132](https://github.com/scala/scala3/pull/23132) +- Improve Unit ascription escape hatch [#23147](https://github.com/scala/scala3/pull/23147) +- Dealias for unused param check [#23256](https://github.com/scala/scala3/pull/23256) +- Take inferred or explicit refinement result for unused check [#23325](https://github.com/scala/scala3/pull/23325) +- Nowarn receiver of extension taking params [#23351](https://github.com/scala/scala3/pull/23351) +- Improved edit span for import [#23083](https://github.com/scala/scala3/pull/23083) +- Use result of lambda type of implicit in CheckUnused [#23497](https://github.com/scala/scala3/pull/23497) + +## Parser + +- Fix incorrect warning with -no-indent [#23216](https://github.com/scala/scala3/pull/23216) +- Patvar: adjust caret in error message [#23115](https://github.com/scala/scala3/pull/23115) +- Disallow empty parameter clauses in `extension` definition [#23143](https://github.com/scala/scala3/pull/23143) + +## Pattern Matching + +- Improve GADT reasoning for pattern alternatives [#23205](https://github.com/scala/scala3/pull/23205) + +## Pickling + +- Try to handle SkolemTypes in SingletonTypeTree during pickling [#23236](https://github.com/scala/scala3/pull/23236) +- Avoid creating constructors where not warranted [#23178](https://github.com/scala/scala3/pull/23178) + +## Presentation Compiler + +- Use untpd.Tree instead of tpd.Tree for SelectionRangeProvider [#22702](https://github.com/scala/scala3/pull/22702) +- Fix completion mode filtering + optimize scopeCompletions [#23172](https://github.com/scala/scala3/pull/23172) +- Handle multiple params lists in for infer type [#23197](https://github.com/scala/scala3/pull/23197) +- Add jpath to VirtualFile (for pc) [#23203](https://github.com/scala/scala3/pull/23203) +- Add selection ranges for more names [#23257](https://github.com/scala/scala3/pull/23257) +- Add inlay hints for by-name parameters [#23283](https://github.com/scala/scala3/pull/23283) +- Implement code action 'convert to named lambda parameters' [#22799](https://github.com/scala/scala3/pull/22799) +- Improve completions when a lot of exports are present [#23414](https://github.com/scala/scala3/pull/23414) +- Buffix: Make PC actions work for re-exported symbols [#22722](https://github.com/scala/scala3/pull/22722) +- Bugfix: Fix enumeration issues when Value is imported [#23124](https://github.com/scala/scala3/pull/23124) +- Bugfix: Check in the collector for empty arrays [#23341](https://github.com/scala/scala3/pull/23341) +- Bugfix: Don't check scope members if not needed [#23384](https://github.com/scala/scala3/pull/23384) +- Improvement: Don't dealias named tuples for type hints [#23013](https://github.com/scala/scala3/pull/23013) +- Improvement: Simplify match types when possible [#23146](https://github.com/scala/scala3/pull/23146) +- Improvement: Improve efficiency of completions [#23355](https://github.com/scala/scala3/pull/23355) +- Improvement: Cache compilation on . and don't add CURSOR [#23356](https://github.com/scala/scala3/pull/23356) + +## Private Options + +- Add an `-Yimplicit-to-given` flag for rewrites to easily test changes in the ecosystem [#22580](https://github.com/scala/scala3/pull/22580) +- Add `scala.language.2.13` [#23219](https://github.com/scala/scala3/pull/23219) + +## Rewrites + +- Remove empty parentheses when rewriting implicits to givens [#23339](https://github.com/scala/scala3/pull/23339) + +## Quotes + +- Preserve implicits in Quotes context [#23263](https://github.com/scala/scala3/pull/23263) +- Don't StackOverflow when printing RecursiveType structure. [#22859](https://github.com/scala/scala3/pull/22859) + +## Reflection + +- Forbid `StringConstant(null)` [#23064](https://github.com/scala/scala3/pull/23064) + +## Reporting + +- Fix incorrect warning on type ascription for backquoted identifiers [#23088](https://github.com/scala/scala3/pull/23088) +- Improve position of deprecation [#23052](https://github.com/scala/scala3/pull/23052) +- Have a better error message when context bounds are not allowed [#23190](https://github.com/scala/scala3/pull/23190) +- Avoid false warning when synthesising deferred givens [#23087](https://github.com/scala/scala3/pull/23087) +- Fix insufficient number width allocated when using `-print-lines` [#23336](https://github.com/scala/scala3/pull/23336) + +## SemanticDB + +- Fix SemantiDB production of method signature with shadowed parameters [#23161](https://github.com/scala/scala3/pull/23161) +- Check if symbol exists before calling methods on it [#23376](https://github.com/scala/scala3/pull/23376) + +## Settings + +- Filter allowed source versions by import and by settings [#23215](https://github.com/scala/scala3/pull/23215) + +## Tooling + +- Suggest to add using as a code action [#23079](https://github.com/scala/scala3/pull/23079) + +## Transform + +- Warn trivial recursion with module prefix [#23278](https://github.com/scala/scala3/pull/23278) +- Partial function synthesis changesOwner of selector [#23337](https://github.com/scala/scala3/pull/23337) +- Check path of module prefix for tailrec [#23491](https://github.com/scala/scala3/pull/23491) +- Fix stale top level synthetic package object being used in later runs [#23464](https://github.com/scala/scala3/pull/23464) + +## Typer + +- Compare TypeVar and TypeParamRef in mergeRefinedOrApplied [#23045](https://github.com/scala/scala3/pull/23045) +- Revert recent changes to opaque type proxy generation [#23059](https://github.com/scala/scala3/pull/23059) +- Only keep denotation for methods in IntegrateMap [#23226](https://github.com/scala/scala3/pull/23226) +- Tighten condition when to do SAM type conversion [#23246](https://github.com/scala/scala3/pull/23246) +- Revert "Make overload pruning based on result types less aggressive (#21744)" in main [#23331](https://github.com/scala/scala3/pull/23331) +- Tweak parameter dependency test when typing applications [#23346](https://github.com/scala/scala3/pull/23346) +- Ensure pt span exists in implicitParams migration [#23372](https://github.com/scala/scala3/pull/23372) +- Check for error before checking members of product type in getUnapplySelectors [#23358](https://github.com/scala/scala3/pull/23358) +- Synthesise value of `this.type` in `ValueOf` [#23094](https://github.com/scala/scala3/pull/23094) +- Hide constructor proxies at PostTyper [#23269](https://github.com/scala/scala3/pull/23269) +- Fix regressions in asSeenFrom introduced in 3.7 [#23438](https://github.com/scala/scala3/pull/23438) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.7.1..3.7.2` these are: + +``` + 93 Martin Odersky + 29 Wojciech Mazur + 22 Som Snytt + 22 noti0na1 + 14 Tomasz Godzik + 13 Hamza Remmal + 13 Yichen Xu + 6 EnzeXing + 5 Jan Chyb + 5 Matt Bovel + 3 Oliver Bračevac + 3 aherlihy + 3 kasiaMarek + 2 Alexander + 2 Dale Wijnand + 2 Dolphin von Chips + 2 Georgi Krastev + 2 Jędrzej Rochala + 2 Kacper Korban + 2 Natsu Kagami + 2 Ondrej Lhotak + 2 Piotr Chabelski + 2 Seyon Sivatharan + 2 Yoonjae Jeon + 2 Zieliński Patryk + 1 Guillaume Martres + 1 Jakub Kozłowski + 1 Katarzyna Marek + 1 MatthieuSLR9 + 1 Ondřej Lhoták + 1 Tomas Mikula + 1 anna herlihy + 1 dependabot[bot] + 1 rochala + 1 s2sivath +``` diff --git a/community-build/community-projects/stdLib213 b/community-build/community-projects/stdLib213 deleted file mode 160000 index 3f6bdaeafde1..000000000000 --- a/community-build/community-projects/stdLib213 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3f6bdaeafde17d790023cc3f299b81eaaf876ca3 diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 699164240015..865fc7a1e442 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -397,6 +397,7 @@ private sealed trait YSettings: val Ylog: Setting[List[String]] = PhasesSetting(ForkSetting, "Ylog", "Log operations during") val YlogClasspath: Setting[Boolean] = BooleanSetting(ForkSetting, "Ylog-classpath", "Output information about what classpath is being applied.") val YdisableFlatCpCaching: Setting[Boolean] = BooleanSetting(ForkSetting, "YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.") + val YnoStdlibPatches: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-stdlib-patches", "Do not patch stdlib files (temporary and only to be used for the stdlib migration)", false) val Yscala2Unpickler: Setting[String] = StringSetting(ForkSetting, "Yscala2-unpickler", "", "Control where we may get Scala 2 symbols from. This is either \"always\", \"never\", or a classpath.", "always") diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 381caa775dbd..d8433de44cb5 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -1468,6 +1468,11 @@ class Definitions { * is read from a classfile. */ def patchStdLibClass(denot: ClassDenotation)(using Context): Unit = + // Do not patch the stdlib files if we explicitly disable it + // This is only to be used during the migration of the stdlib + if ctx.settings.YnoStdlibPatches.value then + return + def patch2(denot: ClassDenotation, patchCls: Symbol): Unit = val scope = denot.info.decls.openForMutations diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index bd43578e3d53..c39db64b77cf 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -2720,7 +2720,7 @@ object SymDenotations { || owner.isRefinementClass || owner.is(Scala2x) || owner.unforcedDecls.contains(denot.name, denot.symbol) - || (denot.is(Synthetic) && denot.is(ModuleClass) && stillValidInOwner(denot.companionClass)) + || (denot.is(Synthetic) && denot.is(ModuleClass) && denot.companionClass.exists && stillValidInOwner(denot.companionClass)) || denot.isSelfSym || denot.isLocalDummy) catch case ex: StaleSymbol => false diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala index 4909602915d3..cf03273b4805 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala @@ -125,7 +125,9 @@ object TypeOps: } def isLegalPrefix(pre: Type)(using Context): Boolean = - pre.isStable + // isLegalPrefix is relaxed after typer unless we're doing an implicit + // search (this matters when doing summonInline in an inline def like in tests/pos/i17222.8.scala). + pre.isStable || !ctx.phase.isTyper && ctx.mode.is(Mode.ImplicitsEnabled) /** Implementation of Types#simplified */ def simplify(tp: Type, theMap: SimplifyMap | Null)(using Context): Type = { diff --git a/compiler/src/dotty/tools/dotc/interactive/Completion.scala b/compiler/src/dotty/tools/dotc/interactive/Completion.scala index de9fcb8f6cb4..dc683aabe1e6 100644 --- a/compiler/src/dotty/tools/dotc/interactive/Completion.scala +++ b/compiler/src/dotty/tools/dotc/interactive/Completion.scala @@ -324,15 +324,15 @@ object Completion: * 8. symbol is not a constructor proxy module when in type completion mode * 9. have same term/type kind as name prefix given so far */ - def isValidCompletionSymbol(sym: Symbol, completionMode: Mode, isNew: Boolean)(using Context): Boolean = - + def isValidCompletionSymbol(sym: Symbol, completionMode: Mode, isNew: Boolean)(using Context): Boolean = try lazy val isEnum = sym.is(Enum) || (sym.companionClass.exists && sym.companionClass.is(Enum)) sym.exists && !sym.isAbsent(canForce = false) && !sym.isPrimaryConstructor && - sym.sourceSymbol.exists && + // running sourceSymbol on ExportedTerm will force a lot of computation from collectSubTrees + (sym.is(ExportedTerm) || sym.sourceSymbol.exists) && (!sym.is(Package) || sym.is(ModuleClass)) && !sym.isAllOf(Mutable | Accessor) && !sym.isPackageObject && @@ -343,6 +343,9 @@ object Completion: (completionMode.is(Mode.Term) && (sym.isTerm || sym.is(ModuleClass)) || (completionMode.is(Mode.Type) && (sym.isType || sym.isStableMember))) ) + catch + case NonFatal(ex) => + false end isValidCompletionSymbol given ScopeOrdering(using Context): Ordering[Seq[SingleDenotation]] with diff --git a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala index b452f558f969..f23c762ed6f3 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala @@ -924,7 +924,7 @@ object CheckUnused: def isCanEqual: Boolean = sym.isOneOf(GivenOrImplicit) && sym.info.finalResultType.baseClasses.exists(_.derivesFrom(defn.CanEqualClass)) def isMarkerTrait: Boolean = - sym.info.hiBound.allMembers.forall: d => + sym.info.hiBound.resultType.allMembers.forall: d => val m = d.symbol !m.isTerm || m.isSelfSym || m.is(Method) && (m.owner == defn.AnyClass || m.owner == defn.ObjectClass) def isEffectivelyPrivate: Boolean = diff --git a/compiler/src/dotty/tools/dotc/transform/TailRec.scala b/compiler/src/dotty/tools/dotc/transform/TailRec.scala index 472ed78bfb6b..08c2c6a015c0 100644 --- a/compiler/src/dotty/tools/dotc/transform/TailRec.scala +++ b/compiler/src/dotty/tools/dotc/transform/TailRec.scala @@ -346,7 +346,10 @@ class TailRec extends MiniPhase { case prefix: This if prefix.symbol == enclosingClass => // Avoid assigning `this = this` assignParamPairs - case prefix if prefix.symbol.is(Module) && prefix.symbol.moduleClass == enclosingClass => + case prefix + if prefix.symbol.is(Module) + && prefix.symbol.moduleClass == enclosingClass + && isPurePath(prefix) => // Avoid assigning `this = MyObject` assignParamPairs case _ => diff --git a/docs/sidebar.yml b/docs/sidebar.yml index f0ca5433d649..e49bddfd2e7d 100644 --- a/docs/sidebar.yml +++ b/docs/sidebar.yml @@ -172,6 +172,7 @@ subsection: - page: reference/experimental/runtimeChecked.md - page: reference/experimental/unrolled-defs.md - page: reference/experimental/package-object-values.md + - page: reference/experimental/quoted-patterns-with-polymorphic-functions.md - page: reference/syntax.md - title: Language Versions index: reference/language-versions/language-versions.md diff --git a/project/Build.scala b/project/Build.scala index 88b6f051cf88..ea40b9e4a48c 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -122,7 +122,7 @@ object Build { * During release candidate cycle incremented by the release officer before publishing a subsequent RC version; * During final, stable release is set exactly to `developedVersion`. */ - val baseVersion = s"$developedVersion-RC1" + val baseVersion = developedVersion /** The version of TASTY that should be emitted, checked in runtime test * For defails on how TASTY version should be set see related discussions: @@ -140,7 +140,7 @@ object Build { * - in release candidate branch is experimental if {patch == 0} * - in stable release is always non-experimetnal */ - val expectedTastyVersion = "28.8-experimental-1" + val expectedTastyVersion = "28.7" checkReleasedTastyVersion() /** Final version of Scala compiler, controlled by environment variables. */ @@ -187,7 +187,7 @@ object Build { val mimaPreviousLTSDottyVersion = "3.3.0" /** Version of Scala CLI to download */ - val scalaCliLauncherVersion = "1.8.1" + val scalaCliLauncherVersion = "1.8.4" /** Version of Coursier to download for initializing the local maven repo of Scala command */ val coursierJarVersion = "2.1.24" diff --git a/project/resources/referenceReplacements/sidebar.yml b/project/resources/referenceReplacements/sidebar.yml index 4e40642858c9..ee4c2e3b0efd 100644 --- a/project/resources/referenceReplacements/sidebar.yml +++ b/project/resources/referenceReplacements/sidebar.yml @@ -28,12 +28,13 @@ subsection: directory: contextual subsection: - page: reference/contextual/givens.md - - page: reference/contextual/deferred-givens.md - - page: reference/contextual/more-givens.md - - page: reference/contextual/previous-givens.md - page: reference/contextual/using-clauses.md - page: reference/contextual/context-bounds.md + - page: reference/contextual/deferred-givens.md - page: reference/contextual/given-imports.md + - page: reference/contextual/more-givens.md + - page: reference/contextual/previous-givens.md + hidden: true - page: reference/contextual/extension-methods.md - page: reference/contextual/right-associative-extension-methods.md - page: reference/contextual/type-classes.md @@ -54,10 +55,10 @@ subsection: - page: reference/metaprogramming/macros.md - page: reference/metaprogramming/macros-spec.md hidden: true + - page: reference/metaprogramming/simple-smp.md # description of a simplified metaprogramming language, this might not be the best place for it - page: reference/metaprogramming/staging.md - page: reference/metaprogramming/reflection.md - page: reference/metaprogramming/tasty-inspect.md - - page: reference/metaprogramming/simple-smp.md - title: Other New Features index: reference/other-new-features/other-new-features.md subsection: @@ -67,6 +68,7 @@ subsection: - page: reference/other-new-features/export.md - page: reference/other-new-features/opaques.md - page: reference/other-new-features/opaques-details.md + - page: reference/other-new-features/named-tuples.md - page: reference/other-new-features/open-classes.md - page: reference/other-new-features/parameter-untupling.md - page: reference/other-new-features/parameter-untupling-spec.md @@ -80,7 +82,9 @@ subsection: - page: reference/other-new-features/safe-initialization.md - page: reference/other-new-features/type-test.md - page: reference/other-new-features/experimental-defs.md + - page: reference/other-new-features/preview-defs.md - page: reference/other-new-features/binary-literals.md + - page: reference/other-new-features/toplevel-definitions.md - title: Other Changed Features directory: changed-features index: reference/changed-features/changed-features.md @@ -118,7 +122,6 @@ subsection: - page: reference/dropped-features/type-projection.md - page: reference/dropped-features/do-while.md - page: reference/dropped-features/procedure-syntax.md - - page: reference/dropped-features/package-objects.md - page: reference/dropped-features/early-initializers.md - page: reference/dropped-features/class-shadowing.md - page: reference/dropped-features/class-shadowing-spec.md @@ -133,6 +136,11 @@ subsection: - page: reference/dropped-features/nonlocal-returns.md - page: reference/dropped-features/this-qualifier.md - page: reference/dropped-features/wildcard-init.md + - title: Preview Features + directory: preview + index: reference/preview/overview.md + subsection: + - page: reference/preview/better-fors.md - title: Experimental Features directory: experimental index: reference/experimental/overview.md @@ -149,10 +157,18 @@ subsection: - page: reference/experimental/numeric-literals.md - page: reference/experimental/explicit-nulls.md - page: reference/experimental/main-annotation.md + - page: reference/experimental/into.md - page: reference/experimental/cc.md - page: reference/experimental/cc-advanced.md hidden: true + - page: reference/experimental/purefuns.md - page: reference/experimental/tupled-function.md + - page: reference/experimental/modularity.md + - page: reference/experimental/typeclasses.md + - page: reference/experimental/runtimeChecked.md + - page: reference/experimental/unrolled-defs.md + - page: reference/experimental/package-object-values.md + - page: reference/experimental/quoted-patterns-with-polymorphic-functions.md - page: reference/syntax.md - title: Language Versions index: reference/language-versions/language-versions.md diff --git a/project/scripts/expected-links/reference-expected-links.txt b/project/scripts/expected-links/reference-expected-links.txt index 3eb5df97bf14..90f78e0ddbdc 100644 --- a/project/scripts/expected-links/reference-expected-links.txt +++ b/project/scripts/expected-links/reference-expected-links.txt @@ -41,6 +41,8 @@ ./contextual/right-associative-extension-methods.html ./contextual/type-classes.html ./contextual/using-clauses.html +./docs/reference/experimental/package-object-values.html +./docs/reference/other-new-features/into.html ./docs/reference/other-new-features/named-typeargs.html ./dropped-features.html ./dropped-features/auto-apply.html @@ -54,7 +56,6 @@ ./dropped-features/limit22.html ./dropped-features/macros.html ./dropped-features/nonlocal-returns.html -./dropped-features/package-objects.html ./dropped-features/procedure-syntax.html ./dropped-features/symlits.html ./dropped-features/this-qualifier.html @@ -75,12 +76,20 @@ ./experimental/explicit-nulls.html ./experimental/fewer-braces.html ./experimental/index.html +./experimental/into.html ./experimental/main-annotation.html +./experimental/modularity.html ./experimental/named-typeargs-spec.html ./experimental/named-typeargs.html ./experimental/numeric-literals.html ./experimental/overview.html +./experimental/package-object-values.html +./experimental/purefuns.html +./experimental/quoted-patterns-with-polymorphic-functions.html +./experimental/runtimeChecked.html ./experimental/tupled-function.html +./experimental/typeclasses.html +./experimental/unrolled-defs.html ./features-classification.html ./index.html ./language-versions/binary-compatibility.html @@ -117,17 +126,23 @@ ./other-new-features/index.html ./other-new-features/kind-polymorphism.html ./other-new-features/matchable.html +./other-new-features/named-tuples.html ./other-new-features/opaques-details.html ./other-new-features/opaques.html ./other-new-features/open-classes.html ./other-new-features/parameter-untupling-spec.html ./other-new-features/parameter-untupling.html +./other-new-features/preview-defs.html ./other-new-features/safe-initialization.html ./other-new-features/targetName.html ./other-new-features/threadUnsafe-annotation.html +./other-new-features/toplevel-definitions.html ./other-new-features/trait-parameters.html ./other-new-features/transparent-traits.html ./other-new-features/type-test.html ./overview.html +./preview/better-fors.html +./preview/index.html +./preview/overview.html ./soft-modifier.html ./syntax.html diff --git a/tasty/src/dotty/tools/tasty/TastyFormat.scala b/tasty/src/dotty/tools/tasty/TastyFormat.scala index 37e3a3acfdab..4c1453243450 100644 --- a/tasty/src/dotty/tools/tasty/TastyFormat.scala +++ b/tasty/src/dotty/tools/tasty/TastyFormat.scala @@ -324,7 +324,7 @@ object TastyFormat { * compatibility, but remains backwards compatible, with all * preceding `MinorVersion`. */ - final val MinorVersion: Int = 8 + final val MinorVersion: Int = 7 /** Natural Number. The `ExperimentalVersion` allows for * experimentation with changes to TASTy without committing @@ -340,7 +340,7 @@ object TastyFormat { * is able to read final TASTy documents if the file's * `MinorVersion` is strictly less than the current value. */ - final val ExperimentalVersion: Int = 1 + final val ExperimentalVersion: Int = 0 /**This method implements a binary relation (`<:<`) between two TASTy versions. * diff --git a/tests/neg-custom-args/captures/lazylist.check b/tests/neg-custom-args/captures/lazylist.check index 455d72e9fd37..0959f1a082fb 100644 --- a/tests/neg-custom-args/captures/lazylist.check +++ b/tests/neg-custom-args/captures/lazylist.check @@ -29,7 +29,7 @@ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazylist.scala:41:42 ------------------------------------- 41 | val ref4c: LazyList[Int]^{cap1, ref3} = ref4 // error | ^^^^ - | Found: (ref4 : lazylists.LazyList[Int]^{cap3, ref1, ref2}) + | Found: (ref4 : lazylists.LazyList[Int]^{cap3, cap1, cap2}) | Required: lazylists.LazyList[Int]^{cap1, ref3} | | longer explanation available when compiling with `-explain` diff --git a/tests/neg/6314-6.check b/tests/neg/6314-6.check index df988f1db9dd..7d6bd182173d 100644 --- a/tests/neg/6314-6.check +++ b/tests/neg/6314-6.check @@ -4,7 +4,7 @@ |object creation impossible, since def apply(fa: String): Int in trait XX in object Test3 is not defined |(Note that | parameter String in def apply(fa: String): Int in trait XX in object Test3 does not match - | parameter Test3.Bar[X & (X & Y)] in def apply(fa: Test3.Bar[X & YY.this.Foo]): Test3.Bar[Y & YY.this.Foo] in trait YY in object Test3 + | parameter Test3.Bar[X & Object with Test3.YY {...}#Foo] in def apply(fa: Test3.Bar[X & YY.this.Foo]): Test3.Bar[Y & YY.this.Foo] in trait YY in object Test3 | ) -- Error: tests/neg/6314-6.scala:52:3 ---------------------------------------------------------------------------------- 52 | (new YY {}).boom // error: object creation impossible @@ -12,5 +12,5 @@ |object creation impossible, since def apply(fa: String): Int in trait XX in object Test4 is not defined |(Note that | parameter String in def apply(fa: String): Int in trait XX in object Test4 does not match - | parameter Test4.Bar[X & (X & Y)] in def apply(fa: Test4.Bar[X & YY.this.FooAlias]): Test4.Bar[Y & YY.this.FooAlias] in trait YY in object Test4 + | parameter Test4.Bar[X & Object with Test4.YY {...}#FooAlias] in def apply(fa: Test4.Bar[X & YY.this.FooAlias]): Test4.Bar[Y & YY.this.FooAlias] in trait YY in object Test4 | ) diff --git a/tests/neg/i19351.check b/tests/neg/i19351.check deleted file mode 100644 index a9ee10510b32..000000000000 --- a/tests/neg/i19351.check +++ /dev/null @@ -1,4 +0,0 @@ --- Error: tests/neg/i19351/A.scala:3:35 -------------------------------------------------------------------------------- -3 | inline def myMacro(): x.type = ${myMacroExpr} // error - | ^ - |Cyclic macro dependency; macro refers to a toplevel symbol in tests/neg/i19351/A.scala from which the macro is called diff --git a/tests/neg/i19351/A.scala b/tests/neg/i19351/A.scala deleted file mode 100644 index f2258631a15a..000000000000 --- a/tests/neg/i19351/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -//object A: - val x: Int = 1 - inline def myMacro(): x.type = ${myMacroExpr} // error - def test = myMacro() - diff --git a/tests/neg/i19351a.check b/tests/neg/i19351a.check deleted file mode 100644 index 10789c2db5aa..000000000000 --- a/tests/neg/i19351a.check +++ /dev/null @@ -1,4 +0,0 @@ --- Error: tests/neg/i19351a/Test.scala:8:34 ---------------------------------------------------------------------------- -8 |inline def not(b: Bool): Bool = ${notMacro('b)} // error - | ^ - |Cyclic macro dependency; macro refers to a toplevel symbol in tests/neg/i19351a/Test.scala from which the macro is called diff --git a/tests/neg/no-patches.check b/tests/neg/no-patches.check new file mode 100644 index 000000000000..69428b83905d --- /dev/null +++ b/tests/neg/no-patches.check @@ -0,0 +1,12 @@ +-- [E008] Not Found Error: tests/neg/no-patches.scala:3:23 ------------------------------------------------------------- +3 |val _ = scala.language.`3.4` // error: we do not patch `scala.language` + | ^^^^^^^^^^^^^^^^^^^^ + | value 3.4 is not a member of object language +-- [E008] Not Found Error: tests/neg/no-patches.scala:4:36 ------------------------------------------------------------- +4 |val _ = scala.language.experimental.captureChecking // error: we do not patch `scala.language.experimental` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | value captureChecking is not a member of object language.experimental +-- [E008] Not Found Error: tests/neg/no-patches.scala:5:15 ------------------------------------------------------------- +5 |val _ = Predef.summon[DummyImplicit] // error: we do not patch `scala.Predef` + | ^^^^^^^^^^^^^ + | value summon is not a member of object Predef diff --git a/tests/neg/no-patches.scala b/tests/neg/no-patches.scala new file mode 100644 index 000000000000..9e36d0a84d88 --- /dev/null +++ b/tests/neg/no-patches.scala @@ -0,0 +1,5 @@ +//> using options -Yno-stdlib-patches + +val _ = scala.language.`3.4` // error: we do not patch `scala.language` +val _ = scala.language.experimental.captureChecking // error: we do not patch `scala.language.experimental` +val _ = Predef.summon[DummyImplicit] // error: we do not patch `scala.Predef` diff --git a/tests/pos-macros/i13821-a/Macro.scala b/tests/pos-macros/i13821-a/Macro.scala new file mode 100644 index 000000000000..3583a44ffddc --- /dev/null +++ b/tests/pos-macros/i13821-a/Macro.scala @@ -0,0 +1,6 @@ +trait Conversions: + given conv(using DFBits.Candidate): Conversion[Int, DFVal] = ??? + +import scala.quoted.* +transparent inline def f: Short = ${ getWidthMacro } +private def getWidthMacro(using Quotes): Expr[Short] = '{ ??? } diff --git a/tests/pos-macros/i13821-a/Test.scala b/tests/pos-macros/i13821-a/Test.scala new file mode 100644 index 000000000000..86f5a6289a80 --- /dev/null +++ b/tests/pos-macros/i13821-a/Test.scala @@ -0,0 +1,12 @@ +type DFBits = Long +object DFBits: + def a: Unit = f // forces suspension of this compilation unit in typer + def b: DFVal = 2 // uses implicit conversion `DFVal.conv` + + trait Candidate + object Candidate: + given candidate: Candidate = ??? // completed in run 3 but created in run 2 +end DFBits + +trait DFVal +object DFVal extends Conversions diff --git a/tests/pos-macros/i13821-b/Macro.scala b/tests/pos-macros/i13821-b/Macro.scala new file mode 100644 index 000000000000..c1c9c5e17851 --- /dev/null +++ b/tests/pos-macros/i13821-b/Macro.scala @@ -0,0 +1,7 @@ +import outer._ +trait Conversions: + given conv(using DFBits.Candidate): Conversion[Int, DFVal] = ??? + +import scala.quoted.* +transparent inline def f: Short = ${ getWidthMacro } +private def getWidthMacro(using Quotes): Expr[Short] = '{ ??? } diff --git a/tests/pos-macros/i13821-b/Test.scala b/tests/pos-macros/i13821-b/Test.scala new file mode 100644 index 000000000000..5c9b8755a33c --- /dev/null +++ b/tests/pos-macros/i13821-b/Test.scala @@ -0,0 +1,14 @@ +type outer = Int +object outer: + type DFBits = Long + object DFBits: + def a: Unit = f // forces suspension of this compilation unit in typer + def b: DFVal = 2 // uses implicit conversion `DFVal.conv` + + trait Candidate + object Candidate: + given candidate: Candidate = ??? // completed in run 3 but created in run 2 + end DFBits + + trait DFVal + object DFVal extends Conversions diff --git a/tests/pos-macros/i19351/A.scala b/tests/pos-macros/i19351/A.scala new file mode 100644 index 000000000000..0b2c7acc3797 --- /dev/null +++ b/tests/pos-macros/i19351/A.scala @@ -0,0 +1,6 @@ +// object A: + val x: Int = 1 + inline def myMacro(): x.type = ${myMacroExpr} + def test = myMacro() + +@main def main() = () \ No newline at end of file diff --git a/tests/neg/i19351/B.scala b/tests/pos-macros/i19351/B.scala similarity index 84% rename from tests/neg/i19351/B.scala rename to tests/pos-macros/i19351/B.scala index 8c8c071f3607..a22b4d5c51b6 100644 --- a/tests/neg/i19351/B.scala +++ b/tests/pos-macros/i19351/B.scala @@ -1,3 +1,3 @@ import scala.quoted.* -//import A.* +// import A.* def myMacroExpr(using Quotes): Expr[x.type] = '{???} \ No newline at end of file diff --git a/tests/neg/i19351a/Macro.scala b/tests/pos-macros/i19351a/Macro.scala similarity index 100% rename from tests/neg/i19351a/Macro.scala rename to tests/pos-macros/i19351a/Macro.scala diff --git a/tests/neg/i19351a/Test.scala b/tests/pos-macros/i19351a/Test.scala similarity index 87% rename from tests/neg/i19351a/Test.scala rename to tests/pos-macros/i19351a/Test.scala index 84fb6ca4ae78..7f9e6dbc9786 100644 --- a/tests/neg/i19351a/Test.scala +++ b/tests/pos-macros/i19351a/Test.scala @@ -5,7 +5,7 @@ type Bool = [R] => (R, R) => R val True: Bool = [R] => (t: R, _: R) => t val False: Bool = [R] => (_: R, f: R) => f -inline def not(b: Bool): Bool = ${notMacro('b)} // error +inline def not(b: Bool): Bool = ${notMacro('b)} inline def show(b: Bool): String = ${showMacro('b)} //inline def not(b: Bool): Bool = ${foldMacro('b, 'False, 'True)} //inline def show(b: Bool): String = ${foldMacro('b, '{"TRUE"}, '{"FALSE"})} diff --git a/tests/pos-macros/i23423/A_1.scala b/tests/pos-macros/i23423/A_1.scala new file mode 100644 index 000000000000..62455c74eed0 --- /dev/null +++ b/tests/pos-macros/i23423/A_1.scala @@ -0,0 +1,16 @@ +package pkg + +import scala.quoted.* + +trait HasElem { + type Elem + type Alias = Elem +} + +object Macro: + inline def foo: Unit = ${fooImpl} + def fooImpl(using Quotes): Expr[Unit] = + '{ + val lll: (he: HasElem) => he.Alias = + (hx: HasElem) => ??? + } diff --git a/tests/pos-macros/i23423/B_2.scala b/tests/pos-macros/i23423/B_2.scala new file mode 100644 index 000000000000..144eaf4ce1da --- /dev/null +++ b/tests/pos-macros/i23423/B_2.scala @@ -0,0 +1,6 @@ +object Test: + def test: Unit = pkg.Macro.foo + // used to be error: + // Found: (hx: pkg.HasElem) => hx.Elem + // Required: (he: pkg.HasElem) => he.Elem + diff --git a/tests/pos/i22676.scala b/tests/pos/i22676.scala new file mode 100644 index 000000000000..5654559b133f --- /dev/null +++ b/tests/pos/i22676.scala @@ -0,0 +1,11 @@ +package example + +trait Example { + class Input + + type Output[A] = A match { + case Input => Int + } +} + +class Ref(ref: Example#Input) diff --git a/tests/run/i23444.scala b/tests/run/i23444.scala new file mode 100644 index 000000000000..ada7545e077f --- /dev/null +++ b/tests/run/i23444.scala @@ -0,0 +1,22 @@ + +import annotation.* + +class Path(action: () => Unit, parent: Option[Path]): + object O: + @tailrec + def apply(): Unit = + action() + + parent match + case Some(p) => + p.O.apply() + case None => + +@main def Test: Unit = + var counter = 0 + val fun = () => { + counter += 1 + if counter > 2 then throw AssertionError("bad loop") + } + val path = Path(fun, Some(Path(fun, None))) + path.O() diff --git a/tests/warn/i15503f.scala b/tests/warn/i15503f.scala index c2eef8a529c5..70d0b9182eb2 100644 --- a/tests/warn/i15503f.scala +++ b/tests/warn/i15503f.scala @@ -1,4 +1,4 @@ -//> using options -Wunused:implicits +//> using options -Wunused:implicits /* This goes around the "trivial method" detection */ val default_int = 1 @@ -67,6 +67,8 @@ package givens: trait Y: def doY: String + trait Z + given X: def doX = 7 @@ -84,6 +86,9 @@ package givens: given namely: (x: X) => Y: // warn protected param to given class def doY = "8" + + def f(using => X) = println() // warn + def g(using => Z) = println() // nowarn marker trait end givens object i22895: diff --git a/tests/warn/i23494.scala b/tests/warn/i23494.scala new file mode 100644 index 000000000000..c3c0c5a2e0bc --- /dev/null +++ b/tests/warn/i23494.scala @@ -0,0 +1,15 @@ +//> using options -Wunused:implicits + +import scala.deriving.Mirror + +abstract class EnumerationValues[A]: + type Out + +object EnumerationValues: + type Aux[A, B] = EnumerationValues[A] { type Out = B } + + def apply[A, B](): EnumerationValues.Aux[A, B] = new EnumerationValues[A]: + override type Out = B + + given sum[A, B <: Tuple](using mirror: Mirror.SumOf[A] { type MirroredElemTypes = B }): EnumerationValues.Aux[A, A] = + EnumerationValues[A, A]()