Skip to content

Commit 2d43817

Browse files
authored
Merge branch 'main' into jsr45
2 parents 0011035 + 348729e commit 2d43817

File tree

479 files changed

+7688
-3669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

479 files changed

+7688
-3669
lines changed

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
name: "\U0001F389 Suggest a feature"
3-
about: Please create a feature request here https://github.com/lampepfl/dotty-feature-requests
3+
about: Please create a feature request here https://github.com/lampepfl/dotty/discussions/new?category=feature-requests
44
title: ''
55
labels: ''
66
assignees: ''
77

88
---
99

10-
Please create a feature request here: [lampepfl/dotty-feature-requests](https://github.com/lampepfl/dotty-feature-requests).
10+
Please create a feature request in the [Dotty Discussions](https://github.com/lampepfl/dotty/discussions/new?category=feature-requests).

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ jobs:
253253

254254
- name: MiMa
255255
run: |
256-
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues"
256+
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues; stdlib-bootstrapped/mimaReportBinaryIssues"
257257
258258
community_build_a:
259259
runs-on: [self-hosted, Linux]

.github/workflows/scaladoc.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
branches-ignore:
66
- 'language-reference-stable'
7+
- 'gh-readonly-queue/**'
78
pull_request:
89
branches-ignore:
910
- 'language-reference-stable'
11+
merge_group:
1012
permissions:
1113
contents: read
1214

@@ -15,7 +17,8 @@ jobs:
1517
env:
1618
AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_STORAGE_SAS_TOKEN }}
1719
runs-on: ubuntu-latest
18-
if: "( github.event_name == 'pull_request'
20+
if: "github.event_name == 'merge_group'
21+
|| ( github.event_name == 'pull_request'
1922
&& !contains(github.event.pull_request.body, '[skip ci]')
2023
&& !contains(github.event.pull_request.body, '[skip docs]')
2124
)

.vscode-template/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"**/*.class": true,
1010
"**/*.tasty": true,
1111
"**/target/": true,
12-
"community-build/community-projects": true
12+
"community-build/community-projects": true,
13+
"tests/pos-with-compiler-cc/dotc/**/*.scala": true
1314
}
1415
}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Firstly, thanks for being willing to contribute to Dotty! Head on over the
44
[Scala 3 Contributing
5-
Guide](https://docs.scala-lang.org/scala3/guides/contribution/contribution-intro.html), which should have all the info you're looking for.
5+
Guide](https://dotty.epfl.ch/docs/contributing/index.html), which should have all the info you're looking for.

MAINTENANCE.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ The issue supervisor is responsible for:
1616
- Attempting to reproduce the issue (or label “stat:cannot reproduce”)
1717
- Further minimizing the issue or asking the reporter of the issue to minimize it correctly (or label “stat:needs minimization”)
1818
- Identifying which issues are of considerable importance and bringing them to the attention of the team during the Dotty meeting, where they can be filtered and added to the [Future Versions](https://github.com/lampepfl/dotty/milestone/46) milestone.
19+
- Identifying if a report is really a feature request and if so, converting it to
20+
a [feature request discussion](https://github.com/lampepfl/dotty/discussions/categories/feature-requests).
21+
- Keeping an eye on new
22+
[discussions](https://github.com/lampepfl/dotty/discussions), making sure they
23+
don't go unanswered and also correctly labeling new feature requests.
1924

2025
Other core teammates are responsible for providing information to the issue supervisor in a timely manner when it is requested if they have that information.
2126

@@ -32,7 +37,6 @@ The issue supervisor schedule is maintained in the [Issue Supervisor Statistics
3237
An issue supervisor needs to have all the accesses and privileges required to get their job done. This might include:
3338

3439
- Admin rights in lampepfl/dotty repository
35-
- Admin rights in lampepfl/dotty-feature-requests repository
3640
- Permission to create new repositories in lampepfl organization (needed to fork repositories for the community build)
3741
- Access to the LAMP slack to be able to ask for help with the infrastructure, triaging and such
3842

@@ -61,28 +65,36 @@ At the end of their supervision period, the supervisor reports to the team durin
6165

6266
The following is the list of all the principal areas of the compiler and the core team members who are responsible for their maintenance:
6367

68+
### Compiler
6469
- Parser: @odersky
6570
- Typer: @odersky, @smarter, (@dwijnand)
6671
- Erasure: @smarter, @odersky
6772
- Enums: @bishabosha
73+
- Derivation & Mirrors: @bishabosha, (@dwijnand)
6874
- Export: @bishabosha, @odersky
6975
- Pattern Matching: @dwijnand, (@liufengyun), @sjrd
7076
- Inline: @nicolasstucki, @odersky
71-
- Metaprogramming (Quotes, Reflect, Staging): @nicolasstucki, @aherlihy
72-
- Match types: @OlivierBlanvillain, @dwijnand
73-
- GADT: @abgruszecki, @dwijnand
74-
- Scaladoc: @KacperFKorban, @BarkingBad, @pikinier20
75-
- Initialization checker: @olhotak, @liufengyun, @anatoliykmetyuk
77+
- Metaprogramming (Quotes, Reflect, Staging): @nicolasstucki, @jchyb
78+
- Match types: @sjrd, @dwijnand, @Decel
79+
- GADT: @dwijnand, @Linyxus
80+
- Initialization checker: @olhotak, @liufengyun
7681
- Safe nulls: @noti0na1, @olhotak
82+
- Lazy vals: @szymon-rd, @sjrd
7783
- tailrec: @sjrd, @mbovel
7884
- JS backend: @sjrd
79-
- forward compat (-scala-release): @prolativ, @Kordyjan, (@nicolasstucki)
80-
- Benchmarks: @anatoliykmetyuk, @mbovel
81-
- REPL: @dwijnand, @anatoliykmetyuk, @prolativ
85+
- JVM backend: @sjrd
86+
- Java-compat: @smarter
87+
88+
### Tooling
89+
- REPL: @dwijnand, @prolativ
90+
- Scaladoc: @Florian3k
91+
- SemanticDB: @tanishiking
92+
- Coverage: @TheElectronWill
93+
- Linting (especially unused warnings) / Reporting UX: @szymon-rd
94+
95+
### Infrastructure
8296
- CI: @anatoliykmetyuk
8397
- Community Build: @anatoliykmetyuk
98+
- Open Community Build: @WojciechMazur
8499
- Vulpix: @dwijnand, @prolativ
85-
- JVM backend: @Kordyjan, (@sjrd)
86-
- Derivation & Mirrors: @bishabosha, (@dwijnand)
87-
- Linting (especially unused warnings) / Reporting UX: VirtusLab TBD?
88-
- Java-compat: @Kordyjan
100+
- Benchmarks: @mbovel

compiler/src/dotty/tools/dotc/CompilationUnit.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ object CompilationUnit {
157157
if tree.symbol.is(Flags.Inline) then
158158
containsInline = true
159159
tree match
160-
case tpd.Quote(_) =>
160+
case _: tpd.Quote =>
161161
containsQuote = true
162162
case tree: tpd.Apply if tree.symbol == defn.QuotedTypeModule_of =>
163163
containsQuote = true

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ object desugar {
338338
def quotedPattern(tree: untpd.Tree, expectedTpt: untpd.Tree)(using Context): untpd.Tree = {
339339
def adaptToExpectedTpt(tree: untpd.Tree): untpd.Tree = tree match {
340340
// Add the expected type as an ascription
341-
case _: untpd.Splice =>
341+
case _: untpd.SplicePattern =>
342342
untpd.Typed(tree, expectedTpt).withSpan(tree.span)
343-
case Typed(expr: untpd.Splice, tpt) =>
343+
case Typed(expr: untpd.SplicePattern, tpt) =>
344344
cpy.Typed(tree)(expr, untpd.makeAndType(tpt, expectedTpt).withSpan(tpt.span))
345345

346346
// Propagate down the expected type to the leafs of the expression
@@ -637,7 +637,10 @@ object desugar {
637637
// new C[...](p1, ..., pN)(moreParams)
638638
val (caseClassMeths, enumScaffolding) = {
639639
def syntheticProperty(name: TermName, tpt: Tree, rhs: Tree) =
640-
DefDef(name, Nil, tpt, rhs).withMods(synthetic)
640+
val mods =
641+
if ctx.settings.Yscala2Stdlib.value then synthetic | Inline
642+
else synthetic
643+
DefDef(name, Nil, tpt, rhs).withMods(mods)
641644

642645
def productElemMeths =
643646
val caseParams = derivedVparamss.head.toArray
@@ -735,13 +738,25 @@ object desugar {
735738
.withMods(appMods) :: Nil
736739
}
737740
val unapplyMeth = {
741+
def scala2LibCompatUnapplyRhs(unapplyParamName: Name) =
742+
assert(arity <= Definitions.MaxTupleArity, "Unexpected case class with tuple larger than 22: "+ cdef.show)
743+
if arity == 1 then Apply(scalaDot(nme.Option), Select(Ident(unapplyParamName), nme._1))
744+
else
745+
val tupleApply = Select(Ident(nme.scala), s"Tuple$arity".toTermName)
746+
val members = List.tabulate(arity) { n => Select(Ident(unapplyParamName), s"_${n+1}".toTermName) }
747+
Apply(scalaDot(nme.Option), Apply(tupleApply, members))
748+
738749
val hasRepeatedParam = constrVparamss.head.exists {
739750
case ValDef(_, tpt, _) => isRepeated(tpt)
740751
}
741752
val methName = if (hasRepeatedParam) nme.unapplySeq else nme.unapply
742753
val unapplyParam = makeSyntheticParameter(tpt = classTypeRef)
743-
val unapplyRHS = if (arity == 0) Literal(Constant(true)) else Ident(unapplyParam.name)
754+
val unapplyRHS =
755+
if (arity == 0) Literal(Constant(true))
756+
else if ctx.settings.Yscala2Stdlib.value then scala2LibCompatUnapplyRhs(unapplyParam.name)
757+
else Ident(unapplyParam.name)
744758
val unapplyResTp = if (arity == 0) Literal(Constant(true)) else TypeTree()
759+
745760
DefDef(
746761
methName,
747762
joinParams(derivedTparams, (unapplyParam :: Nil) :: Nil),
@@ -1824,16 +1839,6 @@ object desugar {
18241839
flatTree(pats1 map (makePatDef(tree, mods, _, rhs)))
18251840
case ext: ExtMethods =>
18261841
Block(List(ext), Literal(Constant(())).withSpan(ext.span))
1827-
case CapturingTypeTree(refs, parent) =>
1828-
// convert `{refs} T` to `T @retains refs`
1829-
// `{refs}-> T` to `-> (T @retainsByName refs)`
1830-
def annotate(annotName: TypeName, tp: Tree) =
1831-
Annotated(tp, New(scalaAnnotationDot(annotName), List(refs)))
1832-
parent match
1833-
case ByNameTypeTree(restpt) =>
1834-
cpy.ByNameTypeTree(parent)(annotate(tpnme.retainsByName, restpt))
1835-
case _ =>
1836-
annotate(tpnme.retains, parent)
18371842
case f: FunctionWithMods if f.hasErasedParams => makeFunctionWithValDefs(f, pt)
18381843
}
18391844
desugared.withSpan(tree.span)
@@ -1927,7 +1932,7 @@ object desugar {
19271932
}
19281933
tree match
19291934
case tree: FunctionWithMods =>
1930-
untpd.FunctionWithMods(applyVParams, tree.body, tree.mods, tree.erasedParams)
1935+
untpd.FunctionWithMods(applyVParams, result, tree.mods, tree.erasedParams)
19311936
case _ => untpd.Function(applyVParams, result)
19321937
}
19331938
}
@@ -1986,15 +1991,13 @@ object desugar {
19861991
trees foreach collect
19871992
case Block(Nil, expr) =>
19881993
collect(expr)
1989-
case Quote(body) =>
1994+
case Quote(body, _) =>
19901995
new UntypedTreeTraverser {
19911996
def traverse(tree: untpd.Tree)(using Context): Unit = tree match {
1992-
case Splice(expr) => collect(expr)
1997+
case SplicePattern(body, _) => collect(body)
19931998
case _ => traverseChildren(tree)
19941999
}
19952000
}.traverse(body)
1996-
case CapturingTypeTree(refs, parent) =>
1997-
collect(parent)
19982001
case _ =>
19992002
}
20002003
collect(tree)

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ trait TreeInfo[T <: Untyped] { self: Trees.Instance[T] =>
223223
/** Strip `=> T` to `T` and (under pureFunctions) `{refs}-> T` to `T` */
224224
def stripByNameType(tree: Tree)(using Context): Tree = unsplice(tree) match
225225
case ByNameTypeTree(t1) => t1
226-
case untpd.CapturingTypeTree(_, parent) =>
227-
val parent1 = stripByNameType(parent)
228-
if parent1 eq parent then tree else parent1
229226
case _ => tree
230227

231228
/** All type and value parameter symbols of this DefDef */
@@ -467,19 +464,21 @@ trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped]
467464
}
468465
}
469466

470-
/** Under pureFunctions: A builder and extractor for `=> T`, which is an alias for `{*}-> T`.
471-
* Only trees of the form `=> T` are matched; trees written directly as `{*}-> T`
467+
/** Under pureFunctions: A builder and extractor for `=> T`, which is an alias for `->{cap} T`.
468+
* Only trees of the form `=> T` are matched; trees written directly as `->{cap} T`
472469
* are ignored by the extractor.
473470
*/
474471
object ImpureByNameTypeTree:
475472

476-
def apply(tp: ByNameTypeTree)(using Context): untpd.CapturingTypeTree =
477-
untpd.CapturingTypeTree(
478-
untpd.captureRoot.withSpan(tp.span.startPos) :: Nil, tp)
473+
def apply(tp: Tree)(using Context): untpd.ByNameTypeTree =
474+
untpd.ByNameTypeTree(
475+
untpd.CapturesAndResult(
476+
untpd.captureRoot.withSpan(tp.span.startPos) :: Nil, tp))
479477

480-
def unapply(tp: Tree)(using Context): Option[ByNameTypeTree] = tp match
481-
case untpd.CapturingTypeTree(id @ Select(_, nme.CAPTURE_ROOT) :: Nil, bntp: ByNameTypeTree)
482-
if id.span == bntp.span.startPos => Some(bntp)
478+
def unapply(tp: Tree)(using Context): Option[Tree] = tp match
479+
case untpd.ByNameTypeTree(
480+
untpd.CapturesAndResult(id @ Select(_, nme.CAPTURE_ROOT) :: Nil, result))
481+
if id.span == result.span.startPos => Some(result)
483482
case _ => None
484483
end ImpureByNameTypeTree
485484
}

compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@ class TreeTypeMap(
146146
val bind1 = tmap.transformSub(bind)
147147
val expr1 = tmap.transform(expr)
148148
cpy.Labeled(labeled)(bind1, expr1)
149-
case tree @ Hole(_, _, args, content, tpt) =>
150-
val args1 = args.mapConserve(transform)
151-
val content1 = transform(content)
152-
val tpt1 = transform(tpt)
153-
cpy.Hole(tree)(args = args1, content = content1, tpt = tpt1)
154149
case tree1 =>
155150
super.transform(tree1)
156151
}

0 commit comments

Comments
 (0)