From 6cdfa5b939c21a7af1e7c25e8ed811b577459d2e Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Mon, 23 Sep 2024 08:44:02 +0200 Subject: [PATCH 01/47] Enable PC tests in test_windows_fast [Cherry-picked f69680d8982c3680ca9e051c6578c1776f142c9d] --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 97c4a9d75277..214ef172fa70 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -175,7 +175,7 @@ jobs: uses: actions/checkout@v4 - name: Test - run: sbt ";scala3-bootstrapped/compile; scala3-bootstrapped/testCompilation" + run: sbt ";scala3-bootstrapped/compile; scala3-bootstrapped/testCompilation; scala3-presentation-compiler-bootstrapped/test; scala3-language-server/test" shell: cmd - name: build binary From 25230027f3627a8ae659f20a142e096f97370995 Mon Sep 17 00:00:00 2001 From: HarrisL2 Date: Tue, 24 Sep 2024 12:41:41 -0400 Subject: [PATCH 02/47] Filter opaque modifier from object documentation Co-authored-by: Matt Bovel [Cherry-picked 4ae882f85aaec5271d51a5ad7c261eba90108b82] --- scaladoc-testcases/src/tests/opaqueTypes.scala | 6 +++++- .../src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scaladoc-testcases/src/tests/opaqueTypes.scala b/scaladoc-testcases/src/tests/opaqueTypes.scala index 33cc7ab9ff91..c248632092bd 100644 --- a/scaladoc-testcases/src/tests/opaqueTypes.scala +++ b/scaladoc-testcases/src/tests/opaqueTypes.scala @@ -6,4 +6,8 @@ opaque type Permissions = Int opaque type PermissionChoice = Int -//opaque type Permission <: Permissions & PermissionChoice = Int TODO: #112 \ No newline at end of file +//opaque type Permission <: Permissions & PermissionChoice = Int TODO: #112 + +object Foo: + opaque type Bar + = Int \ No newline at end of file diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala index 880979852ef6..4514cb42c9c3 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala @@ -314,7 +314,7 @@ trait ClassLikeSupport: def parseObject(classDef: ClassDef, signatureOnly: Boolean = false): Member = mkClass(classDef)( // All objects are final so we do not need final modifier! - modifiers = classDef.symbol.getExtraModifiers().filter(_ != Modifier.Final), + modifiers = classDef.symbol.getExtraModifiers().filter(mod => mod != Modifier.Final && mod != Modifier.Opaque), signatureOnly = signatureOnly ) From 323145fc53e500b88331f8a220c58f7bdadfe35e Mon Sep 17 00:00:00 2001 From: HarrisL2 Date: Tue, 24 Sep 2024 12:06:10 -0400 Subject: [PATCH 03/47] Add better error reporting for inlined non-immutable paths Co-authored-by: Matt Bovel [Cherry-picked 000f484dbb0e4a526207004a10c9e8f4a3037492] --- .../src/dotty/tools/dotc/reporting/messages.scala | 14 +++++++++++++- tests/neg/21538.check | 11 +++++++++++ tests/neg/21538.scala | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/neg/21538.check create mode 100644 tests/neg/21538.scala diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index b8df9c466a2b..bf0645b61d2c 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -1797,13 +1797,25 @@ class SuperCallsNotAllowedInlineable(symbol: Symbol)(using Context) } class NotAPath(tp: Type, usage: String)(using Context) extends TypeMsg(NotAPathID): - def msg(using Context) = i"$tp is not a valid $usage, since it is not an immutable path" + def msg(using Context) = i"$tp is not a valid $usage, since it is not an immutable path" + inlineParamAddendum def explain(using Context) = i"""An immutable path is | - a reference to an immutable value, or | - a reference to `this`, or | - a selection of an immutable path with an immutable value.""" + def inlineParamAddendum(using Context) = + val sym = tp.termSymbol + if sym.isAllOf(Flags.InlineParam) then + i""" + |Inline parameters are not considered immutable paths and cannot be used as + |singleton types. + | + |Hint: Removing the `inline` qualifier from the `${sym.name}` parameter + |may help resolve this issue.""" + else "" + + class WrongNumberOfParameters(tree: untpd.Tree, foundCount: Int, pt: Type, expectedCount: Int)(using Context) extends SyntaxMsg(WrongNumberOfParametersID) { def msg(using Context) = s"Wrong number of parameters, expected: $expectedCount" diff --git a/tests/neg/21538.check b/tests/neg/21538.check new file mode 100644 index 000000000000..0e799bef3611 --- /dev/null +++ b/tests/neg/21538.check @@ -0,0 +1,11 @@ +-- [E083] Type Error: tests/neg/21538.scala:3:45 ----------------------------------------------------------------------- +3 |inline def foo[V](inline value: V)(using Bar[value.type]) : Unit = {} // error + | ^^^^^^^^^^ + | (value : V) is not a valid singleton type, since it is not an immutable path + | Inline parameters are not considered immutable paths and cannot be used as + | singleton types. + | + | Hint: Removing the `inline` qualifier from the `value` parameter + | may help resolve this issue. + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg/21538.scala b/tests/neg/21538.scala new file mode 100644 index 000000000000..761e9cde678a --- /dev/null +++ b/tests/neg/21538.scala @@ -0,0 +1,3 @@ +trait Bar[T] +given [T]: Bar[T] with {} +inline def foo[V](inline value: V)(using Bar[value.type]) : Unit = {} // error \ No newline at end of file From 385bcc5232260c798e684c3ecff93f676ec94698 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Tue, 24 Sep 2024 18:06:07 +0100 Subject: [PATCH 04/47] Make right assoc extx method fwd refs error [Cherry-picked f684bacbb8f149f6fad92b373472315c1725d677] --- .../src/dotty/tools/dotc/ast/Desugar.scala | 20 ++++++++++--- tests/neg/i16815.check | 28 +++++++++++++++++++ tests/neg/i16815.scala | 20 +++++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 tests/neg/i16815.check create mode 100644 tests/neg/i16815.scala diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 6863618bacfc..a5d112de10c9 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -934,8 +934,8 @@ object desugar { paramss match case rightParam :: paramss1 => // `rightParam` must have a single parameter and without `given` flag - def badRightAssoc(problem: String) = - report.error(em"right-associative extension method $problem", mdef.srcPos) + def badRightAssoc(problem: String, pos: SrcPos) = + report.error(em"right-associative extension method $problem", pos) extParamss ++ mdef.paramss rightParam match @@ -951,11 +951,23 @@ object desugar { // // If you change the names of the clauses below, also change them in right-associative-extension-methods.md val (leftTyParamsAndLeadingUsing, leftParamAndTrailingUsing) = extParamss.span(isUsingOrTypeParamClause) + + val names = (for ps <- mdef.paramss; p <- ps yield p.name).toSet[Name] + + val tt = new untpd.UntypedTreeTraverser: + def traverse(tree: Tree)(using Context): Unit = tree match + case tree: Ident if names.contains(tree.name) => + badRightAssoc(s"cannot have a forward reference to ${tree.name}", tree.srcPos) + case _ => traverseChildren(tree) + + for ts <- leftParamAndTrailingUsing; t <- ts do + tt.traverse(t) + leftTyParamsAndLeadingUsing ::: rightTyParams ::: rightParam :: leftParamAndTrailingUsing ::: paramss1 else - badRightAssoc("cannot start with using clause") + badRightAssoc("cannot start with using clause", mdef.srcPos) case _ => - badRightAssoc("must start with a single parameter") + badRightAssoc("must start with a single parameter", mdef.srcPos) case _ => // no value parameters, so not an infix operator. extParamss ++ mdef.paramss diff --git a/tests/neg/i16815.check b/tests/neg/i16815.check new file mode 100644 index 000000000000..8f2f5c57d405 --- /dev/null +++ b/tests/neg/i16815.check @@ -0,0 +1,28 @@ +-- Error: tests/neg/i16815.scala:3:37 ---------------------------------------------------------------------------------- +3 |extension [C1 >: Chain <: Chain](c2: c1.Tail) // error + | ^^ + | right-associative extension method cannot have a forward reference to c1 +-- Error: tests/neg/i16815.scala:6:24 ---------------------------------------------------------------------------------- +6 |extension [C1](c2: (C1, C2)) // error + | ^^ + | right-associative extension method cannot have a forward reference to C2 +-- Error: tests/neg/i16815.scala:9:19 ---------------------------------------------------------------------------------- +9 |extension [C1](c2: C2) // error + | ^^ + | right-associative extension method cannot have a forward reference to C2 +-- Error: tests/neg/i16815.scala:12:24 --------------------------------------------------------------------------------- +12 |extension [C1](c2: (C1, C2, C3)) // error // error + | ^^ + | right-associative extension method cannot have a forward reference to C2 +-- Error: tests/neg/i16815.scala:12:28 --------------------------------------------------------------------------------- +12 |extension [C1](c2: (C1, C2, C3)) // error // error + | ^^ + | right-associative extension method cannot have a forward reference to C3 +-- Error: tests/neg/i16815.scala:15:48 --------------------------------------------------------------------------------- +15 |extension [C1](str: String)(using z: (str.type, C2)) // error + | ^^ + | right-associative extension method cannot have a forward reference to C2 +-- Error: tests/neg/i16815.scala:19:31 --------------------------------------------------------------------------------- +19 |extension [D1 <: Int](D2: (D1, D2)) // error + | ^^ + | right-associative extension method cannot have a forward reference to D2 diff --git a/tests/neg/i16815.scala b/tests/neg/i16815.scala new file mode 100644 index 000000000000..595f75e40df4 --- /dev/null +++ b/tests/neg/i16815.scala @@ -0,0 +1,20 @@ +trait Chain { type Tail <: Chain } + +extension [C1 >: Chain <: Chain](c2: c1.Tail) // error + def ra1_:[C2 <: C1](c1: C1): C2 = ??? + +extension [C1](c2: (C1, C2)) // error + def ra2_:[C2 <: C1](c1: (C1, C2)): C2 = ??? + +extension [C1](c2: C2) // error + def ra3_:[C2 <: C1](c1: C1): C2 = ??? + +extension [C1](c2: (C1, C2, C3)) // error // error + def ra4_:[C2 <: C1, C3 <: C1](c1: (C1, C2)): C2 = ??? + +extension [C1](str: String)(using z: (str.type, C2)) // error + def ra5_:[C2 <: Int](c1: C1): C2 = ??? + +type D2 = String +extension [D1 <: Int](D2: (D1, D2)) // error + def sa2_:[D2 <: D1](D1: (D1, D2)): D2 = ??? From 848820beb9b3b3a31549e9ef09c18fe234f877a0 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Wed, 25 Sep 2024 21:31:49 +0100 Subject: [PATCH 05/47] Tighten java annot value parsing [Cherry-picked 07dce3f9f1065b2bb4de9d0aa39aa69d5eebd40e] --- .../dotty/tools/dotc/parsing/JavaParsers.scala | 4 ++-- tests/pos/i20026/J.java | 4 ++++ tests/pos/i20026/S.scala | 1 + tests/pos/i20026/TestInstance.java | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/pos/i20026/J.java create mode 100644 tests/pos/i20026/S.scala create mode 100644 tests/pos/i20026/TestInstance.java diff --git a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala index b9edb147be9d..6f0d88c9a71e 100644 --- a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -363,8 +363,8 @@ object JavaParsers { def annotation(): Option[Tree] = { def classOrId(): Tree = val id = qualId() - if in.lookaheadToken == CLASS then - in.nextToken() + if in.token == DOT && in.lookaheadToken == CLASS then + accept(DOT) accept(CLASS) TypeApply( Select( diff --git a/tests/pos/i20026/J.java b/tests/pos/i20026/J.java new file mode 100644 index 000000000000..e950024ed913 --- /dev/null +++ b/tests/pos/i20026/J.java @@ -0,0 +1,4 @@ +package p; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class J { } diff --git a/tests/pos/i20026/S.scala b/tests/pos/i20026/S.scala new file mode 100644 index 000000000000..7da04d6b6bbe --- /dev/null +++ b/tests/pos/i20026/S.scala @@ -0,0 +1 @@ +class S diff --git a/tests/pos/i20026/TestInstance.java b/tests/pos/i20026/TestInstance.java new file mode 100644 index 000000000000..8db79ad88d89 --- /dev/null +++ b/tests/pos/i20026/TestInstance.java @@ -0,0 +1,15 @@ +package p; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface TestInstance { + enum Lifecycle { PER_CLASS, PER_METHOD; } + Lifecycle value(); +} From ef1046808ba18625414d8c358cbd7e5d34e484a4 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 16:01:41 +0100 Subject: [PATCH 06/47] Handle suspension due to macro call completed in arbitrary phases Previously we only supported suspension in Typer and Inliner. In the added test case this happens in PostTyper, but I've seen it happen in Mixin too. Fixes #18517. [Cherry-picked bac87814faf2492087fcd9e99f6eecbc63ea2b29][modified] --- compiler/src/dotty/tools/dotc/core/Phases.scala | 17 +++++++++++------ .../dotty/tools/dotc/transform/Inlining.scala | 8 +------- tests/pos-macros/i18517/Caller.scala | 17 +++++++++++++++++ tests/pos-macros/i18517/Macro.scala | 7 +++++++ tests/pos-macros/i18517/User.scala | 6 ++++++ 5 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 tests/pos-macros/i18517/Caller.scala create mode 100644 tests/pos-macros/i18517/Macro.scala create mode 100644 tests/pos-macros/i18517/User.scala diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index e3e28139a150..5fd2e276adec 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -333,15 +333,20 @@ object Phases { for unit <- units do given unitCtx: Context = runCtx.fresh.setPhase(this.start).setCompilationUnit(unit).withRootImports if ctx.run.enterUnit(unit) then - try run - catch case ex: Throwable if !ctx.run.enrichedErrorMessage => - println(ctx.run.enrichErrorMessage(s"unhandled exception while running $phaseName on $unit")) - throw ex + try + run + buf += unitCtx.compilationUnit + catch + case _: CompilationUnit.SuspendException => // this unit will be run again in `Run#compileSuspendedUnits` + case ex: Throwable if !ctx.run.enrichedErrorMessage => + println(ctx.run.enrichErrorMessage(s"unhandled exception while running $phaseName on $unit")) + throw ex finally ctx.run.advanceUnit() - buf += unitCtx.compilationUnit end if end for - buf.result() + val res = buf.result() + ctx.run.nn.checkSuspendedUnits(res) + res end runOn /** Convert a compilation unit's tree to a string; can be overridden */ diff --git a/compiler/src/dotty/tools/dotc/transform/Inlining.scala b/compiler/src/dotty/tools/dotc/transform/Inlining.scala index 2215a580dccd..72c763ef155a 100644 --- a/compiler/src/dotty/tools/dotc/transform/Inlining.scala +++ b/compiler/src/dotty/tools/dotc/transform/Inlining.scala @@ -31,13 +31,7 @@ class Inlining extends MacroTransform { override def run(using Context): Unit = if ctx.compilationUnit.needsInlining || ctx.compilationUnit.hasMacroAnnotations then - try super.run - catch case _: CompilationUnit.SuspendException => () - - override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] = - val newUnits = super.runOn(units).filterNot(_.suspended) - ctx.run.nn.checkSuspendedUnits(newUnits) - newUnits + super.run override def checkPostCondition(tree: Tree)(using Context): Unit = tree match { diff --git a/tests/pos-macros/i18517/Caller.scala b/tests/pos-macros/i18517/Caller.scala new file mode 100644 index 000000000000..3f5ce9eee903 --- /dev/null +++ b/tests/pos-macros/i18517/Caller.scala @@ -0,0 +1,17 @@ +package dummy + +trait BG { + val description: { type Structure } + type Structure = description.Structure +} + +abstract class Caller extends BG { + type Foo >: this.type <: this.type + + transparent inline def generate2() = + ${Macro.impl() } + + final val description = { + generate2() + } +} diff --git a/tests/pos-macros/i18517/Macro.scala b/tests/pos-macros/i18517/Macro.scala new file mode 100644 index 000000000000..d18b07e910a5 --- /dev/null +++ b/tests/pos-macros/i18517/Macro.scala @@ -0,0 +1,7 @@ +package dummy + +import scala.quoted.* + +object Macro: + def impl()(using quotes:Quotes) : Expr[Any] = + '{ null } diff --git a/tests/pos-macros/i18517/User.scala b/tests/pos-macros/i18517/User.scala new file mode 100644 index 000000000000..8216c581937b --- /dev/null +++ b/tests/pos-macros/i18517/User.scala @@ -0,0 +1,6 @@ +package dummy + +trait User: + final def bar(cell:Any) : Unit = + (cell: cell.type) match + case c: (Caller & cell.type) => () From 6049b84ade0c50bcc1dc896ea892b13e445e3949 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 16:02:20 +0100 Subject: [PATCH 07/47] Fix compilation --- compiler/src/dotty/tools/dotc/ast/Desugar.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index a5d112de10c9..f2bb972726d8 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -19,6 +19,7 @@ import printing.Formatting.hl import config.Printers import scala.annotation.internal.sharable +import dotty.tools.dotc.util.SrcPos object desugar { import untpd.* From 3fea8d1fd6c10bfb29ce0dd80a045d89be0ee824 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Fri, 27 Sep 2024 11:23:48 +0200 Subject: [PATCH 08/47] Allow export statements in AnyVal [Cherry-picked d2cf0fb967111168cae5ff880a9d1de898650234] --- compiler/src/dotty/tools/dotc/typer/Checking.scala | 2 +- tests/run/export-anyval.check | 1 + tests/run/export-anyval.scala | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/run/export-anyval.check create mode 100644 tests/run/export-anyval.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index 6bfbea0ace1a..ea350437f20d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -708,7 +708,7 @@ object Checking { report.error(ValueClassesMayNotDefineNonParameterField(clazz, stat.symbol), stat.srcPos) case _: DefDef if stat.symbol.isConstructor => report.error(ValueClassesMayNotDefineASecondaryConstructor(clazz, stat.symbol), stat.srcPos) - case _: MemberDef | _: Import | EmptyTree => + case _: MemberDef | _: Import | _: Export | EmptyTree => // ok case _ => report.error(ValueClassesMayNotContainInitalization(clazz), stat.srcPos) diff --git a/tests/run/export-anyval.check b/tests/run/export-anyval.check new file mode 100644 index 000000000000..1c2f472bb006 --- /dev/null +++ b/tests/run/export-anyval.check @@ -0,0 +1 @@ +Hello from export \ No newline at end of file diff --git a/tests/run/export-anyval.scala b/tests/run/export-anyval.scala new file mode 100644 index 000000000000..26fb2230781d --- /dev/null +++ b/tests/run/export-anyval.scala @@ -0,0 +1,12 @@ +class Foo(val x: String) + + +class Bar(val y: Foo) extends AnyVal: + export y.* + def foo: String = x +end Bar + +@main def Test = + val a = Bar(Foo("Hello from export")) + println(a.foo) + From 45428252b90ff1141b49a36e270c8c77b9aa2893 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:17:40 +0000 Subject: [PATCH 09/47] Bump webrick from 1.8.1 to 1.8.2 in /docs/_spec Bumps [webrick](https://github.com/ruby/webrick) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/ruby/webrick/releases) - [Commits](https://github.com/ruby/webrick/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: webrick dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] [Cherry-picked 97455cfe3435c44fb2b10cda679f36318d16b27f] --- docs/_spec/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_spec/Gemfile.lock b/docs/_spec/Gemfile.lock index b8e54fb6b4cb..c703a87bf993 100644 --- a/docs/_spec/Gemfile.lock +++ b/docs/_spec/Gemfile.lock @@ -41,7 +41,7 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - webrick (1.8.1) + webrick (1.8.2) PLATFORMS ruby From eede2f54f1d68e0769db48f81f3af069788f1f6a Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 16:04:42 +0100 Subject: [PATCH 10/47] Expr#show: Don't crash when the expression contains an unsupported type (like a SkolemType) When the SkolemType appears as the prefix of a TypeRef, we avoid it by going using `qualifier` which is defined in QuotesImpl to widen skolem, but skolems can appear in any position, and so before this change we would get a compiler crash in the added test case where the skolem appears as the prefix of a TermRef. We fix this by adding fallback cases in the quotes pretty-printer, now for the test case we get: Test.f.ho(((arg: < does not have a source representation>.x.type) => arg)) Which isn't great, but better than a crash. Maybe we should run `Type#deskolemized` on a type before trying to print it in SourceCode/Extractors, but currently these files are intentionally defined to not depend on compiler internals and do not have a `Context` so we cannot even call `deskolemized` on them. Alternatively, maybe SkolemType should be a tasty-reflect constructor but that would also be a pretty big change. [Cherry-picked 0ee87625e80566ae52e236030b4af70f039c40fb][modified] --- .../quoted/runtime/impl/printers/Extractors.scala | 4 ++++ .../quoted/runtime/impl/printers/SourceCode.scala | 8 +++++--- tests/pos-macros/skolem/Macro_1.scala | 10 ++++++++++ tests/pos-macros/skolem/Test_2.scala | 9 +++++++++ tests/run-macros/i19905.check | 4 ++-- 5 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 tests/pos-macros/skolem/Macro_1.scala create mode 100644 tests/pos-macros/skolem/Test_2.scala diff --git a/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala b/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala index eac85244d97b..726f2daf1788 100644 --- a/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala @@ -177,6 +177,8 @@ object Extractors { this += "Alternatives(" ++= patterns += ")" case TypedOrTest(tree, tpt) => this += "TypedOrTest(" += tree += ", " += tpt += ")" + case tree => + this += s"" } def visitConstant(x: Constant): this.type = x match { @@ -239,6 +241,8 @@ object Extractors { this += "NoPrefix()" case MatchCase(pat, rhs) => this += "MatchCase(" += pat += ", " += rhs += ")" + case tp => + this += s"" } def visitSignature(sig: Signature): this.type = { diff --git a/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala index db6027460a02..11a4c855f37e 100644 --- a/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala @@ -1287,7 +1287,9 @@ object SourceCode { val sym = annot.tpe.typeSymbol sym != Symbol.requiredClass("scala.forceInline") && sym.maybeOwner != Symbol.requiredPackage("scala.annotation.internal") - case x => cannotBeShownAsSource(x.show(using Printer.TreeStructure)) + case x => + cannotBeShownAsSource(x.show(using Printer.TreeStructure)) + false } printAnnotations(annots) if (annots.nonEmpty) this += " " @@ -1462,8 +1464,8 @@ object SourceCode { } } - private def cannotBeShownAsSource(x: String): Nothing = - throw new Exception(s"$x does not have a source representation") + private def cannotBeShownAsSource(x: String): this.type = + this += s"<$x does not have a source representation>" private object SpecialOp { def unapply(arg: Tree): Option[(String, List[Term])] = arg match { diff --git a/tests/pos-macros/skolem/Macro_1.scala b/tests/pos-macros/skolem/Macro_1.scala new file mode 100644 index 000000000000..65b14cffbc5b --- /dev/null +++ b/tests/pos-macros/skolem/Macro_1.scala @@ -0,0 +1,10 @@ +import scala.quoted.* + +object Macro { + + def impl(expr: Expr[Any])(using Quotes): Expr[Unit] = + println(expr.show) + '{ () } + + inline def macr(inline x: Any): Unit = ${impl('x)} +} diff --git a/tests/pos-macros/skolem/Test_2.scala b/tests/pos-macros/skolem/Test_2.scala new file mode 100644 index 000000000000..e243b8844c23 --- /dev/null +++ b/tests/pos-macros/skolem/Test_2.scala @@ -0,0 +1,9 @@ +trait Foo: + val x: Int + def ho(p: x.type => x.type): Unit = () + +object Test { + var f: Foo = ??? + Macro.macr: + f.ho(arg => arg) +} diff --git a/tests/run-macros/i19905.check b/tests/run-macros/i19905.check index 36ba7772bfdb..47e9d86e3662 100644 --- a/tests/run-macros/i19905.check +++ b/tests/run-macros/i19905.check @@ -1,3 +1,3 @@ -java.lang.Exception: NoPrefix() does not have a source representation -java.lang.Exception: NoPrefix() does not have a source representation + + NoPrefix() From 4ee2a3f4563be14c5b0cc3fd2516d3561f7fd03d Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 16:07:52 +0100 Subject: [PATCH 11/47] Localize TypeError handling in addRecheckedTypes [Cherry-picked 0f2613c7aec3c222e191ca86301db1fb8127a716][modified] --- compiler/src/dotty/tools/dotc/transform/Recheck.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/transform/Recheck.scala b/compiler/src/dotty/tools/dotc/transform/Recheck.scala index 5963a98f50f2..2eebc2347eec 100644 --- a/compiler/src/dotty/tools/dotc/transform/Recheck.scala +++ b/compiler/src/dotty/tools/dotc/transform/Recheck.scala @@ -39,10 +39,13 @@ object Recheck: val addRecheckedTypes = new TreeMap: override def transform(tree: Tree)(using Context): Tree = - val tree1 = super.transform(tree) - tree.getAttachment(RecheckedType) match - case Some(tpe) => tree1.withType(tpe) - case None => tree1 + try + val tree1 = super.transform(tree) + tree.getAttachment(RecheckedType) match + case Some(tpe) => tree1.withType(tpe) + case None => tree1 + catch + case _:TypeError => tree extension (sym: Symbol) From 22aef92e21e057b662d898f21a7db1904d9c274c Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Tue, 1 Oct 2024 22:33:15 -0700 Subject: [PATCH 12/47] Always rewrite empty List() to Nil [Cherry-picked d00bb8e4e3c3d0210860a8c84423449d7d5e7362] --- .../tools/dotc/transform/ArrayApply.scala | 2 +- .../tools/backend/jvm/ArrayApplyOptTest.scala | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala b/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala index 98ca8f2e2b5b..1a6ec307e289 100644 --- a/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala +++ b/compiler/src/dotty/tools/dotc/transform/ArrayApply.scala @@ -76,7 +76,7 @@ class ArrayApply extends MiniPhase { tree.args match // (a, b, c) ~> new ::(a, new ::(b, new ::(c, Nil))) but only for reference types case StripAscription(Apply(wrapArrayMeth, List(StripAscription(rest: JavaSeqLiteral)))) :: Nil - if defn.WrapArrayMethods().contains(wrapArrayMeth.symbol) => + if rest.elems.isEmpty || defn.WrapArrayMethods().contains(wrapArrayMeth.symbol) => Some(rest.elems) case _ => None else None diff --git a/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala b/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala index 37e7d5316f9d..bf8ec32ed81e 100644 --- a/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala +++ b/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala @@ -161,6 +161,42 @@ class ArrayApplyOptTest extends DottyBytecodeTest { } } + @Test def emptyListApplyAvoidsIntermediateArray = + checkApplyAvoidsIntermediateArray("EmptyList"): + """import scala.collection.immutable.Nil + |class Foo { + | def meth1: List[String] = List() + | def meth2: List[String] = Nil + |} + """.stripMargin + + @Test def emptyRefListApplyAvoidsIntermediateArray = + checkApplyAvoidsIntermediateArray("EmptyListOfRef"): + """import scala.collection.immutable.Nil + |class Foo { + | def meth1: List[String] = List[String]() + | def meth2: List[String] = Nil + |} + """.stripMargin + + @Test def emptyPrimitiveListApplyAvoidsIntermediateArray = + checkApplyAvoidsIntermediateArray("EmptyListOfInt"): + """import scala.collection.immutable.Nil + |class Foo { + | def meth1: List[Int] = List() + | def meth2: List[Int] = Nil + |} + """.stripMargin + + @Test def primitiveListApplyAvoidsIntermediateArray = + checkApplyAvoidsIntermediateArray("ListOfInt"): + """import scala.collection.immutable.{ ::, Nil } + |class Foo { + | def meth1: List[Int] = List(1, 2, 3) + | def meth2: List[Int] = new ::(1, new ::(2, new ::(3, Nil))) + |} + """.stripMargin + @Test def testListApplyAvoidsIntermediateArray = { checkApplyAvoidsIntermediateArray("List"): """import scala.collection.immutable.{ ::, Nil } From aa3b599ecc1be0e7e102f153e3680fddbd6e252c Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Wed, 2 Oct 2024 20:00:05 +0900 Subject: [PATCH 13/47] fix `dotty.tools.dotc.config.Properties` scaladoc [Cherry-picked 111124ff62c00accb2ce89b1e546a5e9c999c914] --- compiler/src/dotty/tools/dotc/config/Properties.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/config/Properties.scala b/compiler/src/dotty/tools/dotc/config/Properties.scala index 1e9cc82112af..4ea058d2cca8 100644 --- a/compiler/src/dotty/tools/dotc/config/Properties.scala +++ b/compiler/src/dotty/tools/dotc/config/Properties.scala @@ -10,7 +10,7 @@ import java.io.IOException import java.util.jar.Attributes.{ Name => AttributeName } import java.nio.charset.StandardCharsets -/** Loads `library.properties` from the jar. */ +/** Loads `compiler.properties` from the jar. */ object Properties extends PropertiesTrait { protected def propCategory: String = "compiler" protected def pickJarBasedOn: Class[PropertiesTrait] = classOf[PropertiesTrait] From e0e5e9a443c6531db4d1e986f76e0409a311b7fd Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 16:45:18 +0100 Subject: [PATCH 14/47] Fix incorrect caching with path-dependent types The added test case used to fail Ycheck:typer with the seemingly identicals: Found: (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})] Required: (a: (aa : A{type B = Int}), b: a.B): CCPoly[(aa : A{type B = Int})] In fact one of the `aa` is a a TypeVar instantiated to `A {type B = Int }`. The MethodType comparison failed the signature check because the `a.B` where `a` is backed by a type variable had a stale signature cached. Fixed by changing `isProvisional` to traverse ParamRefs. [Cherry-picked c32e5354a256acf8ff237e19c5b1258235025b41][modified] --- compiler/src/dotty/tools/dotc/core/Types.scala | 3 +++ tests/pos/dep-poly-class.scala | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/pos/dep-poly-class.scala diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 51e690e9a899..0123f023472f 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -140,6 +140,9 @@ object Types extends TypeUtils { !t.isPermanentlyInstantiated || test(t.permanentInst, theAcc) case t: LazyRef => !t.completed || test(t.ref, theAcc) + case t: ParamRef => + (t: Type).mightBeProvisional = false // break cycles + test(t.underlying, theAcc) case _ => (if theAcc != null then theAcc else ProAcc()).foldOver(false, t) end if diff --git a/tests/pos/dep-poly-class.scala b/tests/pos/dep-poly-class.scala new file mode 100644 index 000000000000..3615b699ff3a --- /dev/null +++ b/tests/pos/dep-poly-class.scala @@ -0,0 +1,9 @@ +trait A: + type B + +class CCPoly[T <: A](a: T, b: a.B) + +object Test: + def test(): Unit = + val aa: A { type B = Int } = new A { type B = Int } + val x: CCPoly[aa.type] = CCPoly(aa, 1) From 120a7862c70c508196351bcd1898a128ef3b4465 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 16:47:10 +0100 Subject: [PATCH 15/47] Add Staging Issue messages and QuotedTypeMissing message [Cherry-picked c3f13074d8579acd9f06cb271719ec74d8b5ce62][modified] --- .../tools/dotc/reporting/ErrorMessageID.scala | 2 ++ .../tools/dotc/reporting/MessageKind.scala | 2 ++ .../dotty/tools/dotc/reporting/messages.scala | 20 ++++++++++++++ .../dotty/tools/dotc/staging/HealType.scala | 26 +++++++++---------- tests/neg/i21696.check | 13 ++++++++++ tests/neg/i21696.scala | 7 +++++ 6 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 tests/neg/i21696.check create mode 100644 tests/neg/i21696.scala diff --git a/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala b/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala index bfeb426d6f9a..ff0aac879752 100644 --- a/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala +++ b/compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala @@ -214,6 +214,8 @@ enum ErrorMessageID(val isActive: Boolean = true) extends java.lang.Enum[ErrorMe case UnusedSymbolID // errorNumber: 198 case TailrecNestedCallID //errorNumber: 199 - unused in LTS case FinalLocalDefID // errorNumber: 200 + case NonNamedArgumentInJavaAnnotationID // errorNumber: 201 - unused in LTS + case QuotedTypeMissingID // errorNumber: 202 def errorNumber = ordinal - 1 diff --git a/compiler/src/dotty/tools/dotc/reporting/MessageKind.scala b/compiler/src/dotty/tools/dotc/reporting/MessageKind.scala index 10ad4f83d93d..bb02a08d2e46 100644 --- a/compiler/src/dotty/tools/dotc/reporting/MessageKind.scala +++ b/compiler/src/dotty/tools/dotc/reporting/MessageKind.scala @@ -22,6 +22,7 @@ enum MessageKind: case Compatibility case PotentialIssue case UnusedSymbol + case Staging /** Human readable message that will end up being shown to the user. * NOTE: This is only used in the situation where you have multiple words @@ -39,5 +40,6 @@ enum MessageKind: case MatchCaseUnreachable => "Match case Unreachable" case PotentialIssue => "Potential Issue" case UnusedSymbol => "Unused Symbol" + case Staging => "Staging Issue" case kind => kind.toString end MessageKind diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index bf0645b61d2c..74bdb0bb52dc 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -107,6 +107,9 @@ end CyclicMsg abstract class ReferenceMsg(errorId: ErrorMessageID)(using Context) extends Message(errorId): def kind = MessageKind.Reference +abstract class StagingMessage(errorId: ErrorMessageID)(using Context) extends Message(errorId): + override final def kind = MessageKind.Staging + abstract class EmptyCatchOrFinallyBlock(tryBody: untpd.Tree, errNo: ErrorMessageID)(using Context) extends SyntaxMsg(errNo) { def explain(using Context) = { @@ -3165,3 +3168,20 @@ object UnusedSymbol { def privateMembers(using Context): UnusedSymbol = new UnusedSymbol(i"unused private member") def patVars(using Context): UnusedSymbol = new UnusedSymbol(i"unused pattern variable") } + +final class QuotedTypeMissing(tpe: Type)(using Context) extends StagingMessage(QuotedTypeMissingID): + + private def witness = defn.QuotedTypeClass.typeRef.appliedTo(tpe) + + override protected def msg(using Context): String = + i"Reference to $tpe within quotes requires a given ${witness} in scope" + + override protected def explain(using Context): String = + i"""Referencing `$tpe` inside a quoted expression requires a `${witness}` to be in scope. + |Since Scala is subject to erasure at runtime, the type information will be missing during the execution of the code. + |`${witness}` is therefore needed to carry `$tpe`'s type information into the quoted code. + |Without an implicit `${witness}`, the type `$tpe` cannot be properly referenced within the expression. + |To resolve this, ensure that a `${witness}` is available, either through a context-bound or explicitly. + |""" + +end QuotedTypeMissing diff --git a/compiler/src/dotty/tools/dotc/staging/HealType.scala b/compiler/src/dotty/tools/dotc/staging/HealType.scala index 5a26803c8137..a73f884fbac9 100644 --- a/compiler/src/dotty/tools/dotc/staging/HealType.scala +++ b/compiler/src/dotty/tools/dotc/staging/HealType.scala @@ -1,17 +1,19 @@ package dotty.tools.dotc package staging -import dotty.tools.dotc.core.Contexts.* -import dotty.tools.dotc.core.Decorators.* -import dotty.tools.dotc.core.Flags.* -import dotty.tools.dotc.core.StdNames.* -import dotty.tools.dotc.core.Symbols.* -import dotty.tools.dotc.core.Types.* -import dotty.tools.dotc.staging.StagingLevel.* -import dotty.tools.dotc.staging.QuoteTypeTags.* +import reporting.* -import dotty.tools.dotc.typer.Implicits.SearchFailureType -import dotty.tools.dotc.util.SrcPos +import core.Contexts.* +import core.Decorators.* +import core.Flags.* +import core.StdNames.* +import core.Symbols.* +import core.Types.* +import StagingLevel.* +import QuoteTypeTags.* + +import typer.Implicits.SearchFailureType +import util.SrcPos class HealType(pos: SrcPos)(using Context) extends TypeMap { @@ -98,9 +100,7 @@ class HealType(pos: SrcPos)(using Context) extends TypeMap { pos) tp case _ => - report.error(em"""Reference to $tp within quotes requires a given $reqType in scope. - | - |""", pos) + report.error(QuotedTypeMissing(tp), pos) tp } diff --git a/tests/neg/i21696.check b/tests/neg/i21696.check new file mode 100644 index 000000000000..9195263040b3 --- /dev/null +++ b/tests/neg/i21696.check @@ -0,0 +1,13 @@ +-- [E202] Staging Issue Error: tests/neg/i21696.scala:7:52 ------------------------------------------------------------- +7 |def foo[T](using Quotes): Expr[Thing[T]] = '{ Thing[T]() } // error + | ^ + | Reference to T within quotes requires a given scala.quoted.Type[T] in scope + |--------------------------------------------------------------------------------------------------------------------- + | Explanation (enabled by `-explain`) + |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + | Referencing `T` inside a quoted expression requires a `scala.quoted.Type[T]` to be in scope. + | Since Scala is subject to erasure at runtime, the type information will be missing during the execution of the code. + | `scala.quoted.Type[T]` is therefore needed to carry `T`'s type information into the quoted code. + | Without an implicit `scala.quoted.Type[T]`, the type `T` cannot be properly referenced within the expression. + | To resolve this, ensure that a `scala.quoted.Type[T]` is available, either through a context-bound or explicitly. + --------------------------------------------------------------------------------------------------------------------- diff --git a/tests/neg/i21696.scala b/tests/neg/i21696.scala new file mode 100644 index 000000000000..7ec30a8a2e41 --- /dev/null +++ b/tests/neg/i21696.scala @@ -0,0 +1,7 @@ +//> using options -explain + +import scala.quoted.{Expr, Quotes} + +case class Thing[T]() + +def foo[T](using Quotes): Expr[Thing[T]] = '{ Thing[T]() } // error From dd86f42b1751ab344818a6d10a1d87331a434edf Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 17:13:24 +0100 Subject: [PATCH 16/47] Always treat underscores as type bounds inside patterns Always treat underscores as type bounds inside patterns, even when `ctx.settings.XkindProjector.value == "underscores"`. Fixes #14952 and #21400. [Cherry-picked 374cd4f7b5fd45c6d1ae96e7cbff7ca7f71010cf][modified] --- .../src/dotty/tools/dotc/parsing/Parsers.scala | 14 +++++++++++--- tests/pos/14952.scala | 9 +++++++++ tests/pos/21400.scala | 7 +++++++ tests/pos/21400b.scala | 10 ++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 tests/pos/14952.scala create mode 100644 tests/pos/21400.scala create mode 100644 tests/pos/21400b.scala diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 6267461185c2..2fa0745ab98e 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -429,6 +429,14 @@ object Parsers { finally inEnum = saved } + private var inMatchPattern = false + private def withinMatchPattern[T](body: => T): T = { + val saved = inMatchPattern + inMatchPattern = true + try body + finally inMatchPattern = saved + } + private var staged = StageKind.None def withinStaged[T](kind: StageKind)(op: => T): T = { val saved = staged @@ -1857,7 +1865,7 @@ object Parsers { if isSimpleLiteral then SingletonTypeTree(simpleLiteral()) else if in.token == USCORE then - if ctx.settings.YkindProjector.value == "underscores" then + if ctx.settings.YkindProjector.value == "underscores" && !inMatchPattern then val start = in.skipToken() Ident(tpnme.USCOREkw).withSpan(Span(start, in.lastOffset, start)) else @@ -2883,7 +2891,7 @@ object Parsers { def caseClause(exprOnly: Boolean = false): CaseDef = atSpan(in.offset) { val (pat, grd) = inSepRegion(InCase) { accept(CASE) - (pattern(), guard()) + (withinMatchPattern(pattern()), guard()) } CaseDef(pat, grd, atSpan(accept(ARROW)) { if exprOnly then @@ -2907,7 +2915,7 @@ object Parsers { val start = in.skipToken() Ident(tpnme.WILDCARD).withSpan(Span(start, in.lastOffset, start)) case _ => - rejectWildcardType(infixType()) + withinMatchPattern(rejectWildcardType(infixType())) } } CaseDef(pat, EmptyTree, atSpan(accept(ARROW)) { diff --git a/tests/pos/14952.scala b/tests/pos/14952.scala new file mode 100644 index 000000000000..5e4fd1c9a5ee --- /dev/null +++ b/tests/pos/14952.scala @@ -0,0 +1,9 @@ +//> using options -Ykind-projector:underscores + +import Tuple.* + +type LiftP[F[_], T] <: Tuple = + T match { + case _ *: _ => F[Head[T]] *: LiftP[F, Tail[T]] + case _ => EmptyTuple + } diff --git a/tests/pos/21400.scala b/tests/pos/21400.scala new file mode 100644 index 000000000000..28a061883913 --- /dev/null +++ b/tests/pos/21400.scala @@ -0,0 +1,7 @@ +//> using options -Ykind-projector:underscores + +import scala.compiletime.ops.int.S + +type IndexOf[T <: Tuple, E] <: Int = T match + case E *: _ => 0 + case _ *: es => 1 // S[IndexOf[es, E]] diff --git a/tests/pos/21400b.scala b/tests/pos/21400b.scala new file mode 100644 index 000000000000..6426de9b0f94 --- /dev/null +++ b/tests/pos/21400b.scala @@ -0,0 +1,10 @@ +//> using options -Ykind-projector:underscores + +import scala.quoted.Type +import scala.quoted.Quotes + +def x[A](t: Type[A])(using Quotes): Boolean = t match + case '[_ *: _] => + true + case _ => + false From 89183f9069d70cbafe374e50d2e1f89d26aa341d Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 2 Oct 2024 10:21:57 +0200 Subject: [PATCH 17/47] Quotes type printing: take `infix` type modifier into account This is similar to how the regular compiler `.show` handles `infix` but using explicit parens everywhere to not have to reimplement the precedence logic (maybe quote type printing should just use `.show` eventually). [Cherry-picked 936c009b8a33d4d673a71f4a69c148155ddf0886] --- .../runtime/impl/printers/SourceCode.scala | 15 ++++++++-- tests/run-macros/type-print.check | 12 ++++++++ tests/run-macros/type-print/Macro_1.scala | 29 +++++++++++++++++++ tests/run-macros/type-print/Test_2.scala | 15 ++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 tests/run-macros/type-print.check create mode 100644 tests/run-macros/type-print/Macro_1.scala create mode 100644 tests/run-macros/type-print/Test_2.scala diff --git a/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala index 11a4c855f37e..017ee7eecb7e 100644 --- a/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala @@ -1150,8 +1150,19 @@ object SourceCode { case tp: TypeRef if tp.typeSymbol == Symbol.requiredClass("scala.") => this += "_*" case _ => - printType(tp) - inSquare(printTypesOrBounds(args, ", ")) + if !fullNames && args.lengthCompare(2) == 0 && tp.typeSymbol.flags.is(Flags.Infix) then + val lhs = args(0) + val rhs = args(1) + this += "(" + printType(lhs) + this += " " + printType(tp) + this += " " + printType(rhs) + this += ")" + else + printType(tp) + inSquare(printTypesOrBounds(args, ", ")) } case AnnotatedType(tp, annot) => diff --git a/tests/run-macros/type-print.check b/tests/run-macros/type-print.check new file mode 100644 index 000000000000..5eae94d4a1bf --- /dev/null +++ b/tests/run-macros/type-print.check @@ -0,0 +1,12 @@ +List[Int] +scala.collection.immutable.List[scala.Int] +scala.collection.immutable.List[scala.Int] +AppliedType(TypeRef(ThisType(TypeRef(NoPrefix(), "immutable")), "List"), List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "Int"))) +(3 + (a * b)) +scala.compiletime.ops.int.+[3, scala.compiletime.ops.int.*[a, b]] +scala.compiletime.ops.int.+[3, scala.compiletime.ops.int.*[a, b]] +AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "+"), List(ConstantType(IntConstant(3)), AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "*"), List(TermRef(NoPrefix(), "a"), TermRef(NoPrefix(), "b"))))) +((3 + a) * b) +scala.compiletime.ops.int.*[scala.compiletime.ops.int.+[3, a], b] +scala.compiletime.ops.int.*[scala.compiletime.ops.int.+[3, a], b] +AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "*"), List(AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "+"), List(ConstantType(IntConstant(3)), TermRef(NoPrefix(), "a"))), TermRef(NoPrefix(), "b"))) diff --git a/tests/run-macros/type-print/Macro_1.scala b/tests/run-macros/type-print/Macro_1.scala new file mode 100644 index 000000000000..c0dd57e33018 --- /dev/null +++ b/tests/run-macros/type-print/Macro_1.scala @@ -0,0 +1,29 @@ +import scala.quoted.* + +inline def printTypeShort[T]: String = + ${ printTypeShortImpl[T] } + +inline def printType[T]: String = + ${ printTypeImpl[T] } + +inline def printTypeAnsi[T]: String = + ${ printTypeAnsiImpl[T] } + +inline def printTypeStructure[T]: String = + ${ printTypeStructureImpl[T] } + +def printTypeShortImpl[T: Type](using Quotes): Expr[String] = + import quotes.reflect.* + Expr(Printer.TypeReprShortCode.show(TypeRepr.of[T])) + +def printTypeImpl[T: Type](using Quotes): Expr[String] = + import quotes.reflect.* + Expr(Printer.TypeReprCode.show(TypeRepr.of[T])) + +def printTypeAnsiImpl[T: Type](using Quotes): Expr[String] = + import quotes.reflect.* + Expr(Printer.TypeReprAnsiCode.show(TypeRepr.of[T])) + +def printTypeStructureImpl[T: Type](using Quotes): Expr[String] = + import quotes.reflect.* + Expr(Printer.TypeReprStructure.show(TypeRepr.of[T])) diff --git a/tests/run-macros/type-print/Test_2.scala b/tests/run-macros/type-print/Test_2.scala new file mode 100644 index 000000000000..f2ea6c3ba8b1 --- /dev/null +++ b/tests/run-macros/type-print/Test_2.scala @@ -0,0 +1,15 @@ +import scala.compiletime.ops.int.* + +inline def printAll[T]: Unit = + println(printTypeShort[T]) + println(printType[T]) + println(printTypeAnsi[T]) + println(printTypeStructure[T]) + +@main +def Test: Unit = + printAll[List[Int]] + val a = 1 + val b = 2 + printAll[3 + a.type * b.type] + printAll[(3 + a.type) * b.type] From 3db968a1e7e23fa0e48efe1f8d3426ee51664095 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 22:40:20 +0100 Subject: [PATCH 18/47] Make the test pass in LTS - int ops are not made infix in the LTS --- tests/run-macros/type-print.check | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/run-macros/type-print.check b/tests/run-macros/type-print.check index 5eae94d4a1bf..6ded89ec4e88 100644 --- a/tests/run-macros/type-print.check +++ b/tests/run-macros/type-print.check @@ -2,11 +2,11 @@ List[Int] scala.collection.immutable.List[scala.Int] scala.collection.immutable.List[scala.Int] AppliedType(TypeRef(ThisType(TypeRef(NoPrefix(), "immutable")), "List"), List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "Int"))) -(3 + (a * b)) ++[3, *[a, b]] scala.compiletime.ops.int.+[3, scala.compiletime.ops.int.*[a, b]] scala.compiletime.ops.int.+[3, scala.compiletime.ops.int.*[a, b]] AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "+"), List(ConstantType(IntConstant(3)), AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "*"), List(TermRef(NoPrefix(), "a"), TermRef(NoPrefix(), "b"))))) -((3 + a) * b) +*[+[3, a], b] scala.compiletime.ops.int.*[scala.compiletime.ops.int.+[3, a], b] scala.compiletime.ops.int.*[scala.compiletime.ops.int.+[3, a], b] AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "*"), List(AppliedType(TypeRef(TermRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix(), "")), "scala"), "compiletime"), "ops"), "int"), "+"), List(ConstantType(IntConstant(3)), TermRef(NoPrefix(), "a"))), TermRef(NoPrefix(), "b"))) From 69977953faf8039b6943c1a61ee4ed61546c6437 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 10 Oct 2024 18:24:04 -0700 Subject: [PATCH 19/47] REPL: JLine 3.27.0 (was 3.25.1) [Cherry-picked 9de4b7c3b7a0d35f75a5dd050e2eca58b9fd5152] --- project/Build.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 6cc860718d5a..342372df399f 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -582,9 +582,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.25.1", // used by the REPL - "org.jline" % "jline-terminal" % "3.25.1", - "org.jline" % "jline-terminal-jna" % "3.25.1", // needed for Windows + "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 ("io.get-coursier" %% "coursier" % "2.0.16" % Test).cross(CrossVersion.for3Use2_13), ), From df6d69925de6e6e7d9cc0e963a4be1111c920db7 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 17:34:26 +0100 Subject: [PATCH 20/47] Scala 2.13.15 (was .14) (#21648) Co-authored-by: Wojciech Mazur [Cherry-picked f6bfa0afddd35bc965e5930f1e050e293cf9dfe1][modified] --- .../community-projects/scala-collection-compat | 2 +- community-build/community-projects/stdLib213 | 2 +- .../src/scala/dotty/communitybuild/projects.scala | 4 ++-- project/Build.scala | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/community-build/community-projects/scala-collection-compat b/community-build/community-projects/scala-collection-compat index b39b4b64732d..c9d3a8b160a3 160000 --- a/community-build/community-projects/scala-collection-compat +++ b/community-build/community-projects/scala-collection-compat @@ -1 +1 @@ -Subproject commit b39b4b64732d9dd5e0f065e4180f656237ac4444 +Subproject commit c9d3a8b160a35c9915816dd84a1063e18db4a84a diff --git a/community-build/community-projects/stdLib213 b/community-build/community-projects/stdLib213 index fcc67cd56c67..b6f70d2347f2 160000 --- a/community-build/community-projects/stdLib213 +++ b/community-build/community-projects/stdLib213 @@ -1 +1 @@ -Subproject commit fcc67cd56c67851bf31019ec25ccb09d08b9561b +Subproject commit b6f70d2347f2857695e5c0fe544b0f921544b02a diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index a425f38b117e..0fed6aa783b4 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -492,8 +492,8 @@ object projects: lazy val scalaCollectionCompat = SbtCommunityProject( project = "scala-collection-compat", - sbtTestCommand = "compat30/test", - sbtPublishCommand = "compat30/publishLocal", + sbtTestCommand = "compat3/test", + sbtPublishCommand = "compat3/publishLocal", ) lazy val scalaJava8Compat = SbtCommunityProject( diff --git a/project/Build.scala b/project/Build.scala index 342372df399f..198a4f23646d 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -124,8 +124,8 @@ object Build { * scala-library. */ def stdlibVersion(implicit mode: Mode): String = mode match { - case NonBootstrapped => "2.13.14" - case Bootstrapped => "2.13.14" + case NonBootstrapped => "2.13.15" + case Bootstrapped => "2.13.15" } val dottyOrganization = "org.scala-lang" @@ -1150,7 +1150,7 @@ object Build { BuildInfoPlugin.buildInfoDefaultSettings lazy val presentationCompilerSettings = { - val mtagsVersion = "1.3.4" + val mtagsVersion = "1.3.5" Seq( libraryDependencies ++= Seq( "org.lz4" % "lz4-java" % "1.8.0", @@ -1160,7 +1160,7 @@ object Build { .exclude("org.eclipse.lsp4j","org.eclipse.lsp4j.jsonrpc"), "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.20.1", ), - libraryDependencies += ("org.scalameta" % "mtags-shared_2.13.14" % mtagsVersion % SourceDeps), + libraryDependencies += ("org.scalameta" % "mtags-shared_2.13.15" % mtagsVersion % SourceDeps), ivyConfigurations += SourceDeps.hide, transitiveClassifiers := Seq("sources"), Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Ysafe-init"), From 19016d2286fbb31a2b1d83024e1b2e934165419c Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 17:35:17 +0100 Subject: [PATCH 21/47] Add zip and unzip to the CI [Cherry-picked dd47185afa1a2ef0e0fa6f99ed7c40d0e87b49ee][modified] --- .github/Dockerfile | 3 ++- .github/workflows/ci.yaml | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/Dockerfile b/.github/Dockerfile index d56ec6a59f2d..59d46fd169d9 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -15,7 +15,8 @@ RUN apt-get update && \ openjdk-17-jdk-headless \ openjdk-21-jdk-headless && \ (curl -fsSL https://deb.nodesource.com/setup_18.x | bash -) && \ - apt-get install -y nodejs + apt-get install -y nodejs && \ + apt-get install -y zip unzip # Install sbt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 214ef172fa70..ec35d7f2542c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,7 +48,7 @@ jobs: test_non_bootstrapped: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -100,7 +100,7 @@ jobs: test: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -230,7 +230,7 @@ jobs: name: MiMa runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -276,7 +276,7 @@ jobs: community_build_a: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -330,7 +330,7 @@ jobs: community_build_b: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -384,7 +384,7 @@ jobs: community_build_c: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -438,7 +438,7 @@ jobs: test_sbt: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -483,7 +483,7 @@ jobs: test_java8: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -539,7 +539,7 @@ jobs: publish_nightly: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -594,7 +594,7 @@ jobs: nightly_documentation: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -648,7 +648,7 @@ jobs: contents: write # for actions/create-release to create a release runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 options: --cpu-shares 4096 volumes: - ${{ github.workspace }}/../../cache/sbt:/root/.sbt @@ -740,7 +740,7 @@ jobs: open_issue_on_failure: runs-on: [self-hosted, Linux] container: - image: lampepfl/dotty:2023-11-07 + image: lampepfl/dotty:2024-10-18 needs: [nightly_documentation, test_windows_full] # The `failure()` expression is true iff at least one of the dependencies # of this job (including transitive dependencies) has failed. From a9625a2f8221ac808484d43739d6faa8622d87fb Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 17:37:30 +0100 Subject: [PATCH 22/47] Fix and future-proof the CI release scripts (#21810) - Forward-ports changes to `publish_release` CI job from `release-3.6.1` branch. * Fix building SDK archives, don't use `build-sdk-packages` job that produced artifacts in SNAPSHOT version * Fix typos introduced in template (forward port from `release-3.6.0`) - Detect and check version used to publish artifacts: * For release builds ensure that `version` is always matching tag used to trigger CI job * For nightly builds ensure that `version` is following the expected pattern [Cherry-picked 34f1c546b968f2d14443e48e268a93c3f19923d1][modified] --- .github/workflows/ci.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ec35d7f2542c..09894b272f22 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -580,6 +580,13 @@ jobs: echo "This build version: $ver" echo "THISBUILD_VERSION=$ver" >> $GITHUB_ENV + - name: Check is version matching pattern + run: | + if ! grep -Eo "3\.[0-9]+\.[0-9]+-RC[0-9]+-bin-[0-9]{8}-[a-zA-Z0-9]{7}-NIGHTLY" <<< "${{ env.THISBUILD_VERSION }}"; then + echo "Version used by compiler to publish nightly release does not match expected pattern" + exit 1 + fi + - name: Check whether not yet published id: not_yet_published continue-on-error: true @@ -685,6 +692,16 @@ jobs: - name: Add SBT proxy repositories run: cp -vf .github/workflows/repositories /root/.sbt/ ; true + - name: Check compiler version + shell: bash + run : | + version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped/version" | tail -n1) + echo "This build version: ${version}" + if [ "${version}" != "${{ env.RELEASE_TAG }}" ]; then + echo "Compiler version for this build '${version}', does not match tag: ${{ env.RELEASE_TAG }}" + exit 1 + fi + - name: Prepare Release run: | ./project/scripts/sbt dist/packArchive From 59556b21fc32b8cec9da76d858f2b2fe3edff30d Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Sun, 20 Oct 2024 08:45:12 +0200 Subject: [PATCH 23/47] Use bash shell when using here-strings (#21817) Screenshot 2024-10-20 at 07 14 49 [positive](https://github.com/WojciechMazur/dotty/actions/runs/11416876799/job/31768568868) test in #21810 also uses `bash` instead of `sh` Closes #21815 [Cherry-picked 022b1ffa21631fb96e424942ba12b49f6996ec77] --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 09894b272f22..9cd0f0b3899c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -581,6 +581,7 @@ jobs: echo "THISBUILD_VERSION=$ver" >> $GITHUB_ENV - name: Check is version matching pattern + shell: bash run: | if ! grep -Eo "3\.[0-9]+\.[0-9]+-RC[0-9]+-bin-[0-9]{8}-[a-zA-Z0-9]{7}-NIGHTLY" <<< "${{ env.THISBUILD_VERSION }}"; then echo "Version used by compiler to publish nightly release does not match expected pattern" From e59705889c5f8db4d366a39e2a3620951fe603db Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 13:47:05 +0100 Subject: [PATCH 24/47] Update CLA check server url domain from lightbend.com to contibute.akka.io [Cherry-picked cb73df2809e1894ff0ce1183b92c63b11cfef38f] --- project/scripts/check-cla.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/scripts/check-cla.sh b/project/scripts/check-cla.sh index 1a91363f5079..d9c570eeb0c5 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]" ] ; 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 -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; From e92d7eccdc0ffafa77ece25b83c9470815fbffbb Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 5 Dec 2024 13:47:37 +0100 Subject: [PATCH 25/47] Follow redirects when checkting CLA [Cherry-picked 191535b8723af53da834a72f99d71df134690370] --- project/scripts/check-cla.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/scripts/check-cla.sh b/project/scripts/check-cla.sh index d9c570eeb0c5..3ccfc48dee02 100755 --- a/project/scripts/check-cla.sh +++ b/project/scripts/check-cla.sh @@ -5,7 +5,7 @@ echo "Pull request submitted by $AUTHOR"; if [ "$AUTHOR" = "github-actions[bot]" ] ; then echo "CLA check for $AUTHOR successful"; else - signed=$(curl -s "https://contribute.akka.io/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 From fa617ffb7015e1d2f59678e99790252294b4d3fa Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 9 Dec 2024 15:18:57 +0100 Subject: [PATCH 26/47] Backport Chocolatey support to Scala LTS (#22095) Backports #20534 and #21221 to LTS. Requires adaptation - we don't produce native launchers and don't use universal packager plugin [test_chocolatey] --------- Co-authored-by: Hamza Remmal --- .github/workflows/build-chocolatey.yml | 57 ++++++++++++++++++ .github/workflows/build-sdk.yml | 58 +++++++++++++++++++ .github/workflows/ci.yaml | 27 +++++++++ .github/workflows/publish-chocolatey.yml | 39 +++++++++++++ .github/workflows/releases.yml | 49 +++++++++++++++- .github/workflows/test-chocolatey.yml | 51 ++++++++++++++++ pkgs/chocolatey/README.md | 17 ++++++ pkgs/chocolatey/icon.svg | 30 ++++++++++ pkgs/chocolatey/scala.nuspec | 25 ++++++++ pkgs/chocolatey/tools/chocolateyInstall.ps1 | 46 +++++++++++++++ pkgs/chocolatey/tools/chocolateyUninstall.ps1 | 21 +++++++ 11 files changed, 418 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-chocolatey.yml create mode 100644 .github/workflows/build-sdk.yml create mode 100644 .github/workflows/publish-chocolatey.yml create mode 100644 .github/workflows/test-chocolatey.yml create mode 100644 pkgs/chocolatey/README.md create mode 100644 pkgs/chocolatey/icon.svg create mode 100644 pkgs/chocolatey/scala.nuspec create mode 100644 pkgs/chocolatey/tools/chocolateyInstall.ps1 create mode 100644 pkgs/chocolatey/tools/chocolateyUninstall.ps1 diff --git a/.github/workflows/build-chocolatey.yml b/.github/workflows/build-chocolatey.yml new file mode 100644 index 000000000000..9de87d8e5ad6 --- /dev/null +++ b/.github/workflows/build-chocolatey.yml @@ -0,0 +1,57 @@ +################################################################################################### +### THIS IS A REUSABLE WORKFLOW TO BUILD SCALA WITH CHOCOLATEY ### +### HOW TO USE: ### +### ### +### NOTE: ### +### ### +################################################################################################### + + +name: Build 'scala' Chocolatey Package +run-name: Build 'scala' (${{ inputs.version }}) Chocolatey Package + +on: + workflow_call: + inputs: + version: + required: true + type : string + url: + required: true + type : string + digest: + required: true + type : string + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Replace the version placeholder + uses: richardrigutins/replace-in-files@v2 + with: + files: ./pkgs/chocolatey/scala.nuspec + search-text: '@LAUNCHER_VERSION@' + replacement-text: ${{ inputs.version }} + - name: Replace the URL placeholder + uses: richardrigutins/replace-in-files@v2 + with: + files: ./pkgs/chocolatey/tools/chocolateyInstall.ps1 + search-text: '@LAUNCHER_URL@' + replacement-text: ${{ inputs.url }} + - name: Replace the CHECKSUM placeholder + uses: richardrigutins/replace-in-files@v2 + with: + files: ./pkgs/chocolatey/tools/chocolateyInstall.ps1 + search-text: '@LAUNCHER_SHA256@' + replacement-text: ${{ inputs.digest }} + - name: Build the Chocolatey package (.nupkg) + run: choco pack ./pkgs/chocolatey/scala.nuspec --out ./pkgs/chocolatey + - name: Upload the Chocolatey package to GitHub + uses: actions/upload-artifact@v4 + with: + name: scala.nupkg + path: ./pkgs/chocolatey/scala.${{ inputs.version }}.nupkg + if-no-files-found: error + \ No newline at end of file diff --git a/.github/workflows/build-sdk.yml b/.github/workflows/build-sdk.yml new file mode 100644 index 000000000000..00ce04080534 --- /dev/null +++ b/.github/workflows/build-sdk.yml @@ -0,0 +1,58 @@ +################################################################################################### +### THIS IS A REUSABLE WORKFLOW TO BUILD THE SCALA LAUNCHERS ### +### HOW TO USE: ### +### - THSI WORKFLOW WILL PACKAGE THE ALL THE LAUNCHERS AND UPLOAD THEM TO GITHUB ARTIFACTS ### +### ### +### NOTE: ### +### - SEE THE WORFLOW FOR THE NAMES OF THE ARTIFACTS ### +################################################################################################### + + +name: Build Scala Launchers +run-name: Build Scala Launchers + +on: + workflow_call: + inputs: + java-version: + type : string + required : true + outputs: + universal-id: + description: ID of the `universal` package from GitHub Artifacts (Authentication Required) + value : ${{ jobs.build.outputs.universal-id }} + universal-digest: + description: The SHA256 of the uploaded artifact (universal) + value : ${{ jobs.build.outputs.universal-digest }} + + +jobs: + build: + runs-on: ubuntu-latest + outputs: + universal-id : ${{ steps.universal.outputs.artifact-id }} + universal-digest : ${{ steps.universal-digest.outputs.digest }} + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ inputs.java-version }} + cache : sbt + + - name: Build and pack the SDK (universal) + run : ./project/scripts/sbt dist/pack + + - name: Upload zip archive to GitHub Artifact (universal) + uses: actions/upload-artifact@v4 + id : universal + with: + path: ./dist/target/pack/* + name: scala3-universal + + - name: Compute SHA256 of the uploaded artifact (universal) + id : universal-digest + run : | + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o artifact.zip -L https://api.github.com/repos/scala/scala3/actions/artifacts/${{ steps.universal.outputs.artifact-id }}/zip + echo "digest=$(sha256sum artifact.zip | cut -d " " -f 1)" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9cd0f0b3899c..87f98b4fe2bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -774,3 +774,30 @@ jobs: WORKFLOW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} with: filename: .github/workflows/issue_nightly_failed.md + + build-sdk-package: + uses: ./.github/workflows/build-sdk.yml + if: + (github.event_name == 'pull_request' && !contains(github.event.pull_request.body, '[skip ci]')) || + (github.event_name == 'workflow_dispatch' && github.repository == 'scala/scala3') || + (github.event_name == 'schedule' && github.repository == 'scala/scala3') || + github.event_name == 'push' + with: + java-version: 8 + + build-chocolatey-package: + uses: ./.github/workflows/build-chocolatey.yml + needs: [ build-sdk-package ] + with: + version: 3.3.5-local # unused + url : https://api.github.com/repos/scala/scala3/actions/artifacts/${{ needs.build-sdk-package.outputs.universal-id }}/zip + digest : ${{ needs.build-sdk-package.outputs.universal-digest }} + + test-chocolatey-package: + uses: ./.github/workflows/test-chocolatey.yml + with: + version : 3.3.5-local # unused + java-version: 8 + if: github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_chocolatey]') + needs: [ build-chocolatey-package ] + diff --git a/.github/workflows/publish-chocolatey.yml b/.github/workflows/publish-chocolatey.yml new file mode 100644 index 000000000000..3b31728a50ba --- /dev/null +++ b/.github/workflows/publish-chocolatey.yml @@ -0,0 +1,39 @@ +################################################################################################### +### THIS IS A REUSABLE WORKFLOW TO PUBLISH SCALA TO CHOCOLATEY ### +### HOW TO USE: ### +### - THE RELEASE WORKFLOW SHOULD CALL THIS WORKFLOW ### +### - IT WILL PUBLISH TO CHOCOLATEY THE MSI ### +### ### +### NOTE: ### +### - WE SHOULD KEEP IN SYNC THE NAME OF THE MSI WITH THE ACTUAL BUILD ### +### - WE SHOULD KEEP IN SYNC THE URL OF THE RELEASE ### +### - IT ASSUMES THAT THE `build-chocolatey` WORKFLOW WAS EXECUTED BEFORE ### +################################################################################################### + + +name: Publish Scala to Chocolatey +run-name: Publish Scala ${{ inputs.version }} to Chocolatey + +on: + workflow_call: + inputs: + version: + required: true + type: string + secrets: + # Connect to https://community.chocolatey.org/profiles/scala + # Accessible via https://community.chocolatey.org/account + API-KEY: + required: true + +jobs: + publish: + runs-on: windows-latest + steps: + - name: Fetch the Chocolatey package from GitHub + uses: actions/download-artifact@v4 + with: + name: scala.nupkg + - name: Publish the package to Chocolatey + run: choco push scala.nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.API-KEY }} + \ No newline at end of file diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index fa65f8cd5ae6..03ff19444d2f 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -1,4 +1,17 @@ -name: Releases +################################################################################################### +### OFFICIAL RELEASE WORKFLOW ### +### HOW TO USE: ### +### - THIS WORKFLOW WILL NEED TO BE TRIGGERED MANUALLY ### +### ### +### NOTE: ### +### - THIS WORKFLOW SHOULD ONLY BE RUN ON STABLE RELEASES ### +### - IT ASSUMES THAT THE PRE-RELEASE WORKFLOW WAS PREVIOUSLY EXECUTED ### +### ### +################################################################################################### + +name: Official release of Scala +run-name: Official release of Scala ${{ inputs.version }} + on: workflow_dispatch: inputs: @@ -11,7 +24,7 @@ permissions: contents: read jobs: - publish_release: + publish-sdkman: runs-on: [self-hosted, Linux] container: image: lampepfl/dotty:2021-03-22 @@ -35,3 +48,35 @@ jobs: - name: Publish to SDKMAN run: .github/workflows/scripts/publish-sdkman.sh ${{ inputs.version }} + + compute-digest: + runs-on: ubuntu-latest + outputs: + digest: ${{ steps.digest.outputs.digest }} + steps: + - name: Compute the SHA256 of scala3-${{ inputs.version }}.zip in GitHub Release + id: digest + run: | + curl -o artifact.zip -L https://github.com/scala/scala3/releases/download/${{ inputs.version }}/scala3-${{ inputs.version }}.zip + echo "digest=$(sha256sum artifact.zip | cut -d " " -f 1)" >> "$GITHUB_OUTPUT" + + build-chocolatey: + uses: ./.github/workflows/build-chocolatey.yml + needs: compute-digest + with: + version: ${{ inputs.version }} + url : 'https://github.com/scala/scala3/releases/download/${{ inputs.version }}/scala3-${{ inputs.version }}.zip' + digest : ${{ needs.compute-digest.outputs.digest }} + test-chocolatey: + uses: ./.github/workflows/test-chocolatey.yml + needs: build-chocolatey + with: + version : ${{ inputs.version }} + java-version: 8 + publish-chocolatey: + uses: ./.github/workflows/publish-chocolatey.yml + needs: [ build-chocolatey, test-chocolatey ] + with: + version: ${{ inputs.version }} + secrets: + API-KEY: ${{ secrets.CHOCOLATEY_KEY }} diff --git a/.github/workflows/test-chocolatey.yml b/.github/workflows/test-chocolatey.yml new file mode 100644 index 000000000000..b6ca9bf74b12 --- /dev/null +++ b/.github/workflows/test-chocolatey.yml @@ -0,0 +1,51 @@ +################################################################################################### +### THIS IS A REUSABLE WORKFLOW TO TEST SCALA WITH CHOCOLATEY ### +### HOW TO USE: ### +### ### +### NOTE: ### +### ### +################################################################################################### + +name: Test 'scala' Chocolatey Package +run-name: Test 'scala' (${{ inputs.version }}) Chocolatey Package + +on: + workflow_call: + inputs: + version: + required: true + type: string + java-version: + required: true + type : string + +env: + CHOCOLATEY-REPOSITORY: chocolatey-pkgs + DOTTY_CI_INSTALLATION: ${{ secrets.GITHUB_TOKEN }} + +jobs: + test: + runs-on: windows-latest + steps: + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ inputs.java-version }} + - name: Download the 'nupkg' from GitHub Artifacts + uses: actions/download-artifact@v4 + with: + name: scala.nupkg + path: ${{ env.CHOCOLATEY-REPOSITORY }} + - name : Install the `scala` package with Chocolatey + run : choco install scala --source "${{ env.CHOCOLATEY-REPOSITORY }}" --pre # --pre since we might be testing non-stable releases + shell: pwsh + - name : Test the `scala` command + run : scala --version + shell: pwsh + - name : Test the `scalac` command + run : scalac --version + - name : Test the `scaladoc` command + run : scaladoc --version + - name : Uninstall the `scala` package + run : choco uninstall scala + \ No newline at end of file diff --git a/pkgs/chocolatey/README.md b/pkgs/chocolatey/README.md new file mode 100644 index 000000000000..c8af9cf92666 --- /dev/null +++ b/pkgs/chocolatey/README.md @@ -0,0 +1,17 @@ +

Configuration for Chocolatey

+ +Official support for Chocolatey started by the release of Scala 3.6.0 and was backported (with modifications) to the Scala 3.3.5 LTS. +Scala 3.3 LTS Chocolatey package uses universal package (.jar) instead of native runners. + +> [!IMPORTANT] +> This folder contains the templates to generate the configuration for Chocolatey. +> The `scala.nuspec` and `chocolateyInstall.ps1` files needs to be rewritten by changing the following placeholders: +> - @LAUNCHER_VERSION@ : Placeholder for the current scala version to deploy +> - @LAUNCHER_URL@ : Placeholder for the URL to the windows zip released on GitHub +> - @LAUNCHER_SHA256@ : Placeholder for the SHA256 of the msi file released on GitHub + +## Important information + +- How to create a *Chocolatey* package: https://docs.chocolatey.org/en-us/create/create-packages/ +- Guidelines to follow for the package icon: https://docs.chocolatey.org/en-us/create/create-packages/#package-icon-guidelines +- `.nuspec` format specification: https://learn.microsoft.com/en-gb/nuget/reference/nuspec diff --git a/pkgs/chocolatey/icon.svg b/pkgs/chocolatey/icon.svg new file mode 100644 index 000000000000..0ccb404b5624 --- /dev/null +++ b/pkgs/chocolatey/icon.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkgs/chocolatey/scala.nuspec b/pkgs/chocolatey/scala.nuspec new file mode 100644 index 000000000000..bb2e0e07ce70 --- /dev/null +++ b/pkgs/chocolatey/scala.nuspec @@ -0,0 +1,25 @@ + + + + scala + @LAUNCHER_VERSION@ + Scala + scala + scala + scala + Scala + Official release of the Scala Programming Language on Chocolatey. + https://github.com/scala/scala3/tree/main/pkgs/chocolatey + https://github.com/scala/scala3 + https://scala-lang.org/ + https://github.com/scala/scala3/issues + © 2002-2024, LAMP/EPFL + https://cdn.jsdelivr.net/gh/scala/scala3@a046b0014ffd9536144d67a48f8759901b96d12f/pkgs/chocolatey/icon.svg + https://github.com/scala/scala3/blob/main/LICENSE + true + https://github.com/scala/scala3/releases + + + + + diff --git a/pkgs/chocolatey/tools/chocolateyInstall.ps1 b/pkgs/chocolatey/tools/chocolateyInstall.ps1 new file mode 100644 index 000000000000..3117efadaf0e --- /dev/null +++ b/pkgs/chocolatey/tools/chocolateyInstall.ps1 @@ -0,0 +1,46 @@ +$ErrorActionPreference = 'Stop'; + +$unzipLocation = Split-Path -Parent $MyInvocation.MyCommand.Definition # Get the root of chocolatey folder +$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageName)" # Append the package's name +$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageVersion)" # Append the package's version + +# Configure the installation arguments +$packageArgs = @{ + packageName = 'scala' + Url64 = '@LAUNCHER_URL@' + UnzipLocation = $unzipLocation + Checksum64 = '@LAUNCHER_SHA256@' + ChecksumType64 = 'SHA256' +} + +## In case we are running in the CI, add the authorisation header to fetch the zip +## See: https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28#download-an-artifact +if ($env:DOTTY_CI_INSTALLATION) { + Write-Host "Installing the Chocolatey package in Scala 3's CI" + $packageArgs += @{ + Options = @{ + Headers = @{ + Accept = 'application/vnd.github+json' + Authorization = "Bearer $env:DOTTY_CI_INSTALLATION" + } + } + } +} + +Install-ChocolateyZipPackage @packageArgs + +# Find the path to the bin directory to create the shims +if($env:DOTTY_CI_INSTALLATION) { + $scalaBinPath = Join-Path $unzipLocation 'bin' # Update this path if the structure inside the ZIP changes +} else { + $extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1 + $scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin' +} + +# Iterate through the .bat files in the bin directory and create shims +Write-Host "Creating shims for .bat file from $scalaBinPath" +Get-ChildItem -Path $scalaBinPath -Filter '*.bat' | ForEach-Object { + $file = $_.FullName + Write-Host "Creating shim for $file..." + Install-BinFile -Name $_.BaseName -Path $file +} diff --git a/pkgs/chocolatey/tools/chocolateyUninstall.ps1 b/pkgs/chocolatey/tools/chocolateyUninstall.ps1 new file mode 100644 index 000000000000..387914af5d09 --- /dev/null +++ b/pkgs/chocolatey/tools/chocolateyUninstall.ps1 @@ -0,0 +1,21 @@ +$ErrorActionPreference = 'Stop'; + +$unzipLocation = Split-Path -Parent $MyInvocation.MyCommand.Definition # Get the root of chocolatey folder +$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageName)" # Append the package's name +$unzipLocation = Join-Path $unzipLocation "$($env:chocolateyPackageVersion)" # Append the package's version + +# Find the path to the bin directory to create the shims +if($env:DOTTY_CI_INSTALLATION) { + $scalaBinPath = Join-Path $unzipLocation 'bin' # Update this path if the structure inside the ZIP changes + } else { + $extractedDir = Get-ChildItem -Path $unzipLocation | Where-Object { $_.PSIsContainer } | Select-Object -First 1 + $scalaBinPath = Join-Path $unzipLocation $extractedDir | Join-Path -ChildPath 'bin' + } + +# Iterate through the .bat files in the bin directory and remove shims +Write-Host "Removing shims for .bat file from $scalaBinPath" +Get-ChildItem -Path $scalaBinPath -Filter '*.bat' | ForEach-Object { + $file = $_.FullName + Write-Host "Removing shim for $file..." + Uninstall-BinFile -Name $_.BaseName -Path $file +} From ab4bf5ea68975e16fc22162e5eefe1026b795013 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 9 Dec 2024 22:45:19 +0100 Subject: [PATCH 27/47] Fix extraction of release tag in publish workflow --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 87f98b4fe2bb..d5f33bee1315 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -693,6 +693,10 @@ 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 + - name: Check compiler version shell: bash run : | @@ -707,7 +711,6 @@ jobs: run: | ./project/scripts/sbt dist/packArchive sha256sum dist/target/scala3-* > dist/target/sha256sum.txt - echo "RELEASE_TAG=${GITHUB_REF#*refs/tags/}" >> $GITHUB_ENV - name: Create GitHub Release id: create_gh_release From b271cb811503367ddfa720f4f23937bb036ab4b6 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 9 Dec 2024 16:51:10 +0100 Subject: [PATCH 28/47] Add changelog for 3.3.5-RC1 --- changelogs/3.3.5-RC1.md | 162 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 changelogs/3.3.5-RC1.md diff --git a/changelogs/3.3.5-RC1.md b/changelogs/3.3.5-RC1.md new file mode 100644 index 000000000000..4e565de5da81 --- /dev/null +++ b/changelogs/3.3.5-RC1.md @@ -0,0 +1,162 @@ +# Highlights of the release + +- Use Scala 2.13.15 standard library [#21648](https://github.com/scala/scala3/pull/21648) +- Support JDK 23 [#20144](https://github.com/scala/scala3/pull/20144) +- Add the `-Wall` option that enables all warnings [#20577](https://github.com/scala/scala3/pull/20577) +- Reversed `-Wconf` parsing order to mirror Scala 2 semantics [#18503](https://github.com/scala/scala3/pull/18503) + +# Other changes and fixes + +## Annotations + +- Tighten java annot value parsing [#21650](https://github.com/scala/scala3/pull/21650) + +## Exports + +- Re-use attachment in exportForwarders to handle ambiguous overloads [#21518](https://github.com/scala/scala3/pull/21518) +- Allow export statements in AnyVal [#21653](https://github.com/scala/scala3/pull/21653) + +## Extension Methods + +- Make right assoc ext method fwd refs error [#21641](https://github.com/scala/scala3/pull/21641) + +## Inference + +- Fix #20521: Optimise caching for computing atoms and widened in OrTypes [#21223](https://github.com/scala/scala3/pull/21223) + +## Linting + +- Add origin filter to WConf, DeprecationWarning [#21404](https://github.com/scala/scala3/pull/21404) +- CheckUnused checks type param annotations [#20549](https://github.com/scala/scala3/pull/20549) + +## Match Types + +- Fix #20897: Make `Nothing ⋔ Nothing`, as per spec. [#21241](https://github.com/scala/scala3/pull/21241) +- Always interpret underscores inside patterns as type bounds [#21718](https://github.com/scala/scala3/pull/21718) + +## Overloading + +- Report only non-overridden unimplemented members [#21337](https://github.com/scala/scala3/pull/21337) + +## Parser + +- Harden skip in Scanner [#21607](https://github.com/scala/scala3/pull/21607) +- SimplePattern errors should now be recovered as wildcard instead of unimplemented expr [#21438](https://github.com/scala/scala3/pull/21438) + +## Positions + +- Fix trailing comma Ident's span [#20445](https://github.com/scala/scala3/pull/20445) + +## Presentation Compiler + +- Fix autoimports with using directives [#21590](https://github.com/scala/scala3/pull/21590) +- Remove artificial `CURSOR` added to code in the completions [#20899](https://github.com/scala/scala3/pull/20899) +- Help implement Metals' infer expected type feature [#21390](https://github.com/scala/scala3/pull/21390) +- Weekly metals backport [#21343](https://github.com/scala/scala3/pull/21343) +- Change mock symbol search [#21296](https://github.com/scala/scala3/pull/21296) +- Fix: completions when parenthesis already provided [#21299](https://github.com/scala/scala3/pull/21299) +- Backport from metals [#21196](https://github.com/scala/scala3/pull/21196) +- Fix: don't add suffix if brackets already present [#21259](https://github.com/scala/scala3/pull/21259) + +## Quotes + +- Handle suspension due to macro call in arbitrary phases [#21651](https://github.com/scala/scala3/pull/21651) +- Have a better error message when healing types [#21711](https://github.com/scala/scala3/pull/21711) +- Expr#show: Don't crash when the expression contains an unsupported type (like a SkolemType) [#20494](https://github.com/scala/scala3/pull/20494) +- Quotes type printing: take `infix` type modifier into account [#21726](https://github.com/scala/scala3/pull/21726) + +## Reporting + +- Nicer error message in case a `derived` method has an explicit term param [#21332](https://github.com/scala/scala3/pull/21332) +- Add better error reporting for inlined non-immutable paths [#21639](https://github.com/scala/scala3/pull/21639) + +## Releases + +- Add support for Chocolatey [#20534](https://github.com/scala/scala3/pull/20534) +- Add the merge commit hash to the icon's url [#21221](https://github.com/scala/scala3/pull/21221) +- Add sources of synthetic classes to sources jar [#20904](https://github.com/scala/scala3/pull/20904) + +## REPL + +- Uppdate JLine to 3.27.0 (was 3.25.1) [#21752](https://github.com/scala/scala3/pull/21752) +- Allow JLine to fall back to a dumb terminal [#21330](https://github.com/scala/scala3/pull/21330) + +## Scaladoc + +- Only trim one newline when preprocessing the content of a markdown code snippet [#21519](https://github.com/scala/scala3/pull/21519) +- Bump Inkuire version to fix it for the new Scala versions [#21611](https://github.com/scala/scala3/pull/21611) +- Filter opaque modifier from object documentation [#21640](https://github.com/scala/scala3/pull/21640) + +## TASTy format + +- Add child to parent in completion context [#21214](https://github.com/scala/scala3/pull/21214) + +## Transform + +- Three fixes to SAM type handling [#21596](https://github.com/scala/scala3/pull/21596) +- Fix treatment of separately compiled @native methods in FirstTransform [#21593](https://github.com/scala/scala3/pull/21593) +- Fix #20856: Serialize `Waiting` and `Evaluating` as if `null`. [#21243](https://github.com/scala/scala3/pull/21243) +- Fixes IllegalAccessError with Java package protected class [#21362](https://github.com/scala/scala3/pull/21362) +- Consistently use TypeMismatch in TreeChecker [#21529](https://github.com/scala/scala3/pull/21529) +- Fix: don't use color codes for pattern match code action [#21120](https://github.com/scala/scala3/pull/21120) +- Let show behave more robustly for Recheck [#21678](https://github.com/scala/scala3/pull/21678) +- Always rewrite empty List() to Nil [#21689](https://github.com/scala/scala3/pull/21689) + +## Typer + +- Fix extending protected nested java classes [#21857](https://github.com/scala/scala3/pull/21857) +- Avoid cyclic errors forcing default arg types [#21597](https://github.com/scala/scala3/pull/21597) +- Survive inaccessible types when computing implicit scope [#21589](https://github.com/scala/scala3/pull/21589) +- Revert "Drop redundant `butNot = Param` clause in isAnchor" [#21566](https://github.com/scala/scala3/pull/21566) +- Fail early & more clearly on shaded-broken classfiles [#21262](https://github.com/scala/scala3/pull/21262) +- Fix isomorphism tests of `AndOrType`s under non-empty `BinderPairs` [#21017](https://github.com/scala/scala3/pull/21017) +- Some fixes for AnnotatedTypes mapping [#19957](https://github.com/scala/scala3/pull/19957) +- Simple performance improvement for Denotations [#21584](https://github.com/scala/scala3/pull/21584) +- Avoid import suggestion thread hang if -Ximport-suggestion-timeout <= 1 [#21434](https://github.com/scala/scala3/pull/21434) +- Fix incorrect caching with dependent method parameters [#21699](https://github.com/scala/scala3/pull/21699) + +## Experimental: Explicit Nulls + +- Add tracking of NotNullInfo for Match, Case, Try trees (fix #21380) [#21389](https://github.com/scala/scala3/pull/21389) +- Fix #21392: Adjust `canComparePredefined(Nothing, T)` in explicit nulls [#21504](https://github.com/scala/scala3/pull/21504) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.3.4..3.3.5-RC1` these are: + +``` + 44 Wojciech Mazur + 14 Dale Wijnand + 10 Katarzyna Marek + 8 rochala + 5 noti0na1 + 4 Hamza Remmal + 4 Matt Bovel + 4 Som Snytt + 3 Jamie Thompson + 3 Martin Odersky + 3 Michał Pałka + 3 dependabot[bot] + 3 kasiaMarek + 2 Aleksander Rainko + 2 Eugene Flesselle + 2 Florian3k + 2 HarrisL2 + 2 Jędrzej Rochala + 2 Kacper Korban + 2 Yichen Xu + 1 Eugene Yokota + 1 Guillaume Martres + 1 Hamza REMMAL + 1 Jan Chyb + 1 Joel Wilsson + 1 Kenji Yoshida + 1 Martin Duhem + 1 Nicolas Stucki + 1 Ondrej Lhotak + 1 Seth Tisue + 1 Sébastien Doeraene + 1 Tomasz Godzik +``` From 8f4727836d22295c7df62a486ae687301e27f882 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 9 Dec 2024 16:52:01 +0100 Subject: [PATCH 29/47] Release 3.3.5-RC1 From 28e5db4a82f1bb2f6f673428a67f747a8493a11e Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 10 Dec 2024 11:22:43 +0100 Subject: [PATCH 30/47] Disable automatic deployment of artifacts published to Sonatype, require manual close and deploy of staging repository --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d5f33bee1315..cdef5f73ddff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -755,7 +755,7 @@ jobs: asset_content_type: text/plain - name: Publish Release - run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleRelease" + run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonatypeBundleUpload" open_issue_on_failure: From 673229704f871996a10cfaacdef29715359c4c2f Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 8 Jan 2025 15:25:02 -0800 Subject: [PATCH 31/47] copyright 2025 note that I added "dba Akka" to NOTICE.md but I don't believe it's necessary to pollute the version history adding that to the top of every source file, too. in legal contexts, "Lightbend, Inc." is still the company's legal name --- NOTICE.md | 19 ++++++++++--------- pkgs/chocolatey/scala.nuspec | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/NOTICE.md b/NOTICE.md index e9b64ac262f2..9bb846dbc3f5 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/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 From b68d08adba1ab6a9d48c4a6e930810be5fe5a8e5 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 15 Jan 2025 15:16:45 +0100 Subject: [PATCH 32/47] Fix CI - add missing sbt/setup-sbt step --- .github/workflows/build-sdk.yml | 6 +++--- .github/workflows/dependency-graph.yml | 1 + .github/workflows/language-reference.yaml | 1 + .github/workflows/scaladoc.yaml | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-sdk.yml b/.github/workflows/build-sdk.yml index 00ce04080534..63b31b742d8b 100644 --- a/.github/workflows/build-sdk.yml +++ b/.github/workflows/build-sdk.yml @@ -24,7 +24,7 @@ on: universal-digest: description: The SHA256 of the uploaded artifact (universal) value : ${{ jobs.build.outputs.universal-digest }} - + jobs: build: @@ -40,7 +40,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/pack @@ -50,7 +50,7 @@ jobs: with: path: ./dist/target/pack/* name: scala3-universal - + - name: Compute SHA256 of the uploaded artifact (universal) id : universal-digest run : | diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml index d4be398148c7..7b4d7237a500 100644 --- a/.github/workflows/dependency-graph.yml +++ b/.github/workflows/dependency-graph.yml @@ -9,4 +9,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: sbt/setup-sbt@v1 - uses: scalacenter/sbt-dependency-submission@v3 diff --git a/.github/workflows/language-reference.yaml b/.github/workflows/language-reference.yaml index 786785eaa4a2..6406996b7ec5 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/scaladoc.yaml b/.github/workflows/scaladoc.yaml index 7d35aa3e253b..ded8b29a3a1a 100644 --- a/.github/workflows/scaladoc.yaml +++ b/.github/workflows/scaladoc.yaml @@ -15,7 +15,7 @@ permissions: jobs: build: env: - AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_STORAGE_SAS_TOKEN }} + AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_STORAGE_SAS_TOKEN }}m runs-on: ubuntu-latest if: "github.event_name == 'merge_group' || ( github.event_name == 'pull_request' @@ -36,6 +36,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 From c3cd13ad8d529b3299254368175f4f145247f4f5 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 15 Jan 2025 16:15:55 +0100 Subject: [PATCH 33/47] Remove scaladoc CI step uploading docs to no longer existing Azure storage --- .github/workflows/scaladoc.yaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/scaladoc.yaml b/.github/workflows/scaladoc.yaml index ded8b29a3a1a..22c49d2ff9c1 100644 --- a/.github/workflows/scaladoc.yaml +++ b/.github/workflows/scaladoc.yaml @@ -63,21 +63,6 @@ jobs: - name: Generate documentation for example project using dotty-sbt run: ./project/scripts/sbt "sbt-test/scripted sbt-dotty/scaladoc" - - name: Generate index file - run: scaladoc/scripts/mk-index.sh scaladoc/output > scaladoc/output/index.html - - - name: Upload documentation to server - uses: azure/CLI@v1 - if: env.AZURE_STORAGE_SAS_TOKEN - env: - PR_NUMBER: ${{ github.event.pull_request.number }} - with: - inlineScript: | - DOC_DEST=$(echo pr-${PR_NUMBER:-${GITHUB_REF##*/}} | tr -d -c "[-A-Za-z0-9]") - echo uplading docs to https://scala3doc.virtuslab.com/$DOC_DEST - az storage container create --name $DOC_DEST --account-name scala3docstorage --public-access container - az storage blob upload-batch --overwrite true -s scaladoc/output -d $DOC_DEST --account-name scala3docstorage - stdlib-sourcelinks-test: runs-on: ubuntu-latest # if false - disable flaky test From bf8aee17a46d1a2777ca96b515d3150516b81849 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Mon, 13 Jan 2025 00:23:20 +0100 Subject: [PATCH 34/47] fix: drop jackson-module-scala from CB --- .../test/scala/dotty/communitybuild/CommunityBuildTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index 9a4965577cf1..61a69398d66e 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() From 86fb2d0b5cc6f375c7bbd3f1f30cab37753d6b0a Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 12 Dec 2024 18:07:29 -0800 Subject: [PATCH 35/47] REPL: JLine: follow recommendation to use JNI, not JNA as per the https://github.com/jline/jline3 readme fixes #22201 --- dist/bin/common | 4 +--- project/Build.scala | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dist/bin/common b/dist/bin/common index e3e4253938fb..932bb1f54572 100755 --- a/dist/bin/common +++ b/dist/bin/common @@ -26,7 +26,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 @@ -55,8 +55,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/project/Build.scala b/project/Build.scala index 198a4f23646d..0ee9440229a4 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -584,7 +584,7 @@ object Build { 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-terminal-jni" % "3.27.0", // needed for Windows ("io.get-coursier" %% "coursier" % "2.0.16" % Test).cross(CrossVersion.for3Use2_13), ), From bfebac4a413912da4570d78274932d6a8b759204 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 12 Dec 2024 18:32:15 -0800 Subject: [PATCH 36/47] JLine 3.27.1 (was 3.27.0) --- project/Build.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 0ee9440229a4..d694f9e96d3b 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -582,9 +582,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-jni" % "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), ), From 9c765bc9d9d369e017544a037bd3eff134caadf1 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 16 Jan 2025 11:04:07 +0100 Subject: [PATCH 37/47] Add changelog for 3.3.5-RC2 --- changelogs/3.3.5-RC2.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 changelogs/3.3.5-RC2.md diff --git a/changelogs/3.3.5-RC2.md b/changelogs/3.3.5-RC2.md new file mode 100644 index 000000000000..b961385aa129 --- /dev/null +++ b/changelogs/3.3.5-RC2.md @@ -0,0 +1,15 @@ +# Backported fixes + +- Backport "REPL: JLine: follow recommendation to use JNI, not JNA; also JLine 3.27.1 (was 3.27.0)" to LTS [#22377](https://github.com/scala/scala3/pull/22377) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.3.5-RC1..3.3.5-RC2` these are: + +``` + 5 Wojciech Mazur + 3 Seth Tisue + 1 Hamza Remmal +``` From 17f3055a35042f926d164276a2b4af55beb9f671 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Thu, 16 Jan 2025 11:04:54 +0100 Subject: [PATCH 38/47] Release 3.3.5-RC2 --- project/Build.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Build.scala b/project/Build.scala index d694f9e96d3b..cc587715f02a 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -83,7 +83,7 @@ object Build { val referenceVersion = "3.3.4" - val baseVersion = "3.3.5-RC1" + val baseVersion = "3.3.5-RC2" // LTS or Next val versionLine = "LTS" From 05e0b68e091e77346db665d05c6d5211e7981351 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Fri, 17 Jan 2025 23:18:09 +0100 Subject: [PATCH 39/47] Fix synchronization of ClassFile versions betwen settings and JVM backend --- compiler/src/dotty/tools/dotc/config/ScalaSettings.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 0123c8f85e7a..8a273e3c8f41 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -9,6 +9,7 @@ import dotty.tools.dotc.config.SourceVersion import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.rewrites.Rewrites import dotty.tools.io.{AbstractFile, Directory, JDK9Reflectors, PlainDirectory} +import dotty.tools.backend.jvm.BackendUtils.classfileVersionMap import Setting.ChoiceWithHelp import scala.util.chaining.* @@ -19,8 +20,8 @@ class ScalaSettings extends SettingGroup with AllScalaSettings object ScalaSettings: // Keep synchronized with `classfileVersion` in `BackendUtils` - private val minTargetVersion = 8 - private val maxTargetVersion = 22 + private lazy val minTargetVersion = classfileVersionMap.keysIterator.min + private lazy val maxTargetVersion = classfileVersionMap.keysIterator.max def supportedTargetVersions: List[String] = (minTargetVersion to maxTargetVersion).toList.map(_.toString) From 464392158063cf2344481ea7531a88178ab4a082 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 20 Jan 2025 12:56:11 +0100 Subject: [PATCH 40/47] Add changelog for 3.3.5-RC3 --- changelogs/3.3.5-RC3.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 changelogs/3.3.5-RC3.md diff --git a/changelogs/3.3.5-RC3.md b/changelogs/3.3.5-RC3.md new file mode 100644 index 000000000000..872b7d0c68f6 --- /dev/null +++ b/changelogs/3.3.5-RC3.md @@ -0,0 +1,13 @@ +# Backported fixes + +- Fix synchronization of `-java-output-versions` with JVM backend [#22403](https://github.com/scala/scala3/pull/22403) + +# Contributors + +Thank you to all theq contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.3.5-RC2..3.3.5-RC3` these are: + +``` + 3 Wojciech Mazur +``` From 2bda6c1a003978d668a6c8b6457b10cec4c56d05 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 20 Jan 2025 12:56:41 +0100 Subject: [PATCH 41/47] Release 3.3.5-RC3 --- project/Build.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Build.scala b/project/Build.scala index cc587715f02a..96f6ef84c0a0 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -83,7 +83,7 @@ object Build { val referenceVersion = "3.3.4" - val baseVersion = "3.3.5-RC2" + val baseVersion = "3.3.5-RC3" // LTS or Next val versionLine = "LTS" From f70ef3624c2a790cb179cd5a4434b13ab73fc6a8 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 27 Jan 2025 11:38:25 +0100 Subject: [PATCH 42/47] Remove JNA dependencies from dist scripts. Add jline-terminal-native dependency (used by jline-terminal-jni) --- dist/bin/common | 10 ++++------ dist/bin/common.bat | 4 ++-- dist/bin/scala.bat | 4 ++-- dist/bin/scalac.bat | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dist/bin/common b/dist/bin/common index 932bb1f54572..6fb828352d52 100755 --- a/dist/bin/common +++ b/dist/bin/common @@ -156,10 +156,8 @@ SCALA_LIB=$(find_lib "*scala-library*") SBT_INTF=$(find_lib "*compiler-interface*") JLINE_READER=$(find_lib "*jline-reader-3*") JLINE_TERMINAL=$(find_lib "*jline-terminal-3*") -JLINE_TERMINAL_JNA=$(find_lib "*jline-terminal-jna-3*") - -# jna-5 only appropriate for some combinations -[[ ${conemu-} && ${msys-} ]] || JNA=$(find_lib "*jna-5*") +JLINE_TERMINAL_JNI=$(find_lib "*jline-terminal-jni-3*") +JLINE_NATIVE=$(find_lib "*jline-native-3*") compilerJavaClasspathArgs () { # echo "dotty-compiler: $DOTTY_COMP" @@ -184,8 +182,8 @@ compilerJavaClasspathArgs () { # jine toolchain+="$JLINE_READER$PSEP" toolchain+="$JLINE_TERMINAL$PSEP" - toolchain+="$JLINE_TERMINAL_JNA$PSEP" - [ -n "${JNA-}" ] && toolchain+="$JNA$PSEP" + toolchain+="$JLINE_TERMINAL_JNI$PSEP" + toolchain+="$JLINE_NATIVE$PSEP" if [ -n "${jvm_cp_args-}" ]; then jvm_cp_args="$toolchain$jvm_cp_args" diff --git a/dist/bin/common.bat b/dist/bin/common.bat index 7aef606d5509..ce78d9ed208a 100644 --- a/dist/bin/common.bat +++ b/dist/bin/common.bat @@ -53,5 +53,5 @@ for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*scala-library*"') do for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*compiler-interface*"') do set "_SBT_INTF=%_LIB_DIR%\%%f" for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-reader-3*"') do set "_JLINE_READER=%_LIB_DIR%\%%f" for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-terminal-3*"') do set "_JLINE_TERMINAL=%_LIB_DIR%\%%f" -for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-terminal-jna-3*"') do set "_JLINE_TERMINAL_JNA=%_LIB_DIR%\%%f" -for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*jna-5*"') do set "_JNA=%_LIB_DIR%\%%f" +for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-terminal-jni-3*"') do set "_JLINE_TERMINAL_JNI=%_LIB_DIR%\%%f" +for /f "delims=" %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-native-3*"') do set "_JLINE_NATIVE=%_LIB_DIR%\%%f" diff --git a/dist/bin/scala.bat b/dist/bin/scala.bat index ca908fd340be..12b32edc4382 100644 --- a/dist/bin/scala.bat +++ b/dist/bin/scala.bat @@ -77,8 +77,8 @@ set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_TASTY_INSPECTOR%%_PSEP%" @rem # jline set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_READER%%_PSEP%" set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL%%_PSEP%" -set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL_JNA%%_PSEP%" -set "__TOOLCHAIN=%__TOOLCHAIN%%_JNA%%_PSEP%" +set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL_JNI%%_PSEP%" +set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_NATIVE%%_PSEP%" if defined _SCALA_CPATH ( set "_JVM_CP_ARGS=%__TOOLCHAIN%%_SCALA_CPATH%" diff --git a/dist/bin/scalac.bat b/dist/bin/scalac.bat index 454158c85666..daf678d30c65 100644 --- a/dist/bin/scalac.bat +++ b/dist/bin/scalac.bat @@ -106,8 +106,8 @@ set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_TASTY_INSPECTOR%%_PSEP%" @rem # jline set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_READER%%_PSEP%" set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL%%_PSEP%" -set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL_JNA%%_PSEP%" -set "__TOOLCHAIN=%__TOOLCHAIN%%_JNA%%_PSEP%" +set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL_JNI%%_PSEP%" +set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_NATIVE%%_PSEP%" if defined _SCALA_CPATH ( set "_JVM_CP_ARGS=%__TOOLCHAIN%%_SCALA_CPATH%" From db021c65784ca51103e680e16a4d609f4f773dbc Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 27 Jan 2025 18:54:30 +0100 Subject: [PATCH 43/47] Fix remaining jna classpath entries in dist/bin/scaladoc* --- dist/bin/scaladoc | 4 ++-- dist/bin/scaladoc.bat | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/bin/scaladoc b/dist/bin/scaladoc index 8b9ec41a7f8c..b00f183f4e8a 100755 --- a/dist/bin/scaladoc +++ b/dist/bin/scaladoc @@ -95,7 +95,8 @@ classpathArgs () { CLASS_PATH+="$(find_lib "*compiler-interface*")$PSEP" CLASS_PATH+="$(find_lib "*jline-reader*")$PSEP" CLASS_PATH+="$(find_lib "*jline-terminal-3*")$PSEP" - CLASS_PATH+="$(find_lib "*jline-terminal-jna*")$PSEP" + CLASS_PATH+="$(find_lib "*jline-terminal-jni*")$PSEP" + CLASS_PATH+="$(find_lib "*jline-native*")$PSEP" CLASS_PATH+="$(find_lib "*flexmark-formatter*")$PSEP" CLASS_PATH+="$(find_lib "*autolink-0.6*")$PSEP" CLASS_PATH+="$(find_lib "*flexmark-jira-converter*")$PSEP" @@ -107,7 +108,6 @@ classpathArgs () { CLASS_PATH+="$(find_lib "*scala-library*")$PSEP" CLASS_PATH+="$(find_lib "*protobuf-java*")$PSEP" CLASS_PATH+="$(find_lib "*util-interface*")$PSEP" - CLASS_PATH+="$(find_lib "*jna-5*")$PSEP" CLASS_PATH+="$(find_lib "*antlr4-runtime*")$PSEP" jvm_cp_args="-classpath \"$CLASS_PATH\"" diff --git a/dist/bin/scaladoc.bat b/dist/bin/scaladoc.bat index bcc0d71788a3..dbccbba0a064 100644 --- a/dist/bin/scaladoc.bat +++ b/dist/bin/scaladoc.bat @@ -129,7 +129,8 @@ call :updateClasspath "scala-asm" call :updateClasspath "compiler-interface" call :updateClasspath "jline-reader" call :updateClasspath "jline-terminal-3" -call :updateClasspath "jline-terminal-jna" +call :updateClasspath "jline-terminal-jni" +call :updateClasspath "jline-native" call :updateClasspath "flexmark-util" call :updateClasspath "flexmark-formatter" call :updateClasspath "autolink-0.6" @@ -142,7 +143,6 @@ call :updateClasspath "snakeyaml" call :updateClasspath "scala-library" call :updateClasspath "protobuf-java" call :updateClasspath "util-interface" -call :updateClasspath "jna-5" call :updateClasspath "flexmark-ext-tables" call :updateClasspath "flexmark-ext-ins" call :updateClasspath "flexmark-ext-superscript" From 0059e3f4048e7318fab63bd39cf6c964ea2ffa42 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 27 Jan 2025 19:33:12 +0100 Subject: [PATCH 44/47] Add changelog for 3.3.5 --- changelogs/3.3.5.md | 168 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 changelogs/3.3.5.md diff --git a/changelogs/3.3.5.md b/changelogs/3.3.5.md new file mode 100644 index 000000000000..a4697c69c895 --- /dev/null +++ b/changelogs/3.3.5.md @@ -0,0 +1,168 @@ +# Highlights of the release + +- Use Scala 2.13.15 standard library [#21648](https://github.com/scala/scala3/pull/21648) +- Support JDK 23 [#20144](https://github.com/scala/scala3/pull/20144) +- Add the `-Wall` option that enables all warnings [#20577](https://github.com/scala/scala3/pull/20577) +- Reversed `-Wconf` parsing order to mirror Scala 2 semantics [#18503](https://github.com/scala/scala3/pull/18503) + +# Other changes and fixes + +## Annotations + +- Tighten java annot value parsing [#21650](https://github.com/scala/scala3/pull/21650) + +## Exports + +- Re-use attachment in exportForwarders to handle ambiguous overloads [#21518](https://github.com/scala/scala3/pull/21518) +- Allow export statements in AnyVal [#21653](https://github.com/scala/scala3/pull/21653) + +## Extension Methods + +- Make right assoc ext method fwd refs error [#21641](https://github.com/scala/scala3/pull/21641) + +## Inference + +- Fix #20521: Optimise caching for computing atoms and widened in OrTypes [#21223](https://github.com/scala/scala3/pull/21223) + +## Linting + +- Add origin filter to WConf, DeprecationWarning [#21404](https://github.com/scala/scala3/pull/21404) +- CheckUnused checks type param annotations [#20549](https://github.com/scala/scala3/pull/20549) + +## Match Types + +- Fix #20897: Make `Nothing ⋔ Nothing`, as per spec. [#21241](https://github.com/scala/scala3/pull/21241) +- Always interpret underscores inside patterns as type bounds [#21718](https://github.com/scala/scala3/pull/21718) + +## Overloading + +- Report only non-overridden unimplemented members [#21337](https://github.com/scala/scala3/pull/21337) + +## Parser + +- Harden skip in Scanner [#21607](https://github.com/scala/scala3/pull/21607) +- SimplePattern errors should now be recovered as wildcard instead of unimplemented expr [#21438](https://github.com/scala/scala3/pull/21438) + +## Positions + +- Fix trailing comma Ident's span [#20445](https://github.com/scala/scala3/pull/20445) + +## Presentation Compiler + +- Fix autoimports with using directives [#21590](https://github.com/scala/scala3/pull/21590) +- Remove artificial `CURSOR` added to code in the completions [#20899](https://github.com/scala/scala3/pull/20899) +- Help implement Metals' infer expected type feature [#21390](https://github.com/scala/scala3/pull/21390) +- Weekly metals backport [#21343](https://github.com/scala/scala3/pull/21343) +- Change mock symbol search [#21296](https://github.com/scala/scala3/pull/21296) +- Fix: completions when parenthesis already provided [#21299](https://github.com/scala/scala3/pull/21299) +- Backport from metals [#21196](https://github.com/scala/scala3/pull/21196) +- Fix: don't add suffix if brackets already present [#21259](https://github.com/scala/scala3/pull/21259) + +## Quotes + +- Handle suspension due to macro call in arbitrary phases [#21651](https://github.com/scala/scala3/pull/21651) +- Have a better error message when healing types [#21711](https://github.com/scala/scala3/pull/21711) +- Expr#show: Don't crash when the expression contains an unsupported type (like a SkolemType) [#20494](https://github.com/scala/scala3/pull/20494) +- Quotes type printing: take `infix` type modifier into account [#21726](https://github.com/scala/scala3/pull/21726) + +## Reporting + +- Nicer error message in case a `derived` method has an explicit term param [#21332](https://github.com/scala/scala3/pull/21332) +- Add better error reporting for inlined non-immutable paths [#21639](https://github.com/scala/scala3/pull/21639) + +## Releases + +- Add support for Chocolatey [#20534](https://github.com/scala/scala3/pull/20534) +- Add the merge commit hash to the icon's url [#21221](https://github.com/scala/scala3/pull/21221) +- Add sources of synthetic classes to sources jar [#20904](https://github.com/scala/scala3/pull/20904) + +## REPL + +- Uppdate JLine to 3.27.0 (was 3.25.1) [#21752](https://github.com/scala/scala3/pull/21752) +- Allow JLine to fall back to a dumb terminal [#21330](https://github.com/scala/scala3/pull/21330) +- JLine: follow recommendation to use JNI, not JNA; also JLine 3.27.1 (was 3.27.0) [#22205](https://github.com/scala/scala3/pull/22205) + +## Runner + +- Fix old scala runner to use correct JLine classpath [#22464](https://github.com/scala/scala3/pull/22464) +- Fix remaining JNA classpath entries in `dist/bin/scaladoc*` scripts [#22471](https://github.com/scala/scala3/pull/22471) + +## Scaladoc + +- Only trim one newline when preprocessing the content of a markdown code snippet [#21519](https://github.com/scala/scala3/pull/21519) +- Bump Inkuire version to fix it for the new Scala versions [#21611](https://github.com/scala/scala3/pull/21611) +- Filter opaque modifier from object documentation [#21640](https://github.com/scala/scala3/pull/21640) + +## TASTy format + +- Add child to parent in completion context [#21214](https://github.com/scala/scala3/pull/21214) + +## Transform + +- Three fixes to SAM type handling [#21596](https://github.com/scala/scala3/pull/21596) +- Fix treatment of separately compiled @native methods in FirstTransform [#21593](https://github.com/scala/scala3/pull/21593) +- Fix #20856: Serialize `Waiting` and `Evaluating` as if `null`. [#21243](https://github.com/scala/scala3/pull/21243) +- Fixes IllegalAccessError with Java package protected class [#21362](https://github.com/scala/scala3/pull/21362) +- Consistently use TypeMismatch in TreeChecker [#21529](https://github.com/scala/scala3/pull/21529) +- Fix: don't use color codes for pattern match code action [#21120](https://github.com/scala/scala3/pull/21120) +- Let show behave more robustly for Recheck [#21678](https://github.com/scala/scala3/pull/21678) +- Always rewrite empty List() to Nil [#21689](https://github.com/scala/scala3/pull/21689) + +## Typer + +- Fix extending protected nested java classes [#21857](https://github.com/scala/scala3/pull/21857) +- Avoid cyclic errors forcing default arg types [#21597](https://github.com/scala/scala3/pull/21597) +- Survive inaccessible types when computing implicit scope [#21589](https://github.com/scala/scala3/pull/21589) +- Revert "Drop redundant `butNot = Param` clause in isAnchor" [#21566](https://github.com/scala/scala3/pull/21566) +- Fail early & more clearly on shaded-broken classfiles [#21262](https://github.com/scala/scala3/pull/21262) +- Fix isomorphism tests of `AndOrType`s under non-empty `BinderPairs` [#21017](https://github.com/scala/scala3/pull/21017) +- Some fixes for AnnotatedTypes mapping [#19957](https://github.com/scala/scala3/pull/19957) +- Simple performance improvement for Denotations [#21584](https://github.com/scala/scala3/pull/21584) +- Avoid import suggestion thread hang if -Ximport-suggestion-timeout <= 1 [#21434](https://github.com/scala/scala3/pull/21434) +- Fix incorrect caching with dependent method parameters [#21699](https://github.com/scala/scala3/pull/21699) + +## Experimental: Explicit Nulls + +- Add tracking of NotNullInfo for Match, Case, Try trees (fix #21380) [#21389](https://github.com/scala/scala3/pull/21389) +- Fix #21392: Adjust `canComparePredefined(Nothing, T)` in explicit nulls [#21504](https://github.com/scala/scala3/pull/21504) + +# Contributors + +Thank you to all the contributors who made this release possible 🎉 + +According to `git shortlog -sn --no-merges 3.3.4..3.3.5-RC1` these are: + +``` + 56 Wojciech Mazur + 14 Dale Wijnand + 10 Katarzyna Marek + 8 rochala + 5 Hamza Remmal + 5 noti0na1 + 4 Matt Bovel + 4 Seth Tisue + 4 Som Snytt + 3 Jamie Thompson + 3 Martin Odersky + 3 Michał Pałka + 3 dependabot[bot] + 3 kasiaMarek + 2 Aleksander Rainko + 2 Eugene Flesselle + 2 Florian3k + 2 HarrisL2 + 2 Jędrzej Rochala + 2 Kacper Korban + 2 Yichen Xu + 1 Eugene Yokota + 1 Guillaume Martres + 1 Hamza REMMAL + 1 Jan Chyb + 1 Joel Wilsson + 1 Kenji Yoshida + 1 Martin Duhem + 1 Nicolas Stucki + 1 Ondrej Lhotak + 1 Sébastien Doeraene + 1 Tomasz Godzik +``` From 0eb46838cc6cb4fde5925e180626a44ffe8d0fe4 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 27 Jan 2025 14:44:58 +0100 Subject: [PATCH 45/47] Release 3.3.5 --- project/Build.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Build.scala b/project/Build.scala index 96f6ef84c0a0..db5b1817044d 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -83,7 +83,7 @@ object Build { val referenceVersion = "3.3.4" - val baseVersion = "3.3.5-RC3" + val baseVersion = "3.3.5" // LTS or Next val versionLine = "LTS" From 8e366a20ef5594f4d390d2e403eda852adcc4963 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 28 Jan 2025 10:09:22 +0100 Subject: [PATCH 46/47] Prepare build for 3.3.6 LTS --- project/Build.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index db5b1817044d..35f6bc15095f 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -81,9 +81,9 @@ object DottyJSPlugin extends AutoPlugin { object Build { import ScaladocConfigs._ - val referenceVersion = "3.3.4" + val referenceVersion = "3.3.5" - val baseVersion = "3.3.5" + val baseVersion = "3.3.6-RC1" // LTS or Next val versionLine = "LTS" @@ -102,7 +102,7 @@ object Build { * set to 3.1.3. If it is going to be 3.1.0, it must be set to the latest * 3.0.x release. */ - val previousDottyVersion = "3.3.3" + val previousDottyVersion = "3.3.5" object CompatMode { final val BinaryCompatible = 0 From c18975544f93dca343eda227fb0543586ff79bac Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Mon, 20 Jan 2025 19:01:56 +0100 Subject: [PATCH 47/47] Use GITHUB_WORKSPACE and GITHUB_REPOSITORY instead of hard-coded values --- .github/workflows/ci.yaml | 34 ++++++++++++++++---------------- project/scripts/cmdScaladocTests | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cdef5f73ddff..f2c57d1de9c3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,7 +72,7 @@ jobs: ## Workaround for https://github.com/actions/runner/issues/2033 (See https://github.com/scala/scala3/pull/19720) - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -125,7 +125,7 @@ jobs: - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -168,7 +168,7 @@ jobs: - name: Reset existing repo shell: cmd run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Git Checkout @@ -212,7 +212,7 @@ jobs: - name: Reset existing repo shell: cmd run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Git Checkout @@ -254,7 +254,7 @@ jobs: - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -301,7 +301,7 @@ jobs: run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -318,7 +318,7 @@ jobs: - name: Test run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git submodule sync git submodule update --init --recursive --jobs 7 ./project/scripts/sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestA" @@ -355,7 +355,7 @@ jobs: run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -372,7 +372,7 @@ jobs: - name: Test run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git submodule sync git submodule update --init --recursive --jobs 7 ./project/scripts/sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestB" @@ -409,7 +409,7 @@ jobs: run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -426,7 +426,7 @@ jobs: - name: Test run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git submodule sync git submodule update --init --recursive --jobs 7 ./project/scripts/sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestC" @@ -462,7 +462,7 @@ jobs: - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -511,7 +511,7 @@ jobs: - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -559,7 +559,7 @@ jobs: run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -623,7 +623,7 @@ jobs: steps: - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script @@ -640,7 +640,7 @@ jobs: - name: Generate Website run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE ./project/scripts/genDocs -doc-snapshot - name: Deploy Website to dotty-website @@ -678,7 +678,7 @@ jobs: run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH - name: Reset existing repo run: | - git config --global --add safe.directory /__w/scala3/scala3 + git config --global --add safe.directory $GITHUB_WORKSPACE git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true - name: Checkout cleanup script diff --git a/project/scripts/cmdScaladocTests b/project/scripts/cmdScaladocTests index 610f98a55890..b00cc37e71e6 100755 --- a/project/scripts/cmdScaladocTests +++ b/project/scripts/cmdScaladocTests @@ -16,7 +16,7 @@ DOTTY_NONBOOTSTRAPPED_VERSION=$(eval $DOTTY_NONBOOTSTRAPPED_VERSION_COMMAND | ta DOTTY_BOOTSTRAPPED_VERSION_COMMAND="$SBT \"eval println(Build.dottyVersion)\"" DOTTY_BOOTSTRAPPED_VERSION=$(eval $DOTTY_BOOTSTRAPPED_VERSION_COMMAND | tail -n 2 | head -n 1) -SOURCE_LINKS_REPOSITORY="scala/scala3" +SOURCE_LINKS_REPOSITORY="${GITHUB_REPOSITORY:-scala/scala3}" SOURCE_LINKS_VERSION="${GITHUB_SHA:-$DOTTY_BOOTSTRAPPED_VERSION}" "$SBT" "scaladoc/generateTestcasesDocumentation" > "$tmp" 2>&1 || echo "generated testcases project with sbt"