diff --git a/.github/workflows/build-sdk.yml b/.github/workflows/build-sdk.yml index b2af623d731a..cd111df1a083 100644 --- a/.github/workflows/build-sdk.yml +++ b/.github/workflows/build-sdk.yml @@ -61,6 +61,7 @@ jobs: distribution: temurin java-version: ${{ inputs.java-version }} cache : sbt + - uses: sbt/setup-sbt@v1 - name: Build and pack the SDK (universal) run : ./project/scripts/sbt dist/Universal/stage - name: Build and pack the SDK (linux x86-64) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 303922719b5b..5931219f472a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -728,7 +728,7 @@ jobs: publish_release: permissions: - contents: write # for actions/create-release to create a release + contents: write # for GH CLI to create a release runs-on: [self-hosted, Linux] container: image: lampepfl/dotty:2024-10-18 @@ -770,6 +770,7 @@ jobs: - name: Add SBT proxy repositories run: cp -vf .github/workflows/repositories /root/.sbt/ ; true + # Extract the release tag - name: Extract the release tag run : echo "RELEASE_TAG=${GITHUB_REF#*refs/tags/}" >> $GITHUB_ENV @@ -793,19 +794,13 @@ jobs: distDir="$3" # Build binaries - ./project/scripts/sbt "${sbtProject}/Universal/stage" + ./project/scripts/sbt "all ${sbtProject}/Universal/packageBin ${sbtProject}/Universal/packageZipTarball" - outputPath="${distDir}/target/universal/stage" artifactName="scala3-${{ env.RELEASE_TAG }}${distroSuffix}" - zipArchive="${artifactName}.zip" - tarGzArchive="${artifactName}.tar.gz" - - cwd=$(pwd) - (cd $outputPath && zip -r ${zipArchive} . && mv ${zipArchive} "${cwd}/") - tar -czf ${tarGzArchive} -C "$outputPath" . # Caluclate SHA for each of archive files - for file in "${zipArchive}" "${tarGzArchive}"; do + for file in "${artifactName}.zip" "${artifactName}.tar.gz"; do + mv ${distDir}/target/universal/$file $file sha256sum "${file}" > "${file}.sha256" done } @@ -828,311 +823,29 @@ jobs: mv scala.msi "${msiInstaller}" sha256sum "${msiInstaller}" > "${msiInstaller}.sha256" + - name: Install GH CLI + uses: dev-hanz-ops/install-gh-cli-action@v0.2.0 + with: + gh-cli-version: 2.59.0 + # Create the GitHub release - name: Create GitHub Release - id: create_gh_release - uses: actions/create-release@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body_path: ./changelogs/${{ env.RELEASE_TAG }}.md - draft: true - prerelease: ${{ contains(env.RELEASE_TAG, '-') }} - - # The following upload steps are generated using template: - # val baseFileName = "scala3-${{ env.RELEASE_TAG }}" - # def upload(kind: String, path: String, contentType: String, distribution: String) = - # s"""- name: Upload $kind to GitHub Release ($distribution) - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: $${{ steps.create_gh_release.outputs.upload_url }} - # asset_path: ./${path} - # asset_name: ${path} - # asset_content_type: ${contentType}""" - # def uploadSDK(distribution: String, suffix: String) = - # val filename = s"${baseFileName}${suffix}" - # s""" - # # $distribution - # ${upload("zip archive", s"$filename.zip", "application/zip", distribution)} - # ${upload("zip archive SHA", s"$filename.zip.sha256", "text/plain", distribution)} - # ${upload("tar.gz archive", s"$filename.tar.gz", "application/gzip", distribution)} - # ${upload("tar.gz archive SHA", s"$filename.tar.gz.sha256", "text/plain", distribution)} - # """ - # def uploadMSI() = - # val distribution = "Windows x86_64 MSI" - # s""" - # # $distribution - # ${upload(".msi file", s"${baseFileName}.msi", "application/x-msi", distribution)} - # ${upload(".msi file SHA", s"${baseFileName}.msi.sha256", "text/plain", distribution)} - # """ - # @main def gen = - # Seq( - # uploadSDK("Universal", ""), - # uploadSDK("Linux x86-64", "-x86_64-pc-linux"), - # uploadSDK("Linux aarch64", "-aarch64-pc-linux"), - # uploadSDK("Mac x86-64", "-x86_64-apple-darwin"), - # uploadSDK("Mac aarch64", "-aarch64-apple-darwin"), - # uploadSDK("Windows x86_64", "-x86_64-pc-win32"), - # uploadMSI() - # ).foreach(println) - - # Universal - - name: Upload zip archive to GitHub Release (Universal) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}.zip - asset_name: scala3-${{ env.RELEASE_TAG }}.zip - asset_content_type: application/zip - - name: Upload zip archive SHA to GitHub Release (Universal) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}.zip.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}.zip.sha256 - asset_content_type: text/plain - - name: Upload tar.gz archive to GitHub Release (Universal) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}.tar.gz - asset_name: scala3-${{ env.RELEASE_TAG }}.tar.gz - asset_content_type: application/gzip - - name: Upload tar.gz archive SHA to GitHub Release (Universal) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}.tar.gz.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}.tar.gz.sha256 - asset_content_type: text/plain - - - # Linux x86-64 - - name: Upload zip archive to GitHub Release (Linux x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.zip - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.zip - asset_content_type: application/zip - - name: Upload zip archive SHA to GitHub Release (Linux x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.zip.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.zip.sha256 - asset_content_type: text/plain - - name: Upload tar.gz archive to GitHub Release (Linux x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.tar.gz - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.tar.gz - asset_content_type: application/gzip - - name: Upload tar.gz archive SHA to GitHub Release (Linux x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.tar.gz.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-linux.tar.gz.sha256 - asset_content_type: text/plain - - - # Linux aarch64 - - name: Upload zip archive to GitHub Release (Linux aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.zip - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.zip - asset_content_type: application/zip - - name: Upload zip archive SHA to GitHub Release (Linux aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.zip.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.zip.sha256 - asset_content_type: text/plain - - name: Upload tar.gz archive to GitHub Release (Linux aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.tar.gz - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.tar.gz - asset_content_type: application/gzip - - name: Upload tar.gz archive SHA to GitHub Release (Linux aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.tar.gz.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-pc-linux.tar.gz.sha256 - asset_content_type: text/plain - - - # Mac x86-64 - - name: Upload zip archive to GitHub Release (Mac x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.zip - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.zip - asset_content_type: application/zip - - name: Upload zip archive SHA to GitHub Release (Mac x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.zip.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.zip.sha256 - asset_content_type: text/plain - - name: Upload tar.gz archive to GitHub Release (Mac x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.tar.gz - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.tar.gz - asset_content_type: application/gzip - - name: Upload tar.gz archive SHA to GitHub Release (Mac x86-64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.tar.gz.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-apple-darwin.tar.gz.sha256 - asset_content_type: text/plain - - - # Mac aarch64 - - name: Upload zip archive to GitHub Release (Mac aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.zip - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.zip - asset_content_type: application/zip - - name: Upload zip archive SHA to GitHub Release (Mac aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.zip.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.zip.sha256 - asset_content_type: text/plain - - name: Upload tar.gz archive to GitHub Release (Mac aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.tar.gz - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.tar.gz - asset_content_type: application/gzip - - name: Upload tar.gz archive SHA to GitHub Release (Mac aarch64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.tar.gz.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-aarch64-apple-darwin.tar.gz.sha256 - asset_content_type: text/plain - - - # Windows x86_64 - - name: Upload zip archive to GitHub Release (Windows x86_64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.zip - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.zip - asset_content_type: application/zip - - name: Upload zip archive SHA to GitHub Release (Windows x86_64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.zip.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.zip.sha256 - asset_content_type: text/plain - - name: Upload tar.gz archive to GitHub Release (Windows x86_64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.tar.gz - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.tar.gz - asset_content_type: application/gzip - - name: Upload tar.gz archive SHA to GitHub Release (Windows x86_64) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.tar.gz.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}-x86_64-pc-win32.tar.gz.sha256 - asset_content_type: text/plain - - - # Windows x86_64 MSI - - name: Upload .msi file to GitHub Release (Windows x86_64 MSI) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}.msi - asset_name: scala3-${{ env.RELEASE_TAG }}.msi - asset_content_type: application/x-msi - - name: Upload .msi file SHA to GitHub Release (Windows x86_64 MSI) - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_gh_release.outputs.upload_url }} - asset_path: ./scala3-${{ env.RELEASE_TAG }}.msi.sha256 - asset_name: scala3-${{ env.RELEASE_TAG }}.msi.sha256 - asset_content_type: text/plain + shell: bash + run: | + git config --global --add safe.directory /__w/scala3/scala3 + gh release create \ + --draft \ + --title "${{ env.RELEASE_TAG }}" \ + --notes-file ./changelogs/${{ env.RELEASE_TAG }}.md \ + --latest=${{ !contains(env.RELEASE_TAG, '-RC') }} \ + --prerelease=${{ contains(env.RELEASE_TAG, '-RC') }} \ + --verify-tag ${{ env.RELEASE_TAG }} \ + scala3-${{ env.RELEASE_TAG }}*.zip \ + scala3-${{ env.RELEASE_TAG }}*.tar.gz \ + scala3-${{ env.RELEASE_TAG }}*.sha256 \ + scala3-${{ env.RELEASE_TAG }}.msi - name: Publish Release run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleUpload" diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml index 35af4fa0526d..6a3f8174b2d7 100644 --- a/.github/workflows/dependency-graph.yml +++ b/.github/workflows/dependency-graph.yml @@ -9,6 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: sbt/setup-sbt@v1 - uses: scalacenter/sbt-dependency-submission@v3 env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} diff --git a/.github/workflows/language-reference.yaml b/.github/workflows/language-reference.yaml index 7f87b4a453ef..d79f4d029a77 100644 --- a/.github/workflows/language-reference.yaml +++ b/.github/workflows/language-reference.yaml @@ -36,6 +36,7 @@ jobs: distribution: 'temurin' java-version: 17 cache: 'sbt' + - uses: sbt/setup-sbt@v1 - name: Generate reference documentation and test links run: | diff --git a/.github/workflows/launchers.yml b/.github/workflows/launchers.yml index ce3aac235224..4ee07e4bfcc9 100644 --- a/.github/workflows/launchers.yml +++ b/.github/workflows/launchers.yml @@ -20,6 +20,7 @@ jobs: java-version: '17' distribution: 'temurin' cache: 'sbt' + - uses: sbt/setup-sbt@v1 - name: Build and test launcher command run: ./project/scripts/native-integration/bashTests env: @@ -37,9 +38,7 @@ jobs: java-version: '17' distribution: 'temurin' cache: 'sbt' - # https://github.com/actions/runner-images/issues/9369 - - name: Install sbt - run: brew install sbt + - uses: sbt/setup-sbt@v1 - name: Build and test launcher command run: ./project/scripts/native-integration/bashTests env: @@ -58,9 +57,7 @@ jobs: java-version: '17' distribution: 'temurin' cache: 'sbt' - # https://github.com/actions/runner-images/issues/9369 - - name: Install sbt - run: brew install sbt + - uses: sbt/setup-sbt@v1 - name: Build and test launcher command run: ./project/scripts/native-integration/bashTests env: @@ -79,9 +76,7 @@ jobs: java-version: '17' distribution: 'temurin' cache: 'sbt' - # https://github.com/actions/runner-images/issues/9369 - - name: Install sbt - run: brew install sbt + - uses: sbt/setup-sbt@v1 - name: Build and test launcher command run: ./project/scripts/native-integration/bashTests env: @@ -100,6 +95,7 @@ jobs: java-version: '17' distribution: 'temurin' cache: 'sbt' + - uses: sbt/setup-sbt@v1 - name: Build the launcher command run: sbt "dist-win-x86_64/Universal/stage" - name: Run the launcher command tests diff --git a/.github/workflows/scaladoc.yaml b/.github/workflows/scaladoc.yaml index 4f6f5bbfe2fb..d2e3071e765b 100644 --- a/.github/workflows/scaladoc.yaml +++ b/.github/workflows/scaladoc.yaml @@ -37,6 +37,7 @@ jobs: java-version: 17 cache: 'sbt' + - uses: sbt/setup-sbt@v1 - name: Compile and test scala3doc-js run: ./project/scripts/sbt scaladoc-js-main/test diff --git a/NOTICE.md b/NOTICE.md index fd931397a500..b3f97913df2f 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1,6 +1,6 @@ -Dotty (https://dotty.epfl.ch) -Copyright 2012-2024 EPFL -Copyright 2012-2024 Lightbend, Inc. +Scala 3 (https://www.scala-lang.org) +Copyright 2012-2025 EPFL +Copyright 2012-2025 Lightbend, Inc. dba Akka Licensed under the Apache License, Version 2.0 (the "License"): http://www.apache.org/licenses/LICENSE-2.0 @@ -11,12 +11,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -The dotty compiler frontend has been developed since November 2012 by Martin -Odersky. It is expected and hoped for that the list of contributors to the -codebase will grow quickly. Dotty draws inspiration and code from the original -Scala compiler "nsc", which is developed at scala/scala [1]. +The Scala 3 compiler is also known as Dotty. The Dotty compiler +frontend has been developed since November 2012 by Martin Odersky. It +is expected and hoped for that the list of contributors to the +codebase will grow quickly. Dotty draws inspiration and code from the +original Scala 2 compiler "nsc", which is still developed at scala/scala [1]. -The majority of the dotty codebase is new code, with the exception of the +The majority of the Dotty codebase is new code, with the exception of the components mentioned below. We have for each component tried to come up with a list of the original authors in the scala/scala [1] codebase. Apologies if some major authors were omitted by oversight. @@ -28,7 +29,7 @@ major authors were omitted by oversight. * dotty.tools.dotc.classpath: The classpath handling is taken mostly as is from scala/scala [1]. The original authors were Grzegorz Kossakowski, - Michał Pociecha, Lukas Rytz, Jason Zaugg and others. + Michał Pociecha, Lukas Rytz, Jason Zaugg and others. * dotty.tools.dotc.config: The configuration components were adapted and extended from scala/scala [1]. The original sources were authored by Paul diff --git a/changelogs/3.4.0-RC1.md b/changelogs/3.4.0-RC1.md new file mode 100644 index 000000000000..79695cad83f9 --- /dev/null +++ b/changelogs/3.4.0-RC1.md @@ -0,0 +1,466 @@ +# Highlights of the release + +- Make polymorphic functions more efficient and expressive [#17548](https://github.com/lampepfl/dotty/pull/17548) +- SIP-56: Better foundations for match types [#18262](https://github.com/lampepfl/dotty/pull/18262) +- Make SIP 54 (Multi-Source Extension Overloads) a standard feature [#17441](https://github.com/lampepfl/dotty/pull/17441) +- Value parameter inference for polymorphic lambdas [#18041](https://github.com/lampepfl/dotty/pull/18041) +- Add `@publicInBinary` annotation and `-WunstableInlineAccessors` linting flag [#18402](https://github.com/lampepfl/dotty/pull/18402) +- Stabilize Quotes `defn.PolyFunction` [#18480](https://github.com/lampepfl/dotty/pull/18480) +- Stabilize Quotes `Flags.AbsOverride` [#18482](https://github.com/lampepfl/dotty/pull/18482) +- Add `-experimental` compiler flags [#18571](https://github.com/lampepfl/dotty/pull/18571) +- Stabilize SIP-53 (quote pattern explicit type variable syntax) [#18574](https://github.com/lampepfl/dotty/pull/18574) +- Add reflect TypeRepr.dealiasKeepOpaques [#18583](https://github.com/lampepfl/dotty/pull/18583) +- Add attributes section to TASTy and use it for Stdlib TASTy [#18599](https://github.com/lampepfl/dotty/pull/18599) +- Error when reading class file with unknown newer jdk version [#18618](https://github.com/lampepfl/dotty/pull/18618) +- Add support for xsbti.compile.CompileProgress [#18739](https://github.com/lampepfl/dotty/pull/18739) +- Improve type inference for functions like fold [#18780](https://github.com/lampepfl/dotty/pull/18780) +- Improve error message for mismatched tasty versions, allow configuration of header unpickler [#18828](https://github.com/lampepfl/dotty/pull/18828) +- In 3.4 make refutable patterns in a for comprehension an error [#18842](https://github.com/lampepfl/dotty/pull/18842) +- Disallow use of PolyFunction in user code [#18920](https://github.com/lampepfl/dotty/pull/18920) +- Store source file in TASTY attributes [#18948](https://github.com/lampepfl/dotty/pull/18948) +- First step to pipelining support - enable reading Java symbols from TASTy [#19074](https://github.com/lampepfl/dotty/pull/19074) +- Activate constrainResult fix in 3.4 [#19253](https://github.com/lampepfl/dotty/pull/19253) +- Parallelise JVM backend - Scala 2 port [#15392](https://github.com/lampepfl/dotty/pull/15392) + +## Deprecation warnings for old syntax + +- `_` type wildcards [#18813](https://github.com/lampepfl/dotty/pull/18813) +- `private[this]` [#18819](https://github.com/lampepfl/dotty/pull/18819) +- `var x = _` [#18821](https://github.com/lampepfl/dotty/pull/18821) +- `with` as a type operator [#18837](https://github.com/lampepfl/dotty/pull/18837) +- `xs: _*` varargs [#18872](https://github.com/lampepfl/dotty/pull/18872) +- trailing `_` to force eta expansion [#18926](https://github.com/lampepfl/dotty/pull/18926) + +# Other changes and fixes + +## Backend + +- Count size of parameters for platform limit check [#18464](https://github.com/lampepfl/dotty/pull/18464) +- Don't emit line number for synthetic unit value [#18717](https://github.com/lampepfl/dotty/pull/18717) +- Avoid too eager transform of $outer for lhs & accessor rhs [#18949](https://github.com/lampepfl/dotty/pull/18949) +- Make more anonymous functions static [#19251](https://github.com/lampepfl/dotty/pull/19251) +- Fix deadlock in initialization of CoreBTypes using Lazy container [#19298](https://github.com/lampepfl/dotty/pull/19298) +- Fix #18769: Allow HK type args in Java signatures. [#18883](https://github.com/lampepfl/dotty/pull/18883) +- Loading symbols from TASTy files directly [#17594](https://github.com/lampepfl/dotty/pull/17594) +- Use dedicated equals method for univerval equality of chars [#18770](https://github.com/lampepfl/dotty/pull/18770) + +## Erasure + +- Get generic signature of fields entered after erasure from their accessor [#19207](https://github.com/lampepfl/dotty/pull/19207) +- Detect case where two alternatives are the same after widening ExprTypes [#18787](https://github.com/lampepfl/dotty/pull/18787) +- Improve erased params logic [#18433](https://github.com/lampepfl/dotty/pull/18433) + +## Experimental: Capture Checking + +- Fix capture set variable installation in Setup [#18885](https://github.com/lampepfl/dotty/pull/18885) +- Don't follow opaque aliases when transforming sym info for cc [#18929](https://github.com/lampepfl/dotty/pull/18929) +- Reset `comparersInUse` to zero in `ContextState.reset` [#18915](https://github.com/lampepfl/dotty/pull/18915) +- Special handling of experimental.captureChecking import [#17427](https://github.com/lampepfl/dotty/pull/17427) +- Change handling of curried function types in capture checking [#18131](https://github.com/lampepfl/dotty/pull/18131) +- Fix #18246: correctly compute capture sets in `TypeComparer.glb` [#18254](https://github.com/lampepfl/dotty/pull/18254) +- New capture escape checking based on levels [#18463](https://github.com/lampepfl/dotty/pull/18463) +- A more robust scheme for resetting denotations after Recheck [#18534](https://github.com/lampepfl/dotty/pull/18534) +- A more flexible scheme for handling the universal capability [#18699](https://github.com/lampepfl/dotty/pull/18699) +- Fix potential soundness hole when adding references to a mapped capture set [#18758](https://github.com/lampepfl/dotty/pull/18758) +- Alternative scheme for cc encapsulation [#18899](https://github.com/lampepfl/dotty/pull/18899) +- Make reach refinement shallow [#19171](https://github.com/lampepfl/dotty/pull/19171) + +## F-bounds + +- Don't check bounds of Java applications in Java units [#18054](https://github.com/lampepfl/dotty/pull/18054) + +## GADTs + +- Avoid embedding SelectionProtos in Conversions [#17755](https://github.com/lampepfl/dotty/pull/17755) +- Freeze constraints while calculating GADT full bounds [#18222](https://github.com/lampepfl/dotty/pull/18222) + +## Implicits + +- Followup fix to transparent inline conversion [#18130](https://github.com/lampepfl/dotty/pull/18130) +- Select local implicits over name-imported over wildcard imported [#18203](https://github.com/lampepfl/dotty/pull/18203) +- Fix how implicit candidates are combined [#18321](https://github.com/lampepfl/dotty/pull/18321) +- Improve error message about missing type of context function parameter [#18788](https://github.com/lampepfl/dotty/pull/18788) +- Support implicit arguments before extractor method [#18671](https://github.com/lampepfl/dotty/pull/18671) +- Tweak convertible implicits fix [#18727](https://github.com/lampepfl/dotty/pull/18727) + +## Incremental Compilation + +- Make incremental compilation aware of synthesized mirrors [#18310](https://github.com/lampepfl/dotty/pull/18310) + +## Inference + +- Honour hard unions in lubbing and param replacing [#18680](https://github.com/lampepfl/dotty/pull/18680) + +## Infrastructure + +- Use -Yscala2-library-tasty to add Scala 2 lib TASTY to scalac (internal only) [#18613](https://github.com/lampepfl/dotty/pull/18613) +- Rename `stdlib-bootstrapped-tasty` to `scala2-library-tasty` [#18615](https://github.com/lampepfl/dotty/pull/18615) +- Fix #19286: Freeze rubygems-update at < 3.5.0. [#19288](https://github.com/lampepfl/dotty/pull/19288) + +## Initialization + +- Fix #17997: Handle intersection type as this type of super type [#18069](https://github.com/lampepfl/dotty/pull/18069) +- Add test for issue #17997 affecting the global object initialization checker [#18141](https://github.com/lampepfl/dotty/pull/18141) +- Fix i18624 and add test case for it [#18859](https://github.com/lampepfl/dotty/pull/18859) +- Treat new Array(0) as immutable [#19192](https://github.com/lampepfl/dotty/pull/19192) +- Fix #18407: Ignore Quote/Slice in init checker [#18848](https://github.com/lampepfl/dotty/pull/18848) +- Check safe initialization of static objects [#16970](https://github.com/lampepfl/dotty/pull/16970) +- Pattern match support in checking global objects [#18127](https://github.com/lampepfl/dotty/pull/18127) +- Fix crash in global object initialization checker when select target has no source [#18627](https://github.com/lampepfl/dotty/pull/18627) +- Fix warning underlining in global init checker [#18668](https://github.com/lampepfl/dotty/pull/18668) +- Fix i18629 [#18839](https://github.com/lampepfl/dotty/pull/18839) +- I18628 [#18841](https://github.com/lampepfl/dotty/pull/18841) +- Make safe init checker skip global objects [#18906](https://github.com/lampepfl/dotty/pull/18906) +- Handle local lazy vals properly [#18998](https://github.com/lampepfl/dotty/pull/18998) + +## Inline + +- Fix regression: inline match crash when rhs uses private inlined methods [#18595](https://github.com/lampepfl/dotty/pull/18595) +- Add structural classes of dynamicApply before inlining [#18766](https://github.com/lampepfl/dotty/pull/18766) +- Set missing expansion span for copied inlined node [#18229](https://github.com/lampepfl/dotty/pull/18229) +- Fix `callTrace` of inlined methods [#18738](https://github.com/lampepfl/dotty/pull/18738) + +## Linting + +- Keep tree of type ascriptions of quote pattern splices [#18412](https://github.com/lampepfl/dotty/pull/18412) +- Fix false positive in WUnused for renamed path-dependent imports [#18468](https://github.com/lampepfl/dotty/pull/18468) +- Fix false positive in WUnused for renamed path-dependent imports (2) [#18617](https://github.com/lampepfl/dotty/pull/18617) +- Fix wunused false positive on CanEqual [#18641](https://github.com/lampepfl/dotty/pull/18641) +- Implement -Xlint:private-shadow, type-parameter-shadow [#17622](https://github.com/lampepfl/dotty/pull/17622) +- Fix: reversed wconf parsing order to mirror scala 2 [#18503](https://github.com/lampepfl/dotty/pull/18503) +- Revert Fix false positive in WUnused for renamed path-dependent imports [#18514](https://github.com/lampepfl/dotty/pull/18514) + +## Macro Annotations + +- Enter missing symbols generated by the MacroAnnotation expansion [#18826](https://github.com/lampepfl/dotty/pull/18826) + +## Match Types + +- Allow Tuple.Head and Tuple.Tail to work with EmptyTuple [#17189](https://github.com/lampepfl/dotty/pull/17189) +- Fix match type reduction with avoided types [#18043](https://github.com/lampepfl/dotty/pull/18043) +- Strip LazyRef before calling simplified, in MT reduction [#18218](https://github.com/lampepfl/dotty/pull/18218) +- Fix MT separate compilation bug [#18398](https://github.com/lampepfl/dotty/pull/18398) +- Do not show deprecation warning for `_` in type match case [#18887](https://github.com/lampepfl/dotty/pull/18887) + +## Nullability + +- Improve logic when to emit pattern type error [#18093](https://github.com/lampepfl/dotty/pull/18093) +- Allow nullability flow typing even in presence of pattern match [#18206](https://github.com/lampepfl/dotty/pull/18206) +- Fix #11967: flow typing nullability in pattern matches [#18212](https://github.com/lampepfl/dotty/pull/18212) +- Fix #18282: consider Predef.eq/ne in nullability flow typing [#18299](https://github.com/lampepfl/dotty/pull/18299) +- Make `this.type` nullable again (unless under -Yexplicit-nulls). [#18399](https://github.com/lampepfl/dotty/pull/18399) + +## Opaque Types + +- Type ascribe trees that require opaque type usage [#18101](https://github.com/lampepfl/dotty/pull/18101) + +## Parser + +- Fix selecting terms using _root_ [#18335](https://github.com/lampepfl/dotty/pull/18335) +- Tweak java getlitch not to skip zero [#18491](https://github.com/lampepfl/dotty/pull/18491) +- Fix i18518 [#18520](https://github.com/lampepfl/dotty/pull/18520) +- Only apply `future` patches on `future-migration` [#18820](https://github.com/lampepfl/dotty/pull/18820) +- Parser simple expression error recovery change from `null` to `???` [#19103](https://github.com/lampepfl/dotty/pull/19103) + +## Pattern Matching + +- Fix syntax and parsing of vararg patterns [#18055](https://github.com/lampepfl/dotty/pull/18055) +- Avoid over widening in SpaceEngine [#18252](https://github.com/lampepfl/dotty/pull/18252) +- Fix regression in exhaustivity of HK types [#18303](https://github.com/lampepfl/dotty/pull/18303) +- Fix missing case in isSubspace, which broke reachablility [#18326](https://github.com/lampepfl/dotty/pull/18326) +- Unsuppress unchecked warnings [#18377](https://github.com/lampepfl/dotty/pull/18377) +- Consider extension methods in Space isSameUnapply [#18642](https://github.com/lampepfl/dotty/pull/18642) +- Fix unreachable warning in deeply nested sealed hierarchy [#18706](https://github.com/lampepfl/dotty/pull/18706) +- Remove unnecessary and recursive Space decomposition [#19216](https://github.com/lampepfl/dotty/pull/19216) +- Prioritise sequence-matches over product-sequence-matches [#19260](https://github.com/lampepfl/dotty/pull/19260) +- Propagate constant in result of inline match [#18455](https://github.com/lampepfl/dotty/pull/18455) +- Disable match anaylsis in inlined trees [#19190](https://github.com/lampepfl/dotty/pull/19190) +- Teach provablyDisjoint about AnyKind [#18510](https://github.com/lampepfl/dotty/pull/18510) +- Warn about unchecked type tests in primitive catch cases [#19206](https://github.com/lampepfl/dotty/pull/19206) +- Reprioritise seq-match over product-seq-match [#19277](https://github.com/lampepfl/dotty/pull/19277) +- Fix exhaustivity due to separate TypeVar lambdas [#18616](https://github.com/lampepfl/dotty/pull/18616) + +## Presentation Compiler + +- Support completions for extension definition parameter [#18331](https://github.com/lampepfl/dotty/pull/18331) +- Fix: Don't collect map, flatMap, withFilter in for-comprehension [#18430](https://github.com/lampepfl/dotty/pull/18430) +- Bugfix: Catch exception from the compiler for broken shadowed pickles [#18502](https://github.com/lampepfl/dotty/pull/18502) +- Bugfix: highlight for enum type params [#18528](https://github.com/lampepfl/dotty/pull/18528) +- Bugfix: No signature help for local methods [#18594](https://github.com/lampepfl/dotty/pull/18594) +- Bugfix: add `moduleClass` imported symbols in `IndexedContext` [#18620](https://github.com/lampepfl/dotty/pull/18620) +- Bugfix: Named args completions with default values [#18633](https://github.com/lampepfl/dotty/pull/18633) +- Fix: match completions for type aliases [#18667](https://github.com/lampepfl/dotty/pull/18667) +- Bugfix: add multiline comment completion [#18703](https://github.com/lampepfl/dotty/pull/18703) +- Bugfix: Backticked named arguments [#18704](https://github.com/lampepfl/dotty/pull/18704) +- Bugfix: [metals] Case completions for tuple type [#18751](https://github.com/lampepfl/dotty/pull/18751) +- Completions should prepend, not replace as it is for Scala 2 [#18803](https://github.com/lampepfl/dotty/pull/18803) +- Bugfix: rename end marker [#18838](https://github.com/lampepfl/dotty/pull/18838) +- Presentation compiler: Bugfix for semantic tokens and synthetic decorations [#18955](https://github.com/lampepfl/dotty/pull/18955) +- Show documentation for value forwarders in completions [#19200](https://github.com/lampepfl/dotty/pull/19200) +- Bugfix: Document highlight on class constructors [#19209](https://github.com/lampepfl/dotty/pull/19209) +- Bugfix: Completions for extension methods with name conflict [#19225](https://github.com/lampepfl/dotty/pull/19225) + +## Polyfunctions + +- Check user defined PolyFunction refinements [#18457](https://github.com/lampepfl/dotty/pull/18457) +- Support polymorphic functions with erased parameters [#18293](https://github.com/lampepfl/dotty/pull/18293) +- Use `PolyFunction` instead of `ErasedFunction` [#18295](https://github.com/lampepfl/dotty/pull/18295) + +## Quotes + +- Support type variable with bounds in quoted pattern [#16910](https://github.com/lampepfl/dotty/pull/16910) +- Add new EXPLICITtpt to TASTy format [#17298](https://github.com/lampepfl/dotty/pull/17298) +- Inhibit typer to insert contextual arguments when it is inside arguments of HOAS patterns [#18040](https://github.com/lampepfl/dotty/pull/18040) +- Compile quote patterns directly into QuotePattern AST [#18133](https://github.com/lampepfl/dotty/pull/18133) +- Add missing span to synthesized product mirror [#18354](https://github.com/lampepfl/dotty/pull/18354) +- Improve non-static macro implementation error message [#18405](https://github.com/lampepfl/dotty/pull/18405) +- Fix scala 2 macros in traits with type parameters [#18663](https://github.com/lampepfl/dotty/pull/18663) +- Patch `underlyingArgument` to avoid mapping into modules [#18923](https://github.com/lampepfl/dotty/pull/18923) +- Fallback erasing term references [#18731](https://github.com/lampepfl/dotty/pull/18731) +- Fix ignored type variable bound warning in type quote pattern [#18199](https://github.com/lampepfl/dotty/pull/18199) +- Splice hole with singleton captures [#18357](https://github.com/lampepfl/dotty/pull/18357) +- Fix macros with erased arguments [#18431](https://github.com/lampepfl/dotty/pull/18431) +- Deprecate 3-arg `FunctionClass` constructor [#18472](https://github.com/lampepfl/dotty/pull/18472) +- Deprecate `Quotes` `{MethodType,TermParamClause}.isErased` [#18479](https://github.com/lampepfl/dotty/pull/18479) +- Avoid crashes on missing positions [#19250](https://github.com/lampepfl/dotty/pull/19250) + +## Reflection + +- Add reflect.ValOrDefDef [#16974](https://github.com/lampepfl/dotty/pull/16974) +- Check New tree for ill-formed module instantiations [#17553](https://github.com/lampepfl/dotty/pull/17553) +- Add reflect `TypeLambda.paramVariances` [#17568](https://github.com/lampepfl/dotty/pull/17568) +- Make check flags for `newMethod`, `newVal` and `newBind` in Quotes API less restrictive [#18217](https://github.com/lampepfl/dotty/pull/18217) +- Normalise mirrorType for mirror Synthesis [#19199](https://github.com/lampepfl/dotty/pull/19199) +- Add reflect `defn.FunctionClass` overloads [#16849](https://github.com/lampepfl/dotty/pull/16849) +- Stabilize reflect flag `JavaAnnotation` [#19267](https://github.com/lampepfl/dotty/pull/19267) +- Stabilize reflect `paramVariance` [#19268](https://github.com/lampepfl/dotty/pull/19268) + +## Reporting + +- Take into account the result type of inline implicit conversions unless they are transparent [#17924](https://github.com/lampepfl/dotty/pull/17924) +- Check if a fatal warning issued in typer is silenced, before converting it into an error [#18089](https://github.com/lampepfl/dotty/pull/18089) +- Elide companion defs to a `object` extending `AnyVal` [#18451](https://github.com/lampepfl/dotty/pull/18451) +- Add regression test for issue i18493 [#18497](https://github.com/lampepfl/dotty/pull/18497) +- Add better explanation to error message [#18665](https://github.com/lampepfl/dotty/pull/18665) +- Better error message when accessing private members [#18690](https://github.com/lampepfl/dotty/pull/18690) +- Improve message for discarded pure non-Unit values [#18723](https://github.com/lampepfl/dotty/pull/18723) +- Better error message when a pattern match extractor is not found. [#18725](https://github.com/lampepfl/dotty/pull/18725) +- Give "did you mean ...?" hints also for simple identifiers [#18747](https://github.com/lampepfl/dotty/pull/18747) +- Better error for definition followed by keyword [#18752](https://github.com/lampepfl/dotty/pull/18752) +- Better explain message for 'pattern expected' [#18753](https://github.com/lampepfl/dotty/pull/18753) +- Improve failure message of enum `fromOrdinal`/`valueOf` [#19182](https://github.com/lampepfl/dotty/pull/19182) +- Fix type mismatch error confusion between types with same simple name [#19204](https://github.com/lampepfl/dotty/pull/19204) +- Add hint for nested quotes missing staged `Quotes` [#18755](https://github.com/lampepfl/dotty/pull/18755) +- Better error messages for missing commas and more [#18785](https://github.com/lampepfl/dotty/pull/18785) +- Fix imported twice error messages [#18102](https://github.com/lampepfl/dotty/pull/18102) +- Improve error message for inaccessible types [#18406](https://github.com/lampepfl/dotty/pull/18406) +- Future migration warning for `with` type operator [#18818](https://github.com/lampepfl/dotty/pull/18818) +- Improve assertion error message for `Apply` and `TypeApply` [#18700](https://github.com/lampepfl/dotty/pull/18700) +- Shorten traces for TypeMismatch errors under -explain [#18742]( +- Improve `with` in type migration warning [#18852](https://github.com/lampepfl/dotty/pull/18852) +hub.com/lampepfl/dotty/pull/18742) +- Future migration warning for alphanumeric infix operator [#18908](https://github.com/lampepfl/dotty/pull/18908) +- Make sure that trace is shown correctly in the presence of invalid line numbers [#18930](https://github.com/lampepfl/dotty/pull/18930) +- Add migration warning for XML literals in language future [#19101](https://github.com/lampepfl/dotty/pull/19101) +- Avoid diagnostic message forcing crashing the compiler [#19113](https://github.com/lampepfl/dotty/pull/19113) +- Make sure that the stacktrace is shown with `-Ydebug-unpickling` [#19115](https://github.com/lampepfl/dotty/pull/19115) +- Improve `asExprOf` cast error formatting [#19195](https://github.com/lampepfl/dotty/pull/19195) +- Do not warn on underscore wildcard type in pattern [#19249](https://github.com/lampepfl/dotty/pull/19249) + +## Scala-JS + +- Fix #18658: Handle varargs of generic types in `JSExportsGen`. [#18659](https://github.com/lampepfl/dotty/pull/18659) + +## Scaladoc + +- Fix incorrect comment parser used in nightly scaladoc [#18523](https://github.com/lampepfl/dotty/pull/18523) + +## SemanticDB + +- Export diagnostics (including unused warnings) to SemanticDB [#17835](https://github.com/lampepfl/dotty/pull/17835) +- Bugfix: Incorrect semanticdb span on Selectable [#18576](https://github.com/lampepfl/dotty/pull/18576) +- Bugfix: in semanticdb make synthetic apply disambiguator consistent w/ Scala 2 implicit [#17341](https://github.com/lampepfl/dotty/pull/17341) + +## Standard Library + +- Intrinsify `constValueTuple` and `summonAll` [#18013](https://github.com/lampepfl/dotty/pull/18013) +- Fix #18609: Add language.`3.4` and language.`3.4-migration`. [#18610](https://github.com/lampepfl/dotty/pull/18610) + +## TASTy format + +- Eliminate FromJavaObject from TASTy of Java sources [#19259](https://github.com/lampepfl/dotty/pull/19259) +- Add new HOLETYPES to TASTy format [#17225](https://github.com/lampepfl/dotty/pull/17225) +- Add capture checking attributes to TASTy [#19033](https://github.com/lampepfl/dotty/pull/19033) +- Add TASTyInfo abstraction [#19089](https://github.com/lampepfl/dotty/pull/19089) +- Add UTF8 abstraction in the TASTy format [#19090](https://github.com/lampepfl/dotty/pull/19090) + +## Tooling + +- Don't add explanation twice [#18779](https://github.com/lampepfl/dotty/pull/18779) +- ExtractDependencies uses more efficient caching [#18403](https://github.com/lampepfl/dotty/pull/18403) +- Introduce the SourceVersions 3.4 and 3.4-migration; make 3.4 the default. [#18501](https://github.com/lampepfl/dotty/pull/18501) +- Bugfix: Completions for named args in wrong order [#18702](https://github.com/lampepfl/dotty/pull/18702) +- Align unpickled Scala 2 accessors encoding with Scala 3 [#18874](https://github.com/lampepfl/dotty/pull/18874) +- Reinterpret Scala 2 case accessors `xyz$access$idx` [#18907](https://github.com/lampepfl/dotty/pull/18907) +- Presentation-compiler: Add synthetic decorations [#18951](https://github.com/lampepfl/dotty/pull/18951) +- Add compilation unit info to `ClassSymbol` [#19010](https://github.com/lampepfl/dotty/pull/19010) +- Make sure that patches for 3.0 are also applied in later versions [#19018](https://github.com/lampepfl/dotty/pull/19018) + +## Transform + +- Also consider @targetName when checking private overrides [#18361](https://github.com/lampepfl/dotty/pull/18361) +- Teach PostTyper to handle untupled context closures [#17739](https://github.com/lampepfl/dotty/pull/17739) +- Properly dealias tuple types when specializing [#18724](https://github.com/lampepfl/dotty/pull/18724) +- Fix condition in prefixIsElidable to prevent compiler crash [#18924](https://github.com/lampepfl/dotty/pull/18924) +- Fix #18816: Transfer the span of rewired `This` nodes in `fullyParameterizedDef`. [#18840](https://github.com/lampepfl/dotty/pull/18840) +- List(...) optimization to avoid intermediate array [#17166](https://github.com/lampepfl/dotty/pull/17166) +- Make Array.apply an intrinsic [#18537](https://github.com/lampepfl/dotty/pull/18537) +- Add missing span to extension method select [#18557](https://github.com/lampepfl/dotty/pull/18557) + +## Tuples + +- Handle TupleXXL in match analysis [#19212](https://github.com/lampepfl/dotty/pull/19212) +- Add `reverse` method to `NonEmptyTuple` [#13752](https://github.com/lampepfl/dotty/pull/13752) +- Refine handling of pattern binders for large tuples [#19085](https://github.com/lampepfl/dotty/pull/19085) +- Introduce `Tuple.ReverseOnto` and use it in `Tuple.reverse` [#19183](https://github.com/lampepfl/dotty/pull/19183) + +## Typeclass Derivation + +- Consider all parents when checking access to the children of a sum [#19083](https://github.com/lampepfl/dotty/pull/19083) + +## Typer + +- Fix logic when comparing var/def bindings with val refinements [#18049](https://github.com/lampepfl/dotty/pull/18049) +- Fix variance checking in refinements [#18053](https://github.com/lampepfl/dotty/pull/18053) +- Fix accessibleType for package object prefixes [#18057](https://github.com/lampepfl/dotty/pull/18057) +- Refix avoid GADT casting with ProtoTypes [#18085](https://github.com/lampepfl/dotty/pull/18085) +- Avoid shadowing by private definitions in more situations [#18142](https://github.com/lampepfl/dotty/pull/18142) +- Refine infoDependsOnPrefix [#18204](https://github.com/lampepfl/dotty/pull/18204) +- Fix spurious subtype check pruning when both sides have unions [#18213](https://github.com/lampepfl/dotty/pull/18213) +- Reimplement support for type aliases in SAM types [#18317](https://github.com/lampepfl/dotty/pull/18317) +- Fix adaptation of constants to constant type aliases [#18360](https://github.com/lampepfl/dotty/pull/18360) +- Issue "positional after named argument" errors [#18363](https://github.com/lampepfl/dotty/pull/18363) +- Deprecate `ops.long.S` [#18426](https://github.com/lampepfl/dotty/pull/18426) +- Tweak selection from self types [#18467](https://github.com/lampepfl/dotty/pull/18467) +- Use the unwidened type when casting structural calls [#18527](https://github.com/lampepfl/dotty/pull/18527) +- Fix #18649: Use loBound of param types when materializing a context function. [#18651](https://github.com/lampepfl/dotty/pull/18651) +- Identify structural trees on Match Type qualifiers [#18765](https://github.com/lampepfl/dotty/pull/18765) +- Tweak approximation of type variables when computing default types [#18798](https://github.com/lampepfl/dotty/pull/18798) +- Admit parametric aliases of classes in parent typing [#18849](https://github.com/lampepfl/dotty/pull/18849) +- Also add privateWithin when creating constructor proxies [#18893](https://github.com/lampepfl/dotty/pull/18893) +- Revert part of `Simplify defn.FunctionOf.unapply` [#19012](https://github.com/lampepfl/dotty/pull/19012) +- Check @targetName when subtyping Refined Types [#19081](https://github.com/lampepfl/dotty/pull/19081) +- Record failures to adapt application arguments [#18269](https://github.com/lampepfl/dotty/pull/18269) +- Improve handling of AndTypes on the LHS of subtype comparisons [#18235](https://github.com/lampepfl/dotty/pull/18235) +- Allow inferred parameter types always, when eta-expanding [#18771](https://github.com/lampepfl/dotty/pull/18771) +- Fix failing bounds check on default getter [#18419](https://github.com/lampepfl/dotty/pull/18419) +- Use constructor's default getters in case class synthetic `apply` methods [#18716](https://github.com/lampepfl/dotty/pull/18716) +- Keep qualifier of Ident when selecting setter [#18714](https://github.com/lampepfl/dotty/pull/18714) +- Retract SynthesizeExtMethodReceiver mode when when going deeper in overloading resolution [#18759](https://github.com/lampepfl/dotty/pull/18759) +- Constant fold all the number conversion methods [#17446](https://github.com/lampepfl/dotty/pull/17446) +- Refine criterion when to widen types [#17180](https://github.com/lampepfl/dotty/pull/17180) +- Run all MatchType reduction under Mode.Type [#17937](https://github.com/lampepfl/dotty/pull/17937) +- Force consistent MT post-redux normalisation, disallow infinite match types [#18073](https://github.com/lampepfl/dotty/pull/18073) +- Fix #17467: Limit isNullable widening to stable TermRefs; remove under explicit nulls. [#17470](https://github.com/lampepfl/dotty/pull/17470) +- Disallow naming the root package, except for selections [#18187](https://github.com/lampepfl/dotty/pull/18187) +- Contextual varargs parameters [#18186](https://github.com/lampepfl/dotty/pull/18186) +- Encode the name of the attribute in Selectable.selectDynamic [#18928](https://github.com/lampepfl/dotty/pull/18928) +- Remove linearization requirement for override ref checks from java classes [#18953](https://github.com/lampepfl/dotty/pull/18953) +- Fix type inferencing (constraining) regressions [#19189](https://github.com/lampepfl/dotty/pull/19189) +- Repeated params must correspond in override [#16836](https://github.com/lampepfl/dotty/pull/16836) +- Convert SAM result types to function types [#17740](https://github.com/lampepfl/dotty/pull/17740) +- Disallow `infix` objects [#17966](https://github.com/lampepfl/dotty/pull/17966) +- Fix hasMatchingMember handling NoDenotation [#17977](https://github.com/lampepfl/dotty/pull/17977) +- Fix: disallow toplevel infix definitions for vals, vars, givens, methods and implicits [#17994](https://github.com/lampepfl/dotty/pull/17994) +- Curried methods are not valid SAM methods [#18110](https://github.com/lampepfl/dotty/pull/18110) +- Fix #17115: Try to normalize while computing `typeSize`. [#18386](https://github.com/lampepfl/dotty/pull/18386) +- Add default arguments to derived refined type [#18435](https://github.com/lampepfl/dotty/pull/18435) +- Handle dependent context functions [#18443](https://github.com/lampepfl/dotty/pull/18443) +- Fix variance loophole for private vars [#18693](https://github.com/lampepfl/dotty/pull/18693) +- Avoid crash arising from trying to find conversions from polymorphic singleton types [#18760](https://github.com/lampepfl/dotty/pull/18760) +- Allow inner classes of universal traits [#18796](https://github.com/lampepfl/dotty/pull/18796) +- Prevent crash when extension not found [#18830](https://github.com/lampepfl/dotty/pull/18830) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.3.1..3.4.0-RC1` these are: + +``` + 458 Martin Odersky + 291 Nicolas Stucki + 132 Fengyun Liu + 118 Dale Wijnand + 77 Jamie Thompson + 69 Sébastien Doeraene + 49 Paweł Marks + 32 Chris Kipp + 27 Guillaume Martres + 26 Rikito Taniguchi + 21 Yichen Xu + 19 EnzeXing + 14 Szymon Rodziewicz + 13 Lucas Leblanc + 12 Jakub Ciesluk + 12 Jędrzej Rochala + 12 Katarzyna Marek + 11 Carl + 10 David Hua + 9 Florian3k + 9 Wojciech Mazur + 8 Eugene Flesselle + 8 ghostbuster91 + 7 Hamza Remmal + 7 Ondrej Lhotak + 7 Quentin Bernet + 6 Jan Chyb + 6 Julien Richard-Foy + 6 Kacper Korban + 6 Seth Tisue + 5 Lorenzo Gabriele + 5 Matt Bovel + 5 Som Snytt + 5 Yuito Murase + 5 dependabot[bot] + 3 David + 3 Lucas + 3 Pascal Weisenburger + 3 Tomasz Godzik + 2 Aleksander Rainko + 2 Decel + 2 Guillaume Raffin + 2 Ondřej Lhoták + 2 Oron Port + 2 danecek + 2 rochala + 1 Adam Dąbrowski + 1 Aleksey Troitskiy + 1 Arnout Engelen + 1 Ausmarton Zarino Fernandes + 1 Bjorn Regnell + 1 Daniel Esik + 1 Eugene Yokota + 1 François Monniot + 1 Jakub Cieśluk + 1 John Duffell + 1 John M. Higgins + 1 Justin Reardon + 1 Kai + 1 Kisaragi + 1 Lucas Nouguier + 1 Lukas Rytz + 1 LydiaSkuse + 1 Martin Kucera + 1 Martin Kučera + 1 Matthew Rooney + 1 Matthias Kurz + 1 Mikołaj Fornal + 1 Nicolas Almerge + 1 Preveen P + 1 Shardul Chiplunkar + 1 Stefan Wachter + 1 philippus + 1 q-ata + 1 slim +``` diff --git a/changelogs/3.4.0-RC2.md b/changelogs/3.4.0-RC2.md new file mode 100644 index 000000000000..84d85e19efb0 --- /dev/null +++ b/changelogs/3.4.0-RC2.md @@ -0,0 +1,22 @@ +# Backported fixes + +- Fix expandParam's use of argForParam/isArgPrefixOf. [#19412](https://github.com/lampepfl/dotty/pull/19412) +- Remove ascriptionVarargsUnpacking as we never used it [#19399](https://github.com/lampepfl/dotty/pull/19399) +- Make explicit arguments for context bounds an error from 3.5 [#19316](https://github.com/lampepfl/dotty/pull/19316) +- Avoid generating given definitions that loop [#19282](https://github.com/lampepfl/dotty/pull/19282) +- Turn given loop prevention on for -source future [#19392](https://github.com/lampepfl/dotty/pull/19392) +- Fix algorithm to prevent recursive givens [#19411](https://github.com/lampepfl/dotty/pull/19411) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.0-RC1..3.4.0-RC2` these are: + +``` + 15 Martin Odersky + 4 Nicolas Stucki + 3 Paweł Marks + 1 Dale Wijnand + 1 Jan Chyb +``` diff --git a/changelogs/3.4.0-RC3.md b/changelogs/3.4.0-RC3.md new file mode 100644 index 000000000000..57b360d2399c --- /dev/null +++ b/changelogs/3.4.0-RC3.md @@ -0,0 +1,17 @@ +# Backported fixes + +- Sync language.scala with main and backport "Add tests for context bounds migration" [#19515] (https://github.com/lampepfl/dotty/pull/19515) +- Handle default implicits to context parameters under -3.4-migration [#19512] (https://github.com/lampepfl/dotty/pull/19512) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.0-RC2..3.4.0-RC3` these are: + +``` + 4 Paweł Marks + 1 Martin Odersky + 1 Nicolas Stucki + +``` diff --git a/changelogs/3.4.0-RC4.md b/changelogs/3.4.0-RC4.md new file mode 100644 index 000000000000..ecbcdabdd586 --- /dev/null +++ b/changelogs/3.4.0-RC4.md @@ -0,0 +1,14 @@ +# Backported fixes + +- Update jsoup dependency of Scaladoc to 7.2 [#19584](https://github.com/lampepfl/dotty/pull/19584) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.0-RC3..3.4.0-RC4` these are: + +``` + 2 Paweł Marks + 1 Fabián Heredia Montiel +``` diff --git a/changelogs/3.4.0.md b/changelogs/3.4.0.md new file mode 100644 index 000000000000..cf6ee8d010d5 --- /dev/null +++ b/changelogs/3.4.0.md @@ -0,0 +1,474 @@ +# Highlights of the release + +- Make polymorphic functions more efficient and expressive [#17548](https://github.com/lampepfl/dotty/pull/17548) +- SIP-56: Better foundations for match types [#18262](https://github.com/lampepfl/dotty/pull/18262) +- Make SIP 54 (Multi-Source Extension Overloads) a standard feature [#17441](https://github.com/lampepfl/dotty/pull/17441) +- Value parameter inference for polymorphic lambdas [#18041](https://github.com/lampepfl/dotty/pull/18041) +- Add `@publicInBinary` annotation and `-WunstableInlineAccessors` linting flag [#18402](https://github.com/lampepfl/dotty/pull/18402) +- Stabilize Quotes `defn.PolyFunction` [#18480](https://github.com/lampepfl/dotty/pull/18480) +- Stabilize Quotes `Flags.AbsOverride` [#18482](https://github.com/lampepfl/dotty/pull/18482) +- Add `-experimental` compiler flags [#18571](https://github.com/lampepfl/dotty/pull/18571) +- Stabilize SIP-53 (quote pattern explicit type variable syntax) [#18574](https://github.com/lampepfl/dotty/pull/18574) +- Add reflect TypeRepr.dealiasKeepOpaques [#18583](https://github.com/lampepfl/dotty/pull/18583) +- Add attributes section to TASTy and use it for Stdlib TASTy [#18599](https://github.com/lampepfl/dotty/pull/18599) +- Error when reading class file with unknown newer jdk version [#18618](https://github.com/lampepfl/dotty/pull/18618) +- Add support for xsbti.compile.CompileProgress [#18739](https://github.com/lampepfl/dotty/pull/18739) +- Improve type inference for functions like fold [#18780](https://github.com/lampepfl/dotty/pull/18780) +- Improve error message for mismatched tasty versions, allow configuration of header unpickler [#18828](https://github.com/lampepfl/dotty/pull/18828) +- In 3.4 make refutable patterns in a for comprehension an error [#18842](https://github.com/lampepfl/dotty/pull/18842) +- Disallow use of PolyFunction in user code [#18920](https://github.com/lampepfl/dotty/pull/18920) +- Store source file in TASTY attributes [#18948](https://github.com/lampepfl/dotty/pull/18948) +- First step to pipelining support - enable reading Java symbols from TASTy [#19074](https://github.com/lampepfl/dotty/pull/19074) +- Activate constrainResult fix in 3.4 [#19253](https://github.com/lampepfl/dotty/pull/19253) +- Parallelise JVM backend - Scala 2 port [#15392](https://github.com/lampepfl/dotty/pull/15392) +- Avoid generating given definitions that loop [#19282](https://github.com/lampepfl/dotty/pull/19282) + +## Deprecation warnings for old syntax + +- `_` type wildcards [#18813](https://github.com/lampepfl/dotty/pull/18813) +- `private[this]` [#18819](https://github.com/lampepfl/dotty/pull/18819) +- `var x = _` [#18821](https://github.com/lampepfl/dotty/pull/18821) +- `with` as a type operator [#18837](https://github.com/lampepfl/dotty/pull/18837) +- `xs: _*` varargs [#18872](https://github.com/lampepfl/dotty/pull/18872) +- trailing `_` to force eta expansion [#18926](https://github.com/lampepfl/dotty/pull/18926) +- Make explicit arguments for context bounds an error from 3.5 [#19316](https://github.com/lampepfl/dotty/pull/19316) + +# Other changes and fixes + +## Backend + +- Count size of parameters for platform limit check [#18464](https://github.com/lampepfl/dotty/pull/18464) +- Don't emit line number for synthetic unit value [#18717](https://github.com/lampepfl/dotty/pull/18717) +- Avoid too eager transform of $outer for lhs & accessor rhs [#18949](https://github.com/lampepfl/dotty/pull/18949) +- Make more anonymous functions static [#19251](https://github.com/lampepfl/dotty/pull/19251) +- Fix deadlock in initialization of CoreBTypes using Lazy container [#19298](https://github.com/lampepfl/dotty/pull/19298) +- Fix #18769: Allow HK type args in Java signatures. [#18883](https://github.com/lampepfl/dotty/pull/18883) +- Loading symbols from TASTy files directly [#17594](https://github.com/lampepfl/dotty/pull/17594) +- Use dedicated equals method for univerval equality of chars [#18770](https://github.com/lampepfl/dotty/pull/18770) + +## Erasure + +- Get generic signature of fields entered after erasure from their accessor [#19207](https://github.com/lampepfl/dotty/pull/19207) +- Detect case where two alternatives are the same after widening ExprTypes [#18787](https://github.com/lampepfl/dotty/pull/18787) +- Improve erased params logic [#18433](https://github.com/lampepfl/dotty/pull/18433) + +## Experimental: Capture Checking + +- Fix capture set variable installation in Setup [#18885](https://github.com/lampepfl/dotty/pull/18885) +- Don't follow opaque aliases when transforming sym info for cc [#18929](https://github.com/lampepfl/dotty/pull/18929) +- Reset `comparersInUse` to zero in `ContextState.reset` [#18915](https://github.com/lampepfl/dotty/pull/18915) +- Special handling of experimental.captureChecking import [#17427](https://github.com/lampepfl/dotty/pull/17427) +- Change handling of curried function types in capture checking [#18131](https://github.com/lampepfl/dotty/pull/18131) +- Fix #18246: correctly compute capture sets in `TypeComparer.glb` [#18254](https://github.com/lampepfl/dotty/pull/18254) +- New capture escape checking based on levels [#18463](https://github.com/lampepfl/dotty/pull/18463) +- A more robust scheme for resetting denotations after Recheck [#18534](https://github.com/lampepfl/dotty/pull/18534) +- A more flexible scheme for handling the universal capability [#18699](https://github.com/lampepfl/dotty/pull/18699) +- Fix potential soundness hole when adding references to a mapped capture set [#18758](https://github.com/lampepfl/dotty/pull/18758) +- Alternative scheme for cc encapsulation [#18899](https://github.com/lampepfl/dotty/pull/18899) +- Make reach refinement shallow [#19171](https://github.com/lampepfl/dotty/pull/19171) + +## F-bounds + +- Don't check bounds of Java applications in Java units [#18054](https://github.com/lampepfl/dotty/pull/18054) + +## GADTs + +- Avoid embedding SelectionProtos in Conversions [#17755](https://github.com/lampepfl/dotty/pull/17755) +- Freeze constraints while calculating GADT full bounds [#18222](https://github.com/lampepfl/dotty/pull/18222) + +## Implicits + +- Followup fix to transparent inline conversion [#18130](https://github.com/lampepfl/dotty/pull/18130) +- Select local implicits over name-imported over wildcard imported [#18203](https://github.com/lampepfl/dotty/pull/18203) +- Fix how implicit candidates are combined [#18321](https://github.com/lampepfl/dotty/pull/18321) +- Improve error message about missing type of context function parameter [#18788](https://github.com/lampepfl/dotty/pull/18788) +- Support implicit arguments before extractor method [#18671](https://github.com/lampepfl/dotty/pull/18671) +- Tweak convertible implicits fix [#18727](https://github.com/lampepfl/dotty/pull/18727) +- Turn given loop prevention on for -source future [#19392](https://github.com/lampepfl/dotty/pull/19392) +- Fix algorithm to prevent recursive givens [#19411](https://github.com/lampepfl/dotty/pull/19411) +- Handle default implicits to context parameters under -3.4-migration [#19512] (https://github.com/lampepfl/dotty/pull/19512) + +## Incremental Compilation + +- Make incremental compilation aware of synthesized mirrors [#18310](https://github.com/lampepfl/dotty/pull/18310) + +## Inference + +- Honour hard unions in lubbing and param replacing [#18680](https://github.com/lampepfl/dotty/pull/18680) + +## Infrastructure + +- Use -Yscala2-library-tasty to add Scala 2 lib TASTY to scalac (internal only) [#18613](https://github.com/lampepfl/dotty/pull/18613) +- Rename `stdlib-bootstrapped-tasty` to `scala2-library-tasty` [#18615](https://github.com/lampepfl/dotty/pull/18615) +- Fix #19286: Freeze rubygems-update at < 3.5.0. [#19288](https://github.com/lampepfl/dotty/pull/19288) + +## Initialization + +- Fix #17997: Handle intersection type as this type of super type [#18069](https://github.com/lampepfl/dotty/pull/18069) +- Add test for issue #17997 affecting the global object initialization checker [#18141](https://github.com/lampepfl/dotty/pull/18141) +- Fix i18624 and add test case for it [#18859](https://github.com/lampepfl/dotty/pull/18859) +- Treat new Array(0) as immutable [#19192](https://github.com/lampepfl/dotty/pull/19192) +- Fix #18407: Ignore Quote/Slice in init checker [#18848](https://github.com/lampepfl/dotty/pull/18848) +- Check safe initialization of static objects [#16970](https://github.com/lampepfl/dotty/pull/16970) +- Pattern match support in checking global objects [#18127](https://github.com/lampepfl/dotty/pull/18127) +- Fix crash in global object initialization checker when select target has no source [#18627](https://github.com/lampepfl/dotty/pull/18627) +- Fix warning underlining in global init checker [#18668](https://github.com/lampepfl/dotty/pull/18668) +- Fix i18629 [#18839](https://github.com/lampepfl/dotty/pull/18839) +- I18628 [#18841](https://github.com/lampepfl/dotty/pull/18841) +- Make safe init checker skip global objects [#18906](https://github.com/lampepfl/dotty/pull/18906) +- Handle local lazy vals properly [#18998](https://github.com/lampepfl/dotty/pull/18998) + +## Inline + +- Fix regression: inline match crash when rhs uses private inlined methods [#18595](https://github.com/lampepfl/dotty/pull/18595) +- Add structural classes of dynamicApply before inlining [#18766](https://github.com/lampepfl/dotty/pull/18766) +- Set missing expansion span for copied inlined node [#18229](https://github.com/lampepfl/dotty/pull/18229) +- Fix `callTrace` of inlined methods [#18738](https://github.com/lampepfl/dotty/pull/18738) + +## Linting + +- Keep tree of type ascriptions of quote pattern splices [#18412](https://github.com/lampepfl/dotty/pull/18412) +- Fix false positive in WUnused for renamed path-dependent imports [#18468](https://github.com/lampepfl/dotty/pull/18468) +- Fix false positive in WUnused for renamed path-dependent imports (2) [#18617](https://github.com/lampepfl/dotty/pull/18617) +- Fix wunused false positive on CanEqual [#18641](https://github.com/lampepfl/dotty/pull/18641) +- Implement -Xlint:private-shadow, type-parameter-shadow [#17622](https://github.com/lampepfl/dotty/pull/17622) +- Fix: reversed wconf parsing order to mirror scala 2 [#18503](https://github.com/lampepfl/dotty/pull/18503) +- Revert Fix false positive in WUnused for renamed path-dependent imports [#18514](https://github.com/lampepfl/dotty/pull/18514) + +## Macro Annotations + +- Enter missing symbols generated by the MacroAnnotation expansion [#18826](https://github.com/lampepfl/dotty/pull/18826) + +## Match Types + +- Allow Tuple.Head and Tuple.Tail to work with EmptyTuple [#17189](https://github.com/lampepfl/dotty/pull/17189) +- Fix match type reduction with avoided types [#18043](https://github.com/lampepfl/dotty/pull/18043) +- Strip LazyRef before calling simplified, in MT reduction [#18218](https://github.com/lampepfl/dotty/pull/18218) +- Fix MT separate compilation bug [#18398](https://github.com/lampepfl/dotty/pull/18398) +- Do not show deprecation warning for `_` in type match case [#18887](https://github.com/lampepfl/dotty/pull/18887) + +## Nullability + +- Improve logic when to emit pattern type error [#18093](https://github.com/lampepfl/dotty/pull/18093) +- Allow nullability flow typing even in presence of pattern match [#18206](https://github.com/lampepfl/dotty/pull/18206) +- Fix #11967: flow typing nullability in pattern matches [#18212](https://github.com/lampepfl/dotty/pull/18212) +- Fix #18282: consider Predef.eq/ne in nullability flow typing [#18299](https://github.com/lampepfl/dotty/pull/18299) +- Make `this.type` nullable again (unless under -Yexplicit-nulls). [#18399](https://github.com/lampepfl/dotty/pull/18399) + +## Opaque Types + +- Type ascribe trees that require opaque type usage [#18101](https://github.com/lampepfl/dotty/pull/18101) + +## Parser + +- Fix selecting terms using _root_ [#18335](https://github.com/lampepfl/dotty/pull/18335) +- Tweak java getlitch not to skip zero [#18491](https://github.com/lampepfl/dotty/pull/18491) +- Fix i18518 [#18520](https://github.com/lampepfl/dotty/pull/18520) +- Only apply `future` patches on `future-migration` [#18820](https://github.com/lampepfl/dotty/pull/18820) +- Parser simple expression error recovery change from `null` to `???` [#19103](https://github.com/lampepfl/dotty/pull/19103) + +## Pattern Matching + +- Fix syntax and parsing of vararg patterns [#18055](https://github.com/lampepfl/dotty/pull/18055) +- Avoid over widening in SpaceEngine [#18252](https://github.com/lampepfl/dotty/pull/18252) +- Fix regression in exhaustivity of HK types [#18303](https://github.com/lampepfl/dotty/pull/18303) +- Fix missing case in isSubspace, which broke reachablility [#18326](https://github.com/lampepfl/dotty/pull/18326) +- Unsuppress unchecked warnings [#18377](https://github.com/lampepfl/dotty/pull/18377) +- Consider extension methods in Space isSameUnapply [#18642](https://github.com/lampepfl/dotty/pull/18642) +- Fix unreachable warning in deeply nested sealed hierarchy [#18706](https://github.com/lampepfl/dotty/pull/18706) +- Remove unnecessary and recursive Space decomposition [#19216](https://github.com/lampepfl/dotty/pull/19216) +- Prioritise sequence-matches over product-sequence-matches [#19260](https://github.com/lampepfl/dotty/pull/19260) +- Propagate constant in result of inline match [#18455](https://github.com/lampepfl/dotty/pull/18455) +- Disable match anaylsis in inlined trees [#19190](https://github.com/lampepfl/dotty/pull/19190) +- Teach provablyDisjoint about AnyKind [#18510](https://github.com/lampepfl/dotty/pull/18510) +- Warn about unchecked type tests in primitive catch cases [#19206](https://github.com/lampepfl/dotty/pull/19206) +- Reprioritise seq-match over product-seq-match [#19277](https://github.com/lampepfl/dotty/pull/19277) +- Fix exhaustivity due to separate TypeVar lambdas [#18616](https://github.com/lampepfl/dotty/pull/18616) + +## Presentation Compiler + +- Support completions for extension definition parameter [#18331](https://github.com/lampepfl/dotty/pull/18331) +- Fix: Don't collect map, flatMap, withFilter in for-comprehension [#18430](https://github.com/lampepfl/dotty/pull/18430) +- Bugfix: Catch exception from the compiler for broken shadowed pickles [#18502](https://github.com/lampepfl/dotty/pull/18502) +- Bugfix: highlight for enum type params [#18528](https://github.com/lampepfl/dotty/pull/18528) +- Bugfix: No signature help for local methods [#18594](https://github.com/lampepfl/dotty/pull/18594) +- Bugfix: add `moduleClass` imported symbols in `IndexedContext` [#18620](https://github.com/lampepfl/dotty/pull/18620) +- Bugfix: Named args completions with default values [#18633](https://github.com/lampepfl/dotty/pull/18633) +- Fix: match completions for type aliases [#18667](https://github.com/lampepfl/dotty/pull/18667) +- Bugfix: add multiline comment completion [#18703](https://github.com/lampepfl/dotty/pull/18703) +- Bugfix: Backticked named arguments [#18704](https://github.com/lampepfl/dotty/pull/18704) +- Bugfix: [metals] Case completions for tuple type [#18751](https://github.com/lampepfl/dotty/pull/18751) +- Completions should prepend, not replace as it is for Scala 2 [#18803](https://github.com/lampepfl/dotty/pull/18803) +- Bugfix: rename end marker [#18838](https://github.com/lampepfl/dotty/pull/18838) +- Presentation compiler: Bugfix for semantic tokens and synthetic decorations [#18955](https://github.com/lampepfl/dotty/pull/18955) +- Show documentation for value forwarders in completions [#19200](https://github.com/lampepfl/dotty/pull/19200) +- Bugfix: Document highlight on class constructors [#19209](https://github.com/lampepfl/dotty/pull/19209) +- Bugfix: Completions for extension methods with name conflict [#19225](https://github.com/lampepfl/dotty/pull/19225) + +## Polyfunctions + +- Check user defined PolyFunction refinements [#18457](https://github.com/lampepfl/dotty/pull/18457) +- Support polymorphic functions with erased parameters [#18293](https://github.com/lampepfl/dotty/pull/18293) +- Use `PolyFunction` instead of `ErasedFunction` [#18295](https://github.com/lampepfl/dotty/pull/18295) + +## Quotes + +- Support type variable with bounds in quoted pattern [#16910](https://github.com/lampepfl/dotty/pull/16910) +- Add new EXPLICITtpt to TASTy format [#17298](https://github.com/lampepfl/dotty/pull/17298) +- Inhibit typer to insert contextual arguments when it is inside arguments of HOAS patterns [#18040](https://github.com/lampepfl/dotty/pull/18040) +- Compile quote patterns directly into QuotePattern AST [#18133](https://github.com/lampepfl/dotty/pull/18133) +- Add missing span to synthesized product mirror [#18354](https://github.com/lampepfl/dotty/pull/18354) +- Improve non-static macro implementation error message [#18405](https://github.com/lampepfl/dotty/pull/18405) +- Fix scala 2 macros in traits with type parameters [#18663](https://github.com/lampepfl/dotty/pull/18663) +- Patch `underlyingArgument` to avoid mapping into modules [#18923](https://github.com/lampepfl/dotty/pull/18923) +- Fallback erasing term references [#18731](https://github.com/lampepfl/dotty/pull/18731) +- Fix ignored type variable bound warning in type quote pattern [#18199](https://github.com/lampepfl/dotty/pull/18199) +- Splice hole with singleton captures [#18357](https://github.com/lampepfl/dotty/pull/18357) +- Fix macros with erased arguments [#18431](https://github.com/lampepfl/dotty/pull/18431) +- Deprecate 3-arg `FunctionClass` constructor [#18472](https://github.com/lampepfl/dotty/pull/18472) +- Deprecate `Quotes` `{MethodType,TermParamClause}.isErased` [#18479](https://github.com/lampepfl/dotty/pull/18479) +- Avoid crashes on missing positions [#19250](https://github.com/lampepfl/dotty/pull/19250) + +## Reflection + +- Add reflect.ValOrDefDef [#16974](https://github.com/lampepfl/dotty/pull/16974) +- Check New tree for ill-formed module instantiations [#17553](https://github.com/lampepfl/dotty/pull/17553) +- Add reflect `TypeLambda.paramVariances` [#17568](https://github.com/lampepfl/dotty/pull/17568) +- Make check flags for `newMethod`, `newVal` and `newBind` in Quotes API less restrictive [#18217](https://github.com/lampepfl/dotty/pull/18217) +- Normalise mirrorType for mirror Synthesis [#19199](https://github.com/lampepfl/dotty/pull/19199) +- Add reflect `defn.FunctionClass` overloads [#16849](https://github.com/lampepfl/dotty/pull/16849) +- Stabilize reflect flag `JavaAnnotation` [#19267](https://github.com/lampepfl/dotty/pull/19267) +- Stabilize reflect `paramVariance` [#19268](https://github.com/lampepfl/dotty/pull/19268) + +## Reporting + +- Take into account the result type of inline implicit conversions unless they are transparent [#17924](https://github.com/lampepfl/dotty/pull/17924) +- Check if a fatal warning issued in typer is silenced, before converting it into an error [#18089](https://github.com/lampepfl/dotty/pull/18089) +- Elide companion defs to a `object` extending `AnyVal` [#18451](https://github.com/lampepfl/dotty/pull/18451) +- Add regression test for issue i18493 [#18497](https://github.com/lampepfl/dotty/pull/18497) +- Add better explanation to error message [#18665](https://github.com/lampepfl/dotty/pull/18665) +- Better error message when accessing private members [#18690](https://github.com/lampepfl/dotty/pull/18690) +- Improve message for discarded pure non-Unit values [#18723](https://github.com/lampepfl/dotty/pull/18723) +- Better error message when a pattern match extractor is not found. [#18725](https://github.com/lampepfl/dotty/pull/18725) +- Give "did you mean ...?" hints also for simple identifiers [#18747](https://github.com/lampepfl/dotty/pull/18747) +- Better error for definition followed by keyword [#18752](https://github.com/lampepfl/dotty/pull/18752) +- Better explain message for 'pattern expected' [#18753](https://github.com/lampepfl/dotty/pull/18753) +- Improve failure message of enum `fromOrdinal`/`valueOf` [#19182](https://github.com/lampepfl/dotty/pull/19182) +- Fix type mismatch error confusion between types with same simple name [#19204](https://github.com/lampepfl/dotty/pull/19204) +- Add hint for nested quotes missing staged `Quotes` [#18755](https://github.com/lampepfl/dotty/pull/18755) +- Better error messages for missing commas and more [#18785](https://github.com/lampepfl/dotty/pull/18785) +- Fix imported twice error messages [#18102](https://github.com/lampepfl/dotty/pull/18102) +- Improve error message for inaccessible types [#18406](https://github.com/lampepfl/dotty/pull/18406) +- Future migration warning for `with` type operator [#18818](https://github.com/lampepfl/dotty/pull/18818) +- Improve assertion error message for `Apply` and `TypeApply` [#18700](https://github.com/lampepfl/dotty/pull/18700) +- Shorten traces for TypeMismatch errors under -explain [#18742]( +- Improve `with` in type migration warning [#18852](https://github.com/lampepfl/dotty/pull/18852) +hub.com/lampepfl/dotty/pull/18742) +- Future migration warning for alphanumeric infix operator [#18908](https://github.com/lampepfl/dotty/pull/18908) +- Make sure that trace is shown correctly in the presence of invalid line numbers [#18930](https://github.com/lampepfl/dotty/pull/18930) +- Add migration warning for XML literals in language future [#19101](https://github.com/lampepfl/dotty/pull/19101) +- Avoid diagnostic message forcing crashing the compiler [#19113](https://github.com/lampepfl/dotty/pull/19113) +- Make sure that the stacktrace is shown with `-Ydebug-unpickling` [#19115](https://github.com/lampepfl/dotty/pull/19115) +- Improve `asExprOf` cast error formatting [#19195](https://github.com/lampepfl/dotty/pull/19195) +- Do not warn on underscore wildcard type in pattern [#19249](https://github.com/lampepfl/dotty/pull/19249) + +## Scala-JS + +- Fix #18658: Handle varargs of generic types in `JSExportsGen`. [#18659](https://github.com/lampepfl/dotty/pull/18659) + +## Scaladoc + +- Fix incorrect comment parser used in nightly scaladoc [#18523](https://github.com/lampepfl/dotty/pull/18523) +- Update jsoup dependency of Scaladoc to 7.2 [#19584](https://github.com/lampepfl/dotty/pull/19584) + +## SemanticDB + +- Export diagnostics (including unused warnings) to SemanticDB [#17835](https://github.com/lampepfl/dotty/pull/17835) +- Bugfix: Incorrect semanticdb span on Selectable [#18576](https://github.com/lampepfl/dotty/pull/18576) +- Bugfix: in semanticdb make synthetic apply disambiguator consistent w/ Scala 2 implicit [#17341](https://github.com/lampepfl/dotty/pull/17341) + +## Standard Library + +- Intrinsify `constValueTuple` and `summonAll` [#18013](https://github.com/lampepfl/dotty/pull/18013) +- Fix #18609: Add language.`3.4` and language.`3.4-migration`. [#18610](https://github.com/lampepfl/dotty/pull/18610) + +## TASTy format + +- Eliminate FromJavaObject from TASTy of Java sources [#19259](https://github.com/lampepfl/dotty/pull/19259) +- Add new HOLETYPES to TASTy format [#17225](https://github.com/lampepfl/dotty/pull/17225) +- Add capture checking attributes to TASTy [#19033](https://github.com/lampepfl/dotty/pull/19033) +- Add TASTyInfo abstraction [#19089](https://github.com/lampepfl/dotty/pull/19089) +- Add UTF8 abstraction in the TASTy format [#19090](https://github.com/lampepfl/dotty/pull/19090) + +## Tooling + +- Don't add explanation twice [#18779](https://github.com/lampepfl/dotty/pull/18779) +- ExtractDependencies uses more efficient caching [#18403](https://github.com/lampepfl/dotty/pull/18403) +- Introduce the SourceVersions 3.4 and 3.4-migration; make 3.4 the default. [#18501](https://github.com/lampepfl/dotty/pull/18501) +- Bugfix: Completions for named args in wrong order [#18702](https://github.com/lampepfl/dotty/pull/18702) +- Align unpickled Scala 2 accessors encoding with Scala 3 [#18874](https://github.com/lampepfl/dotty/pull/18874) +- Reinterpret Scala 2 case accessors `xyz$access$idx` [#18907](https://github.com/lampepfl/dotty/pull/18907) +- Presentation-compiler: Add synthetic decorations [#18951](https://github.com/lampepfl/dotty/pull/18951) +- Add compilation unit info to `ClassSymbol` [#19010](https://github.com/lampepfl/dotty/pull/19010) +- Make sure that patches for 3.0 are also applied in later versions [#19018](https://github.com/lampepfl/dotty/pull/19018) + +## Transform + +- Also consider @targetName when checking private overrides [#18361](https://github.com/lampepfl/dotty/pull/18361) +- Teach PostTyper to handle untupled context closures [#17739](https://github.com/lampepfl/dotty/pull/17739) +- Properly dealias tuple types when specializing [#18724](https://github.com/lampepfl/dotty/pull/18724) +- Fix condition in prefixIsElidable to prevent compiler crash [#18924](https://github.com/lampepfl/dotty/pull/18924) +- Fix #18816: Transfer the span of rewired `This` nodes in `fullyParameterizedDef`. [#18840](https://github.com/lampepfl/dotty/pull/18840) +- List(...) optimization to avoid intermediate array [#17166](https://github.com/lampepfl/dotty/pull/17166) +- Make Array.apply an intrinsic [#18537](https://github.com/lampepfl/dotty/pull/18537) +- Add missing span to extension method select [#18557](https://github.com/lampepfl/dotty/pull/18557) + +## Tuples + +- Handle TupleXXL in match analysis [#19212](https://github.com/lampepfl/dotty/pull/19212) +- Add `reverse` method to `NonEmptyTuple` [#13752](https://github.com/lampepfl/dotty/pull/13752) +- Refine handling of pattern binders for large tuples [#19085](https://github.com/lampepfl/dotty/pull/19085) +- Introduce `Tuple.ReverseOnto` and use it in `Tuple.reverse` [#19183](https://github.com/lampepfl/dotty/pull/19183) + +## Typeclass Derivation + +- Consider all parents when checking access to the children of a sum [#19083](https://github.com/lampepfl/dotty/pull/19083) + +## Typer + +- Fix logic when comparing var/def bindings with val refinements [#18049](https://github.com/lampepfl/dotty/pull/18049) +- Fix variance checking in refinements [#18053](https://github.com/lampepfl/dotty/pull/18053) +- Fix accessibleType for package object prefixes [#18057](https://github.com/lampepfl/dotty/pull/18057) +- Refix avoid GADT casting with ProtoTypes [#18085](https://github.com/lampepfl/dotty/pull/18085) +- Avoid shadowing by private definitions in more situations [#18142](https://github.com/lampepfl/dotty/pull/18142) +- Refine infoDependsOnPrefix [#18204](https://github.com/lampepfl/dotty/pull/18204) +- Fix spurious subtype check pruning when both sides have unions [#18213](https://github.com/lampepfl/dotty/pull/18213) +- Reimplement support for type aliases in SAM types [#18317](https://github.com/lampepfl/dotty/pull/18317) +- Fix adaptation of constants to constant type aliases [#18360](https://github.com/lampepfl/dotty/pull/18360) +- Issue "positional after named argument" errors [#18363](https://github.com/lampepfl/dotty/pull/18363) +- Deprecate `ops.long.S` [#18426](https://github.com/lampepfl/dotty/pull/18426) +- Tweak selection from self types [#18467](https://github.com/lampepfl/dotty/pull/18467) +- Use the unwidened type when casting structural calls [#18527](https://github.com/lampepfl/dotty/pull/18527) +- Fix #18649: Use loBound of param types when materializing a context function. [#18651](https://github.com/lampepfl/dotty/pull/18651) +- Identify structural trees on Match Type qualifiers [#18765](https://github.com/lampepfl/dotty/pull/18765) +- Tweak approximation of type variables when computing default types [#18798](https://github.com/lampepfl/dotty/pull/18798) +- Admit parametric aliases of classes in parent typing [#18849](https://github.com/lampepfl/dotty/pull/18849) +- Also add privateWithin when creating constructor proxies [#18893](https://github.com/lampepfl/dotty/pull/18893) +- Revert part of `Simplify defn.FunctionOf.unapply` [#19012](https://github.com/lampepfl/dotty/pull/19012) +- Check @targetName when subtyping Refined Types [#19081](https://github.com/lampepfl/dotty/pull/19081) +- Record failures to adapt application arguments [#18269](https://github.com/lampepfl/dotty/pull/18269) +- Improve handling of AndTypes on the LHS of subtype comparisons [#18235](https://github.com/lampepfl/dotty/pull/18235) +- Allow inferred parameter types always, when eta-expanding [#18771](https://github.com/lampepfl/dotty/pull/18771) +- Fix failing bounds check on default getter [#18419](https://github.com/lampepfl/dotty/pull/18419) +- Use constructor's default getters in case class synthetic `apply` methods [#18716](https://github.com/lampepfl/dotty/pull/18716) +- Keep qualifier of Ident when selecting setter [#18714](https://github.com/lampepfl/dotty/pull/18714) +- Retract SynthesizeExtMethodReceiver mode when when going deeper in overloading resolution [#18759](https://github.com/lampepfl/dotty/pull/18759) +- Constant fold all the number conversion methods [#17446](https://github.com/lampepfl/dotty/pull/17446) +- Refine criterion when to widen types [#17180](https://github.com/lampepfl/dotty/pull/17180) +- Run all MatchType reduction under Mode.Type [#17937](https://github.com/lampepfl/dotty/pull/17937) +- Force consistent MT post-redux normalisation, disallow infinite match types [#18073](https://github.com/lampepfl/dotty/pull/18073) +- Fix #17467: Limit isNullable widening to stable TermRefs; remove under explicit nulls. [#17470](https://github.com/lampepfl/dotty/pull/17470) +- Disallow naming the root package, except for selections [#18187](https://github.com/lampepfl/dotty/pull/18187) +- Contextual varargs parameters [#18186](https://github.com/lampepfl/dotty/pull/18186) +- Encode the name of the attribute in Selectable.selectDynamic [#18928](https://github.com/lampepfl/dotty/pull/18928) +- Remove linearization requirement for override ref checks from java classes [#18953](https://github.com/lampepfl/dotty/pull/18953) +- Fix type inferencing (constraining) regressions [#19189](https://github.com/lampepfl/dotty/pull/19189) +- Repeated params must correspond in override [#16836](https://github.com/lampepfl/dotty/pull/16836) +- Convert SAM result types to function types [#17740](https://github.com/lampepfl/dotty/pull/17740) +- Disallow `infix` objects [#17966](https://github.com/lampepfl/dotty/pull/17966) +- Fix hasMatchingMember handling NoDenotation [#17977](https://github.com/lampepfl/dotty/pull/17977) +- Fix: disallow toplevel infix definitions for vals, vars, givens, methods and implicits [#17994](https://github.com/lampepfl/dotty/pull/17994) +- Curried methods are not valid SAM methods [#18110](https://github.com/lampepfl/dotty/pull/18110) +- Fix #17115: Try to normalize while computing `typeSize`. [#18386](https://github.com/lampepfl/dotty/pull/18386) +- Add default arguments to derived refined type [#18435](https://github.com/lampepfl/dotty/pull/18435) +- Handle dependent context functions [#18443](https://github.com/lampepfl/dotty/pull/18443) +- Fix variance loophole for private vars [#18693](https://github.com/lampepfl/dotty/pull/18693) +- Avoid crash arising from trying to find conversions from polymorphic singleton types [#18760](https://github.com/lampepfl/dotty/pull/18760) +- Allow inner classes of universal traits [#18796](https://github.com/lampepfl/dotty/pull/18796) +- Prevent crash when extension not found [#18830](https://github.com/lampepfl/dotty/pull/18830) +- Fix expandParam's use of argForParam/isArgPrefixOf. [#19412](https://github.com/lampepfl/dotty/pull/19412) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.3.1..3.4.0` these are: + +``` + 474 Martin Odersky + 296 Nicolas Stucki + 132 Fengyun Liu + 119 Dale Wijnand + 77 Jamie Thompson + 69 Sébastien Doeraene + 60 Paweł Marks + 32 Chris Kipp + 27 Guillaume Martres + 26 Rikito Taniguchi + 21 Yichen Xu + 19 EnzeXing + 14 Szymon Rodziewicz + 13 Lucas Leblanc + 12 Jakub Ciesluk + 12 Jędrzej Rochala + 12 Katarzyna Marek + 11 Carl + 10 David Hua + 9 Florian3k + 9 Wojciech Mazur + 8 Eugene Flesselle + 8 ghostbuster91 + 7 Hamza Remmal + 7 Jan Chyb + 7 Ondrej Lhotak + 7 Quentin Bernet + 6 Julien Richard-Foy + 6 Kacper Korban + 6 Seth Tisue + 5 Lorenzo Gabriele + 5 Matt Bovel + 5 Som Snytt + 5 Yuito Murase + 5 dependabot[bot] + 3 David + 3 Lucas + 3 Pascal Weisenburger + 3 Tomasz Godzik + 2 Aleksander Rainko + 2 Decel + 2 Guillaume Raffin + 2 Ondřej Lhoták + 2 Oron Port + 2 danecek + 2 rochala + 1 Adam Dąbrowski + 1 Aleksey Troitskiy + 1 Arnout Engelen + 1 Ausmarton Zarino Fernandes + 1 Bjorn Regnell + 1 Daniel Esik + 1 Eugene Yokota + 1 Fabián Heredia Montiel + 1 François Monniot + 1 Jakub Cieśluk + 1 John Duffell + 1 John M. Higgins + 1 Justin Reardon + 1 Kai + 1 Kisaragi + 1 Lucas Nouguier + 1 Lukas Rytz + 1 LydiaSkuse + 1 Martin Kucera + 1 Martin Kučera + 1 Matthew Rooney + 1 Matthias Kurz + 1 Mikołaj Fornal + 1 Nicolas Almerge + 1 Preveen P + 1 Shardul Chiplunkar + 1 Stefan Wachter + 1 philippus + 1 q-ata + 1 slim +``` diff --git a/changelogs/3.4.1-RC1.md b/changelogs/3.4.1-RC1.md new file mode 100644 index 000000000000..f374c6768497 --- /dev/null +++ b/changelogs/3.4.1-RC1.md @@ -0,0 +1,190 @@ +# Highlights of the release + +- Add support for `@deprecatedInheritance` [#19082](https://github.com/lampepfl/dotty/pull/19082) +- Avoid generating given definitions that loop [#19282](https://github.com/lampepfl/dotty/pull/19282) + +# Other changes and fixes + +## Coverage + +- Correctly prettify names in coverage info [#18542](https://github.com/lampepfl/dotty/pull/18542) + +## Desugaring + +- Make apply proxies work with overloaded ctors [#19464](https://github.com/lampepfl/dotty/pull/19464) +- Fix possible crash in Desugar [#19567](https://github.com/lampepfl/dotty/pull/19567) + +## Documentation + +- Update `private[this]` deprecation warning and documentation [#19393](https://github.com/lampepfl/dotty/pull/19393) + +## Erasure + +- Make eraseInfo work for classes with EmptyScopes [#19550](https://github.com/lampepfl/dotty/pull/19550) + +## Exports + +- Do not propagate `@tailrec` to exported methods [#19509](https://github.com/lampepfl/dotty/pull/19509) +- Fix retained flags in exports [#19636](https://github.com/lampepfl/dotty/pull/19636) + +## GADTs + +- Only cache base types when gadt state is empty [#19562](https://github.com/lampepfl/dotty/pull/19562) + +## Implicits + +- Run CheckStatic after UncacheGivenAliases [#19318](https://github.com/lampepfl/dotty/pull/19318) +- Add tests to verify that crash is fixed elsewhere. Fixes #19328 [#19329](https://github.com/lampepfl/dotty/pull/19329) +- Don't search for implicit conversions to NoType [#19563](https://github.com/lampepfl/dotty/pull/19563) +- Instantiate argument type vars before implicit search [#19096](https://github.com/lampepfl/dotty/pull/19096) + +## Java Interop + +- Classfile reader: handle JDK 9+ constant types in constant pool [#19533](https://github.com/lampepfl/dotty/pull/19533) + +## Linting + +- Make fatal warnings not fail compilation early & aggregate warns [#19245](https://github.com/lampepfl/dotty/pull/19245) + +## Macro Annotations + +- Check and enter missing symbols in MacroAnnotations only for definitions [#19579](https://github.com/lampepfl/dotty/pull/19579) + +## Match Types + +- Normalize MatchAlias in unrollTupleTypes [#19565](https://github.com/lampepfl/dotty/pull/19565) +- Fix #19445: Remove too-strict test in match type matching. [#19511](https://github.com/lampepfl/dotty/pull/19511) + +## Opaque Types + +- Fix problems with cycle checks [#19453](https://github.com/lampepfl/dotty/pull/19453) + +## Parser + +- Fix(#18265): crash on extension method without type nor RHS [#18743](https://github.com/lampepfl/dotty/pull/18743) +- Warn when @volatile is used on vals [#19462](https://github.com/lampepfl/dotty/pull/19462) +- Fix(#16459) xml parse regression [#19531](https://github.com/lampepfl/dotty/pull/19531) + +## Pattern Matching + +- Fix false unreachable due to opaqueness [#19368](https://github.com/lampepfl/dotty/pull/19368) +- Improve recursive decompose prefix fix [#19375](https://github.com/lampepfl/dotty/pull/19375) +- Allow constraining a parameter to Nothing [#19397](https://github.com/lampepfl/dotty/pull/19397) +- Add a test case, proving i15661 is fixed [#19432](https://github.com/lampepfl/dotty/pull/19432) + +## Presentation Compiler + +- Improvement: Support completions for implicit classes [#19314](https://github.com/lampepfl/dotty/pull/19314) +- Chore: Backport changes from Metals [#19410](https://github.com/lampepfl/dotty/pull/19410) +- Fix goto-def on exported forwarders [#19494](https://github.com/lampepfl/dotty/pull/19494) +- Backport pc changes from metals [#19617](https://github.com/lampepfl/dotty/pull/19617) +- Chore: Backport changes from Metals [#19592](https://github.com/lampepfl/dotty/pull/19592) +- Use comma counting for all signature help types [#19520](https://github.com/lampepfl/dotty/pull/19520) +- Make PC more resilient to crashes [#19488](https://github.com/lampepfl/dotty/pull/19488) +- Make order of renames and missing imports deterministic [#19468](https://github.com/lampepfl/dotty/pull/19468) +- Chore: backport changes from metals [#19452](https://github.com/lampepfl/dotty/pull/19452) +- Improve signature help by more stable position calculation + better named arg support [#19214](https://github.com/lampepfl/dotty/pull/19214) +- Instantiate Type Vars in completion labels of extension methods [#18914](https://github.com/lampepfl/dotty/pull/18914) + +## Quotes + +- Only evaluate transparent inline unapply once [#19380](https://github.com/lampepfl/dotty/pull/19380) +- Update `staging.Compiler.make` documentation [#19428](https://github.com/lampepfl/dotty/pull/19428) +- Error instead of StaleSymbol crash for certain cyclic macro dependencies [#19549](https://github.com/lampepfl/dotty/pull/19549) +- Refine handling of StaleSymbol type errors [#19605](https://github.com/lampepfl/dotty/pull/19605) +- Fix module symbol recovery from `NoClassDefFoundError` [#19645](https://github.com/lampepfl/dotty/pull/19645) +- Fix HOAS pattern example and error message [#19655](https://github.com/lampepfl/dotty/pull/19655) +- Set the correct type when copying reflect Inlined trees [#19409](https://github.com/lampepfl/dotty/pull/19409) + +## Reporting + +- Don't explain erroneous bounds [#19338](https://github.com/lampepfl/dotty/pull/19338) +- Better error diagnostics for cyclic references [#19408](https://github.com/lampepfl/dotty/pull/19408) +- Properly identify empty bounds in error message [#19310](https://github.com/lampepfl/dotty/pull/19310) + +## Scala-JS + +- Fix #19528: Actually remove Dynamic from interfaces of native JS classes. [#19536](https://github.com/lampepfl/dotty/pull/19536) +- Consider static and non-static methods as non-double def [#19400](https://github.com/lampepfl/dotty/pull/19400) + +## Scaladoc + +- Scaladoc - add option for dynamic side menu [#19337](https://github.com/lampepfl/dotty/pull/19337) +- Scaladoc: Fix "case case Foo" in enum's cases [#19519](https://github.com/lampepfl/dotty/pull/19519) +- Fix(#19377): show inherited abstract members in dedicated section [#19552](https://github.com/lampepfl/dotty/pull/19552) +- Jsoup: 1.14.3 → 1.17.2 [#19564](https://github.com/lampepfl/dotty/pull/19564) +- Extend copyright into 2024 [#19367](https://github.com/lampepfl/dotty/pull/19367) + +## Tooling + +- Prioritize TASTy files over classfiles on classpath aggregation [#19431](https://github.com/lampepfl/dotty/pull/19431) + +## Transform + +- Fix purity check for val inside of object [#19598](https://github.com/lampepfl/dotty/pull/19598) +- Drop special treatment of function types in overloading resolution [#19654](https://github.com/lampepfl/dotty/pull/19654) +- Add checks for the consistency of the parents in TreeChecker [#18935](https://github.com/lampepfl/dotty/pull/18935) + +## Type Inference + +- More careful type variable instance improvements [#19659](https://github.com/lampepfl/dotty/pull/19659) + +## Typer + +- Reject wildcard types in using clauses [#19459](https://github.com/lampepfl/dotty/pull/19459) +- Don't leave underspecified SAM types in the code [#19461](https://github.com/lampepfl/dotty/pull/19461) +- Also compute base classes of wildcardTypes [#19465](https://github.com/lampepfl/dotty/pull/19465) +- Fix(#15784): ident rule for pat match was too strict [#19501](https://github.com/lampepfl/dotty/pull/19501) +- Heal occurrences of => T between ElimByName and Erasure [#19558](https://github.com/lampepfl/dotty/pull/19558) +- Fix(#i18645): overload ext method body in braces didn't compile [#19651](https://github.com/lampepfl/dotty/pull/19651) +- Fix #19202: Passing NotNullInfos to a mutable field of a Completer [#19463](https://github.com/lampepfl/dotty/pull/19463) +- Fix Java record problems (#19578) and (#19386) [#19583](https://github.com/lampepfl/dotty/pull/19583) +- Improve when deprecation warnings are emitted [#19621](https://github.com/lampepfl/dotty/pull/19621) +- Space: Replace showType & make Space Showable [#19370](https://github.com/lampepfl/dotty/pull/19370) + + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.0..3.4.1-RC1` these are: + +``` + 53 Martin Odersky + 53 Nicolas Stucki + 20 Dale Wijnand + 11 Szymon Rodziewicz + 11 i10416 + 7 noti0na1 + 6 Yilin Wei + 4 Hamza REMMAL + 4 Jędrzej Rochala + 3 Eugene Flesselle + 3 Paweł Marks + 3 Seth Tisue + 2 Florian3k + 2 Hamza Remmal + 2 Jan Chyb + 2 Katarzyna Marek + 2 Sébastien Doeraene + 2 Tomasz Godzik + 2 dependabot[bot] + 1 Bersier + 1 Fabián Heredia Montiel + 1 Jakub Ciesluk + 1 Jakub Cieśluk + 1 Kacper Korban + 1 Kenji Yoshida + 1 Mehdi Alaoui + 1 Nikita Gazarov + 1 Oron Port + 1 Pascal Weisenburger + 1 Philippus Baalman + 1 Quentin Bernet + 1 Som Snytt + 1 Wojciech Mazur + 1 Yichen Xu + 1 aherlihy + 1 rochala + +``` diff --git a/changelogs/3.4.1-RC2.md b/changelogs/3.4.1-RC2.md new file mode 100644 index 000000000000..7267d2339c35 --- /dev/null +++ b/changelogs/3.4.1-RC2.md @@ -0,0 +1,18 @@ +# Backported fixes + +- Adjust owner in Interactive.contextOfPath causing crash in ImplicitSearch [#19875](https://github.com/lampepfl/dotty/pull/19875) +- Add GADT symbols when typing typing-ahead lambda bodies[#19644](https://github.com/lampepfl/dotty/pull/19644) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.1-RC1..3.4.1-RC2` these are: + +``` + 4 Hamza REMMAL + 2 Dale Wijnand + 2 Paweł Marks + 1 Jędrzej Rochala + +``` diff --git a/changelogs/3.4.1.md b/changelogs/3.4.1.md new file mode 100644 index 000000000000..920c78f61e8f --- /dev/null +++ b/changelogs/3.4.1.md @@ -0,0 +1,192 @@ +# Highlights of the release + +- Add support for `@deprecatedInheritance` [#19082](https://github.com/lampepfl/dotty/pull/19082) +- Avoid generating given definitions that loop [#19282](https://github.com/lampepfl/dotty/pull/19282) + +# Other changes and fixes + +## Coverage + +- Correctly prettify names in coverage info [#18542](https://github.com/lampepfl/dotty/pull/18542) + +## Desugaring + +- Make apply proxies work with overloaded ctors [#19464](https://github.com/lampepfl/dotty/pull/19464) +- Fix possible crash in Desugar [#19567](https://github.com/lampepfl/dotty/pull/19567) + +## Documentation + +- Update `private[this]` deprecation warning and documentation [#19393](https://github.com/lampepfl/dotty/pull/19393) + +## Erasure + +- Make eraseInfo work for classes with EmptyScopes [#19550](https://github.com/lampepfl/dotty/pull/19550) + +## Exports + +- Do not propagate `@tailrec` to exported methods [#19509](https://github.com/lampepfl/dotty/pull/19509) +- Fix retained flags in exports [#19636](https://github.com/lampepfl/dotty/pull/19636) + +## GADTs + +- Only cache base types when gadt state is empty [#19562](https://github.com/lampepfl/dotty/pull/19562) +- Add GADT symbols when typing typing-ahead lambda bodies[#19644](https://github.com/lampepfl/dotty/pull/19644) + +## Implicits + +- Run CheckStatic after UncacheGivenAliases [#19318](https://github.com/lampepfl/dotty/pull/19318) +- Add tests to verify that crash is fixed elsewhere. Fixes #19328 [#19329](https://github.com/lampepfl/dotty/pull/19329) +- Don't search for implicit conversions to NoType [#19563](https://github.com/lampepfl/dotty/pull/19563) +- Instantiate argument type vars before implicit search [#19096](https://github.com/lampepfl/dotty/pull/19096) +- Adjust owner in Interactive.contextOfPath causing crash in ImplicitSearch [#19875](https://github.com/lampepfl/dotty/pull/19875) + +## Java Interop + +- Classfile reader: handle JDK 9+ constant types in constant pool [#19533](https://github.com/lampepfl/dotty/pull/19533) + +## Linting + +- Make fatal warnings not fail compilation early & aggregate warns [#19245](https://github.com/lampepfl/dotty/pull/19245) + +## Macro Annotations + +- Check and enter missing symbols in MacroAnnotations only for definitions [#19579](https://github.com/lampepfl/dotty/pull/19579) + +## Match Types + +- Normalize MatchAlias in unrollTupleTypes [#19565](https://github.com/lampepfl/dotty/pull/19565) +- Fix #19445: Remove too-strict test in match type matching. [#19511](https://github.com/lampepfl/dotty/pull/19511) + +## Opaque Types + +- Fix problems with cycle checks [#19453](https://github.com/lampepfl/dotty/pull/19453) + +## Parser + +- Fix(#18265): crash on extension method without type nor RHS [#18743](https://github.com/lampepfl/dotty/pull/18743) +- Warn when @volatile is used on vals [#19462](https://github.com/lampepfl/dotty/pull/19462) +- Fix(#16459) xml parse regression [#19531](https://github.com/lampepfl/dotty/pull/19531) + +## Pattern Matching + +- Fix false unreachable due to opaqueness [#19368](https://github.com/lampepfl/dotty/pull/19368) +- Improve recursive decompose prefix fix [#19375](https://github.com/lampepfl/dotty/pull/19375) +- Allow constraining a parameter to Nothing [#19397](https://github.com/lampepfl/dotty/pull/19397) +- Add a test case, proving i15661 is fixed [#19432](https://github.com/lampepfl/dotty/pull/19432) + +## Presentation Compiler + +- Improvement: Support completions for implicit classes [#19314](https://github.com/lampepfl/dotty/pull/19314) +- Chore: Backport changes from Metals [#19410](https://github.com/lampepfl/dotty/pull/19410) +- Fix goto-def on exported forwarders [#19494](https://github.com/lampepfl/dotty/pull/19494) +- Backport pc changes from metals [#19617](https://github.com/lampepfl/dotty/pull/19617) +- Chore: Backport changes from Metals [#19592](https://github.com/lampepfl/dotty/pull/19592) +- Use comma counting for all signature help types [#19520](https://github.com/lampepfl/dotty/pull/19520) +- Make PC more resilient to crashes [#19488](https://github.com/lampepfl/dotty/pull/19488) +- Make order of renames and missing imports deterministic [#19468](https://github.com/lampepfl/dotty/pull/19468) +- Chore: backport changes from metals [#19452](https://github.com/lampepfl/dotty/pull/19452) +- Improve signature help by more stable position calculation + better named arg support [#19214](https://github.com/lampepfl/dotty/pull/19214) +- Instantiate Type Vars in completion labels of extension methods [#18914](https://github.com/lampepfl/dotty/pull/18914) + +## Quotes + +- Only evaluate transparent inline unapply once [#19380](https://github.com/lampepfl/dotty/pull/19380) +- Update `staging.Compiler.make` documentation [#19428](https://github.com/lampepfl/dotty/pull/19428) +- Error instead of StaleSymbol crash for certain cyclic macro dependencies [#19549](https://github.com/lampepfl/dotty/pull/19549) +- Refine handling of StaleSymbol type errors [#19605](https://github.com/lampepfl/dotty/pull/19605) +- Fix module symbol recovery from `NoClassDefFoundError` [#19645](https://github.com/lampepfl/dotty/pull/19645) +- Fix HOAS pattern example and error message [#19655](https://github.com/lampepfl/dotty/pull/19655) +- Set the correct type when copying reflect Inlined trees [#19409](https://github.com/lampepfl/dotty/pull/19409) + +## Reporting + +- Don't explain erroneous bounds [#19338](https://github.com/lampepfl/dotty/pull/19338) +- Better error diagnostics for cyclic references [#19408](https://github.com/lampepfl/dotty/pull/19408) +- Properly identify empty bounds in error message [#19310](https://github.com/lampepfl/dotty/pull/19310) + +## Scala-JS + +- Fix #19528: Actually remove Dynamic from interfaces of native JS classes. [#19536](https://github.com/lampepfl/dotty/pull/19536) +- Consider static and non-static methods as non-double def [#19400](https://github.com/lampepfl/dotty/pull/19400) + +## Scaladoc + +- Scaladoc - add option for dynamic side menu [#19337](https://github.com/lampepfl/dotty/pull/19337) +- Scaladoc: Fix "case case Foo" in enum's cases [#19519](https://github.com/lampepfl/dotty/pull/19519) +- Fix(#19377): show inherited abstract members in dedicated section [#19552](https://github.com/lampepfl/dotty/pull/19552) +- Jsoup: 1.14.3 → 1.17.2 [#19564](https://github.com/lampepfl/dotty/pull/19564) +- Extend copyright into 2024 [#19367](https://github.com/lampepfl/dotty/pull/19367) + +## Tooling + +- Prioritize TASTy files over classfiles on classpath aggregation [#19431](https://github.com/lampepfl/dotty/pull/19431) + +## Transform + +- Fix purity check for val inside of object [#19598](https://github.com/lampepfl/dotty/pull/19598) +- Drop special treatment of function types in overloading resolution [#19654](https://github.com/lampepfl/dotty/pull/19654) +- Add checks for the consistency of the parents in TreeChecker [#18935](https://github.com/lampepfl/dotty/pull/18935) + +## Type Inference + +- More careful type variable instance improvements [#19659](https://github.com/lampepfl/dotty/pull/19659) + +## Typer + +- Reject wildcard types in using clauses [#19459](https://github.com/lampepfl/dotty/pull/19459) +- Don't leave underspecified SAM types in the code [#19461](https://github.com/lampepfl/dotty/pull/19461) +- Also compute base classes of wildcardTypes [#19465](https://github.com/lampepfl/dotty/pull/19465) +- Fix(#15784): ident rule for pat match was too strict [#19501](https://github.com/lampepfl/dotty/pull/19501) +- Heal occurrences of => T between ElimByName and Erasure [#19558](https://github.com/lampepfl/dotty/pull/19558) +- Fix(#i18645): overload ext method body in braces didn't compile [#19651](https://github.com/lampepfl/dotty/pull/19651) +- Fix #19202: Passing NotNullInfos to a mutable field of a Completer [#19463](https://github.com/lampepfl/dotty/pull/19463) +- Fix Java record problems (#19578) and (#19386) [#19583](https://github.com/lampepfl/dotty/pull/19583) +- Improve when deprecation warnings are emitted [#19621](https://github.com/lampepfl/dotty/pull/19621) +- Space: Replace showType & make Space Showable [#19370](https://github.com/lampepfl/dotty/pull/19370) + + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.0..3.4.1` these are: + +``` + 53 Martin Odersky + 53 Nicolas Stucki + 22 Dale Wijnand + 11 Szymon Rodziewicz + 11 i10416 + 8 Hamza REMMAL + 7 Paweł Marks + 7 noti0na1 + 6 Yilin Wei + 5 Jędrzej Rochala + 3 Eugene Flesselle + 3 Seth Tisue + 2 Florian3k + 2 Hamza Remmal + 2 Jan Chyb + 2 Katarzyna Marek + 2 Sébastien Doeraene + 2 Tomasz Godzik + 2 dependabot[bot] + 1 Bersier + 1 Fabián Heredia Montiel + 1 Jakub Ciesluk + 1 Jakub Cieśluk + 1 Kacper Korban + 1 Kenji Yoshida + 1 Mehdi Alaoui + 1 Nikita Gazarov + 1 Oron Port + 1 Pascal Weisenburger + 1 Philippus Baalman + 1 Quentin Bernet + 1 Som Snytt + 1 Wojciech Mazur + 1 Yichen Xu + 1 aherlihy + 1 rochala + +``` diff --git a/changelogs/3.4.2-RC1.md b/changelogs/3.4.2-RC1.md new file mode 100644 index 000000000000..464a5f6b086a --- /dev/null +++ b/changelogs/3.4.2-RC1.md @@ -0,0 +1,209 @@ +# Highlights of the release + +- Bump JLine 3.19.0 -> 3.24.1 & sbt 1.9.7 -> 1.9.9 [#19744](https://github.com/lampepfl/dotty/pull/19744) +- Refactor settings & improve dx [#19766](https://github.com/lampepfl/dotty/pull/19766) +- Publish `scala2-library-tasty-experimental` [#19588](https://github.com/lampepfl/dotty/pull/19588) +- Repl - method signatures in autocomplete [#19917](https://github.com/lampepfl/dotty/pull/19917) + +# Other changes and fixes + +## Annotations + +- Attempt implicit search for old style `implicit` parameters in Application matchArgs [#19737](https://github.com/lampepfl/dotty/pull/19737) + +## Backend + +- Fix(#17255): cannot find Scala companion module from Java [#19773](https://github.com/lampepfl/dotty/pull/19773) +- Change isStatic to isStaticOwner in hasLocalInstantiation [#19803](https://github.com/lampepfl/dotty/pull/19803) + +## Coverage + +- Port coverage filter options for packages and files [#19727](https://github.com/lampepfl/dotty/pull/19727) + +## Default parameters + +- Lift all non trivial prefixes for default parameters [#19739](https://github.com/lampepfl/dotty/pull/19739) + +## Doctool + +- Prevent HTML/XSS Injection in Scala Search [#19980](https://github.com/lampepfl/dotty/pull/19980) +- Parse search query param in Scaladoc [#19669](https://github.com/lampepfl/dotty/pull/19669) + +## Experimental: Capture Checking + +- Disallow covariant `cap`s in the lower bound of type members [#19624](https://github.com/lampepfl/dotty/pull/19624) +- Ignore orphan parameters inside a retains annotation during Ycheck [#19684](https://github.com/lampepfl/dotty/pull/19684) +- Fix the pickling of `This` inside capture sets [#19797](https://github.com/lampepfl/dotty/pull/19797) +- Add updated to SeqViewOps [#19798](https://github.com/lampepfl/dotty/pull/19798) +- Fix Function tree copier [#19822](https://github.com/lampepfl/dotty/pull/19822) +- Drop FreeSeqFactory from stdlib-cc [#19849](https://github.com/lampepfl/dotty/pull/19849) +- Fix i19859 [#19860](https://github.com/lampepfl/dotty/pull/19860) +- Various fixes to stdlib-cc [#19873](https://github.com/lampepfl/dotty/pull/19873) +- Add more methods in `SeqViewOps` [#19993](https://github.com/lampepfl/dotty/pull/19993) +- Check `This` references in `refersToParamOf` [#20005](https://github.com/lampepfl/dotty/pull/20005) + +## Exports + +- Fix the tparam bounds of exported inherited classes [#18647](https://github.com/lampepfl/dotty/pull/18647) + +## Implicits + +- Prefer extensions over conversions for member selection [#19717](https://github.com/lampepfl/dotty/pull/19717) +- Don't allow implicit conversions on prefixes of type selections [#19934](https://github.com/lampepfl/dotty/pull/19934) +- Make sure typeParams returns a stable result even in the presence of completions [#19974](https://github.com/lampepfl/dotty/pull/19974) + +## Incremental Compilation + +- Fix undercompilation upon ctor change [#19911](https://github.com/lampepfl/dotty/pull/19911) +- Load but not enter case accessors fields in Scala2Unpickler [#19926](https://github.com/lampepfl/dotty/pull/19926) + +## Initialization + +- Add supports for type cast and filtering type for field and method owner in global initialization checker [#19612](https://github.com/lampepfl/dotty/pull/19612) +- Added a second trace for global init checker showing creation of mutable fields [#19996](https://github.com/lampepfl/dotty/pull/19996) +- Suppressing repetitive warnings in the global initialization checker [#19898](https://github.com/lampepfl/dotty/pull/19898) + +## Inline + +- Specialized retained inline FunctionN apply methods [#19801](https://github.com/lampepfl/dotty/pull/19801) +- Avoid crash after StopMacroExpansion [#19883](https://github.com/lampepfl/dotty/pull/19883) +- Check deprecation of inline methods [#19914](https://github.com/lampepfl/dotty/pull/19914) +- Inline transparent implicit parameters when typing Unapply trees [#19646](https://github.com/lampepfl/dotty/pull/19646) +- Restore pre-3.3.2 behavior of `inline implicit def` [#19877](https://github.com/lampepfl/dotty/pull/19877) + +## Match Types + +- Cover patterns using `reflect.TypeTest` in isMatchTypeShaped [#19923](https://github.com/lampepfl/dotty/pull/19923) +- Rework MatchType recursion in collectParts [#19867](https://github.com/lampepfl/dotty/pull/19867) + +## Nullability + +- Fix #19808: Don't force to compute the owner of a symbol when there is no denotation [#19813](https://github.com/lampepfl/dotty/pull/19813) + +## Parser + +- Add support for JEP-409 (sealed classes) + Add javacOpt directive [#19080](https://github.com/lampepfl/dotty/pull/19080) +- Fix(#16458): regression in xml syntax parsing [#19522](https://github.com/lampepfl/dotty/pull/19522) +- Fix parsing of conditional expressions in parentheses [#19985](https://github.com/lampepfl/dotty/pull/19985) + +## Presentation Compiler + +- Allow range selection on function parameter to select a parameter list [#19777](https://github.com/lampepfl/dotty/pull/19777) + +## Quotes + +- Disallow ill-staged references to local classes [#19869](https://github.com/lampepfl/dotty/pull/19869) +- Add regression test for #19909 [#19915](https://github.com/lampepfl/dotty/pull/19915) +- Detect non `Expr[..]` splice patterns [#19944](https://github.com/lampepfl/dotty/pull/19944) +- Avoid spurious `val` binding in quote pattern [#19948](https://github.com/lampepfl/dotty/pull/19948) +- Add regression test and imporve -Xprint-suspension message [#19688](https://github.com/lampepfl/dotty/pull/19688) + +## REPL + +- Repl truncation copes with null [#17336](https://github.com/lampepfl/dotty/pull/17336) +- Catch stackoverflow errors in the highlighter [#19836](https://github.com/lampepfl/dotty/pull/19836) +- Fix a REPL bad symbolic reference [#19786](https://github.com/lampepfl/dotty/pull/19786) + +## Reflection + +- Fix `TypeTreeTypeTest` to not match `TypeBoundsTree`s [#19485](https://github.com/lampepfl/dotty/pull/19485) +- Improve message when tree cannot be shown as source [#19906](https://github.com/lampepfl/dotty/pull/19906) +- Fix #19732: quotes.reflect.Ref incorrectly casting `This` to `RefTree` [#19930](https://github.com/lampepfl/dotty/pull/19930) +- Add check for parents in Quotes (#19842) [#19870](https://github.com/lampepfl/dotty/pull/19870) + +## Reporting + +- Improve error reporting for missing members [#19800](https://github.com/lampepfl/dotty/pull/19800) +- Avoid repetitions in name hints [#19975](https://github.com/lampepfl/dotty/pull/19975) +- Improve error message when using experimental definitions [#19782](https://github.com/lampepfl/dotty/pull/19782) +- Make -Xprompt work as desired under -Werror [#19765](https://github.com/lampepfl/dotty/pull/19765) +- Fix #19402: emit proper error in absence of using in given definitions [#19714](https://github.com/lampepfl/dotty/pull/19714) +- Bugfix: Choose correct signature is signatureHelp for overloaded methods [#19707](https://github.com/lampepfl/dotty/pull/19707) +- Unify completion pos usage, fix presentation compiler crash in interpolation [#19614](https://github.com/lampepfl/dotty/pull/19614) + +## Scaladoc + +- Fix(#16610): warn ignored Scaladoc on multiple enum cases [#19555](https://github.com/lampepfl/dotty/pull/19555) + +## TASTy format + +- Add patch for undefined behavior with `object $` [#19705](https://github.com/lampepfl/dotty/pull/19705) +- Fix(#19806): wrong tasty of scala module class reference [#19827](https://github.com/lampepfl/dotty/pull/19827) +- Used derived types to type arguments of dependent function type [#19838](https://github.com/lampepfl/dotty/pull/19838) + +## Tooling + +- Java TASTy: use new threadsafe writer implementation [#19690](https://github.com/lampepfl/dotty/pull/19690) +- Remove `-Yforce-inline-while-typing` [#19889](https://github.com/lampepfl/dotty/pull/19889) +- Cleanup unnecessary language flag [#19865](https://github.com/lampepfl/dotty/pull/19865) +- Bugfix: Auto imports in worksheets in Scala 3 [#19793](https://github.com/lampepfl/dotty/pull/19793) +- Refine behavior of `-Yno-experimental` [#19741](https://github.com/lampepfl/dotty/pull/19741) + +## Transform + +- Short-circuit isCheckable with classSymbol [#19634](https://github.com/lampepfl/dotty/pull/19634) +- Avoid eta-reduction of `(..., f: T => R, ...) => f.apply(..)` into `f` [#19966](https://github.com/lampepfl/dotty/pull/19966) +- Tweak parameter accessor scheme [#19719](https://github.com/lampepfl/dotty/pull/19719) + +## Typer + +- Update phrasing for NotClassType explain error message [#19635](https://github.com/lampepfl/dotty/pull/19635) +- Fix java typer problems with inner class references and raw types [#19747](https://github.com/lampepfl/dotty/pull/19747) +- Approximate MatchTypes with lub of case bodies, if non-recursive [#19761](https://github.com/lampepfl/dotty/pull/19761) +- Revert broken changes with transparent inline [#19922](https://github.com/lampepfl/dotty/pull/19922) +- Delay hard argument comparisons [#20007](https://github.com/lampepfl/dotty/pull/20007) +- Fix #19607: Allow to instantiate *wildcard* type captures to TypeBounds. [#19627](https://github.com/lampepfl/dotty/pull/19627) +- Fix #19907: Skip soft unions in widenSingle of widenInferred [#19995](https://github.com/lampepfl/dotty/pull/19995) +- Fix untupling of functions in for comprehensions [#19620](https://github.com/lampepfl/dotty/pull/19620) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.1..3.42-RC1` these are: + +``` + 46 Nicolas Stucki + 33 Martin Odersky + 25 Dale Wijnand + 22 Hamza REMMAL + 18 Yichen Xu + 17 Jamie Thompson + 15 Szymon Rodziewicz + 11 EnzeXing + 11 i10416 + 7 Paweł Marks + 6 Kacper Korban + 4 Dan13llljws + 4 Katarzyna Marek + 4 Matt Bovel + 4 Som Snytt + 4 noti0na1 + 3 110416 + 3 Eugene Flesselle + 3 Sébastien Doeraene + 3 dependabot[bot] + 2 Bersier + 2 Hamza Remmal + 2 Jakub Ciesluk + 2 João Costa + 2 Jędrzej Rochala + 2 Natsu Kagami + 2 Stephane Bersier + 2 Taro L. Saito + 2 aherlihy + 1 Aleksander Boruch-Gruszecki + 1 Aviv Keller + 1 Eugene Yokota + 1 Guillaume Martres + 1 Jan Chyb + 1 Lukas Rytz + 1 Mikołaj Fornal + 1 Olga Mazhara + 1 Ondřej Lhoták + 1 Robert Stoll + 1 Seth Tisue + 1 Valentin Schneeberger + 1 Yilin Wei + 1 willerf +``` diff --git a/changelogs/3.4.2.md b/changelogs/3.4.2.md new file mode 100644 index 000000000000..bb6fcc40c952 --- /dev/null +++ b/changelogs/3.4.2.md @@ -0,0 +1,209 @@ +# Highlights of the release + +- Bump JLine 3.19.0 -> 3.24.1 & sbt 1.9.7 -> 1.9.9 [#19744](https://github.com/lampepfl/dotty/pull/19744) +- Refactor settings & improve dx [#19766](https://github.com/lampepfl/dotty/pull/19766) +- Publish `scala2-library-tasty-experimental` [#19588](https://github.com/lampepfl/dotty/pull/19588) +- Repl - method signatures in autocomplete [#19917](https://github.com/lampepfl/dotty/pull/19917) + +# Other changes and fixes + +## Annotations + +- Attempt implicit search for old style `implicit` parameters in Application matchArgs [#19737](https://github.com/lampepfl/dotty/pull/19737) + +## Backend + +- Fix(#17255): cannot find Scala companion module from Java [#19773](https://github.com/lampepfl/dotty/pull/19773) +- Change isStatic to isStaticOwner in hasLocalInstantiation [#19803](https://github.com/lampepfl/dotty/pull/19803) + +## Coverage + +- Port coverage filter options for packages and files [#19727](https://github.com/lampepfl/dotty/pull/19727) + +## Default parameters + +- Lift all non trivial prefixes for default parameters [#19739](https://github.com/lampepfl/dotty/pull/19739) + +## Doctool + +- Prevent HTML/XSS Injection in Scala Search [#19980](https://github.com/lampepfl/dotty/pull/19980) +- Parse search query param in Scaladoc [#19669](https://github.com/lampepfl/dotty/pull/19669) + +## Experimental: Capture Checking + +- Disallow covariant `cap`s in the lower bound of type members [#19624](https://github.com/lampepfl/dotty/pull/19624) +- Ignore orphan parameters inside a retains annotation during Ycheck [#19684](https://github.com/lampepfl/dotty/pull/19684) +- Fix the pickling of `This` inside capture sets [#19797](https://github.com/lampepfl/dotty/pull/19797) +- Add updated to SeqViewOps [#19798](https://github.com/lampepfl/dotty/pull/19798) +- Fix Function tree copier [#19822](https://github.com/lampepfl/dotty/pull/19822) +- Drop FreeSeqFactory from stdlib-cc [#19849](https://github.com/lampepfl/dotty/pull/19849) +- Fix i19859 [#19860](https://github.com/lampepfl/dotty/pull/19860) +- Various fixes to stdlib-cc [#19873](https://github.com/lampepfl/dotty/pull/19873) +- Add more methods in `SeqViewOps` [#19993](https://github.com/lampepfl/dotty/pull/19993) +- Check `This` references in `refersToParamOf` [#20005](https://github.com/lampepfl/dotty/pull/20005) + +## Exports + +- Fix the tparam bounds of exported inherited classes [#18647](https://github.com/lampepfl/dotty/pull/18647) + +## Implicits + +- Prefer extensions over conversions for member selection [#19717](https://github.com/lampepfl/dotty/pull/19717) +- Don't allow implicit conversions on prefixes of type selections [#19934](https://github.com/lampepfl/dotty/pull/19934) +- Make sure typeParams returns a stable result even in the presence of completions [#19974](https://github.com/lampepfl/dotty/pull/19974) + +## Incremental Compilation + +- Fix undercompilation upon ctor change [#19911](https://github.com/lampepfl/dotty/pull/19911) +- Load but not enter case accessors fields in Scala2Unpickler [#19926](https://github.com/lampepfl/dotty/pull/19926) + +## Initialization + +- Add supports for type cast and filtering type for field and method owner in global initialization checker [#19612](https://github.com/lampepfl/dotty/pull/19612) +- Added a second trace for global init checker showing creation of mutable fields [#19996](https://github.com/lampepfl/dotty/pull/19996) +- Suppressing repetitive warnings in the global initialization checker [#19898](https://github.com/lampepfl/dotty/pull/19898) + +## Inline + +- Specialized retained inline FunctionN apply methods [#19801](https://github.com/lampepfl/dotty/pull/19801) +- Avoid crash after StopMacroExpansion [#19883](https://github.com/lampepfl/dotty/pull/19883) +- Check deprecation of inline methods [#19914](https://github.com/lampepfl/dotty/pull/19914) +- Inline transparent implicit parameters when typing Unapply trees [#19646](https://github.com/lampepfl/dotty/pull/19646) +- Restore pre-3.3.2 behavior of `inline implicit def` [#19877](https://github.com/lampepfl/dotty/pull/19877) + +## Match Types + +- Cover patterns using `reflect.TypeTest` in isMatchTypeShaped [#19923](https://github.com/lampepfl/dotty/pull/19923) +- Rework MatchType recursion in collectParts [#19867](https://github.com/lampepfl/dotty/pull/19867) + +## Nullability + +- Fix #19808: Don't force to compute the owner of a symbol when there is no denotation [#19813](https://github.com/lampepfl/dotty/pull/19813) + +## Parser + +- Add support for JEP-409 (sealed classes) + Add javacOpt directive [#19080](https://github.com/lampepfl/dotty/pull/19080) +- Fix(#16458): regression in xml syntax parsing [#19522](https://github.com/lampepfl/dotty/pull/19522) +- Fix parsing of conditional expressions in parentheses [#19985](https://github.com/lampepfl/dotty/pull/19985) + +## Presentation Compiler + +- Allow range selection on function parameter to select a parameter list [#19777](https://github.com/lampepfl/dotty/pull/19777) + +## Quotes + +- Disallow ill-staged references to local classes [#19869](https://github.com/lampepfl/dotty/pull/19869) +- Add regression test for #19909 [#19915](https://github.com/lampepfl/dotty/pull/19915) +- Detect non `Expr[..]` splice patterns [#19944](https://github.com/lampepfl/dotty/pull/19944) +- Avoid spurious `val` binding in quote pattern [#19948](https://github.com/lampepfl/dotty/pull/19948) +- Add regression test and imporve -Xprint-suspension message [#19688](https://github.com/lampepfl/dotty/pull/19688) + +## REPL + +- Repl truncation copes with null [#17336](https://github.com/lampepfl/dotty/pull/17336) +- Catch stackoverflow errors in the highlighter [#19836](https://github.com/lampepfl/dotty/pull/19836) +- Fix a REPL bad symbolic reference [#19786](https://github.com/lampepfl/dotty/pull/19786) + +## Reflection + +- Fix `TypeTreeTypeTest` to not match `TypeBoundsTree`s [#19485](https://github.com/lampepfl/dotty/pull/19485) +- Improve message when tree cannot be shown as source [#19906](https://github.com/lampepfl/dotty/pull/19906) +- Fix #19732: quotes.reflect.Ref incorrectly casting `This` to `RefTree` [#19930](https://github.com/lampepfl/dotty/pull/19930) +- Add check for parents in Quotes (#19842) [#19870](https://github.com/lampepfl/dotty/pull/19870) + +## Reporting + +- Improve error reporting for missing members [#19800](https://github.com/lampepfl/dotty/pull/19800) +- Avoid repetitions in name hints [#19975](https://github.com/lampepfl/dotty/pull/19975) +- Improve error message when using experimental definitions [#19782](https://github.com/lampepfl/dotty/pull/19782) +- Make -Xprompt work as desired under -Werror [#19765](https://github.com/lampepfl/dotty/pull/19765) +- Fix #19402: emit proper error in absence of using in given definitions [#19714](https://github.com/lampepfl/dotty/pull/19714) +- Bugfix: Choose correct signature is signatureHelp for overloaded methods [#19707](https://github.com/lampepfl/dotty/pull/19707) +- Unify completion pos usage, fix presentation compiler crash in interpolation [#19614](https://github.com/lampepfl/dotty/pull/19614) + +## Scaladoc + +- Fix(#16610): warn ignored Scaladoc on multiple enum cases [#19555](https://github.com/lampepfl/dotty/pull/19555) + +## TASTy format + +- Add patch for undefined behavior with `object $` [#19705](https://github.com/lampepfl/dotty/pull/19705) +- Fix(#19806): wrong tasty of scala module class reference [#19827](https://github.com/lampepfl/dotty/pull/19827) +- Used derived types to type arguments of dependent function type [#19838](https://github.com/lampepfl/dotty/pull/19838) + +## Tooling + +- Java TASTy: use new threadsafe writer implementation [#19690](https://github.com/lampepfl/dotty/pull/19690) +- Remove `-Yforce-inline-while-typing` [#19889](https://github.com/lampepfl/dotty/pull/19889) +- Cleanup unnecessary language flag [#19865](https://github.com/lampepfl/dotty/pull/19865) +- Bugfix: Auto imports in worksheets in Scala 3 [#19793](https://github.com/lampepfl/dotty/pull/19793) +- Refine behavior of `-Yno-experimental` [#19741](https://github.com/lampepfl/dotty/pull/19741) + +## Transform + +- Short-circuit isCheckable with classSymbol [#19634](https://github.com/lampepfl/dotty/pull/19634) +- Avoid eta-reduction of `(..., f: T => R, ...) => f.apply(..)` into `f` [#19966](https://github.com/lampepfl/dotty/pull/19966) +- Tweak parameter accessor scheme [#19719](https://github.com/lampepfl/dotty/pull/19719) + +## Typer + +- Update phrasing for NotClassType explain error message [#19635](https://github.com/lampepfl/dotty/pull/19635) +- Fix java typer problems with inner class references and raw types [#19747](https://github.com/lampepfl/dotty/pull/19747) +- Approximate MatchTypes with lub of case bodies, if non-recursive [#19761](https://github.com/lampepfl/dotty/pull/19761) +- Revert broken changes with transparent inline [#19922](https://github.com/lampepfl/dotty/pull/19922) +- Delay hard argument comparisons [#20007](https://github.com/lampepfl/dotty/pull/20007) +- Fix #19607: Allow to instantiate *wildcard* type captures to TypeBounds. [#19627](https://github.com/lampepfl/dotty/pull/19627) +- Fix #19907: Skip soft unions in widenSingle of widenInferred [#19995](https://github.com/lampepfl/dotty/pull/19995) +- Fix untupling of functions in for comprehensions [#19620](https://github.com/lampepfl/dotty/pull/19620) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.1..3.4.2` these are: + +``` + 46 Nicolas Stucki + 33 Martin Odersky + 25 Dale Wijnand + 22 Hamza REMMAL + 18 Yichen Xu + 17 Jamie Thompson + 15 Szymon Rodziewicz + 11 EnzeXing + 11 i10416 + 9 Paweł Marks + 6 Kacper Korban + 4 Dan13llljws + 4 Katarzyna Marek + 4 Matt Bovel + 4 Som Snytt + 4 noti0na1 + 3 110416 + 3 Eugene Flesselle + 3 Sébastien Doeraene + 3 dependabot[bot] + 2 Bersier + 2 Hamza Remmal + 2 Jakub Ciesluk + 2 João Costa + 2 Jędrzej Rochala + 2 Natsu Kagami + 2 Stephane Bersier + 2 Taro L. Saito + 2 aherlihy + 1 Aleksander Boruch-Gruszecki + 1 Aviv Keller + 1 Eugene Yokota + 1 Guillaume Martres + 1 Jan Chyb + 1 Lukas Rytz + 1 Mikołaj Fornal + 1 Olga Mazhara + 1 Ondřej Lhoták + 1 Robert Stoll + 1 Seth Tisue + 1 Valentin Schneeberger + 1 Yilin Wei + 1 willerf +``` diff --git a/changelogs/3.5.0-RC1.md b/changelogs/3.5.0-RC1.md new file mode 100644 index 000000000000..4cbc2aa1d668 --- /dev/null +++ b/changelogs/3.5.0-RC1.md @@ -0,0 +1,254 @@ +# Highlights of the release + +- Bundle scala-cli in scala command (For RC1 requires JVM 17, further RCs will use native launchers) +- Introduce Best Effort compilation options [#17582](https://github.com/lampepfl/dotty/pull/17582) +- Add support for Pipelined builds [#18880](https://github.com/lampepfl/dotty/pull/18880) +- Add support for `var` in refinements [#19982](https://github.com/lampepfl/dotty/pull/19982) +- Implement SIP-42 - Support for binary integer literals [#19405](https://github.com/lampepfl/dotty/pull/19405) + +# Other changes and fixes + +## Backend + +- Fix Closure span assignment in makeClosure [#15841](https://github.com/lampepfl/dotty/pull/15841) + +## Default parameters + +- Fix default args lookup for given classes [#20256](https://github.com/lampepfl/dotty/pull/20256) +- Fix implicit search failure reporting [#20261](https://github.com/lampepfl/dotty/pull/20261) + +## Derivation + +- Fix infinite loop in Mirror synthesis of unreducible match type [#20133](https://github.com/lampepfl/dotty/pull/20133) + +## Desugaring + +- Add explanation to checkCaseClassInheritanceInvariant error msg [#20141](https://github.com/lampepfl/dotty/pull/20141) + +## Exports + +- Add annotations in parameters for exports [#20140](https://github.com/lampepfl/dotty/pull/20140) +- Fix isAliasType [#20195](https://github.com/lampepfl/dotty/pull/20195) + +## Implicits + +- Fix implicitNotFound message for type aliases [#19343](https://github.com/lampepfl/dotty/pull/19343) +- Normalize types before collecting parts determining implicit scope [#20077](https://github.com/lampepfl/dotty/pull/20077) +- Better error diagnostics under -explain-cyclic [#20251](https://github.com/lampepfl/dotty/pull/20251) +- Update unreducible match types error reporting [#19954](https://github.com/lampepfl/dotty/pull/19954) +- Improve ConstraintHandling of SkolemTypes [#20175](https://github.com/lampepfl/dotty/pull/20175) + +## Incremental Compilation + +- Retain default parameters with `export` [#20167](https://github.com/lampepfl/dotty/pull/20167) + +## Inline + +- Fix by-name parameter in beta-reduction [#20096](https://github.com/lampepfl/dotty/pull/20096) +- Add warning for anonymous inline classes (#16723) [#20291](https://github.com/lampepfl/dotty/pull/20291) +- Avoid conversion of `Unit` type into `()` term [#20295](https://github.com/lampepfl/dotty/pull/20295) +- Type desugared `transparent inline def unapply` call in the correct mode [#20108](https://github.com/lampepfl/dotty/pull/20108) +- Regression: fix compilation performance on Windows [#20193](https://github.com/lampepfl/dotty/pull/20193) +- Fix inline match on blocks with multiple statements [#20125](https://github.com/lampepfl/dotty/pull/20125) +- Inline `unapply`s in the inlining phase [#19382](https://github.com/lampepfl/dotty/pull/19382) +- Fix outerSelect in Inliner [#20313](https://github.com/lampepfl/dotty/pull/20313) + +## Linting + +- Fix #20146: attach the original name if there is an import selection for an indent [#20163](https://github.com/lampepfl/dotty/pull/20163) +- Add regression test for issue 18632 [#20308](https://github.com/lampepfl/dotty/pull/20308) + +## Match Types + +- Make aliases of `MatchAlias`es normal `TypeAlias`es [#19871](https://github.com/lampepfl/dotty/pull/19871) +- Fix #19746: Do not follow param term refs in `isConcrete`. [#20015](https://github.com/lampepfl/dotty/pull/20015) +- Do match type reduction atPhaseNoLater than ElimOpaque [#20017](https://github.com/lampepfl/dotty/pull/20017) +- Do not flag match types as `Deferred` and amend #20077 [#20147](https://github.com/lampepfl/dotty/pull/20147) +- Always use baseType when constraining patternTp with scrutineeTp [#20032](https://github.com/lampepfl/dotty/pull/20032) +- Use `MirrorSource.reduce` result for `companionPath` [#20207](https://github.com/lampepfl/dotty/pull/20207) +- Regression: Fix match type extraction of a MatchAlias [#20111](https://github.com/lampepfl/dotty/pull/20111) + +## Polyfunctions + +- Discard poly-functions when trying to resolve overloading [#20181](https://github.com/lampepfl/dotty/pull/20181) + +## Presentation Compiler + +- Stabilise returned completions by improving deduplication + extra completions for constructors [#19976](https://github.com/lampepfl/dotty/pull/19976) +- Fix active param index for empty param lists [#20142](https://github.com/lampepfl/dotty/pull/20142) +- Delias type members in hover [#20173](https://github.com/lampepfl/dotty/pull/20173) +- Interactive: handle context bounds in extension construct workaround [#20201](https://github.com/lampepfl/dotty/pull/20201) +- Fix: prefer non-export definition locations [#20252](https://github.com/lampepfl/dotty/pull/20252) +- Don't show enum completions in new keyword context [#20304](https://github.com/lampepfl/dotty/pull/20304) +- Chore: Backport changes for presentation compiler [#20345](https://github.com/lampepfl/dotty/pull/20345) +- Add custom matchers for completions (fuzzy search for presentation compiler) [#19850](https://github.com/lampepfl/dotty/pull/19850) + +## Quotes + +- Fix TermRef prefixes not having their type healed [#20102](https://github.com/lampepfl/dotty/pull/20102) +- Improve reporting in staging about the possible use of an incorrect class loader [#20137](https://github.com/lampepfl/dotty/pull/20137) +- Introduce MethodTypeKind to quotes reflection API [#20249](https://github.com/lampepfl/dotty/pull/20249) +- Add quote ASTs to TASTy [#20165](https://github.com/lampepfl/dotty/pull/20165) + +## Reflection + +- Allow to beta reduce curried function applications in quotes reflect [#18121](https://github.com/lampepfl/dotty/pull/18121) +- Set the inlining phase in the Context used for checking macro trees [#20087](https://github.com/lampepfl/dotty/pull/20087) +- Add Symbol.isSuperAccessor to reflection API [#13388](https://github.com/lampepfl/dotty/pull/13388) +- Stabilize reflect `SymbolMethods.isSuperAccessor` [#20198](https://github.com/lampepfl/dotty/pull/20198) + +## Repl + +- Fix validity period of derived SingleDenotations [#19983](https://github.com/lampepfl/dotty/pull/19983) +- Fix #18383: Never consider top-level `import`s as unused in the repl. [#20310](https://github.com/lampepfl/dotty/pull/20310) + +## Reporting + +- Warn if extension receiver already has member [#17543](https://github.com/lampepfl/dotty/pull/17543) +- Deprecation of case class elements [#17911](https://github.com/lampepfl/dotty/pull/17911) +- Support src filter in -WConf (Closes #17635) [#18783](https://github.com/lampepfl/dotty/pull/18783) +- Add note about type mismatch in automatically inserted apply argument [#20023](https://github.com/lampepfl/dotty/pull/20023) +- Make error reporting resilient to exception thrown while reporting [#20158](https://github.com/lampepfl/dotty/pull/20158) +- Remove duplicate comma from Matchable selector warning [#20159](https://github.com/lampepfl/dotty/pull/20159) +- Generalize warnings for top-level calls to Any or AnyRef methods [#20312](https://github.com/lampepfl/dotty/pull/20312) +- Make CheckUnused not slow. [#20321](https://github.com/lampepfl/dotty/pull/20321) + +## Rewrites + +- Patch indentation when removing braces (and other bug fixes in `-indent -rewrite`) [#17522](https://github.com/lampepfl/dotty/pull/17522) +- Extra check to avoid converting block expressions on the rhs of an in… [#20043](https://github.com/lampepfl/dotty/pull/20043) + +## Scaladoc + +- Fix scaladoc crash on Windows - illegal path character [#20311](https://github.com/lampepfl/dotty/pull/20311) +- Scaladoc: improve refined function types rendering [#20333](https://github.com/lampepfl/dotty/pull/20333) +- Relax font-weight reset [#20348](https://github.com/lampepfl/dotty/pull/20348) + +## Scala JS + +- Optimize main.js [#20093](https://github.com/lampepfl/dotty/pull/20093) + +## Settings + +- Lift Scala Settings from experimental to stabilized [#20199](https://github.com/lampepfl/dotty/pull/20199) + +## Tooling + +- Detect macro dependencies that are missing from the classloader [#20139](https://github.com/lampepfl/dotty/pull/20139) +- Write pipelined tasty in parallel. [#20153](https://github.com/lampepfl/dotty/pull/20153) +- ConsoleReporter sends INFO to stdout [#20328](https://github.com/lampepfl/dotty/pull/20328) + +## Transform + +- Fix overloaded default methods test in RefChecks [#20218](https://github.com/lampepfl/dotty/pull/20218) +- Fix handling of AppliedType aliases in outerPrefix [#20190](https://github.com/lampepfl/dotty/pull/20190) +- Elide unit binding when beta-reducing [#20085](https://github.com/lampepfl/dotty/pull/20085) + +## Typer + +- Reduce projections of type aliases with class type prefixes [#19931](https://github.com/lampepfl/dotty/pull/19931) +- Re-lub also hard union types in simplify [#20027](https://github.com/lampepfl/dotty/pull/20027) +- Fix #19789: Merge same TypeParamRef in orDominator [#20090](https://github.com/lampepfl/dotty/pull/20090) +- Allow SAM types to contain match alias refinements [#20092](https://github.com/lampepfl/dotty/pull/20092) +- Don't dealias when deciding which arguments to defer [#20116](https://github.com/lampepfl/dotty/pull/20116) +- Avoid the TypeVar.inst trap [#20160](https://github.com/lampepfl/dotty/pull/20160) +- Avoid crash when superType does not exist after erasure [#20188](https://github.com/lampepfl/dotty/pull/20188) +- Refine overloading and implicit disambiguation [#20084](https://github.com/lampepfl/dotty/pull/20084) +- Refactor constant folding of applications [#20099](https://github.com/lampepfl/dotty/pull/20099) +- Rollback constraints if `isSameType` failed second direction [#20109](https://github.com/lampepfl/dotty/pull/20109) +- Suppress "extension method will never be selected" for overrides [#20164](https://github.com/lampepfl/dotty/pull/20164) +- Allow SAM types to contain multiple refinements [#20172](https://github.com/lampepfl/dotty/pull/20172) +- Normalize when verifying if TypeTestCasts are unchecked [#20258](https://github.com/lampepfl/dotty/pull/20258) + +# Experimental Changes + +- Named tuples second implementation [#19174](https://github.com/lampepfl/dotty/pull/19174) +- Change rules for given prioritization [#19300](https://github.com/lampepfl/dotty/pull/19300) +- Enable experimental mode when experimental feature is imported [#19807](https://github.com/lampepfl/dotty/pull/19807) +- Add message parameter to `@experimental` annotation [#19935](https://github.com/lampepfl/dotty/pull/19935) +- Implement match type amendment: extractors follow aliases and singletons [#20161](https://github.com/lampepfl/dotty/pull/20161) + +## Capture Checking + +- Carry and check universal capability from parents correctly [#20004](https://github.com/lampepfl/dotty/pull/20004) +- Make parameter types of context functions inferred type trees [#20155](https://github.com/lampepfl/dotty/pull/20155) +- Handle reach capabilities correctly in depedent functions [#20203](https://github.com/lampepfl/dotty/pull/20203) +- Fix the visibility check in `markFree` [#20221](https://github.com/lampepfl/dotty/pull/20221) +- Make inline proxy vals have inferred types [#20241](https://github.com/lampepfl/dotty/pull/20241) +- CC: Give more info when context function parameters leak [#20244](https://github.com/lampepfl/dotty/pull/20244) +- Plug soundness hole for reach capabilities [#20051](https://github.com/lampepfl/dotty/pull/20051) +- Tighten the screws a bit more to seal the soundness hole for reach capabilities [#20056](https://github.com/lampepfl/dotty/pull/20056) +- Drop retains annotations in inferred type trees [#20057](https://github.com/lampepfl/dotty/pull/20057) +- Allow @retains arguments to be context functions [#20232](https://github.com/lampepfl/dotty/pull/20232) +- Fix conversion of this.fld capture refs under separate compilation [#20238](https://github.com/lampepfl/dotty/pull/20238) + +## Erased definitions + +- Fix "Compiler crash when using CanThrow" [#20210](https://github.com/lampepfl/dotty/pull/20210) +- Only allow erased parameters in erased definitions [#19686](https://github.com/lampepfl/dotty/pull/19686) + +## Initialization + +- Deprecate `StandardPlugin.init` in favor of `initialize` method taking implicit Context [#20330](https://github.com/lampepfl/dotty/pull/20330) +- Fix missing changesParents in PostTyper [#20062](https://github.com/lampepfl/dotty/pull/20062) +- Special case for next field of colon colon in global init checker [#20281](https://github.com/lampepfl/dotty/pull/20281) +- Extend whitelist in global initialization checker [#20290](https://github.com/lampepfl/dotty/pull/20290) + +## Macro Annotations + +- Allow macro annotation to transform companion [#19677](https://github.com/lampepfl/dotty/pull/19677) +- Remove experimental `MainAnnotation`/`newMain` (replaced with `MacroAnnotation`) [#19937](https://github.com/lampepfl/dotty/pull/19937) + +## Nullability + +- Add flexible types to deal with Java-defined signatures under -Yexplicit-nulls [#18112](https://github.com/lampepfl/dotty/pull/18112) +- Fix #20287: Add flexible types to Quotes library [#20293](https://github.com/lampepfl/dotty/pull/20293) +- Add fromNullable to Predef for explicit nulls [#20222](https://github.com/lampepfl/dotty/pull/20222) + + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.2..3.5.0-RC1` these are: + +``` + 137 Martin Odersky + 51 Eugene Flesselle + 32 Jamie Thompson + 25 Nicolas Stucki + 22 Sébastien Doeraene + 18 noti0na1 + 16 Matt Bovel + 12 Guillaume Martres + 9 Paweł Marks + 9 Yichen Xu + 8 Jan Chyb + 7 Hamza REMMAL + 6 Jędrzej Rochala + 6 Som Snytt + 5 Fengyun Liu + 5 dependabot[bot] + 3 Mikołaj Fornal + 2 Aviv Keller + 2 EnzeXing + 2 Wojciech Mazur + 1 Chris Pado + 1 Filip Zybała + 1 Georgi Krastev + 1 Hamza Remmal + 1 Jisoo Park + 1 Katarzyna Marek + 1 Lucas Nouguier + 1 Lucy Martin + 1 Ola Flisbäck + 1 Pascal Weisenburger + 1 Quentin Bernet + 1 Raphael Jolly + 1 Stephane Bersier + 1 Tomasz Godzik + 1 Yoonjae Jeon + 1 aherlihy + 1 rochala + 1 willerf +``` diff --git a/changelogs/3.5.0-RC2.md b/changelogs/3.5.0-RC2.md new file mode 100644 index 000000000000..f3bb8b52c73c --- /dev/null +++ b/changelogs/3.5.0-RC2.md @@ -0,0 +1,25 @@ +# Backported fixes + +- Bundle scala-cli in scala command [#20351](https://github.com/scala/scala3/pull/20351) +- Avoid stacked thisCall contexts [#20488](https://github.com/scala/scala3/pull/20488) +- Adapt the workflow to release on SDKMAN! [#20535](https://github.com/scala/scala3/pull/20535) +- Adapt the release workflow to SIP-46 [#20565](https://github.com/scala/scala3/pull/20565) +- Disable ClasspathTests.unglobClasspathVerifyTest [#20551](https://github.com/scala/scala3/pull/20551) +- Set default source version to 3.5 [#20441](https://github.com/scala/scala3/pull/20441) +- Bring back ambiguity filter when we report an implicit not found error [#20368](https://github.com/scala/scala3/pull/20368) +- Treat 3.5-migration the same as 3.5 for a warning about implicit priority change [#20436](https://github.com/scala/scala3/pull/20436) +- Avoid forcing whole package when using -experimental [#20409](https://github.com/scala/scala3/pull/20409) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.5.0-RC1..3.5.0-RC2` these are: + +``` + 4 Hamza Remmal + 4 Wojciech Mazur + 3 Martin Odersky + 1 Jamie Thompson + 1 Guillaume Martres +``` diff --git a/changelogs/3.5.0-RC3.md b/changelogs/3.5.0-RC3.md new file mode 100644 index 000000000000..a7a2d164d5a7 --- /dev/null +++ b/changelogs/3.5.0-RC3.md @@ -0,0 +1,26 @@ +# Backported fixes + +- Release .zip instead of .tar.gz for windows in sdkman [#20630](https://github.com/scala/scala3/pull/20630) +- SIP 46 - read classpath from file, remove lib directory in distribution [#20631](https://github.com/scala/scala3/pull/20631) +- Bump scala-cli to 1.4.0 [#20859](https://github.com/scala/scala3/pull/20859) +- Priority warning fix alternative [#20487](https://github.com/scala/scala3/pull/20487) +- Add --skip-cli-updates by default to the scala command [#20900](https://github.com/scala/scala3/pull/20900) +- Upgrade Scala 2 to 2.13.14 (was 2.13.12) [#20902](https://github.com/scala/scala3/pull/20902) +- fix issue 20901: etaCollapse context bound type [#20910](https://github.com/scala/scala3/pull/20910) +- Use final result type to check selector bound [#20989](https://github.com/scala/scala3/pull/20989) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.5.0-RC2..3.5.0-RC3` these are: + +``` + 6 Wojciech Mazur + 5 Jamie Thompson + 5 Martin Odersky + 4 Hamza Remmal + 1 Hamza REMMAL + 1 Seth Tisue + 1 Som Snytt +``` diff --git a/changelogs/3.5.0-RC4.md b/changelogs/3.5.0-RC4.md new file mode 100644 index 000000000000..75e72870d6f4 --- /dev/null +++ b/changelogs/3.5.0-RC4.md @@ -0,0 +1,19 @@ +# Backported fixes + +- Refine implicit priority change warnings [#21045](https://github.com/scala/scala3/pull/21045) +- Use pathing jars in cli commands [#21121](https://github.com/scala/scala3/pull/21121) +- expand classpath of pathing jars in scala_legacy command [#21160](https://github.com/scala/scala3/pull/21160) +- Fix symbol reference retrivial of `scala.caps.Caps` [#20493](https://github.com/scala/scala3/pull/20493) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.5.0-RC3..3.5.0-RC4` these are: + +``` + 5 Martin Odersky + 3 Wojciech Mazur + 2 Hamza REMMAL + 1 Jamie Thompson +``` diff --git a/changelogs/3.5.0-RC5.md b/changelogs/3.5.0-RC5.md new file mode 100644 index 000000000000..405396223eb7 --- /dev/null +++ b/changelogs/3.5.0-RC5.md @@ -0,0 +1,14 @@ +# Backported fixes + +- emit generatedNonLocalClass in backend when callback is not enabled [#21186](https://github.com/scala/scala3/pull/21186) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.5.0-RC4..3.5.0-RC5` these are: + +``` + 2 Jamie Thompson + 2 Wojciech Mazur +``` diff --git a/changelogs/3.5.0-RC6.md b/changelogs/3.5.0-RC6.md new file mode 100644 index 000000000000..77731f346750 --- /dev/null +++ b/changelogs/3.5.0-RC6.md @@ -0,0 +1,13 @@ +# Backported fixes + +- Revert "Approximate MatchTypes with lub of case bodies, if non-recursive" in 3.5.0 [#21266](https://github.com/scala/scala3/pull/21266) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.5.0-RC5..3.5.0-RC6` these are: + +``` + 4 Wojciech Mazur +``` diff --git a/changelogs/3.5.0-RC7.md b/changelogs/3.5.0-RC7.md new file mode 100644 index 000000000000..dab10f60b1ee --- /dev/null +++ b/changelogs/3.5.0-RC7.md @@ -0,0 +1,15 @@ +# Backported fixes + +- Backport "Fix healAmbiguous to compareAlternatives with disambiguate = true" to 3.5.0 [#21344](https://github.com/scala/scala3/pull/21344) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.5.0-RC6..3.5.0-RC7` these are: + +``` + 5 Martin Odersky + 4 Wojciech Mazur + 2 Eugene Flesselle +``` diff --git a/changelogs/3.5.0.md b/changelogs/3.5.0.md new file mode 100644 index 000000000000..654a19b169a8 --- /dev/null +++ b/changelogs/3.5.0.md @@ -0,0 +1,278 @@ +# Highlights of the release + +- Bundle scala-cli in scala command (For RC1 requires JVM 17, further RCs will use native launchers) +- Introduce Best Effort compilation options [#17582](https://github.com/lampepfl/dotty/pull/17582) +- Add support for Pipelined builds [#18880](https://github.com/lampepfl/dotty/pull/18880) +- Add support for `var` in refinements [#19982](https://github.com/lampepfl/dotty/pull/19982) +- Implement SIP-42 - Support for binary integer literals [#19405](https://github.com/lampepfl/dotty/pull/19405) + +# Other changes and fixes + +## Backend + +- Fix Closure span assignment in makeClosure [#15841](https://github.com/lampepfl/dotty/pull/15841) + +## Default parameters + +- Fix default args lookup for given classes [#20256](https://github.com/lampepfl/dotty/pull/20256) +- Fix implicit search failure reporting [#20261](https://github.com/lampepfl/dotty/pull/20261) + +## Derivation + +- Fix infinite loop in Mirror synthesis of unreducible match type [#20133](https://github.com/lampepfl/dotty/pull/20133) + +## Desugaring + +- Add explanation to checkCaseClassInheritanceInvariant error msg [#20141](https://github.com/lampepfl/dotty/pull/20141) + +## Exports + +- Add annotations in parameters for exports [#20140](https://github.com/lampepfl/dotty/pull/20140) +- Fix isAliasType [#20195](https://github.com/lampepfl/dotty/pull/20195) + +## Implicits + +- Fix implicitNotFound message for type aliases [#19343](https://github.com/lampepfl/dotty/pull/19343) +- Normalize types before collecting parts determining implicit scope [#20077](https://github.com/lampepfl/dotty/pull/20077) +- Better error diagnostics under -explain-cyclic [#20251](https://github.com/lampepfl/dotty/pull/20251) +- Update unreducible match types error reporting [#19954](https://github.com/lampepfl/dotty/pull/19954) +- Improve ConstraintHandling of SkolemTypes [#20175](https://github.com/lampepfl/dotty/pull/20175) + +## Incremental Compilation + +- Retain default parameters with `export` [#20167](https://github.com/lampepfl/dotty/pull/20167) + +## Inline + +- Fix by-name parameter in beta-reduction [#20096](https://github.com/lampepfl/dotty/pull/20096) +- Add warning for anonymous inline classes (#16723) [#20291](https://github.com/lampepfl/dotty/pull/20291) +- Avoid conversion of `Unit` type into `()` term [#20295](https://github.com/lampepfl/dotty/pull/20295) +- Type desugared `transparent inline def unapply` call in the correct mode [#20108](https://github.com/lampepfl/dotty/pull/20108) +- Regression: fix compilation performance on Windows [#20193](https://github.com/lampepfl/dotty/pull/20193) +- Fix inline match on blocks with multiple statements [#20125](https://github.com/lampepfl/dotty/pull/20125) +- Inline `unapply`s in the inlining phase [#19382](https://github.com/lampepfl/dotty/pull/19382) +- Fix outerSelect in Inliner [#20313](https://github.com/lampepfl/dotty/pull/20313) + +## Linting + +- Fix #20146: attach the original name if there is an import selection for an indent [#20163](https://github.com/lampepfl/dotty/pull/20163) +- Add regression test for issue 18632 [#20308](https://github.com/lampepfl/dotty/pull/20308) + +## Match Types + +- Make aliases of `MatchAlias`es normal `TypeAlias`es [#19871](https://github.com/lampepfl/dotty/pull/19871) +- Fix #19746: Do not follow param term refs in `isConcrete`. [#20015](https://github.com/lampepfl/dotty/pull/20015) +- Do match type reduction atPhaseNoLater than ElimOpaque [#20017](https://github.com/lampepfl/dotty/pull/20017) +- Do not flag match types as `Deferred` and amend #20077 [#20147](https://github.com/lampepfl/dotty/pull/20147) +- Always use baseType when constraining patternTp with scrutineeTp [#20032](https://github.com/lampepfl/dotty/pull/20032) +- Use `MirrorSource.reduce` result for `companionPath` [#20207](https://github.com/lampepfl/dotty/pull/20207) +- Regression: Fix match type extraction of a MatchAlias [#20111](https://github.com/lampepfl/dotty/pull/20111) +- Revert "Approximate MatchTypes with lub of case bodies, if non-recursive" in 3.5.0 [#21266](https://github.com/scala/scala3/pull/21266) + +## Polyfunctions + +- Discard poly-functions when trying to resolve overloading [#20181](https://github.com/lampepfl/dotty/pull/20181) + +## Presentation Compiler + +- Stabilise returned completions by improving deduplication + extra completions for constructors [#19976](https://github.com/lampepfl/dotty/pull/19976) +- Fix active param index for empty param lists [#20142](https://github.com/lampepfl/dotty/pull/20142) +- Delias type members in hover [#20173](https://github.com/lampepfl/dotty/pull/20173) +- Interactive: handle context bounds in extension construct workaround [#20201](https://github.com/lampepfl/dotty/pull/20201) +- Fix: prefer non-export definition locations [#20252](https://github.com/lampepfl/dotty/pull/20252) +- Don't show enum completions in new keyword context [#20304](https://github.com/lampepfl/dotty/pull/20304) +- Chore: Backport changes for presentation compiler [#20345](https://github.com/lampepfl/dotty/pull/20345) +- Add custom matchers for completions (fuzzy search for presentation compiler) [#19850](https://github.com/lampepfl/dotty/pull/19850) + +## Quotes + +- Fix TermRef prefixes not having their type healed [#20102](https://github.com/lampepfl/dotty/pull/20102) +- Improve reporting in staging about the possible use of an incorrect class loader [#20137](https://github.com/lampepfl/dotty/pull/20137) +- Introduce MethodTypeKind to quotes reflection API [#20249](https://github.com/lampepfl/dotty/pull/20249) +- Add quote ASTs to TASTy [#20165](https://github.com/lampepfl/dotty/pull/20165) + +## Reflection + +- Allow to beta reduce curried function applications in quotes reflect [#18121](https://github.com/lampepfl/dotty/pull/18121) +- Set the inlining phase in the Context used for checking macro trees [#20087](https://github.com/lampepfl/dotty/pull/20087) +- Add Symbol.isSuperAccessor to reflection API [#13388](https://github.com/lampepfl/dotty/pull/13388) +- Stabilize reflect `SymbolMethods.isSuperAccessor` [#20198](https://github.com/lampepfl/dotty/pull/20198) + +## Repl + +- Fix validity period of derived SingleDenotations [#19983](https://github.com/lampepfl/dotty/pull/19983) +- Fix #18383: Never consider top-level `import`s as unused in the repl. [#20310](https://github.com/lampepfl/dotty/pull/20310) + +## Reporting + +- Warn if extension receiver already has member [#17543](https://github.com/lampepfl/dotty/pull/17543) +- Deprecation of case class elements [#17911](https://github.com/lampepfl/dotty/pull/17911) +- Support src filter in -WConf (Closes #17635) [#18783](https://github.com/lampepfl/dotty/pull/18783) +- Add note about type mismatch in automatically inserted apply argument [#20023](https://github.com/lampepfl/dotty/pull/20023) +- Make error reporting resilient to exception thrown while reporting [#20158](https://github.com/lampepfl/dotty/pull/20158) +- Remove duplicate comma from Matchable selector warning [#20159](https://github.com/lampepfl/dotty/pull/20159) +- Generalize warnings for top-level calls to Any or AnyRef methods [#20312](https://github.com/lampepfl/dotty/pull/20312) +- Make CheckUnused not slow. [#20321](https://github.com/lampepfl/dotty/pull/20321) +- Bring back ambiguity filter when we report an implicit not found error [#20368](https://github.com/scala/scala3/pull/20368) +- Treat 3.5-migration the same as 3.5 for a warning about implicit priority change [#20436](https://github.com/scala/scala3/pull/20436) +- Priority warning fix alternative [#20487](https://github.com/scala/scala3/pull/20487) +- Use final result type to check selector bound [#20989](https://github.com/scala/scala3/pull/20989) +- Refine implicit priority change warnings [#21045](https://github.com/scala/scala3/pull/21045) +- Backport "Fix healAmbiguous to compareAlternatives with disambiguate = true" to 3.5.0 [#21344](https://github.com/scala/scala3/pull/21344) + +## Rewrites + +- Patch indentation when removing braces (and other bug fixes in `-indent -rewrite`) [#17522](https://github.com/lampepfl/dotty/pull/17522) +- Extra check to avoid converting block expressions on the rhs of an in… [#20043](https://github.com/lampepfl/dotty/pull/20043) + +## Scaladoc + +- Fix scaladoc crash on Windows - illegal path character [#20311](https://github.com/lampepfl/dotty/pull/20311) +- Scaladoc: improve refined function types rendering [#20333](https://github.com/lampepfl/dotty/pull/20333) +- Relax font-weight reset [#20348](https://github.com/lampepfl/dotty/pull/20348) + +## Scala JS + +- Optimize main.js [#20093](https://github.com/lampepfl/dotty/pull/20093) + +## Settings + +- Lift Scala Settings from experimental to stabilized [#20199](https://github.com/lampepfl/dotty/pull/20199) + +## Tooling + +- Detect macro dependencies that are missing from the classloader [#20139](https://github.com/lampepfl/dotty/pull/20139) +- Write pipelined tasty in parallel. [#20153](https://github.com/lampepfl/dotty/pull/20153) +- ConsoleReporter sends INFO to stdout [#20328](https://github.com/lampepfl/dotty/pull/20328) +- Bundle scala-cli in scala command [#20351](https://github.com/scala/scala3/pull/20351) +- Adapt the workflow to release on SDKMAN! [#20535](https://github.com/scala/scala3/pull/20535) +- Adapt the release workflow to SIP-46 [#20565](https://github.com/scala/scala3/pull/20565) +- Release .zip instead of .tar.gz for windows in sdkman [#20630](https://github.com/scala/scala3/pull/20630) +- SIP 46 - read classpath from file, remove lib directory in distribution [#20631](https://github.com/scala/scala3/pull/20631) +.gz for windows in sdkman [#20630](https://github.com/scala/scala3/pull/20630) +- Bump scala-cli to 1.4.0 [#20859](https://github.com/scala/scala3/pull/20859) +- Add --skip-cli-updates by default to the scala command [#20900](https://github.com/scala/scala3/pull/20900) +- Use pathing jars in cli commands [#21121](https://github.com/scala/scala3/pull/21121) +- expand classpath of pathing jars in scala_legacy command [#21160](https://github.com/scala/scala3/pull/21160) +- emit generatedNonLocalClass in backend when callback is not enabled [#21186](https://github.com/scala/scala3/pull/21186) + +## Transform + +- Fix overloaded default methods test in RefChecks [#20218](https://github.com/lampepfl/dotty/pull/20218) +- Fix handling of AppliedType aliases in outerPrefix [#20190](https://github.com/lampepfl/dotty/pull/20190) +- Elide unit binding when beta-reducing [#20085](https://github.com/lampepfl/dotty/pull/20085) + +## Typer + +- Reduce projections of type aliases with class type prefixes [#19931](https://github.com/lampepfl/dotty/pull/19931) +- Re-lub also hard union types in simplify [#20027](https://github.com/lampepfl/dotty/pull/20027) +- Fix #19789: Merge same TypeParamRef in orDominator [#20090](https://github.com/lampepfl/dotty/pull/20090) +- Allow SAM types to contain match alias refinements [#20092](https://github.com/lampepfl/dotty/pull/20092) +- Don't dealias when deciding which arguments to defer [#20116](https://github.com/lampepfl/dotty/pull/20116) +- Avoid the TypeVar.inst trap [#20160](https://github.com/lampepfl/dotty/pull/20160) +- Avoid crash when superType does not exist after erasure [#20188](https://github.com/lampepfl/dotty/pull/20188) +- Refine overloading and implicit disambiguation [#20084](https://github.com/lampepfl/dotty/pull/20084) +- Refactor constant folding of applications [#20099](https://github.com/lampepfl/dotty/pull/20099) +- Rollback constraints if `isSameType` failed second direction [#20109](https://github.com/lampepfl/dotty/pull/20109) +- Suppress "extension method will never be selected" for overrides [#20164](https://github.com/lampepfl/dotty/pull/20164) +- Allow SAM types to contain multiple refinements [#20172](https://github.com/lampepfl/dotty/pull/20172) +- Normalize when verifying if TypeTestCasts are unchecked [#20258](https://github.com/lampepfl/dotty/pull/20258) +- Avoid stacked thisCall contexts [#20488](https://github.com/scala/scala3/pull/20488) +- fix issue 20901: etaCollapse context bound type [#20910](https://github.com/scala/scala3/pull/20910) +- Fix symbol reference retrivial of `scala.caps.Caps` [#20493](https://github.com/scala/scala3/pull/20493) + +# Experimental Changes + +- Named tuples second implementation [#19174](https://github.com/lampepfl/dotty/pull/19174) +- Change rules for given prioritization [#19300](https://github.com/lampepfl/dotty/pull/19300) +- Enable experimental mode when experimental feature is imported [#19807](https://github.com/lampepfl/dotty/pull/19807) +- Add message parameter to `@experimental` annotation [#19935](https://github.com/lampepfl/dotty/pull/19935) +- Implement match type amendment: extractors follow aliases and singletons [#20161](https://github.com/lampepfl/dotty/pull/20161) +- Avoid forcing whole package when using -experimental [#20409](https://github.com/scala/scala3/pull/20409) + +## Capture Checking + +- Carry and check universal capability from parents correctly [#20004](https://github.com/lampepfl/dotty/pull/20004) +- Make parameter types of context functions inferred type trees [#20155](https://github.com/lampepfl/dotty/pull/20155) +- Handle reach capabilities correctly in depedent functions [#20203](https://github.com/lampepfl/dotty/pull/20203) +- Fix the visibility check in `markFree` [#20221](https://github.com/lampepfl/dotty/pull/20221) +- Make inline proxy vals have inferred types [#20241](https://github.com/lampepfl/dotty/pull/20241) +- CC: Give more info when context function parameters leak [#20244](https://github.com/lampepfl/dotty/pull/20244) +- Plug soundness hole for reach capabilities [#20051](https://github.com/lampepfl/dotty/pull/20051) +- Tighten the screws a bit more to seal the soundness hole for reach capabilities [#20056](https://github.com/lampepfl/dotty/pull/20056) +- Drop retains annotations in inferred type trees [#20057](https://github.com/lampepfl/dotty/pull/20057) +- Allow @retains arguments to be context functions [#20232](https://github.com/lampepfl/dotty/pull/20232) +- Fix conversion of this.fld capture refs under separate compilation [#20238](https://github.com/lampepfl/dotty/pull/20238) + +## Erased definitions + +- Fix "Compiler crash when using CanThrow" [#20210](https://github.com/lampepfl/dotty/pull/20210) +- Only allow erased parameters in erased definitions [#19686](https://github.com/lampepfl/dotty/pull/19686) + +## Initialization + +- Deprecate `StandardPlugin.init` in favor of `initialize` method taking implicit Context [#20330](https://github.com/lampepfl/dotty/pull/20330) +- Fix missing changesParents in PostTyper [#20062](https://github.com/lampepfl/dotty/pull/20062) +- Special case for next field of colon colon in global init checker [#20281](https://github.com/lampepfl/dotty/pull/20281) +- Extend whitelist in global initialization checker [#20290](https://github.com/lampepfl/dotty/pull/20290) + +## Macro Annotations + +- Allow macro annotation to transform companion [#19677](https://github.com/lampepfl/dotty/pull/19677) +- Remove experimental `MainAnnotation`/`newMain` (replaced with `MacroAnnotation`) [#19937](https://github.com/lampepfl/dotty/pull/19937) + +## Nullability + +- Add flexible types to deal with Java-defined signatures under -Yexplicit-nulls [#18112](https://github.com/lampepfl/dotty/pull/18112) +- Fix #20287: Add flexible types to Quotes library [#20293](https://github.com/lampepfl/dotty/pull/20293) +- Add fromNullable to Predef for explicit nulls [#20222](https://github.com/lampepfl/dotty/pull/20222) + + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.4.2..3.5.0` these are: + +``` + 153 Martin Odersky + 53 Eugene Flesselle + 41 Jamie Thompson + 29 Wojciech Mazur + 25 Nicolas Stucki + 22 Sébastien Doeraene + 18 noti0na1 + 16 Matt Bovel + 13 Guillaume Martres + 11 Paweł Marks + 10 Hamza REMMAL + 9 Yichen Xu + 8 Jan Chyb + 7 Hamza Remmal + 7 Som Snytt + 6 Jędrzej Rochala + 5 Fengyun Liu + 5 dependabot[bot] + 3 Mikołaj Fornal + 2 Aviv Keller + 2 EnzeXing + 1 Chris Pado + 1 Filip Zybała + 1 Georgi Krastev + 1 Jisoo Park + 1 Katarzyna Marek + 1 Lucas Nouguier + 1 Lucy Martin + 1 Ola Flisbäck + 1 Pascal Weisenburger + 1 Quentin Bernet + 1 Raphael Jolly + 1 Seth Tisue + 1 Stephane Bersier + 1 Tomasz Godzik + 1 Yoonjae Jeon + 1 aherlihy + 1 rochala + 1 willerf + +``` diff --git a/changelogs/3.6.3-RC1.md b/changelogs/3.6.3-RC1.md new file mode 100644 index 000000000000..201201fbf1bc --- /dev/null +++ b/changelogs/3.6.3-RC1.md @@ -0,0 +1,179 @@ +# Highlights of the release + +- Scala 2 forwardport: `-Yprofile-trace` [#19897](https://github.com/scala/scala3/pull/19897) + +# Other changes and fixes + +## Annotations + +- Fix Java parsing of annotations on qualified types [#21867](https://github.com/scala/scala3/pull/21867) +- Consider all arguments in Annotations.refersToParamOf [#22001](https://github.com/scala/scala3/pull/22001) + +## Backend + +- Flag class file collision as error [#19332](https://github.com/scala/scala3/pull/19332) + +## Compiler Phases + +- Fix #21939: Update names and descriptions for cc and setup phases [#21942](https://github.com/scala/scala3/pull/21942) + +## Experimental: Explicit Nulls + +- Improve warning for wildcard matching only null under the explicit nulls flag (scala#21577) [#21623](https://github.com/scala/scala3/pull/21623) +- Fix warning message for matching on redundant nulls [#21850](https://github.com/scala/scala3/pull/21850) + +## Experimental: Capture Checking + +- Fix #21868, #21869, and #21870: handle CapsOf in more places [#21875](https://github.com/scala/scala3/pull/21875) +- Consolidate CC [#21863](https://github.com/scala/scala3/pull/21863) +- Add path support for capture checking [#21445](https://github.com/scala/scala3/pull/21445) + +## Experimentals + +- Replace symbol traversal with tree traversal when finding top level experimentals [#21827](https://github.com/scala/scala3/pull/21827) + +## Extension Methods + +- Nowarn extension matching nonpublic member [#21825](https://github.com/scala/scala3/pull/21825) + +## Implicits + +- Apply implicit conversion from derived Conversion instance defined as implicit rather than given [#21785](https://github.com/scala/scala3/pull/21785) + +## Imports + +- Allow imports nested in packagings to shadow [#21539](https://github.com/scala/scala3/pull/21539) + +## Inline + +- Avoid using the current denotation in NamedType.disambiguate [#21414](https://github.com/scala/scala3/pull/21414) +- Drop phase.isTyper use in isLegalPrefix/asf [#21954](https://github.com/scala/scala3/pull/21954) +- Fix for macro annotation that resolves macro-based implicit crashing the compiler [#20353](https://github.com/scala/scala3/pull/20353) +- Allow macro annotations to recover from suspension [#21969](https://github.com/scala/scala3/pull/21969) + +## Linting + +- Disallow open modifier on objects [#21922](https://github.com/scala/scala3/pull/21922) +- Allow discarding "Discarded non-Unit" warnings with `: Unit` [#21927](https://github.com/scala/scala3/pull/21927) + +## Opaque Types + +- Fix pkg obj prefix of opaque tp ext meth [#21527](https://github.com/scala/scala3/pull/21527) + +## Parser + +- Fix: don't consider `into` as a soft-modifier [#21924](https://github.com/scala/scala3/pull/21924) + +## Pattern Matching + +- Drop inaccessible subclasses from refineUsingParent [#21799](https://github.com/scala/scala3/pull/21799) +- (Re-)Drop inaccessible subclasses from refineUsingParent [#21930](https://github.com/scala/scala3/pull/21930) +- Fix use of class terms in match analysis [#21848](https://github.com/scala/scala3/pull/21848) +- Don't project nested wildcard patterns to nullable [#21934](https://github.com/scala/scala3/pull/21934) +- Fix provablyDisjoint handling enum constants with mixins [#21876](https://github.com/scala/scala3/pull/21876) +- Do not consider uninhabited constructors when performing exhaustive match checking [#21750](https://github.com/scala/scala3/pull/21750) + +## Presentation Compiler + +- Update mtags to 1.4.1 and backport remaining changes [#21859](https://github.com/scala/scala3/pull/21859) +- Backport changes for the presentation compiler from Metals [#21756](https://github.com/scala/scala3/pull/21756) + +## Pickling + +- Avoid orphan param from default arg [#21824](https://github.com/scala/scala3/pull/21824) +- Make sure definition tree has the defined symbol [#21851](https://github.com/scala/scala3/pull/21851) + +## REPL + +- Allow top-level opaque type definitions in REPL [#21753](https://github.com/scala/scala3/pull/21753) + +## Scaladoc + +- Fix scaladoc TastyInspector regressions [#21716](https://github.com/scala/scala3/pull/21716) +- Bring back the fix for scaladoc TastyInspector regressions [#21929](https://github.com/scala/scala3/pull/21929) + +## Standard Library + +- Combine cases of `Tuple.Zip` disjoint from `(h1 *: t1, h2 *: t2)` [#21287](https://github.com/scala/scala3/pull/21287) + +## Quotes + +- Fix #20471: owners of top-level symbols in cached quoted code being incorrect [#21945](https://github.com/scala/scala3/pull/21945) + +## Reporting + +- Do not warn about expected missing positions in quotes.reflect.Symbol [#21677](https://github.com/scala/scala3/pull/21677) +- Add missing error messages to asserts in QuotesImpl [#21852](https://github.com/scala/scala3/pull/21852) +- Don't point to the compiler backlog when a compiler plugin phase crashes [#21887](https://github.com/scala/scala3/pull/21887) +- Better error message for polytypes wrapping capturing types [#21843](https://github.com/scala/scala3/pull/21843) +- Pretty-print lambdas [#21846](https://github.com/scala/scala3/pull/21846) + +## Scala.js + +- Shade scalajs.ir under dotty.tools [#21765](https://github.com/scala/scala3/pull/21765) + +## Scaladoc + +- Fix scaladoc graph highlight background color in dark mode [#21814](https://github.com/scala/scala3/pull/21814) + +## SemanticDB + +- Extract semanticDB for lifted definitions [#21856](https://github.com/scala/scala3/pull/21856) + +## Transform + +- Fix enclosingClass from returning refinement classes [#21411](https://github.com/scala/scala3/pull/21411) +- Attempt to beta reduce only if parameters and arguments have same shape [#21970](https://github.com/scala/scala3/pull/21970) +- Drop copied parent refinements before generating bytecode [#21733](https://github.com/scala/scala3/pull/21733) + +## Tooling + +- Ensure to escape characters before constructing JSON profile trace [#21872](https://github.com/scala/scala3/pull/21872) + +## Tuples + +- Fix tupleTypeFromSeq for XXL tuples [#21782](https://github.com/scala/scala3/pull/21782) + +## Typer + +- Do not crash when typing a closure with unknown type, since it can occur for erroneous input [#21178](https://github.com/scala/scala3/pull/21178) +- Revert SAM condition to what it was before [#21684](https://github.com/scala/scala3/pull/21684) +- Fix ctx implicits under case unapplySeq [#21748](https://github.com/scala/scala3/pull/21748) +- Avoid erasure/preErasure issues around Any in transformIsInstanceOf [#21647](https://github.com/scala/scala3/pull/21647) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.6.2..3.6.3-RC1` these are: + +``` + 30 Dale Wijnand + 30 Kacper Korban + 27 Wojciech Mazur + 14 noti0na1 + 10 Eugene Flesselle + 10 Hamza Remmal + 10 HarrisL2 + 9 Martin Odersky + 8 Matt Bovel + 7 Jan Chyb + 6 Tomasz Godzik + 4 Jamie Thompson + 2 Friendseeker + 2 Pascal Weisenburger + 2 Seth Tisue + 2 Sébastien Doeraene + 1 Adrien Piquerez + 1 Alden Torres + 1 Alexander + 1 Fengyun Liu + 1 Georgi Krastev + 1 Jentsch + 1 Lunfu Zhong + 1 Michał Pałka + 1 Natsu Kagami + 1 dependabot[bot] + 1 friendseeker + 1 tgodzik +``` diff --git a/changelogs/3.6.3-RC2.md b/changelogs/3.6.3-RC2.md new file mode 100644 index 000000000000..0da2783bd6fe --- /dev/null +++ b/changelogs/3.6.3-RC2.md @@ -0,0 +1,24 @@ +# Backported fixes + +- Fix: update `scala-cli.jar` path [#22274](http://github.com/scala/scala3/pull/22274) +- Nowarn extension matching nonpublic member [#22276](http://github.com/scala/scala3/pull/22276) +- Limit exposure to ConcurrentModificationException when sys props are replaced or mutated [#22275](http://github.com/scala/scala3/pull/22275) +- Refactor: Improve Given search preference warning [#22273](http://github.com/scala/scala3/pull/22273) +- Fix layout of released SDK archives, restore intermiediete top-level directory [#22272](http://github.com/scala/scala3/pull/22272) +- REPL: JLine: follow recommendation to use JNI, not JNA; also JLine 3.27.1 (was 3.27.0) [#22271](http://github.com/scala/scala3/pull/22271) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.6.3-RC1..3.6.3-RC2` these are: + +``` + 4 Wojciech Mazur + 2 João Ferreira + 2 Seth Tisue + 2 Som Snytt + 1 Eugene Yokota + 1 Hamza Remmal + 1 Rui Chen +``` diff --git a/changelogs/3.6.3.md b/changelogs/3.6.3.md new file mode 100644 index 000000000000..2b3d23b75222 --- /dev/null +++ b/changelogs/3.6.3.md @@ -0,0 +1,192 @@ +# Highlights of the release + +- Scala 2 forwardport: `-Yprofile-trace` [#19897](https://github.com/scala/scala3/pull/19897) + +# Other changes and fixes + +## Annotations + +- Fix Java parsing of annotations on qualified types [#21867](https://github.com/scala/scala3/pull/21867) +- Consider all arguments in Annotations.refersToParamOf [#22001](https://github.com/scala/scala3/pull/22001) + +## Backend + +- Flag class file collision as error [#19332](https://github.com/scala/scala3/pull/19332) + +## Compiler Phases + +- Fix #21939: Update names and descriptions for cc and setup phases [#21942](https://github.com/scala/scala3/pull/21942) +- Limit exposure to ConcurrentModificationException when sys props are replaced or mutated [#22275](http://github.com/scala/scala3/pull/22275) + +## Experimental: Explicit Nulls + +- Improve warning for wildcard matching only null under the explicit nulls flag (scala#21577) [#21623](https://github.com/scala/scala3/pull/21623) +- Fix warning message for matching on redundant nulls [#21850](https://github.com/scala/scala3/pull/21850) + +## Experimental: Capture Checking + +- Fix #21868, #21869, and #21870: handle CapsOf in more places [#21875](https://github.com/scala/scala3/pull/21875) +- Consolidate CC [#21863](https://github.com/scala/scala3/pull/21863) +- Add path support for capture checking [#21445](https://github.com/scala/scala3/pull/21445) + +## Experimentals + +- Replace symbol traversal with tree traversal when finding top level experimentals [#21827](https://github.com/scala/scala3/pull/21827) + +## Extension Methods + +- Nowarn extension matching nonpublic member [#21825](https://github.com/scala/scala3/pull/21825) + +## Implicits + +- Apply implicit conversion from derived Conversion instance defined as implicit rather than given [#21785](https://github.com/scala/scala3/pull/21785) + +## Imports + +- Allow imports nested in packagings to shadow [#21539](https://github.com/scala/scala3/pull/21539) + +## Inline + +- Avoid using the current denotation in NamedType.disambiguate [#21414](https://github.com/scala/scala3/pull/21414) +- Drop phase.isTyper use in isLegalPrefix/asf [#21954](https://github.com/scala/scala3/pull/21954) +- Fix for macro annotation that resolves macro-based implicit crashing the compiler [#20353](https://github.com/scala/scala3/pull/20353) +- Allow macro annotations to recover from suspension [#21969](https://github.com/scala/scala3/pull/21969) + +## Linting + +- Disallow open modifier on objects [#21922](https://github.com/scala/scala3/pull/21922) +- Allow discarding "Discarded non-Unit" warnings with `: Unit` [#21927](https://github.com/scala/scala3/pull/21927) + +## Opaque Types + +- Fix pkg obj prefix of opaque tp ext meth [#21527](https://github.com/scala/scala3/pull/21527) + +## Parser + +- Fix: don't consider `into` as a soft-modifier [#21924](https://github.com/scala/scala3/pull/21924) + +## Pattern Matching + +- Drop inaccessible subclasses from refineUsingParent [#21799](https://github.com/scala/scala3/pull/21799) +- (Re-)Drop inaccessible subclasses from refineUsingParent [#21930](https://github.com/scala/scala3/pull/21930) +- Fix use of class terms in match analysis [#21848](https://github.com/scala/scala3/pull/21848) +- Don't project nested wildcard patterns to nullable [#21934](https://github.com/scala/scala3/pull/21934) +- Fix provablyDisjoint handling enum constants with mixins [#21876](https://github.com/scala/scala3/pull/21876) +- Do not consider uninhabited constructors when performing exhaustive match checking [#21750](https://github.com/scala/scala3/pull/21750) + +## Presentation Compiler + +- Update mtags to 1.4.1 and backport remaining changes [#21859](https://github.com/scala/scala3/pull/21859) +- Backport changes for the presentation compiler from Metals [#21756](https://github.com/scala/scala3/pull/21756) + +## Pickling + +- Avoid orphan param from default arg [#21824](https://github.com/scala/scala3/pull/21824) +- Make sure definition tree has the defined symbol [#21851](https://github.com/scala/scala3/pull/21851) + +## REPL + +- Allow top-level opaque type definitions in REPL [#21753](https://github.com/scala/scala3/pull/21753) +- JLine: follow recommendation to use JNI, not JNA; also JLine 3.27.1 (was 3.27.0) [#22271](http://github.com/scala/scala3/pull/22271) + +## Scaladoc + +- Fix scaladoc TastyInspector regressions [#21716](https://github.com/scala/scala3/pull/21716) +- Bring back the fix for scaladoc TastyInspector regressions [#21929](https://github.com/scala/scala3/pull/21929) +- Fix scaladoc graph highlight background color in dark mode [#21814](https://github.com/scala/scala3/pull/21814) + +## Standard Library + +- Combine cases of `Tuple.Zip` disjoint from `(h1 *: t1, h2 *: t2)` [#21287](https://github.com/scala/scala3/pull/21287) + +## Quotes + +- Fix #20471: owners of top-level symbols in cached quoted code being incorrect [#21945](https://github.com/scala/scala3/pull/21945) + +## Reporting + +- Do not warn about expected missing positions in quotes.reflect.Symbol [#21677](https://github.com/scala/scala3/pull/21677) +- Add missing error messages to asserts in QuotesImpl [#21852](https://github.com/scala/scala3/pull/21852) +- Don't point to the compiler backlog when a compiler plugin phase crashes [#21887](https://github.com/scala/scala3/pull/21887) +- Better error message for polytypes wrapping capturing types [#21843](https://github.com/scala/scala3/pull/21843) +- Pretty-print lambdas [#21846](https://github.com/scala/scala3/pull/21846) +- Nowarn extension matching nonpublic member [#22276](http://github.com/scala/scala3/pull/22276) +- Refactor: Improve Given search preference warning [#22273](http://github.com/scala/scala3/pull/22273) + +## Runner + +- Fix: update `scala-cli.jar` path [#22274](http://github.com/scala/scala3/pull/22274) + +## Releases + +- Fix layout of released SDK archives, restore intermiediete top-level directory [#22272](http://github.com/scala/scala3/pull/22272) + +## Scala.js + +- Shade scalajs.ir under dotty.tools [#21765](https://github.com/scala/scala3/pull/21765) + +## SemanticDB + +- Extract semanticDB for lifted definitions [#21856](https://github.com/scala/scala3/pull/21856) + +## Transform + +- Fix enclosingClass from returning refinement classes [#21411](https://github.com/scala/scala3/pull/21411) +- Attempt to beta reduce only if parameters and arguments have same shape [#21970](https://github.com/scala/scala3/pull/21970) +- Drop copied parent refinements before generating bytecode [#21733](https://github.com/scala/scala3/pull/21733) + +## Tooling + +- Ensure to escape characters before constructing JSON profile trace [#21872](https://github.com/scala/scala3/pull/21872) + +## Tuples + +- Fix tupleTypeFromSeq for XXL tuples [#21782](https://github.com/scala/scala3/pull/21782) + +## Typer + +- Do not crash when typing a closure with unknown type, since it can occur for erroneous input [#21178](https://github.com/scala/scala3/pull/21178) +- Revert SAM condition to what it was before [#21684](https://github.com/scala/scala3/pull/21684) +- Fix ctx implicits under case unapplySeq [#21748](https://github.com/scala/scala3/pull/21748) +- Avoid erasure/preErasure issues around Any in transformIsInstanceOf [#21647](https://github.com/scala/scala3/pull/21647) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.6.2..3.6.3` these are: + +``` + 33 Wojciech Mazur + 30 Dale Wijnand + 30 Kacper Korban + 14 noti0na1 + 11 Hamza Remmal + 10 Eugene Flesselle + 10 HarrisL2 + 9 Martin Odersky + 8 Matt Bovel + 7 Jan Chyb + 6 Tomasz Godzik + 5 Seth Tisue + 4 Jamie Thompson + 2 Friendseeker + 2 João Ferreira + 2 Pascal Weisenburger + 2 Som Snytt + 2 Sébastien Doeraene + 1 Adrien Piquerez + 1 Alden Torres + 1 Alexander + 1 Eugene Yokota + 1 Fengyun Liu + 1 Georgi Krastev + 1 Jentsch + 1 Lunfu Zhong + 1 Michał Pałka + 1 Natsu Kagami + 1 Rui Chen + 1 dependabot[bot] + 1 friendseeker + 1 tgodzik +``` diff --git a/community-build/community-projects/scas b/community-build/community-projects/scas index 83d0f62bbc57..acaad1055738 160000 --- a/community-build/community-projects/scas +++ b/community-build/community-projects/scas @@ -1 +1 @@ -Subproject commit 83d0f62bbc57691e509f07186b34847bafe4b96e +Subproject commit acaad1055738dbbcae7b18e6c6c2fc95f06eb7d6 diff --git a/community-build/community-projects/stdLib213 b/community-build/community-projects/stdLib213 index b6f70d2347f2..fcc67cd56c67 160000 --- a/community-build/community-projects/stdLib213 +++ b/community-build/community-projects/stdLib213 @@ -1 +1 @@ -Subproject commit b6f70d2347f2857695e5c0fe544b0f921544b02a +Subproject commit fcc67cd56c67851bf31019ec25ccb09d08b9561b diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index bf78c8e1a2cf..6181d4c3ddec 100644 --- a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala +++ b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala @@ -68,7 +68,7 @@ class CommunityBuildTestC: @Test def fastparse = projects.fastparse.run() @Test def geny = projects.geny.run() @Test def intent = projects.intent.run() - @Test def jacksonModuleScala = projects.jacksonModuleScala.run() + //@Test def jacksonModuleScala = projects.jacksonModuleScala.run() @Test def libretto = projects.libretto.run() @Test def minitest = projects.minitest.run() //@Test def onnxScala = projects.onnxScala.run() @@ -95,6 +95,7 @@ class CommunityBuildTestC: @Test def sourcecode = projects.sourcecode.run() @Test def specs2 = projects.specs2.run() + // @Test def stdLib213 = projects.stdLib213.run() @Test def ujson = projects.ujson.run() @Test def upickle = projects.upickle.run() @Test def utest = projects.utest.run() diff --git a/compiler/src/dotty/tools/dotc/config/Feature.scala b/compiler/src/dotty/tools/dotc/config/Feature.scala index ad20bab46c1e..8b9a64924ace 100644 --- a/compiler/src/dotty/tools/dotc/config/Feature.scala +++ b/compiler/src/dotty/tools/dotc/config/Feature.scala @@ -34,6 +34,7 @@ object Feature: val pureFunctions = experimental("pureFunctions") val captureChecking = experimental("captureChecking") val into = experimental("into") + val namedTuples = experimental("namedTuples") val modularity = experimental("modularity") val betterMatchTypeExtractors = experimental("betterMatchTypeExtractors") val quotedPatternsWithPolymorphicFunctions = experimental("quotedPatternsWithPolymorphicFunctions") @@ -65,6 +66,7 @@ object Feature: (pureFunctions, "Enable pure functions for capture checking"), (captureChecking, "Enable experimental capture checking"), (into, "Allow into modifier on parameter types"), + (namedTuples, "Allow named tuples"), (modularity, "Enable experimental modularity features"), (betterMatchTypeExtractors, "Enable better match type extractors"), (betterFors, "Enable improvements in `for` comprehensions") diff --git a/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala b/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala index 247e3f62a98d..1d99caa789d3 100644 --- a/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala +++ b/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala @@ -26,7 +26,7 @@ enum MigrationVersion(val warnFrom: SourceVersion, val errorFrom: SourceVersion) case WithOperator extends MigrationVersion(`3.4`, future) case FunctionUnderscore extends MigrationVersion(`3.4`, future) case NonNamedArgumentInJavaAnnotation extends MigrationVersion(`3.6`, `3.6`) - case AmbiguousNamedTupleInfixApply extends MigrationVersion(`3.6`, never) + case AmbiguousNamedTupleSyntax extends MigrationVersion(`3.6`, future) case ImportWildcard extends MigrationVersion(future, future) case ImportRename extends MigrationVersion(future, future) case ParameterEnclosedByParenthesis extends MigrationVersion(future, future) diff --git a/compiler/src/dotty/tools/dotc/config/PathResolver.scala b/compiler/src/dotty/tools/dotc/config/PathResolver.scala index 29e6e35855c8..f60727e6bba2 100644 --- a/compiler/src/dotty/tools/dotc/config/PathResolver.scala +++ b/compiler/src/dotty/tools/dotc/config/PathResolver.scala @@ -36,9 +36,16 @@ object PathResolver { /** Values found solely by inspecting environment or property variables. */ object Environment { - private def searchForBootClasspath = ( - systemProperties find (_._1 endsWith ".boot.class.path") map (_._2) getOrElse "" - ) + private def searchForBootClasspath = { + import scala.jdk.CollectionConverters.* + val props = System.getProperties + // This formulation should be immune to ConcurrentModificationExceptions when system properties + // we're unlucky enough to witness a partially published result of System.setProperty or direct + // mutation of the System property map. stringPropertyNames internally uses the Enumeration interface, + // rather than Iterator, and this disables the fail-fast ConcurrentModificationException. + val propNames = props.stringPropertyNames() + propNames.asScala collectFirst { case k if k endsWith ".boot.class.path" => props.getProperty(k) } getOrElse "" + } /** Environment variables which java pays attention to so it * seems we do as well. @@ -46,7 +53,8 @@ object PathResolver { def classPathEnv: String = envOrElse("CLASSPATH", "") def sourcePathEnv: String = envOrElse("SOURCEPATH", "") - def javaBootClassPath: String = propOrElse("sun.boot.class.path", searchForBootClasspath) + //using propOrNone/getOrElse instead of propOrElse so that searchForBootClasspath is lazy evaluated + def javaBootClassPath: String = propOrNone("sun.boot.class.path") getOrElse searchForBootClasspath def javaExtDirs: String = propOrEmpty("java.ext.dirs") def scalaHome: String = propOrEmpty("scala.home") diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 2e441553689c..220053e277a5 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -667,7 +667,7 @@ object Parsers { else leading :: Nil def maybeNamed(op: () => Tree): () => Tree = () => - if isIdent && in.lookahead.token == EQUALS && sourceVersion.isAtLeast(`3.6`) then + if isIdent && in.lookahead.token == EQUALS && in.featureEnabled(Feature.namedTuples) then atSpan(in.offset): val name = ident() in.nextToken() @@ -1149,8 +1149,8 @@ object Parsers { if isType then infixOp else infixOp.right match case Tuple(args) if args.exists(_.isInstanceOf[NamedArg]) && !isNamedTupleOperator => - report.errorOrMigrationWarning(AmbiguousNamedTupleInfixApply(), infixOp.right.srcPos, MigrationVersion.AmbiguousNamedTupleInfixApply) - if MigrationVersion.AmbiguousNamedTupleInfixApply.needsPatch then + report.errorOrMigrationWarning(DeprecatedInfixNamedArgumentSyntax(), infixOp.right.srcPos, MigrationVersion.AmbiguousNamedTupleSyntax) + if MigrationVersion.AmbiguousNamedTupleSyntax.needsPatch then val asApply = cpy.Apply(infixOp)(Select(opInfo.operand, opInfo.operator.name), args) patch(source, infixOp.span, asApply.show(using ctx.withoutColors)) asApply // allow to use pre-3.6 syntax in migration mode @@ -2172,7 +2172,7 @@ object Parsers { if namedOK && isIdent && in.lookahead.token == EQUALS then commaSeparated(() => namedArgType()) - else if tupleOK && isIdent && in.lookahead.isColon && sourceVersion.isAtLeast(`3.6`) then + else if tupleOK && isIdent && in.lookahead.isColon && in.featureEnabled(Feature.namedTuples) then commaSeparated(() => namedElem()) else commaSeparated(() => argType()) @@ -3491,7 +3491,7 @@ object Parsers { val hkparams = typeParamClauseOpt(ParamOwner.Hk) val bounds = if paramOwner.acceptsCtxBounds then typeAndCtxBounds(name) - else if in.featureEnabled(Feature.modularity) && paramOwner == ParamOwner.Type then typeAndCtxBounds(name) + else if sourceVersion.isAtLeast(`3.6`) && paramOwner == ParamOwner.Type then typeAndCtxBounds(name) else typeBounds() TypeDef(name, lambdaAbstract(hkparams, bounds)).withMods(mods) } diff --git a/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala b/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala index 35c170858bbf..d3467fe70c52 100644 --- a/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala +++ b/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala @@ -216,8 +216,9 @@ enum ErrorMessageID(val isActive: Boolean = true) extends java.lang.Enum[ErrorMe case FinalLocalDefID // errorNumber: 200 case NonNamedArgumentInJavaAnnotationID // errorNumber: 201 case QuotedTypeMissingID // errorNumber: 202 - case AmbiguousNamedTupleAssignmentID // errorNumber: 203 - case AmbiguousNamedTupleInfixApplyID // errorNumber: 204 + case DeprecatedAssignmentSyntaxID // errorNumber: 203 + case DeprecatedInfixNamedArgumentSyntaxID // errorNumber: 204 + case GivenSearchPriorityID // errorNumber: 205 def errorNumber = ordinal - 1 diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index 328ec122f848..bb3194558cae 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -3344,21 +3344,58 @@ final class QuotedTypeMissing(tpe: Type)(using Context) extends StagingMessage(Q end QuotedTypeMissing -final class AmbiguousNamedTupleAssignment(key: Name, value: untpd.Tree)(using Context) extends SyntaxMsg(AmbiguousNamedTupleAssignmentID): +final class DeprecatedAssignmentSyntax(key: Name, value: untpd.Tree)(using Context) extends SyntaxMsg(DeprecatedAssignmentSyntaxID): override protected def msg(using Context): String = - i"""Ambiguous syntax: this is interpreted as a named tuple with one element, + i"""Deprecated syntax: in the future it would be interpreted as a named tuple with one element, |not as an assignment. | |To assign a value, use curly braces: `{${key} = ${value}}`.""" - + + Message.rewriteNotice("This", version = SourceVersion.`3.6-migration`) + override protected def explain(using Context): String = "" -class AmbiguousNamedTupleInfixApply()(using Context) extends SyntaxMsg(AmbiguousNamedTupleInfixApplyID): +class DeprecatedInfixNamedArgumentSyntax()(using Context) extends SyntaxMsg(DeprecatedInfixNamedArgumentSyntaxID): def msg(using Context) = - "Ambigious syntax: this infix call argument list is interpreted as single named tuple argument, not as an named arguments list." - + Message.rewriteNotice("This", version = SourceVersion.`3.6-migration`) + i"""Deprecated syntax: infix named arguments lists are deprecated; in the future it would be interpreted as a single name tuple argument. + |To avoid this warning, either remove the argument names or use dotted selection.""" + + Message.rewriteNotice("This", version = SourceVersion.`3.6-migration`) - def explain(using Context) = - i"""Starting with Scala 3.6 infix named arguments are interpretted as Named Tuple. - | - |To avoid this warning, either remove the argument names or use dotted selection.""" + def explain(using Context) = "" + +class GivenSearchPriorityWarning( + pt: Type, + cmp: Int, + prev: Int, + winner: TermRef, + loser: TermRef, + isLastOldVersion: Boolean +)(using Context) extends Message(GivenSearchPriorityID): + def kind = MessageKind.PotentialIssue + def choice(nth: String, c: Int) = + if c == 0 then "none - it's ambiguous" + else s"the $nth alternative" + val (change, whichChoice) = + if isLastOldVersion + then ("will change in the future release", "Current choice ") + else ("has changed", "Previous choice") + def warningMessage: String = + i"""Given search preference for $pt between alternatives + | ${loser} + |and + | ${winner} + |$change. + |$whichChoice : ${choice("first", prev)} + |Choice from Scala 3.7 : ${choice("second", cmp)}""" + def migrationHints: String = + i"""Suppress this warning by choosing -source 3.5, -source 3.7, or + |by using @annotation.nowarn("id=205")""" + def ambiguousNote: String = + i""" + | + |Note: $warningMessage""" + def msg(using Context) = + i"""$warningMessage + | + |$migrationHints""" + + def explain(using Context) = "" diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 0727c83d8469..9d273ebca866 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -549,10 +549,10 @@ object Implicits: /** An ambiguous implicits failure */ class AmbiguousImplicits(val alt1: SearchSuccess, val alt2: SearchSuccess, val expectedType: Type, val argument: Tree, val nested: Boolean = false) extends SearchFailureType: - private[Implicits] var priorityChangeWarnings: List[Message] = Nil + private[Implicits] var priorityChangeWarnings: List[GivenSearchPriorityWarning] = Nil def priorityChangeWarningNote(using Context): String = - priorityChangeWarnings.map(msg => s"\n\nNote: $msg").mkString + priorityChangeWarnings.map(_.ambiguousNote).mkString def msg(using Context): Message = var str1 = err.refStr(alt1.ref) @@ -1312,7 +1312,7 @@ trait Implicits: // A map that associates a priority change warning (between -source 3.6 and 3.7) // with the candidate refs mentioned in the warning. We report the associated // message if one of the critical candidates is part of the result of the implicit search. - val priorityChangeWarnings = mutable.ListBuffer[(/*critical:*/ List[TermRef], Message)]() + val priorityChangeWarnings = mutable.ListBuffer[(/*critical:*/ List[TermRef], GivenSearchPriorityWarning)]() val sv = Feature.sourceVersion val isLastOldVersion = sv.stable == SourceVersion.`3.6` @@ -1353,21 +1353,7 @@ trait Implicits: cmp match case 1 => (alt2, alt1) case -1 => (alt1, alt2) - def choice(nth: String, c: Int) = - if c == 0 then "none - it's ambiguous" - else s"the $nth alternative" - val (change, whichChoice) = - if isLastOldVersion - then ("will change", "Current choice ") - else ("has changed", "Previous choice") - val msg = - em"""Given search preference for $pt between alternatives - | ${loser.ref} - |and - | ${winner.ref} - |$change. - |$whichChoice : ${choice("first", prev)} - |New choice from Scala 3.7: ${choice("second", cmp)}""" + val msg = GivenSearchPriorityWarning(pt, cmp, prev, winner.ref, loser.ref, isLastOldVersion) val critical = alt1.ref :: alt2.ref :: Nil priorityChangeWarnings += ((critical, msg)) if isLastOldVersion then prev else cmp diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index 0a0356707048..0ec9458cac5c 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -525,7 +525,6 @@ object RefChecks { // todo: align accessibility implication checking with isAccessible in Contexts def isOverrideAccessOK = - val memberIsPublic = (member.flags & AccessFlags).isEmpty && !member.privateWithin.exists def protectedOK = !other.is(Protected) || member.is(Protected) // if o is protected, so is m def accessBoundaryOK = val ob = other.accessBoundary(member.owner) @@ -534,7 +533,7 @@ object RefChecks { def companionBoundaryOK = ob.isClass && !ob.isLocalToBlock && mb.is(Module) && (ob.companionModule eq mb.companionModule) ob.isContainedIn(mb) || companionBoundaryOK // m relaxes o's access boundary, def otherIsJavaProtected = other.isAllOf(JavaProtected) // or o is Java defined and protected (see #3946) - memberIsPublic || protectedOK && (accessBoundaryOK || otherIsJavaProtected) + member.isPublic || protectedOK && (accessBoundaryOK || otherIsJavaProtected) end isOverrideAccessOK if !member.hasTargetName(other.targetName) then @@ -1169,16 +1168,18 @@ object RefChecks { target.nonPrivateMember(sym.name) .filterWithPredicate: member => - val memberIsImplicit = member.info.hasImplicitParams - val paramTps = - if memberIsImplicit then methTp.stripPoly.firstParamTypes - else methTp.firstExplicitParamTypes - - paramTps.isEmpty || memberIsImplicit && !methTp.hasImplicitParams || { - val memberParamTps = member.info.stripPoly.firstParamTypes - !memberParamTps.isEmpty - && memberParamTps.lengthCompare(paramTps) == 0 - && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m) + member.symbol.isPublic && { + val memberIsImplicit = member.info.hasImplicitParams + val paramTps = + if memberIsImplicit then methTp.stripPoly.firstParamTypes + else methTp.firstExplicitParamTypes + + paramTps.isEmpty || memberIsImplicit && !methTp.hasImplicitParams || { + val memberParamTps = member.info.stripPoly.firstParamTypes + !memberParamTps.isEmpty + && memberParamTps.lengthCompare(paramTps) == 0 + && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m) + } } .exists if !target.typeSymbol.denot.isAliasType && !target.typeSymbol.denot.isOpaqueAlias && hidden diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 76f0e8a3ecf6..5c5ca8af46c6 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -792,7 +792,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer def tryNamedTupleSelection() = val namedTupleElems = qual.tpe.widenDealias.namedTupleElementTypes val nameIdx = namedTupleElems.indexWhere(_._1 == selName) - if nameIdx >= 0 && sourceVersion.isAtLeast(`3.6`) then + if nameIdx >= 0 && Feature.enabled(Feature.namedTuples) then typed( untpd.Apply( untpd.Select(untpd.TypedSplice(qual), nme.apply), @@ -3398,7 +3398,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer /** Translate tuples of all arities */ def typedTuple(tree: untpd.Tuple, pt: Type)(using Context): Tree = val tree1 = desugar.tuple(tree, pt) - checkAmbiguousNamedTupleAssignment(tree) + checkDeprecatedAssignmentSyntax(tree) if tree1 ne tree then typed(tree1, pt) else val arity = tree.trees.length @@ -3427,7 +3427,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer /** Checks if `tree` is a named tuple with one element that could be * interpreted as an assignment, such as `(x = 1)`. If so, issues a warning. */ - def checkAmbiguousNamedTupleAssignment(tree: untpd.Tuple)(using Context): Unit = + def checkDeprecatedAssignmentSyntax(tree: untpd.Tuple)(using Context): Unit = tree.trees match case List(NamedArg(name, value)) => val tmpCtx = ctx.fresh.setNewTyperState() @@ -3435,7 +3435,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer if !tmpCtx.reporter.hasErrors then // If there are no errors typing the above, then the named tuple is // ambiguous and we issue a warning. - report.migrationWarning(AmbiguousNamedTupleAssignment(name, value), tree.srcPos) + report.migrationWarning(DeprecatedAssignmentSyntax(name, value), tree.srcPos) + if MigrationVersion.AmbiguousNamedTupleSyntax.needsPatch then + patch(tree.source, Span(tree.span.start, tree.span.start + 1), "{") + patch(tree.source, Span(tree.span.end - 1, tree.span.end), "}") case _ => () /** Retrieve symbol attached to given tree */ diff --git a/compiler/src/dotty/tools/repl/ReplDriver.scala b/compiler/src/dotty/tools/repl/ReplDriver.scala index 486005658d79..589ea6c3c677 100644 --- a/compiler/src/dotty/tools/repl/ReplDriver.scala +++ b/compiler/src/dotty/tools/repl/ReplDriver.scala @@ -176,7 +176,7 @@ class ReplDriver(settings: Array[String], /* complete = */ false // if true adds space when completing ) } - val comps = completions(line.cursor, line.line, state) + val comps = completionsWithSignatures(line.cursor, line.line, state) candidates.addAll(comps.map(_.label).distinct.map(makeCandidate).asJava) val lineWord = line.word() comps.filter(c => c.label == lineWord && c.symbols.nonEmpty) match @@ -268,8 +268,22 @@ class ReplDriver(settings: Array[String], else label + @deprecated("Use completionsWithSignatures instead", "3.4.2") + protected final def completions(cursor: Int, expr: String, state0: State): List[Candidate] = + completionsWithSignatures(cursor, expr, state0).map: c => + new Candidate( + /* value = */ c.label, + /* displ = */ stripBackTicks(c.label), // displayed value + /* group = */ null, // can be used to group completions together + /* descr = */ null, // TODO use for documentation? + /* suffix = */ null, + /* key = */ null, + /* complete = */ false // if true adds space when completing + ) + end completions + /** Extract possible completions at the index of `cursor` in `expr` */ - protected final def completions(cursor: Int, expr: String, state0: State): List[Completion] = + protected final def completionsWithSignatures(cursor: Int, expr: String, state0: State): List[Completion] = if expr.startsWith(":") then ParseResult.commands.collect { case command if command._1.startsWith(expr) => Completion(command._1, "", List()) @@ -288,7 +302,7 @@ class ReplDriver(settings: Array[String], try Completion.completions(srcPos)._2 catch case NonFatal(_) => Nil } .getOrElse(Nil) - end completions + end completionsWithSignatures protected def interpret(res: ParseResult, quiet: Boolean = false)(using state: State): State = { res match { diff --git a/compiler/test-resources/scripting/envtestNu.sc b/compiler/test-resources/scripting/envtestNu.sc new file mode 100755 index 000000000000..fe4cd7851b0a --- /dev/null +++ b/compiler/test-resources/scripting/envtestNu.sc @@ -0,0 +1,2 @@ +// MIGRATION: Scala CLI expects `*.sc` files to be straight-line code + println("Hello " + util.Properties.propOrNull("key")) diff --git a/compiler/test-resources/scripting/scriptPathNu.sc b/compiler/test-resources/scripting/scriptPathNu.sc new file mode 100755 index 000000000000..bb3e459654b9 --- /dev/null +++ b/compiler/test-resources/scripting/scriptPathNu.sc @@ -0,0 +1,13 @@ +#!/usr/bin/env bin/scala + +// THIS FILE IS RAN WITH SCALA CLI, which wraps scripts exposing scriptPath and args variables + +args.zipWithIndex.foreach { case (arg,i) => printf("arg %d: [%s]\n",i,arg) } + +if !scriptPath.endsWith("scriptPathNu.sc") then + printf( s"incorrect script.path defined as [$scriptPath]") +else + printf("scriptPath: %s\n", scriptPath) // report the value + +extension(s: String) + def norm: String = s.replace('\\', '/') diff --git a/compiler/test-resources/scripting/showArgsNu.sc b/compiler/test-resources/scripting/showArgsNu.sc new file mode 100755 index 000000000000..f4c1aa6af257 --- /dev/null +++ b/compiler/test-resources/scripting/showArgsNu.sc @@ -0,0 +1,6 @@ +#!/usr/bin/env bin/scala + +// precise output format expected by BashScriptsTests.scala +// MIGRATION: Scala CLI expects `*.sc` files to be straight-line code +for (a,i) <- args.zipWithIndex do + printf(s"arg %2d:[%s]\n",i,a) diff --git a/compiler/test-resources/scripting/sqlDateErrorNu.sc b/compiler/test-resources/scripting/sqlDateErrorNu.sc new file mode 100755 index 000000000000..a6f1bd50297d --- /dev/null +++ b/compiler/test-resources/scripting/sqlDateErrorNu.sc @@ -0,0 +1,6 @@ +#!/usr/bin/env bin/scala + +// def main(args: Array[String]): Unit = { MIGRATION: Scala CLI expects `*.sc` files to be straight-line code + println(new java.sql.Date(100L)) + System.err.println("SCALA_OPTS="+Option(System.getenv("SCALA_OPTS")).getOrElse("")) +// } diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 3bd3b5138fad..9f72db6fc390 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -80,6 +80,7 @@ class CompilationTests { compileDir("tests/rewrites/annotation-named-pararamters", defaultOptions.and("-rewrite", "-source:3.6-migration")), compileFile("tests/rewrites/i21418.scala", unindentOptions.and("-rewrite", "-source:3.5-migration")), compileFile("tests/rewrites/infix-named-args.scala", defaultOptions.and("-rewrite", "-source:3.6-migration")), + compileFile("tests/rewrites/ambigious-named-tuple-assignment.scala", defaultOptions.and("-rewrite", "-source:3.6-migration")), ).checkRewrites() } diff --git a/compiler/test/dotty/tools/repl/ReplTest.scala b/compiler/test/dotty/tools/repl/ReplTest.scala index 3e827a0f1e36..3925b61d7de0 100644 --- a/compiler/test/dotty/tools/repl/ReplTest.scala +++ b/compiler/test/dotty/tools/repl/ReplTest.scala @@ -42,7 +42,7 @@ extends ReplDriver(options, new PrintStream(out, true, StandardCharsets.UTF_8.na /** Returns the `(, )`*/ def tabComplete(src: String)(implicit state: State): List[String] = - completions(src.length, src, state).map(_.label).sorted.distinct + completionsWithSignatures(src.length, src, state).map(_.label).sorted.distinct extension [A](state: State) infix def andThen(op: State ?=> A): A = op(using state) diff --git a/compiler/test/dotty/tools/scripting/ScriptingTests.scala b/compiler/test/dotty/tools/scripting/ScriptingTests.scala index 8d07cb137917..4dc193f0efe4 100644 --- a/compiler/test/dotty/tools/scripting/ScriptingTests.scala +++ b/compiler/test/dotty/tools/scripting/ScriptingTests.scala @@ -51,7 +51,10 @@ class ScriptingTests: */ @Test def scriptingMainTests = assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty) - for (scriptFile, scriptArgs) <- scalaFilesWithArgs(".sc") do + for + (scriptFile, scriptArgs) <- scalaFilesWithArgs(".sc") + if !scriptFile.getName().endsWith("Nu.sc") + do showScriptUnderTest(scriptFile) val unexpectedJar = script2jar(scriptFile) unexpectedJar.delete @@ -70,7 +73,10 @@ class ScriptingTests: */ @Test def scriptingJarTest = assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty) - for (scriptFile, scriptArgs) <- scalaFilesWithArgs(".sc") do + for + (scriptFile, scriptArgs) <- scalaFilesWithArgs(".sc") + if !scriptFile.getName().endsWith("Nu.sc") + do showScriptUnderTest(scriptFile) val expectedJar = script2jar(scriptFile) expectedJar.delete diff --git a/compiler/test/dotty/tools/vulpix/FileFilter.scala b/compiler/test/dotty/tools/vulpix/FileFilter.scala index b2aef8af038e..9f62a7db2fb6 100644 --- a/compiler/test/dotty/tools/vulpix/FileFilter.scala +++ b/compiler/test/dotty/tools/vulpix/FileFilter.scala @@ -23,4 +23,8 @@ object FileFilter { object NoFilter extends FileFilter { def accept(file: String) = true } + + object ExcludeDotFiles extends FileFilter { + def accept(file: String) = !file.startsWith(".") + } } diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index e7e5936a4b29..09d3614b64a5 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -1411,7 +1411,7 @@ trait ParallelTesting extends RunnerOrchestration { self => private def compilationTargets(sourceDir: JFile, fileFilter: FileFilter = FileFilter.NoFilter): (List[JFile], List[JFile]) = sourceDir.listFiles.foldLeft((List.empty[JFile], List.empty[JFile])) { case ((dirs, files), f) => if (!fileFilter.accept(f.getName)) (dirs, files) - else if (f.isDirectory) (f :: dirs, files) + else if (f.isDirectory && FileFilter.ExcludeDotFiles.accept(f.getName)) (f :: dirs, files) else if (isSourceFile(f)) (dirs, f :: files) else (dirs, files) } diff --git a/dist/bin-native-overrides/cli-common-platform b/dist/bin-native-overrides/cli-common-platform new file mode 100644 index 000000000000..1a11c770f91a --- /dev/null +++ b/dist/bin-native-overrides/cli-common-platform @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +if [[ ${cygwin-} || ${mingw-} || ${msys-} ]]; then + SCALA_CLI_VERSION="" + # iterate through lines in VERSION_SRC + while IFS= read -r line; do + # if line starts with "version:=" then extract the version + if [[ "$line" == cli_version:=* ]]; then + SCALA_CLI_VERSION="${line#cli_version:=}" + break + fi + done < "$PROG_HOME/EXTRA_PROPERTIES" + SCALA_CLI_CMD_BASH=("\"$PROG_HOME/bin/scala-cli\"" "--cli-version \"$SCALA_CLI_VERSION\"") +else + SCALA_CLI_CMD_BASH=("\"$PROG_HOME/bin/scala-cli\"") +fi diff --git a/dist/bin-native-overrides/cli-common-platform.bat b/dist/bin-native-overrides/cli-common-platform.bat new file mode 100644 index 000000000000..d1c4f1c4716b --- /dev/null +++ b/dist/bin-native-overrides/cli-common-platform.bat @@ -0,0 +1,22 @@ +@echo off + +setlocal enabledelayedexpansion + +set "_SCALA_CLI_VERSION=" +@rem read for cli_version:=_SCALA_CLI_VERSION in EXTRA_PROPERTIES file +FOR /F "usebackq delims=" %%G IN ("%_PROG_HOME%\EXTRA_PROPERTIES") DO ( + SET "line=%%G" + IF "!line:~0,13!"=="cli_version:=" ( + SET "_SCALA_CLI_VERSION=!line:~13!" + GOTO :foundCliVersion + ) +) + +@REM we didn't find it, so we should fail +echo "ERROR: cli_version not found in EXTRA_PROPERTIES file" +exit /b 1 + +:foundCliVersion +endlocal & set "SCALA_CLI_VERSION=%_SCALA_CLI_VERSION%" + +set SCALA_CLI_CMD_WIN="%_PROG_HOME%\bin\scala-cli.exe" "--cli-version" "%SCALA_CLI_VERSION%" diff --git a/dist/bin/cli-common b/dist/bin/cli-common new file mode 100644 index 000000000000..d295d58916da --- /dev/null +++ b/dist/bin/cli-common @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +#/*-------------------------------------------------------------------------- +# * Credits: This script is based on the script generated by sbt-pack. +# *--------------------------------------------------------------------------*/ + +# save terminal settings +saved_stty=$(stty -g 2>/dev/null) +# clear on error so we don't later try to restore them +if [[ ! $? ]]; then + saved_stty="" +fi + +# restore stty settings (echo in particular) +function restoreSttySettings() { + stty $saved_stty + saved_stty="" +} + +scala_exit_status=127 +function onExit() { + [[ "$saved_stty" != "" ]] && restoreSttySettings + exit $scala_exit_status +} + +#/*-------------------------------------------------------------------------- +# * SECTION FOR JAVA COMMAND +# *--------------------------------------------------------------------------*/ + +# to reenable echo if we are interrupted before completing. +trap onExit INT TERM EXIT + +unset cygwin mingw msys darwin conemu + +# COLUMNS is used together with command line option '-pageWidth'. +if command -v tput >/dev/null 2>&1; then + export COLUMNS="$(tput -Tdumb cols)" +fi + +case "`uname`" in + CYGWIN*) cygwin=true + ;; + MINGW*) mingw=true + ;; + MSYS*) msys=true + ;; + Darwin*) darwin=true + if [ -z "$JAVA_VERSION" ] ; then + JAVA_VERSION="CurrentJDK" + else + echo "Using Java version: $JAVA_VERSION" 1>&2 + fi + if [ -z "$JAVA_HOME" ] ; then + JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home + fi + JAVACMD="`which java`" + ;; +esac + +unset CYGPATHCMD +if [[ ${cygwin-} || ${mingw-} || ${msys-} ]]; then + # ConEmu terminal is incompatible with jna-5.*.jar + [[ (${CONEMUANSI-} || ${ConEmuANSI-}) ]] && conemu=true + # cygpath is used by various windows shells: cygwin, git-sdk, gitbash, msys, etc. + CYGPATHCMD=`which cygpath 2>/dev/null` + case "$TERM" in + rxvt* | xterm* | cygwin*) + stty -icanon min 1 -echo + JAVA_OPTS="$JAVA_OPTS -Djline.terminal=unix" + ;; + esac +fi + +# Resolve JAVA_HOME from javac command path +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" -a -f "$javaExecutable" -a ! "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + javaExecutable="`readlink -f \"$javaExecutable\"`" + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "${JAVACMD-}" ] ; then + if [ -n "${JAVA_HOME-}" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." + echo " We cannot execute $JAVACMD" + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSPATH_SUFFIX="" +# Path separator used in EXTRA_CLASSPATH +PSEP=":" + +# translate paths to Windows-mixed format before running java +if [ -n "${CYGPATHCMD-}" ]; then + [ -n "${PROG_HOME-}" ] && + PROG_HOME=`"$CYGPATHCMD" -am "$PROG_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`"$CYGPATHCMD" -am "$JAVA_HOME"` + CLASSPATH_SUFFIX=";" + PSEP=";" +elif [[ ${mingw-} || ${msys-} ]]; then + # For Mingw / Msys, convert paths from UNIX format before anything is touched + [ -n "$PROG_HOME" ] && + PROG_HOME="`(cd "$PROG_HOME"; pwd -W | sed 's|/|\\\\|g')`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd -W | sed 's|/|\\\\|g')`" + CLASSPATH_SUFFIX=";" + PSEP=";" +fi + +#/*-------------------------------------------------- +# * The code below is for Dotty +# *-------------------------------------------------*/ + +find_lib () { + for lib in "$PROG_HOME"/lib/$1 ; do + if [[ -f "$lib" ]]; then + if [ -n "$CYGPATHCMD" ]; then + "$CYGPATHCMD" -am "$lib" + elif [[ $mingw || $msys ]]; then + echo "$lib" | sed 's|/|\\\\|g' + else + echo "$lib" + fi + return + fi + done +} + +SCALA_CLI_JAR="$PROG_HOME/etc/scala-cli.jar" + +declare -a scala_args + +addScala () { + scala_args+=("'$1'") +} diff --git a/dist/bin/cli-common-platform b/dist/bin/cli-common-platform new file mode 100644 index 000000000000..a5906e882bb4 --- /dev/null +++ b/dist/bin/cli-common-platform @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +SCALA_CLI_CMD_BASH=("\"$JAVACMD\"" "-jar \"$PROG_HOME/bin/scala-cli.jar\"") diff --git a/dist/bin/cli-common-platform.bat b/dist/bin/cli-common-platform.bat new file mode 100644 index 000000000000..99103266c1d9 --- /dev/null +++ b/dist/bin/cli-common-platform.bat @@ -0,0 +1,5 @@ +@echo off + +@rem we need to escape % in the java command path, for some reason this doesnt work in common.bat +set "_JAVACMD=!_JAVACMD:%%=%%%%!" +set SCALA_CLI_CMD_WIN="%_JAVACMD%" "-jar" "%_PROG_HOME%\bin\scala-cli.jar" \ No newline at end of file diff --git a/dist/bin/common-shared b/dist/bin/common-shared new file mode 100644 index 000000000000..8c85993a5283 --- /dev/null +++ b/dist/bin/common-shared @@ -0,0 +1,139 @@ +#!/usr/bin/env bash + +# Common options for both scala-cli and java based launchers + +#/*-------------------------------------------------------------------------- +# * Credits: This script is based on the script generated by sbt-pack. +# *--------------------------------------------------------------------------*/ + +# save terminal settings +saved_stty=$(stty -g 2>/dev/null) +# clear on error so we don't later try to restore them +if [[ ! $? ]]; then + saved_stty="" +fi + +# restore stty settings (echo in particular) +function restoreSttySettings() { + stty $saved_stty + saved_stty="" +} + +scala_exit_status=127 +function onExit() { + [[ "$saved_stty" != "" ]] && restoreSttySettings + exit $scala_exit_status +} + +# to reenable echo if we are interrupted before completing. +trap onExit INT TERM EXIT + +unset cygwin mingw msys darwin conemu + +# COLUMNS is used together with command line option '-pageWidth'. +if command -v tput >/dev/null 2>&1; then + export COLUMNS="$(tput -Tdumb cols)" +fi + +case "`uname`" in + CYGWIN*) cygwin=true + ;; + MINGW*) mingw=true + ;; + MSYS*) msys=true + ;; + Darwin*) darwin=true + if [ -z "$JAVA_VERSION" ] ; then + JAVA_VERSION="CurrentJDK" + else + echo "Using Java version: $JAVA_VERSION" 1>&2 + fi + if [ -z "$JAVA_HOME" ] ; then + JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home + fi + JAVACMD="`which java`" + ;; +esac + +unset CYGPATHCMD +if [[ ${cygwin-} || ${mingw-} || ${msys-} ]]; then + # ConEmu terminal is incompatible with jna-5.*.jar + [[ (${CONEMUANSI-} || ${ConEmuANSI-}) ]] && conemu=true + # cygpath is used by various windows shells: cygwin, git-sdk, gitbash, msys, etc. + CYGPATHCMD=`which cygpath 2>/dev/null` + case "$TERM" in + rxvt* | xterm* | cygwin*) + stty -icanon min 1 -echo + JAVA_OPTS="$JAVA_OPTS -Djline.terminal=unix" + ;; + esac +fi + +# Resolve JAVA_HOME from javac command path +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" -a -f "$javaExecutable" -a ! "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + javaExecutable="`readlink -f \"$javaExecutable\"`" + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "${JAVACMD-}" ] ; then + if [ -n "${JAVA_HOME-}" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." + echo " We cannot execute $JAVACMD" + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSPATH_SUFFIX="" +# Path separator used in EXTRA_CLASSPATH +PSEP=":" +PROG_HOME_URI="file://$PROG_HOME" + +# translate paths to Windows-mixed format before running java +if [ -n "${CYGPATHCMD-}" ]; then + [ -n "${PROG_HOME-}" ] && + PROG_HOME=`"$CYGPATHCMD" -am "$PROG_HOME"` + PROG_HOME_URI="file:///$PROG_HOME" # Add extra root dir prefix + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`"$CYGPATHCMD" -am "$JAVA_HOME"` + CLASSPATH_SUFFIX=";" + PSEP=";" +elif [[ ${mingw-} || ${msys-} ]]; then + # For Mingw / Msys, convert paths from UNIX format before anything is touched + [ -n "$PROG_HOME" ] && + PROG_HOME="`(cd "$PROG_HOME"; pwd -W | sed 's|/|\\\\|g')`" + PROG_HOME_URI="file:///$PROG_HOME" # Add extra root dir prefix + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd -W | sed 's|/|\\\\|g')`" + CLASSPATH_SUFFIX=";" + PSEP=";" +fi + +declare -a scala_args +addScala () { + scala_args+=("'$1'") +} diff --git a/dist/libexec/cli-common-platform b/dist/libexec/cli-common-platform index a5906e882bb4..e56f5221dbf2 100644 --- a/dist/libexec/cli-common-platform +++ b/dist/libexec/cli-common-platform @@ -1,3 +1,3 @@ #!/usr/bin/env bash -SCALA_CLI_CMD_BASH=("\"$JAVACMD\"" "-jar \"$PROG_HOME/bin/scala-cli.jar\"") +SCALA_CLI_CMD_BASH=("\"$JAVACMD\"" "-jar \"$PROG_HOME/libexec/scala-cli.jar\"") diff --git a/dist/libexec/cli-common-platform.bat b/dist/libexec/cli-common-platform.bat index 99103266c1d9..45b09f3460e6 100644 --- a/dist/libexec/cli-common-platform.bat +++ b/dist/libexec/cli-common-platform.bat @@ -2,4 +2,4 @@ @rem we need to escape % in the java command path, for some reason this doesnt work in common.bat set "_JAVACMD=!_JAVACMD:%%=%%%%!" -set SCALA_CLI_CMD_WIN="%_JAVACMD%" "-jar" "%_PROG_HOME%\bin\scala-cli.jar" \ No newline at end of file +set SCALA_CLI_CMD_WIN="%_JAVACMD%" "-jar" "%_PROG_HOME%\libexec\scala-cli.jar" diff --git a/dist/libexec/common-shared b/dist/libexec/common-shared index 8c85993a5283..fa1e62c09241 100644 --- a/dist/libexec/common-shared +++ b/dist/libexec/common-shared @@ -28,7 +28,7 @@ function onExit() { # to reenable echo if we are interrupted before completing. trap onExit INT TERM EXIT -unset cygwin mingw msys darwin conemu +unset cygwin mingw msys darwin # COLUMNS is used together with command line option '-pageWidth'. if command -v tput >/dev/null 2>&1; then @@ -57,8 +57,6 @@ esac unset CYGPATHCMD if [[ ${cygwin-} || ${mingw-} || ${msys-} ]]; then - # ConEmu terminal is incompatible with jna-5.*.jar - [[ (${CONEMUANSI-} || ${ConEmuANSI-}) ]] && conemu=true # cygpath is used by various windows shells: cygwin, git-sdk, gitbash, msys, etc. CYGPATHCMD=`which cygpath 2>/dev/null` case "$TERM" in diff --git a/docs/_docs/reference/experimental/cc.md b/docs/_docs/reference/experimental/cc.md index aea14abc7e22..ff480ffb638b 100644 --- a/docs/_docs/reference/experimental/cc.md +++ b/docs/_docs/reference/experimental/cc.md @@ -138,7 +138,7 @@ This type is a shorthand for `(A -> B)^{c, d}`, i.e. the function type `A -> B` The impure function type `A => B` is treated as an alias for `A ->{cap} B`. That is, impure functions are functions that can capture anything. A capture annotation `^` binds more strongly than a function arrow. So -`A -> B^{c}` is read as `A` -> (B^{c})`. +`A -> B^{c}` is read as `A -> (B^{c})`. Analogous conventions apply to context function types. `A ?=> B` is an impure context function, with `A ?-> B` as its pure complement. diff --git a/docs/_docs/reference/other-new-features/named-tuples.md b/docs/_docs/reference/experimental/named-tuples.md similarity index 98% rename from docs/_docs/reference/other-new-features/named-tuples.md rename to docs/_docs/reference/experimental/named-tuples.md index 5483c5cc255b..27d74259725d 100644 --- a/docs/_docs/reference/other-new-features/named-tuples.md +++ b/docs/_docs/reference/experimental/named-tuples.md @@ -1,10 +1,10 @@ --- layout: doc-page title: "Named Tuples" -nightlyOf: https://docs.scala-lang.org/scala3/reference/other-new-features/named-tuples.html +nightlyOf: https://docs.scala-lang.org/scala3/reference/experimental/named-tuples.html --- -Starting in Scala 3.6, the elements of a tuple can be named. Example: +The elements of a tuple can now be named. Example: ```scala type Person = (name: String, age: Int) val Bob: Person = (name = "Bob", age = 33) diff --git a/docs/sidebar.yml b/docs/sidebar.yml index 74aee3dfc668..a306d8bdf274 100644 --- a/docs/sidebar.yml +++ b/docs/sidebar.yml @@ -72,7 +72,6 @@ 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 @@ -159,6 +158,7 @@ subsection: - page: reference/experimental/cc.md - page: reference/experimental/purefuns.md - page: reference/experimental/tupled-function.md + - page: reference/experimental/named-tuples.md - page: reference/experimental/modularity.md - page: reference/experimental/typeclasses.md - page: reference/experimental/runtimeChecked.md diff --git a/library/src/scala/NamedTuple.scala b/library/src/scala/NamedTuple.scala index d105cf042f37..6da7f940dc47 100644 --- a/library/src/scala/NamedTuple.scala +++ b/library/src/scala/NamedTuple.scala @@ -1,6 +1,8 @@ package scala +import annotation.experimental import compiletime.ops.boolean.* +@experimental object NamedTuple: /** The type to which named tuples get mapped to. For instance, @@ -131,6 +133,7 @@ object NamedTuple: end NamedTuple /** Separate from NamedTuple object so that we can match on the opaque type NamedTuple. */ +@experimental object NamedTupleDecomposition: import NamedTuple.* extension [N <: Tuple, V <: Tuple](x: NamedTuple[N, V]) diff --git a/library/src/scala/runtime/stdLibPatches/language.scala b/library/src/scala/runtime/stdLibPatches/language.scala index b8d990cf56f5..547710d55293 100644 --- a/library/src/scala/runtime/stdLibPatches/language.scala +++ b/library/src/scala/runtime/stdLibPatches/language.scala @@ -97,7 +97,6 @@ object language: * @see [[https://dotty.epfl.ch/docs/reference/experimental/named-tuples]] */ @compileTimeOnly("`namedTuples` can only be used at compile time in import statements") - @deprecated("The experimental.namedTuples language import is no longer needed since the feature is now standard", since = "3.6") object namedTuples /** Experimental support for new features for better modularity, including diff --git a/pkgs/chocolatey/scala.nuspec b/pkgs/chocolatey/scala.nuspec index bb2e0e07ce70..83033fe4b349 100644 --- a/pkgs/chocolatey/scala.nuspec +++ b/pkgs/chocolatey/scala.nuspec @@ -13,7 +13,7 @@ https://github.com/scala/scala3 https://scala-lang.org/ https://github.com/scala/scala3/issues - © 2002-2024, LAMP/EPFL + © 2002-2025, LAMP/EPFL https://cdn.jsdelivr.net/gh/scala/scala3@a046b0014ffd9536144d67a48f8759901b96d12f/pkgs/chocolatey/icon.svg https://github.com/scala/scala3/blob/main/LICENSE true diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala index 7be2ea6181ef..ab28baea994b 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala @@ -1988,7 +1988,8 @@ class CompletionSuite extends BaseCompletionSuite: @Test def `namedTuple completions` = check( - """|import scala.NamedTuple.* + """|import scala.language.experimental.namedTuples + |import scala.NamedTuple.* | |val person = (name = "Jamie", city = "Lausanne") | @@ -1999,7 +2000,8 @@ class CompletionSuite extends BaseCompletionSuite: @Test def `Selectable with namedTuple Fields member` = check( - """|import scala.NamedTuple.* + """|import scala.language.experimental.namedTuples + |import scala.NamedTuple.* | |class NamedTupleSelectable extends Selectable { | type Fields <: AnyNamedTuple diff --git a/project/Build.scala b/project/Build.scala index d742ab9ad3f4..7f98e87fcaaa 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -97,7 +97,7 @@ object Build { * - In release branch it should be the last stable release * 3.6.0-RC1 was released as 3.6.0 - it's having and experimental TASTy version */ - val referenceVersion = "3.6.0" + val referenceVersion = "3.6.2" /** Version of the Scala compiler targeted in the current release cycle * Contains a version without RC/SNAPSHOT/NIGHTLY specific suffixes @@ -115,7 +115,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 /** Final version of Scala compiler, controlled by environment variables. */ val dottyVersion = { @@ -151,7 +151,7 @@ object Build { * - `3.(M-1).0` if `P = 0` * 3.6.1 is an exception from this rule - 3.6.0 was a broken release */ - val mimaPreviousDottyVersion = "3.6.1" + val mimaPreviousDottyVersion = "3.6.2" /** LTS version against which we check binary compatibility. * @@ -162,9 +162,9 @@ object Build { val mimaPreviousLTSDottyVersion = "3.3.0" /** Version of Scala CLI to download */ - val scalaCliLauncherVersion = "1.5.1" + val scalaCliLauncherVersion = "1.5.4" /** Version of Coursier to download for initializing the local maven repo of Scala command */ - val coursierJarVersion = "2.1.13" + val coursierJarVersion = "2.1.18" object CompatMode { final val BinaryCompatible = 0 @@ -741,9 +741,9 @@ object Build { libraryDependencies ++= Seq( "org.scala-lang.modules" % "scala-asm" % "9.7.0-scala-2", // used by the backend Dependencies.compilerInterface, - "org.jline" % "jline-reader" % "3.27.0", // used by the REPL - "org.jline" % "jline-terminal" % "3.27.0", - "org.jline" % "jline-terminal-jna" % "3.27.0", // needed for Windows + "org.jline" % "jline-reader" % "3.27.1", // used by the REPL + "org.jline" % "jline-terminal" % "3.27.1", + "org.jline" % "jline-terminal-jni" % "3.27.1", // needed for Windows ("io.get-coursier" %% "coursier" % "2.0.16" % Test).cross(CrossVersion.for3Use2_13), ), @@ -2230,7 +2230,14 @@ object Build { // ======== Universal / stage := (Universal / stage).dependsOn(republish).value, Universal / packageBin := (Universal / packageBin).dependsOn(republish).value, - Universal / packageZipTarball := (Universal / packageZipTarball).dependsOn(republish).value, + Universal / packageZipTarball := (Universal / packageZipTarball).dependsOn(republish) + .map { archiveFile => + // Rename .tgz to .tar.gz for consistency with previous versions + val renamedFile = archiveFile.getParentFile() / archiveFile.getName.replaceAll("\\.tgz$", ".tar.gz") + IO.move(archiveFile, renamedFile) + renamedFile + } + .value, // ======== Universal / mappings ++= directory(dist.base / "bin"), Universal / mappings ++= directory(republishRepo.value / "maven2"), diff --git a/project/Modes.scala b/project/Modes.scala index eddb5a3f1a7b..fcc13dea8a89 100644 --- a/project/Modes.scala +++ b/project/Modes.scala @@ -1,4 +1,4 @@ -import sbt.{Project, ProjectReference, SettingsDefinition} +import sbt.{Project, ProjectReference, SettingsDefinition, Plugins} object Modes { @@ -25,5 +25,9 @@ object Modes { def bootstrappedDependsOn(s: sbt.ClasspathDep[ProjectReference]*)(implicit mode: Mode): Project = if (mode == NonBootstrapped) project else project.dependsOn(s: _*) + /** Plugins only if the mode is bootstrapped */ + def bootstrappedEnablePlugins(ns: Plugins*)(implicit mode: Mode): Project = + if (mode == NonBootstrapped) project else project.enablePlugins(ns: _*) + } } diff --git a/project/resources/referenceReplacements/sidebar.yml b/project/resources/referenceReplacements/sidebar.yml index 240085b681f2..2e84b0b5e433 100644 --- a/project/resources/referenceReplacements/sidebar.yml +++ b/project/resources/referenceReplacements/sidebar.yml @@ -28,6 +28,9 @@ 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/given-imports.md diff --git a/project/scripts/check-cla.sh b/project/scripts/check-cla.sh index e4e489830f11..dbb148d3c652 100755 --- a/project/scripts/check-cla.sh +++ b/project/scripts/check-cla.sh @@ -5,16 +5,16 @@ echo "Pull request submitted by $AUTHOR"; if [[ "$AUTHOR" == "github-actions[bot]" || "$AUTHOR" == "dependabot[bot]" ]] ; then echo "CLA check for $AUTHOR successful"; else - signed=$(curl -s "https://www.lightbend.com/contribute/cla/scala/check/$AUTHOR" | jq -r ".signed"); + signed=$(curl -L -s "https://contribute.akka.io/contribute/cla/scala/check/$AUTHOR" | jq -r ".signed"); if [ "$signed" = "true" ] ; then echo "CLA check for $AUTHOR successful"; else echo "CLA check for $AUTHOR failed"; echo "Please sign the Scala CLA to contribute to the Scala compiler."; - echo "Go to https://www.lightbend.com/contribute/cla/scala and then"; + echo "Go to https://contribute.akka.io/contribute/cla/scala and then"; echo "comment on the pull request to ask for a new check."; echo ""; - echo "Check if CLA is signed: https://www.lightbend.com/contribute/cla/scala/check/$AUTHOR"; + echo "Check if CLA is signed: https://contribute.akka.io/contribute/cla/scala/check/$AUTHOR"; exit 1; fi; fi; diff --git a/project/scripts/expected-links/reference-expected-links.txt b/project/scripts/expected-links/reference-expected-links.txt index 0fbb84831e37..8be7dba8d4d0 100644 --- a/project/scripts/expected-links/reference-expected-links.txt +++ b/project/scripts/expected-links/reference-expected-links.txt @@ -27,13 +27,16 @@ ./contextual/context-functions-spec.html ./contextual/context-functions.html ./contextual/conversions.html +./contextual/deferred-givens.html ./contextual/derivation-macro.html ./contextual/derivation.html ./contextual/extension-methods.html ./contextual/given-imports.html ./contextual/givens.html ./contextual/index.html +./contextual/more-givens.html ./contextual/multiversal-equality.html +./contextual/previous-givens.html ./contextual/relationship-implicits.html ./contextual/right-associative-extension-methods.html ./contextual/type-classes.html @@ -104,6 +107,7 @@ ./new-types/union-types-spec.html ./new-types/union-types.html ./other-new-features.html +./other-new-features/binary-literals.html ./other-new-features/control-syntax.html ./other-new-features/creator-applications.html ./other-new-features/experimental-defs.html diff --git a/tasty/src/dotty/tools/tasty/TastyFormat.scala b/tasty/src/dotty/tools/tasty/TastyFormat.scala index 8f5f9d57a8a5..8da8879185f5 100644 --- a/tasty/src/dotty/tools/tasty/TastyFormat.scala +++ b/tasty/src/dotty/tools/tasty/TastyFormat.scala @@ -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/given-triangle.check b/tests/neg/given-triangle.check index f366c18e78f0..8a05ed4b3129 100644 --- a/tests/neg/given-triangle.check +++ b/tests/neg/given-triangle.check @@ -7,6 +7,6 @@ | (given_B : B) |and | (given_A : A) - |will change. - |Current choice : the first alternative - |New choice from Scala 3.7: the second alternative + |will change in the future release. + |Current choice : the first alternative + |Choice from Scala 3.7 : the second alternative diff --git a/tests/neg/i15474.check b/tests/neg/i15474.check deleted file mode 100644 index 3205f703cd50..000000000000 --- a/tests/neg/i15474.check +++ /dev/null @@ -1,31 +0,0 @@ --- Error: tests/neg/i15474.scala:6:39 ---------------------------------------------------------------------------------- -6 | given c: Conversion[ String, Int ] = _.toInt // error - | ^ - | Result of implicit search for ?{ toInt: ? } will change. - | Current result Test2.c will be no longer eligible - | because it is not defined before the search position. - | Result with new rules: augmentString. - | To opt into the new rules, compile with `-source future` or use - | the `scala.language.future` language import. - | - | To fix the problem without the language import, you could try one of the following: - | - use a `given ... with` clause as the enclosing given, - | - rearrange definitions so that Test2.c comes earlier, - | - use an explicit conversion, - | - use an import to get extension method into scope. - | This will be an error in Scala 3.5 and later. --- Error: tests/neg/i15474.scala:12:56 --------------------------------------------------------------------------------- -12 | given Ordering[Price] = summon[Ordering[BigDecimal]] // error - | ^ - | Result of implicit search for Ordering[BigDecimal] will change. - | Current result Prices.Price.given_Ordering_Price will be no longer eligible - | because it is not defined before the search position. - | Result with new rules: scala.math.Ordering.BigDecimal. - | To opt into the new rules, compile with `-source future` or use - | the `scala.language.future` language import. - | - | To fix the problem without the language import, you could try one of the following: - | - use a `given ... with` clause as the enclosing given, - | - rearrange definitions so that Prices.Price.given_Ordering_Price comes earlier, - | - use an explicit argument. - | This will be an error in Scala 3.5 and later. diff --git a/tests/neg/i20517.check b/tests/neg/i20517.check index 119c34025ee0..55aeff46572b 100644 --- a/tests/neg/i20517.check +++ b/tests/neg/i20517.check @@ -1,7 +1,7 @@ --- [E007] Type Mismatch Error: tests/neg/i20517.scala:9:43 ------------------------------------------------------------- -9 | def dep(foo: Foo[Any]): From[foo.type] = (elem = "") // error - | ^^^^^^^^^^^ - | Found: (elem : String) - | Required: NamedTuple.From[(foo : Foo[Any])] - | - | longer explanation available when compiling with `-explain` +-- [E007] Type Mismatch Error: tests/neg/i20517.scala:10:43 ------------------------------------------------------------ +10 | def dep(foo: Foo[Any]): From[foo.type] = (elem = "") // error + | ^^^^^^^^^^^ + | Found: (elem : String) + | Required: NamedTuple.From[(foo : Foo[Any])] + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg/i20517.scala b/tests/neg/i20517.scala index 342a7d86ca7e..11c4432434dd 100644 --- a/tests/neg/i20517.scala +++ b/tests/neg/i20517.scala @@ -1,3 +1,4 @@ +import scala.language.experimental.namedTuples import NamedTuple.From case class Foo[+T](elem: T) diff --git a/tests/neg/infix-named-args.check b/tests/neg/infix-named-args.check index 0cfbbaef73a3..d960892a9624 100644 --- a/tests/neg/infix-named-args.check +++ b/tests/neg/infix-named-args.check @@ -1,5 +1,5 @@ --- [E134] Type Error: tests/neg/infix-named-args.scala:2:13 ------------------------------------------------------------ -2 | def f = 42 + (x = 1) // error // werror +-- [E134] Type Error: tests/neg/infix-named-args.scala:4:13 ------------------------------------------------------------ +4 | def f = 42 + (x = 1) // error // werror | ^^^^ | None of the overloaded alternatives of method + in class Int with types | (x: Double): Double @@ -11,31 +11,27 @@ | (x: Byte): Int | (x: String): String | match arguments ((x : Int)) (a named tuple) --- [E204] Syntax Warning: tests/neg/infix-named-args.scala:2:15 -------------------------------------------------------- -2 | def f = 42 + (x = 1) // error // werror +-- [E204] Syntax Warning: tests/neg/infix-named-args.scala:4:15 -------------------------------------------------------- +4 | def f = 42 + (x = 1) // error // werror | ^^^^^^^ - |Ambigious syntax: this infix call argument list is interpreted as single named tuple argument, not as an named arguments list. + |Deprecated syntax: infix named arguments lists are deprecated; in the future it would be interpreted as a single name tuple argument. + |To avoid this warning, either remove the argument names or use dotted selection. |This can be rewritten automatically under -rewrite -source 3.6-migration. - | - | longer explanation available when compiling with `-explain` --- [E204] Syntax Warning: tests/neg/infix-named-args.scala:5:26 -------------------------------------------------------- -5 | def g = new C() `multi` (x = 42, y = 27) // werror +-- [E204] Syntax Warning: tests/neg/infix-named-args.scala:7:26 -------------------------------------------------------- +7 | def g = new C() `multi` (x = 42, y = 27) // werror | ^^^^^^^^^^^^^^^^ - |Ambigious syntax: this infix call argument list is interpreted as single named tuple argument, not as an named arguments list. + |Deprecated syntax: infix named arguments lists are deprecated; in the future it would be interpreted as a single name tuple argument. + |To avoid this warning, either remove the argument names or use dotted selection. |This can be rewritten automatically under -rewrite -source 3.6-migration. - | - | longer explanation available when compiling with `-explain` --- [E204] Syntax Warning: tests/neg/infix-named-args.scala:6:21 -------------------------------------------------------- -6 | def h = new C() ** (x = 42, y = 27) // werror +-- [E204] Syntax Warning: tests/neg/infix-named-args.scala:8:21 -------------------------------------------------------- +8 | def h = new C() ** (x = 42, y = 27) // werror | ^^^^^^^^^^^^^^^^ - |Ambigious syntax: this infix call argument list is interpreted as single named tuple argument, not as an named arguments list. + |Deprecated syntax: infix named arguments lists are deprecated; in the future it would be interpreted as a single name tuple argument. + |To avoid this warning, either remove the argument names or use dotted selection. |This can be rewritten automatically under -rewrite -source 3.6-migration. - | - | longer explanation available when compiling with `-explain` --- [E204] Syntax Warning: tests/neg/infix-named-args.scala:13:18 ------------------------------------------------------- -13 | def f = this ** (x = 2) // werror +-- [E204] Syntax Warning: tests/neg/infix-named-args.scala:15:18 ------------------------------------------------------- +15 | def f = this ** (x = 2) // werror | ^^^^^^^ - |Ambigious syntax: this infix call argument list is interpreted as single named tuple argument, not as an named arguments list. + |Deprecated syntax: infix named arguments lists are deprecated; in the future it would be interpreted as a single name tuple argument. + |To avoid this warning, either remove the argument names or use dotted selection. |This can be rewritten automatically under -rewrite -source 3.6-migration. - | - | longer explanation available when compiling with `-explain` diff --git a/tests/neg/infix-named-args.scala b/tests/neg/infix-named-args.scala index d8616899540c..b0ef555cf965 100644 --- a/tests/neg/infix-named-args.scala +++ b/tests/neg/infix-named-args.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.namedTuples + class C: def f = 42 + (x = 1) // error // werror def multi(x: Int, y: Int): Int = x + y diff --git a/tests/neg/named-tuple-selectable.scala b/tests/neg/named-tuple-selectable.scala index c81eba1237ff..5cf7e68654ef 100644 --- a/tests/neg/named-tuple-selectable.scala +++ b/tests/neg/named-tuple-selectable.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.namedTuples + class FromFields extends Selectable: type Fields = (i: Int) def selectDynamic(key: String) = diff --git a/tests/neg/named-tuples-2.check b/tests/neg/named-tuples-2.check index daa1c0d69069..0a52d5f3989b 100644 --- a/tests/neg/named-tuples-2.check +++ b/tests/neg/named-tuples-2.check @@ -1,8 +1,8 @@ --- Error: tests/neg/named-tuples-2.scala:4:9 --------------------------------------------------------------------------- -4 | case (name, age) => () // error +-- Error: tests/neg/named-tuples-2.scala:5:9 --------------------------------------------------------------------------- +5 | case (name, age) => () // error | ^ | this case is unreachable since type (String, Int, Boolean) is not a subclass of class Tuple2 --- Error: tests/neg/named-tuples-2.scala:5:9 --------------------------------------------------------------------------- -5 | case (n, a, m, x) => () // error +-- Error: tests/neg/named-tuples-2.scala:6:9 --------------------------------------------------------------------------- +6 | case (n, a, m, x) => () // error | ^ | this case is unreachable since type (String, Int, Boolean) is not a subclass of class Tuple4 diff --git a/tests/neg/named-tuples-2.scala b/tests/neg/named-tuples-2.scala index b3917d9ad57c..0507891e0549 100644 --- a/tests/neg/named-tuples-2.scala +++ b/tests/neg/named-tuples-2.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples def Test = val person = (name = "Bob", age = 33, married = true) person match diff --git a/tests/neg/named-tuples-3.check b/tests/neg/named-tuples-3.check index 2809836b4803..2091c36191c0 100644 --- a/tests/neg/named-tuples-3.check +++ b/tests/neg/named-tuples-3.check @@ -1,5 +1,5 @@ --- [E007] Type Mismatch Error: tests/neg/named-tuples-3.scala:5:16 ----------------------------------------------------- -5 |val p: Person = f // error +-- [E007] Type Mismatch Error: tests/neg/named-tuples-3.scala:7:16 ----------------------------------------------------- +7 |val p: Person = f // error | ^ | Found: NamedTuple.NamedTuple[(Int, Any), (Int, String)] | Required: Person diff --git a/tests/neg/named-tuples-3.scala b/tests/neg/named-tuples-3.scala index 21e6ed9b3741..0f1215338b0a 100644 --- a/tests/neg/named-tuples-3.scala +++ b/tests/neg/named-tuples-3.scala @@ -1,3 +1,5 @@ +import language.experimental.namedTuples + def f: NamedTuple.NamedTuple[(Int, Any), (Int, String)] = ??? type Person = (name: Int, age: String) diff --git a/tests/neg/named-tuples.check b/tests/neg/named-tuples.check index 8ec958b6a75d..db3cc703722f 100644 --- a/tests/neg/named-tuples.check +++ b/tests/neg/named-tuples.check @@ -1,101 +1,101 @@ --- Error: tests/neg/named-tuples.scala:8:19 ---------------------------------------------------------------------------- -8 | val illformed = (_2 = 2) // error +-- Error: tests/neg/named-tuples.scala:9:19 ---------------------------------------------------------------------------- +9 | val illformed = (_2 = 2) // error | ^^^^^^ | _2 cannot be used as the name of a tuple element because it is a regular tuple selector --- Error: tests/neg/named-tuples.scala:9:20 ---------------------------------------------------------------------------- -9 | type Illformed = (_1: Int) // error - | ^^^^^^^ - | _1 cannot be used as the name of a tuple element because it is a regular tuple selector --- Error: tests/neg/named-tuples.scala:10:40 --------------------------------------------------------------------------- -10 | val illformed2 = (name = "", age = 0, name = true) // error +-- Error: tests/neg/named-tuples.scala:10:20 --------------------------------------------------------------------------- +10 | type Illformed = (_1: Int) // error + | ^^^^^^^ + | _1 cannot be used as the name of a tuple element because it is a regular tuple selector +-- Error: tests/neg/named-tuples.scala:11:40 --------------------------------------------------------------------------- +11 | val illformed2 = (name = "", age = 0, name = true) // error | ^^^^^^^^^^^ | Duplicate tuple element name --- Error: tests/neg/named-tuples.scala:11:45 --------------------------------------------------------------------------- -11 | type Illformed2 = (name: String, age: Int, name: Boolean) // error +-- Error: tests/neg/named-tuples.scala:12:45 --------------------------------------------------------------------------- +12 | type Illformed2 = (name: String, age: Int, name: Boolean) // error | ^^^^^^^^^^^^^ | Duplicate tuple element name --- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:19:20 ------------------------------------------------------ -19 | val _: NameOnly = person // error +-- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:20:20 ------------------------------------------------------ +20 | val _: NameOnly = person // error | ^^^^^^ | Found: (Test.person : (name : String, age : Int)) | Required: Test.NameOnly | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:20:18 ------------------------------------------------------ -20 | val _: Person = nameOnly // error +-- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:21:18 ------------------------------------------------------ +21 | val _: Person = nameOnly // error | ^^^^^^^^ | Found: (Test.nameOnly : (name : String)) | Required: Test.Person | | longer explanation available when compiling with `-explain` --- [E172] Type Error: tests/neg/named-tuples.scala:21:41 --------------------------------------------------------------- -21 | val _: Person = (name = "") ++ nameOnly // error +-- [E172] Type Error: tests/neg/named-tuples.scala:22:41 --------------------------------------------------------------- +22 | val _: Person = (name = "") ++ nameOnly // error | ^ | Cannot prove that Tuple.Disjoint[Tuple1[("name" : String)], Tuple1[("name" : String)]] =:= (true : Boolean). --- [E008] Not Found Error: tests/neg/named-tuples.scala:22:9 ----------------------------------------------------------- -22 | person._1 // error +-- [E008] Not Found Error: tests/neg/named-tuples.scala:23:9 ----------------------------------------------------------- +23 | person._1 // error | ^^^^^^^^^ | value _1 is not a member of (name : String, age : Int) --- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:24:36 ------------------------------------------------------ -24 | val _: (age: Int, name: String) = person // error +-- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:25:36 ------------------------------------------------------ +25 | val _: (age: Int, name: String) = person // error | ^^^^^^ | Found: (Test.person : (name : String, age : Int)) | Required: (age : Int, name : String) | | longer explanation available when compiling with `-explain` --- Error: tests/neg/named-tuples.scala:26:17 --------------------------------------------------------------------------- -26 | val (name = x, agee = y) = person // error +-- Error: tests/neg/named-tuples.scala:27:17 --------------------------------------------------------------------------- +27 | val (name = x, agee = y) = person // error | ^^^^^^^^ | No element named `agee` is defined in selector type (name : String, age : Int) --- Error: tests/neg/named-tuples.scala:29:10 --------------------------------------------------------------------------- -29 | case (name = n, age = a) => () // error // error +-- Error: tests/neg/named-tuples.scala:30:10 --------------------------------------------------------------------------- +30 | case (name = n, age = a) => () // error // error | ^^^^^^^^ | No element named `name` is defined in selector type (String, Int) --- Error: tests/neg/named-tuples.scala:29:20 --------------------------------------------------------------------------- -29 | case (name = n, age = a) => () // error // error +-- Error: tests/neg/named-tuples.scala:30:20 --------------------------------------------------------------------------- +30 | case (name = n, age = a) => () // error // error | ^^^^^^^ | No element named `age` is defined in selector type (String, Int) --- [E172] Type Error: tests/neg/named-tuples.scala:31:27 --------------------------------------------------------------- -31 | val pp = person ++ (1, 2) // error +-- [E172] Type Error: tests/neg/named-tuples.scala:32:27 --------------------------------------------------------------- +32 | val pp = person ++ (1, 2) // error | ^ | Cannot prove that Tuple.Disjoint[(("name" : String), ("age" : String)), Tuple] =:= (true : Boolean). --- [E172] Type Error: tests/neg/named-tuples.scala:34:18 --------------------------------------------------------------- -34 | person ++ (1, 2) match // error +-- [E172] Type Error: tests/neg/named-tuples.scala:35:18 --------------------------------------------------------------- +35 | person ++ (1, 2) match // error | ^ | Cannot prove that Tuple.Disjoint[(("name" : String), ("age" : String)), Tuple] =:= (true : Boolean). --- Error: tests/neg/named-tuples.scala:37:17 --------------------------------------------------------------------------- -37 | val bad = ("", age = 10) // error +-- Error: tests/neg/named-tuples.scala:38:17 --------------------------------------------------------------------------- +38 | val bad = ("", age = 10) // error | ^^^^^^^^ | Illegal combination of named and unnamed tuple elements --- Error: tests/neg/named-tuples.scala:40:20 --------------------------------------------------------------------------- -40 | case (name = n, age) => () // error +-- Error: tests/neg/named-tuples.scala:41:20 --------------------------------------------------------------------------- +41 | case (name = n, age) => () // error | ^^^ | Illegal combination of named and unnamed tuple elements --- Error: tests/neg/named-tuples.scala:41:16 --------------------------------------------------------------------------- -41 | case (name, age = a) => () // error +-- Error: tests/neg/named-tuples.scala:42:16 --------------------------------------------------------------------------- +42 | case (name, age = a) => () // error | ^^^^^^^ | Illegal combination of named and unnamed tuple elements --- Error: tests/neg/named-tuples.scala:44:10 --------------------------------------------------------------------------- -44 | case (age = x) => // error +-- Error: tests/neg/named-tuples.scala:45:10 --------------------------------------------------------------------------- +45 | case (age = x) => // error | ^^^^^^^ | No element named `age` is defined in selector type Tuple --- [E172] Type Error: tests/neg/named-tuples.scala:46:27 --------------------------------------------------------------- -46 | val p2 = person ++ person // error +-- [E172] Type Error: tests/neg/named-tuples.scala:47:27 --------------------------------------------------------------- +47 | val p2 = person ++ person // error | ^ |Cannot prove that Tuple.Disjoint[(("name" : String), ("age" : String)), (("name" : String), ("age" : String))] =:= (true : Boolean). --- [E172] Type Error: tests/neg/named-tuples.scala:47:43 --------------------------------------------------------------- -47 | val p3 = person ++ (first = 11, age = 33) // error +-- [E172] Type Error: tests/neg/named-tuples.scala:48:43 --------------------------------------------------------------- +48 | val p3 = person ++ (first = 11, age = 33) // error | ^ |Cannot prove that Tuple.Disjoint[(("name" : String), ("age" : String)), (("first" : String), ("age" : String))] =:= (true : Boolean). --- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:49:22 ------------------------------------------------------ -49 | val p5 = person.zip((first = 11, age = 33)) // error +-- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:50:22 ------------------------------------------------------ +50 | val p5 = person.zip((first = 11, age = 33)) // error | ^^^^^^^^^^^^^^^^^^^^^^ | Found: (first : Int, age : Int) | Required: NamedTuple.NamedTuple[(("name" : String), ("age" : String)), Tuple] | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:60:32 ------------------------------------------------------ -60 | val typo: (name: ?, age: ?) = (name = "he", ag = 1) // error +-- [E007] Type Mismatch Error: tests/neg/named-tuples.scala:61:32 ------------------------------------------------------ +61 | val typo: (name: ?, age: ?) = (name = "he", ag = 1) // error | ^^^^^^^^^^^^^^^^^^^^^ | Found: (name : String, ag : Int) | Required: (name : ?, age : ?) diff --git a/tests/neg/named-tuples.scala b/tests/neg/named-tuples.scala index daae6e26bac2..8f78f7915206 100644 --- a/tests/neg/named-tuples.scala +++ b/tests/neg/named-tuples.scala @@ -1,6 +1,7 @@ import annotation.experimental +import language.experimental.namedTuples -object Test: +@experimental object Test: type Person = (name: String, age: Int) val person = (name = "Bob", age = 33): (name: String, age: Int) diff --git a/tests/new/test.scala b/tests/new/test.scala index dc1891f3525c..18644422ab06 100644 --- a/tests/new/test.scala +++ b/tests/new/test.scala @@ -1,3 +1,5 @@ +import language.experimental.namedTuples + type Person = (name: String, age: Int) trait A: diff --git a/tests/pending/neg/i16451.scala b/tests/pending/neg/i16451.scala new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/pos/13633.scala b/tests/pos/13633.scala index 8883ef98d0be..ca0f7e68e81e 100644 --- a/tests/pos/13633.scala +++ b/tests/pos/13633.scala @@ -21,7 +21,7 @@ object Sums extends App: type Reverse[A] = ReverseLoop[A, EmptyTuple] - type PlusTri[A, B, C] <: Tuple = (A, B, C) match + type PlusTri[A, B, C] = (A, B, C) match case (false, false, false) => (false, false) case (true, false, false) | (false, true, false) | (false, false, true) => (false, true) case (true, true, false) | (true, false, true) | (false, true, true) => (true, false) diff --git a/tests/pos/Tuple.Drop.scala b/tests/pos/Tuple.Drop.scala deleted file mode 100644 index 9b88cc227966..000000000000 --- a/tests/pos/Tuple.Drop.scala +++ /dev/null @@ -1,7 +0,0 @@ -import compiletime.ops.int.* - -type Drop[T <: Tuple, N <: Int] <: Tuple = N match - case 0 => T - case S[n1] => T match - case EmptyTuple => EmptyTuple - case x *: xs => Drop[xs, n1] diff --git a/tests/pos/Tuple.Elem.scala b/tests/pos/Tuple.Elem.scala deleted file mode 100644 index 81494485c321..000000000000 --- a/tests/pos/Tuple.Elem.scala +++ /dev/null @@ -1,7 +0,0 @@ -import compiletime.ops.int.* - -type Elem[T <: Tuple, I <: Int] = T match - case h *: tail => - I match - case 0 => h - case S[j] => Elem[tail, j] diff --git a/tests/pos/contextbounds-for-poly-functions.scala b/tests/pos/contextbounds-for-poly-functions.scala index 13411a3ad769..49975cf8591d 100644 --- a/tests/pos/contextbounds-for-poly-functions.scala +++ b/tests/pos/contextbounds-for-poly-functions.scala @@ -1,6 +1,3 @@ -import scala.language.experimental.modularity -import scala.language.future - trait Ord[X]: def compare(x: X, y: X): Int type T diff --git a/tests/pos/fieldsOf.scala b/tests/pos/fieldsOf.scala index 08f20a1f7e8e..2594dae2cbf7 100644 --- a/tests/pos/fieldsOf.scala +++ b/tests/pos/fieldsOf.scala @@ -1,3 +1,5 @@ +import language.experimental.namedTuples + case class Person(name: String, age: Int) type PF = NamedTuple.From[Person] diff --git a/tests/pos/given-loop-prevention.scala b/tests/pos/given-loop-prevention.scala deleted file mode 100644 index f02559af1e82..000000000000 --- a/tests/pos/given-loop-prevention.scala +++ /dev/null @@ -1,14 +0,0 @@ -//> using options -Xfatal-warnings -source 3.4 - -class Foo - -object Bar { - given Foo with {} - given List[Foo] = List(summon[Foo]) // ok -} - -object Baz { - @annotation.nowarn - given List[Foo] = List(summon[Foo]) // gives a warning, which is suppressed - given Foo with {} -} diff --git a/tests/pos/i19710.scala b/tests/pos/i19710.scala deleted file mode 100644 index 03fd1e2d80b3..000000000000 --- a/tests/pos/i19710.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.util.NotGiven - -type HasName1 = [n] =>> [x] =>> x match { - case n => true - case _ => false - } -@main def Test = { - summon[HasName1["foo"]["foo"] =:= true] - summon[NotGiven[HasName1["foo"]["bar"] =:= true]] - summon[Tuple.Filter[(1, "foo", 2, "bar"), HasName1["foo"]] =:= Tuple1["foo"]] // error -} diff --git a/tests/pos/i20377.scala b/tests/pos/i20377.scala index a555e01867ab..661fa7adfca9 100644 --- a/tests/pos/i20377.scala +++ b/tests/pos/i20377.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples import NamedTuple.{NamedTuple, AnyNamedTuple} // Repros for bugs or questions diff --git a/tests/pos/i21300.scala b/tests/pos/i21300.scala index e7c7965b0e9a..22859482ef98 100644 --- a/tests/pos/i21300.scala +++ b/tests/pos/i21300.scala @@ -1,15 +1,17 @@ +import scala.language.experimental.namedTuples + class Test[S <: String & Singleton](name: S): type NT = NamedTuple.NamedTuple[(S, "foo"), (Int, Long)] def nt: NT = ??? type Name = S - + type NT2 = NamedTuple.NamedTuple[(Name, "foo"), (Int, Long)] def nt2: NT2 = ??? def test = val foo = new Test("bar") - + foo.nt.bar foo.nt2.bar diff --git a/tests/pos/i21320.scala b/tests/pos/i21320.scala new file mode 100644 index 000000000000..0a7e0d1941d1 --- /dev/null +++ b/tests/pos/i21320.scala @@ -0,0 +1,73 @@ +import scala.deriving.* +import scala.compiletime.* + +trait ConfigMonoid[T]: + def zero: T + def orElse(main: T, defaults: T): T + +object ConfigMonoid: + given option[T]: ConfigMonoid[Option[T]] = ??? + + inline def zeroTuple[C <: Tuple]: Tuple = + inline erasedValue[C] match + case _: EmptyTuple => EmptyTuple + case _: (t *: ts) => + summonInline[ConfigMonoid[t]].zero *: zeroTuple[ts] + + inline def valueTuple[C <: Tuple, T](index: Int, main: T, defaults: T): Tuple = + inline erasedValue[C] match + case _: EmptyTuple => EmptyTuple + case _: (t *: ts) => + def get(v: T) = v.asInstanceOf[Product].productElement(index).asInstanceOf[t] + summonInline[ConfigMonoid[t]].orElse(get(main), get(defaults)) *: valueTuple[ts, T]( + index + 1, + main, + defaults + ) + + inline given derive[T](using m: Mirror.ProductOf[T]): ConfigMonoid[T] = + new ConfigMonoid[T]: + def zero: T = m.fromProduct(zeroTuple[m.MirroredElemTypes]) + def orElse(main: T, defaults: T): T = m.fromProduct(valueTuple[m.MirroredElemTypes, T](0, main, defaults)) + + + +final case class PublishOptions( + v1: Option[String] = None, + v2: Option[String] = None, + v3: Option[String] = None, + v4: Option[String] = None, + v5: Option[String] = None, + v6: Option[String] = None, + v7: Option[String] = None, + v8: Option[String] = None, + v9: Option[String] = None, + ci: PublishContextualOptions = PublishContextualOptions(), +) +object PublishOptions: + implicit val monoid: ConfigMonoid[PublishOptions] = ConfigMonoid.derive + +final case class PublishContextualOptions( + v1: Option[String] = None, + v2: Option[String] = None, + v3: Option[String] = None, + v4: Option[String] = None, + v5: Option[String] = None, + v6: Option[String] = None, + v7: Option[String] = None, + v8: Option[String] = None, + v9: Option[String] = None, + v10: Option[String] = None, + v11: Option[String] = None, + v12: Option[String] = None, + v13: Option[String] = None, + v14: Option[String] = None, + v15: Option[String] = None, + v16: Option[String] = None, + v17: Option[String] = None, + v18: Option[String] = None, + v19: Option[String] = None, + v20: Option[String] = None +) +object PublishContextualOptions: + given monoid: ConfigMonoid[PublishContextualOptions] = ConfigMonoid.derive \ No newline at end of file diff --git a/tests/pos/i21413.scala b/tests/pos/i21413.scala index d2dc52e34630..72b5c6d59d8d 100644 --- a/tests/pos/i21413.scala +++ b/tests/pos/i21413.scala @@ -1,2 +1,4 @@ +import scala.language.experimental.namedTuples + val x = (aaa = 1).aaa //val y = x.aaa \ No newline at end of file diff --git a/tests/pos/named-tuple-combinators.scala b/tests/pos/named-tuple-combinators.scala index c027ba688d02..a5134b2e7d26 100644 --- a/tests/pos/named-tuple-combinators.scala +++ b/tests/pos/named-tuple-combinators.scala @@ -1,3 +1,4 @@ +import scala.language.experimental.namedTuples object Test: // original code from issue https://github.com/scala/scala3/issues/20427 diff --git a/tests/pos/named-tuple-selectable.scala b/tests/pos/named-tuple-selectable.scala index 0e1324f70ae6..be5f0400e58c 100644 --- a/tests/pos/named-tuple-selectable.scala +++ b/tests/pos/named-tuple-selectable.scala @@ -1,3 +1,4 @@ +import scala.language.experimental.namedTuples class FromFields extends Selectable: type Fields = (xs: List[Int], poly: [T] => (x: List[T]) => Option[T]) diff --git a/tests/pos/named-tuple-selections.scala b/tests/pos/named-tuple-selections.scala index 7b73daad2e72..c3569f21b323 100644 --- a/tests/pos/named-tuple-selections.scala +++ b/tests/pos/named-tuple-selections.scala @@ -1,3 +1,4 @@ +import scala.language.experimental.namedTuples object Test1: // original code from issue https://github.com/scala/scala3/issues/20439 diff --git a/tests/pos/named-tuple-unstable.scala b/tests/pos/named-tuple-unstable.scala index d15bdc578a3a..6a6a36732a14 100644 --- a/tests/pos/named-tuple-unstable.scala +++ b/tests/pos/named-tuple-unstable.scala @@ -1,3 +1,4 @@ +import scala.language.experimental.namedTuples import NamedTuple.{AnyNamedTuple, NamedTuple} trait Foo extends Selectable: diff --git a/tests/pos/named-tuple-widen.scala b/tests/pos/named-tuple-widen.scala index cc12a5f09b16..410832e04c17 100644 --- a/tests/pos/named-tuple-widen.scala +++ b/tests/pos/named-tuple-widen.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples class A class B diff --git a/tests/pos/named-tuples-ops-mirror.scala b/tests/pos/named-tuples-ops-mirror.scala index b8745cf785d5..f66eb89534fb 100644 --- a/tests/pos/named-tuples-ops-mirror.scala +++ b/tests/pos/named-tuples-ops-mirror.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples import NamedTuple.* @FailsWith[HttpError] diff --git a/tests/pos/named-tuples1.scala b/tests/pos/named-tuples1.scala index 532f1df7efd4..58e3fc065e61 100644 --- a/tests/pos/named-tuples1.scala +++ b/tests/pos/named-tuples1.scala @@ -1,4 +1,5 @@ import annotation.experimental +import language.experimental.namedTuples @main def Test = val bob = (name = "Bob", age = 33): (name: String, age: Int) diff --git a/tests/pos/namedtuple-src-incompat.scala b/tests/pos/namedtuple-src-incompat.scala index 76eb5e4aa850..57451a4321b7 100644 --- a/tests/pos/namedtuple-src-incompat.scala +++ b/tests/pos/namedtuple-src-incompat.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples var age = 22 val x = (age = 1) val _: (age: Int) = x diff --git a/tests/pos/tuple-ops.scala b/tests/pos/tuple-ops.scala index e89c0e8e51aa..739b1ebeeb02 100644 --- a/tests/pos/tuple-ops.scala +++ b/tests/pos/tuple-ops.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples import Tuple.* def test = diff --git a/tests/rewrites/ambigious-named-tuple-assignment.check b/tests/rewrites/ambigious-named-tuple-assignment.check new file mode 100644 index 000000000000..00e6cc4112f1 --- /dev/null +++ b/tests/rewrites/ambigious-named-tuple-assignment.check @@ -0,0 +1,19 @@ +import scala.language.experimental.namedTuples + +object i21770: + def f(g: Int => Unit) = g(0) + var cache: Option[Int] = None + f(i => {cache = Some(i)}) + +object i21861: + var age: Int = 28 + { + age = 29 + } + + +object i21861c: + def age: Int = ??? + def age_=(x: Int): Unit = () + age = 29 + { age = 29 } diff --git a/tests/rewrites/ambigious-named-tuple-assignment.scala b/tests/rewrites/ambigious-named-tuple-assignment.scala new file mode 100644 index 000000000000..e9685b7b58cf --- /dev/null +++ b/tests/rewrites/ambigious-named-tuple-assignment.scala @@ -0,0 +1,19 @@ +import scala.language.experimental.namedTuples + +object i21770: + def f(g: Int => Unit) = g(0) + var cache: Option[Int] = None + f(i => (cache = Some(i))) + +object i21861: + var age: Int = 28 + ( + age = 29 + ) + + +object i21861c: + def age: Int = ??? + def age_=(x: Int): Unit = () + age = 29 + ( age = 29 ) diff --git a/tests/rewrites/infix-named-args.check b/tests/rewrites/infix-named-args.check index a50593ef18a8..5f59cf272ba1 100644 --- a/tests/rewrites/infix-named-args.check +++ b/tests/rewrites/infix-named-args.check @@ -1,3 +1,5 @@ +import scala.language.experimental.namedTuples + class C: def multi(x: Int, y: Int): Int = x + y def **(x: Int, y: Int): Int = x + y @@ -12,4 +14,4 @@ class D(d: Int): def f = this.**(x = 2) def g = this ** 2 def h = this ** ((x = 2)) - def i = this.**(x = (1 + 1)) \ No newline at end of file + def i = this.**(x = (1 + 1)) diff --git a/tests/rewrites/infix-named-args.scala b/tests/rewrites/infix-named-args.scala index bcdf4a21a9d2..a954776a9104 100644 --- a/tests/rewrites/infix-named-args.scala +++ b/tests/rewrites/infix-named-args.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.namedTuples + class C: def multi(x: Int, y: Int): Int = x + y def **(x: Int, y: Int): Int = x + y diff --git a/tests/run-macros/tasty-definitions-1.check b/tests/run-macros/tasty-definitions-1.check index 1eba400b6c71..066aeb2eeae4 100644 --- a/tests/run-macros/tasty-definitions-1.check +++ b/tests/run-macros/tasty-definitions-1.check @@ -57,57 +57,31 @@ Function23 Function24 Function25 ContextFunction0 -ContextFunction0 -ContextFunction1 ContextFunction1 ContextFunction2 -ContextFunction2 -ContextFunction3 ContextFunction3 ContextFunction4 -ContextFunction4 -ContextFunction5 ContextFunction5 ContextFunction6 -ContextFunction6 ContextFunction7 -ContextFunction7 -ContextFunction8 ContextFunction8 ContextFunction9 -ContextFunction9 ContextFunction10 -ContextFunction10 -ContextFunction11 ContextFunction11 ContextFunction12 -ContextFunction12 ContextFunction13 -ContextFunction13 -ContextFunction14 ContextFunction14 ContextFunction15 -ContextFunction15 -ContextFunction16 ContextFunction16 ContextFunction17 -ContextFunction17 -ContextFunction18 ContextFunction18 ContextFunction19 -ContextFunction19 ContextFunction20 -ContextFunction20 -ContextFunction21 ContextFunction21 ContextFunction22 -ContextFunction22 ContextFunction23 -ContextFunction23 -ContextFunction24 ContextFunction24 ContextFunction25 -ContextFunction25 class java.lang.Exception: Erased function classes are not supported. Use a refined `scala.PolyFunction` PolyFunction Tuple2 diff --git a/tests/run-macros/tasty-definitions-1/quoted_1.scala b/tests/run-macros/tasty-definitions-1/quoted_1.scala index f5538cb903dc..9a6d6e2edd41 100644 --- a/tests/run-macros/tasty-definitions-1/quoted_1.scala +++ b/tests/run-macros/tasty-definitions-1/quoted_1.scala @@ -60,7 +60,6 @@ object Macros { printout(defn.FunctionClass(i).name) for (i <- 0 to 25) - printout(defn.FunctionClass(i, isContextual = true).name) printout(defn.FunctionClass(i, isImplicit = true).name) // should fail diff --git a/tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala b/tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala index 7a8dcb9bd2df..65e3a730ee7e 100644 --- a/tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala +++ b/tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala @@ -77,6 +77,12 @@ val experimentalDefinitionInLibrary = Set( // New feature: fromNullable for explicit nulls "scala.Predef$.fromNullable", + // New feature: named tuples + "scala.NamedTuple", + "scala.NamedTuple$", + "scala.NamedTupleDecomposition", + "scala.NamedTupleDecomposition$", + // New feature: modularity "scala.Precise", "scala.annotation.internal.WitnessNames", diff --git a/tests/run/contextbounds-for-poly-functions.scala b/tests/run/contextbounds-for-poly-functions.scala index dcc974fce198..72eed8939fcf 100644 --- a/tests/run/contextbounds-for-poly-functions.scala +++ b/tests/run/contextbounds-for-poly-functions.scala @@ -1,6 +1,3 @@ -import scala.language.experimental.modularity -import scala.language.future - trait Show[X]: def show(x: X): String diff --git a/tests/run/named-patmatch.scala b/tests/run/named-patmatch.scala index 6fe1934f008e..e62497e4aa8f 100644 --- a/tests/run/named-patmatch.scala +++ b/tests/run/named-patmatch.scala @@ -1,4 +1,5 @@ import annotation.experimental +import language.experimental.namedTuples @main def Test = locally: diff --git a/tests/run/named-patterns.scala b/tests/run/named-patterns.scala index e92bbf751c22..7c24dc8d683a 100644 --- a/tests/run/named-patterns.scala +++ b/tests/run/named-patterns.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples object Test1: class Person(val name: String, val age: Int) diff --git a/tests/run/named-tuple-ops.scala b/tests/run/named-tuple-ops.scala index 8c6db6f2fa1c..076ab5028c6c 100644 --- a/tests/run/named-tuple-ops.scala +++ b/tests/run/named-tuple-ops.scala @@ -1,4 +1,5 @@ //> using options -source future +import language.experimental.namedTuples import scala.compiletime.asMatchable type City = (name: String, zip: Int, pop: Int) diff --git a/tests/run/named-tuples-xxl.scala b/tests/run/named-tuples-xxl.scala index 8c831fb1d223..3a0a1e5e1294 100644 --- a/tests/run/named-tuples-xxl.scala +++ b/tests/run/named-tuples-xxl.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples import NamedTuple.toTuple type Person = ( diff --git a/tests/run/named-tuples.scala b/tests/run/named-tuples.scala index c99393a403b3..406c6195cf0f 100644 --- a/tests/run/named-tuples.scala +++ b/tests/run/named-tuples.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples import NamedTuple.* type Person = (name: String, age: Int) diff --git a/tests/run/tyql.scala b/tests/run/tyql.scala index ee3fd1138265..8fe253b559ac 100644 --- a/tests/run/tyql.scala +++ b/tests/run/tyql.scala @@ -1,3 +1,4 @@ +import language.experimental.namedTuples import NamedTuple.{NamedTuple, AnyNamedTuple} /* This is a demonstrator that shows how to map regular for expressions to diff --git a/tests/warn/21681.check b/tests/warn/21681.check index e86ce4e36134..adf3586e6e0b 100644 --- a/tests/warn/21681.check +++ b/tests/warn/21681.check @@ -1,7 +1,8 @@ --- [E203] Syntax Migration Warning: tests/warn/21681.scala:3:2 --------------------------------------------------------- -3 | (age = 29) // warn +-- [E203] Syntax Migration Warning: tests/warn/21681.scala:5:2 --------------------------------------------------------- +5 | (age = 29) // warn | ^^^^^^^^^^ - | Ambiguous syntax: this is interpreted as a named tuple with one element, + | Deprecated syntax: in the future it would be interpreted as a named tuple with one element, | not as an assignment. | | To assign a value, use curly braces: `{age = 29}`. + | This can be rewritten automatically under -rewrite -source 3.6-migration. diff --git a/tests/warn/21681.scala b/tests/warn/21681.scala index 76a19c96e1cb..67f45571ecf6 100644 --- a/tests/warn/21681.scala +++ b/tests/warn/21681.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.namedTuples + def main() = var age: Int = 28 (age = 29) // warn diff --git a/tests/warn/21681b.check b/tests/warn/21681b.check index 32760e00ebb6..09c007f351b4 100644 --- a/tests/warn/21681b.check +++ b/tests/warn/21681b.check @@ -1,7 +1,8 @@ --- [E203] Syntax Migration Warning: tests/warn/21681b.scala:3:2 -------------------------------------------------------- -3 | (age = 29) // warn +-- [E203] Syntax Migration Warning: tests/warn/21681b.scala:5:2 -------------------------------------------------------- +5 | (age = 29) // warn | ^^^^^^^^^^ - | Ambiguous syntax: this is interpreted as a named tuple with one element, + | Deprecated syntax: in the future it would be interpreted as a named tuple with one element, | not as an assignment. | | To assign a value, use curly braces: `{age = 29}`. + | This can be rewritten automatically under -rewrite -source 3.6-migration. diff --git a/tests/warn/21681b.scala b/tests/warn/21681b.scala index 710d69b0dd23..44d04fc98aad 100644 --- a/tests/warn/21681b.scala +++ b/tests/warn/21681b.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.namedTuples + object Test: var age: Int = 28 (age = 29) // warn diff --git a/tests/warn/21681c.check b/tests/warn/21681c.check index 11c427f87cfe..20273f723384 100644 --- a/tests/warn/21681c.check +++ b/tests/warn/21681c.check @@ -1,7 +1,8 @@ --- [E203] Syntax Migration Warning: tests/warn/21681c.scala:5:2 -------------------------------------------------------- -5 | (age = 29) // warn +-- [E203] Syntax Migration Warning: tests/warn/21681c.scala:7:2 -------------------------------------------------------- +7 | (age = 29) // warn | ^^^^^^^^^^ - | Ambiguous syntax: this is interpreted as a named tuple with one element, + | Deprecated syntax: in the future it would be interpreted as a named tuple with one element, | not as an assignment. | | To assign a value, use curly braces: `{age = 29}`. + | This can be rewritten automatically under -rewrite -source 3.6-migration. diff --git a/tests/warn/21681c.scala b/tests/warn/21681c.scala index 5e2eae11708c..a0c361382a54 100644 --- a/tests/warn/21681c.scala +++ b/tests/warn/21681c.scala @@ -1,3 +1,5 @@ +import scala.language.experimental.namedTuples + object Test: def age: Int = ??? def age_=(x: Int): Unit = () diff --git a/tests/warn/21770.check b/tests/warn/21770.check index 0899f11d6ca5..7853d77a423c 100644 --- a/tests/warn/21770.check +++ b/tests/warn/21770.check @@ -1,7 +1,8 @@ --- [E203] Syntax Migration Warning: tests/warn/21770.scala:5:9 --------------------------------------------------------- -5 | f(i => (cache = Some(i))) // warn +-- [E203] Syntax Migration Warning: tests/warn/21770.scala:7:9 --------------------------------------------------------- +7 | f(i => (cache = Some(i))) // warn | ^^^^^^^^^^^^^^^^^ - | Ambiguous syntax: this is interpreted as a named tuple with one element, + | Deprecated syntax: in the future it would be interpreted as a named tuple with one element, | not as an assignment. | | To assign a value, use curly braces: `{cache = Some(i)}`. + | This can be rewritten automatically under -rewrite -source 3.6-migration. diff --git a/tests/warn/21770.scala b/tests/warn/21770.scala index 9696a31d6ba8..8ee5b52e7b3f 100644 --- a/tests/warn/21770.scala +++ b/tests/warn/21770.scala @@ -1,5 +1,7 @@ +import scala.language.experimental.namedTuples + def f(g: Int => Unit) = g(0) -def test = +def test = var cache: Option[Int] = None f(i => (cache = Some(i))) // warn diff --git a/tests/warn/i21036a.check b/tests/warn/i21036a.check index 63d611a6e246..6ce5b94d123f 100644 --- a/tests/warn/i21036a.check +++ b/tests/warn/i21036a.check @@ -1,10 +1,13 @@ --- Warning: tests/warn/i21036a.scala:7:17 ------------------------------------------------------------------------------ +-- [E205] Potential Issue Warning: tests/warn/i21036a.scala:7:17 ------------------------------------------------------- 7 |val y = summon[A] // warn | ^ | Given search preference for A between alternatives | (b : B) | and | (a : A) - | will change. - | Current choice : the first alternative - | New choice from Scala 3.7: the second alternative + | will change in the future release. + | Current choice : the first alternative + | Choice from Scala 3.7 : the second alternative + | + | Suppress this warning by choosing -source 3.5, -source 3.7, or + | by using @annotation.nowarn("id=205") diff --git a/tests/warn/i21036b.check b/tests/warn/i21036b.check index dfa19a0e9bb1..da0639438c86 100644 --- a/tests/warn/i21036b.check +++ b/tests/warn/i21036b.check @@ -1,4 +1,4 @@ --- Warning: tests/warn/i21036b.scala:7:17 ------------------------------------------------------------------------------ +-- [E205] Potential Issue Warning: tests/warn/i21036b.scala:7:17 ------------------------------------------------------- 7 |val y = summon[A] // warn | ^ | Given search preference for A between alternatives @@ -6,5 +6,8 @@ | and | (a : A) | has changed. - | Previous choice : the first alternative - | New choice from Scala 3.7: the second alternative + | Previous choice : the first alternative + | Choice from Scala 3.7 : the second alternative + | + | Suppress this warning by choosing -source 3.5, -source 3.7, or + | by using @annotation.nowarn("id=205") diff --git a/tests/warn/i21036c.scala b/tests/warn/i21036c.scala new file mode 100644 index 000000000000..4015cc8a84bb --- /dev/null +++ b/tests/warn/i21036c.scala @@ -0,0 +1,7 @@ +trait A +trait B extends A +given b: B = ??? +given a: A = ??? + +@annotation.nowarn("id=205") +val y = summon[A] // don't warn \ No newline at end of file diff --git a/tests/warn/i21816.scala b/tests/warn/i21816.scala new file mode 100644 index 000000000000..9153b8b0ee2f --- /dev/null +++ b/tests/warn/i21816.scala @@ -0,0 +1,17 @@ + +case class CC(a: String, b: String) extends Iterable[String] { + override def iterator: Iterator[String] = Iterator(a, b) +} + +trait T { + extension (cc: CC) def className: String = "foo" +} + +object O extends T { + def foo = { + val cc = CC("a", "b") + println(cc.className) + } +} + +@main def main() = O.foo diff --git a/tests/warn/infix-named-args-migration.scala b/tests/warn/infix-named-args-migration.scala index df4bfb50271c..361004f08f13 100644 --- a/tests/warn/infix-named-args-migration.scala +++ b/tests/warn/infix-named-args-migration.scala @@ -1,4 +1,6 @@ //> using options -source:3.6-migration +import scala.language.experimental.namedTuples + class C: def f = 42 + (x = 1) // warn // interpreted as 42.+(x = 1) under migration, x is a valid synthetic parameter name def multi(x: Int, y: Int): Int = x + y