Skip to content

Commit d00a472

Browse files
committed
Merge branch 'main' into fix-18763
2 parents 01c8620 + 9f20aa5 commit d00a472

File tree

159 files changed

+3999
-628
lines changed

Some content is hidden

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

159 files changed

+3999
-628
lines changed

.github/workflows/stdlib.yaml

Lines changed: 140 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
compile-nonbootstrapped:
13+
scala-library-nonbootstrapped:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Git Checkout
@@ -27,8 +27,27 @@ jobs:
2727
- name: Compile `scala-library-nonbootstrapped`
2828
run: ./project/scripts/sbt scala-library-nonbootstrapped/compile
2929

30-
compile-bootstrapped:
30+
scala3-library-nonbootstrapped:
3131
runs-on: ubuntu-latest
32+
##needs: [scala-library-nonbootstrapped] Add when we add support for caching here
33+
steps:
34+
- name: Git Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up JDK 17
38+
uses: actions/setup-java@v4
39+
with:
40+
distribution: 'temurin'
41+
java-version: 17
42+
cache: 'sbt'
43+
44+
- uses: sbt/setup-sbt@v1
45+
- name: Compile `scala3-library-nonbootstrapped`
46+
run: ./project/scripts/sbt scala3-library-nonbootstrapped/compile
47+
48+
scala-library-bootstrapped:
49+
runs-on: ubuntu-latest
50+
needs : [scala3-compiler-nonbootstrapped, scala3-sbt-bridge-nonbootstrapped, scala-library-nonbootstrapped, scala3-library-nonbootstrapped]
3251
steps:
3352
- name: Git Checkout
3453
uses: actions/checkout@v4
@@ -44,3 +63,122 @@ jobs:
4463
- name: Compile `scala-library-bootstrapped`
4564
run: ./project/scripts/sbt scala-library-bootstrapped/compile
4665

66+
scala3-library-bootstrapped:
67+
runs-on: ubuntu-latest
68+
##needs: [scala-library-bootstrapped] Add when we add support for caching here
69+
steps:
70+
- name: Git Checkout
71+
uses: actions/checkout@v4
72+
73+
- name: Set up JDK 17
74+
uses: actions/setup-java@v4
75+
with:
76+
distribution: 'temurin'
77+
java-version: 17
78+
cache: 'sbt'
79+
80+
- uses: sbt/setup-sbt@v1
81+
- name: Compile `scala3-library-bootstrapped`
82+
run: ./project/scripts/sbt scala3-library-bootstrapped-new/compile
83+
84+
tasty-core-nonbootstrapped:
85+
runs-on: ubuntu-latest
86+
##needs: [scala3-library-nonbootstrapped] Add when we add support for caching here
87+
steps:
88+
- name: Git Checkout
89+
uses: actions/checkout@v4
90+
91+
- name: Set up JDK 17
92+
uses: actions/setup-java@v4
93+
with:
94+
distribution: 'temurin'
95+
java-version: 17
96+
cache: 'sbt'
97+
- uses: sbt/setup-sbt@v1
98+
- name: Compile `tasty-core-nonbootstrapped`
99+
run: ./project/scripts/sbt tasty-core-nonbootstrapped/compile
100+
101+
scala3-compiler-nonbootstrapped:
102+
runs-on: ubuntu-latest
103+
##needs: [tasty-core-nonbootstrapped, scala3-library-nonbootstrapped] Add when we add support for caching here
104+
steps:
105+
- name: Git Checkout
106+
uses: actions/checkout@v4
107+
108+
- name: Set up JDK 17
109+
uses: actions/setup-java@v4
110+
with:
111+
distribution: 'temurin'
112+
java-version: 17
113+
cache: 'sbt'
114+
- uses: sbt/setup-sbt@v1
115+
- name: Compile `scala3-compiler-nonbootstrapped`
116+
run: ./project/scripts/sbt scala3-compiler-nonbootstrapped/compile
117+
118+
scala3-sbt-bridge-nonbootstrapped:
119+
runs-on: ubuntu-latest
120+
##needs: [scala3-compiler-nonbootstrapped] Add when we add support for caching here
121+
steps:
122+
- name: Git Checkout
123+
uses: actions/checkout@v4
124+
125+
- name: Set up JDK 17
126+
uses: actions/setup-java@v4
127+
with:
128+
distribution: 'temurin'
129+
java-version: 17
130+
cache: 'sbt'
131+
- uses: sbt/setup-sbt@v1
132+
- name: Compile `scala3-sbt-bridge-nonbootstrapped`
133+
run: ./project/scripts/sbt scala3-sbt-bridge-nonbootstrapped/compile
134+
135+
tasty-core-bootstrapped:
136+
runs-on: ubuntu-latest
137+
##needs: [scala3-library-bootstrapped] Add when we add support for caching here
138+
steps:
139+
- name: Git Checkout
140+
uses: actions/checkout@v4
141+
142+
- name: Set up JDK 17
143+
uses: actions/setup-java@v4
144+
with:
145+
distribution: 'temurin'
146+
java-version: 17
147+
cache: 'sbt'
148+
- uses: sbt/setup-sbt@v1
149+
- name: Compile `tasty-core-bootstrapped`
150+
run: ./project/scripts/sbt tasty-core-bootstrapped-new/compile
151+
152+
scala3-compiler-bootstrapped:
153+
runs-on: ubuntu-latest
154+
##needs: [tasty-core-bootstrapped, scala3-library-bootstrapped] Add when we add support for caching here
155+
steps:
156+
- name: Git Checkout
157+
uses: actions/checkout@v4
158+
159+
- name: Set up JDK 17
160+
uses: actions/setup-java@v4
161+
with:
162+
distribution: 'temurin'
163+
java-version: 17
164+
cache: 'sbt'
165+
- uses: sbt/setup-sbt@v1
166+
- name: Compile `scala3-compiler-bootstrapped`
167+
run: ./project/scripts/sbt scala3-compiler-bootstrapped-new/compile
168+
169+
scala3-sbt-bridge-bootstrapped:
170+
runs-on: ubuntu-latest
171+
##needs: [scala3-compiler-bootstrapped] Add when we add support for caching here
172+
steps:
173+
- name: Git Checkout
174+
uses: actions/checkout@v4
175+
176+
- name: Set up JDK 17
177+
uses: actions/setup-java@v4
178+
with:
179+
distribution: 'temurin'
180+
java-version: 17
181+
cache: 'sbt'
182+
- uses: sbt/setup-sbt@v1
183+
- name: Compile `scala3-sbt-bridge-bootstrapped`
184+
run: ./project/scripts/sbt scala3-sbt-bridge-bootstrapped/compile

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
[submodule "community-build/community-projects/scala-parallel-collections"]
101101
path = community-build/community-projects/scala-parallel-collections
102102
url = https://github.com/dotty-staging/scala-parallel-collections.git
103+
branch = serialisation-stability-fix
103104
[submodule "community-build/community-projects/scala-collection-compat"]
104105
path = community-build/community-projects/scala-collection-compat
105106
url = https://github.com/dotty-staging/scala-collection-compat.git

build.sbt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
val scala3 = Build.scala3
2+
val `scala3-nonbootstrapped` = Build.`scala3-nonbootstrapped`
23
val `scala3-bootstrapped` = Build.`scala3-bootstrapped`
4+
val `scala3-bootstrapped-new` = Build.`scala3-bootstrapped-new`
35
val `scala3-interfaces` = Build.`scala3-interfaces`
46
val `scala3-compiler` = Build.`scala3-compiler`
7+
val `scala3-compiler-nonbootstrapped` = Build.`scala3-compiler-nonbootstrapped`
8+
val `scala3-compiler-bootstrapped-new` = Build.`scala3-compiler-bootstrapped-new`
59
val `scala3-compiler-bootstrapped` = Build.`scala3-compiler-bootstrapped`
610
val `scala-library-nonbootstrapped` = Build.`scala-library-nonbootstrapped`
11+
val `scala3-library-nonbootstrapped` = Build.`scala3-library-nonbootstrapped`
712
val `scala-library-bootstrapped` = Build.`scala-library-bootstrapped`
13+
val `scala3-library-bootstrapped-new` = Build.`scala3-library-bootstrapped-new`
814
val `scala3-library` = Build.`scala3-library`
915
val `scala3-library-bootstrapped` = Build.`scala3-library-bootstrapped`
1016
val `scala3-library-bootstrappedJS` = Build.`scala3-library-bootstrappedJS`
1117
val `scala3-sbt-bridge` = Build.`scala3-sbt-bridge`
18+
val `scala3-sbt-bridge-bootstrapped` = Build.`scala3-sbt-bridge-bootstrapped`
19+
val `scala3-sbt-bridge-nonbootstrapped` = Build.`scala3-sbt-bridge-nonbootstrapped`
1220
val `scala3-sbt-bridge-tests` = Build.`scala3-sbt-bridge-tests`
1321
val `scala3-staging` = Build.`scala3-staging`
1422
val `scala3-tasty-inspector` = Build.`scala3-tasty-inspector`
@@ -21,6 +29,8 @@ val `scala2-library-tasty` = Build.`scala2-library-tasty`
2129
val `scala2-library-cc` = Build.`scala2-library-cc`
2230
val `scala2-library-cc-tasty` = Build.`scala2-library-cc-tasty`
2331
val `tasty-core` = Build.`tasty-core`
32+
val `tasty-core-nonbootstrapped` = Build.`tasty-core-nonbootstrapped`
33+
val `tasty-core-bootstrapped-new` = Build.`tasty-core-bootstrapped-new`
2434
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
2535
val `tasty-core-scala2` = Build.`tasty-core-scala2`
2636
val scaladoc = Build.scaladoc

compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import dotty.tools.dotc.core.Types.*
3131
import dotty.tools.dotc.core.TypeErasure
3232
import dotty.tools.dotc.transform.GenericSignatures
3333
import dotty.tools.dotc.transform.ElimErasedValueType
34+
import dotty.tools.dotc.transform.Mixin
3435
import dotty.tools.io.AbstractFile
3536
import dotty.tools.dotc.report
3637

@@ -395,12 +396,20 @@ trait BCodeHelpers extends BCodeIdiomatic {
395396
*/
396397
def getGenericSignature(sym: Symbol, owner: Symbol): String = {
397398
atPhase(erasurePhase) {
398-
val memberTpe =
399+
def computeMemberTpe(): Type =
399400
if (sym.is(Method)) sym.denot.info
400401
else if sym.denot.validFor.phaseId > erasurePhase.id && sym.isField && sym.getter.exists then
401402
// Memoization field of getter entered after erasure, see run/i17069 for an example
402403
sym.getter.denot.info.resultType
403404
else owner.denot.thisType.memberInfo(sym)
405+
406+
val memberTpe = if sym.is(MixedIn) then
407+
mixinPhase.asInstanceOf[Mixin].mixinForwarderGenericInfos.get(sym) match
408+
case Some(genericInfo) => genericInfo
409+
case none => computeMemberTpe()
410+
else
411+
computeMemberTpe()
412+
404413
getGenericSignatureHelper(sym, owner, memberTpe).orNull
405414
}
406415
}
@@ -491,7 +500,7 @@ trait BCodeHelpers extends BCodeIdiomatic {
491500
report.debuglog(s"Potentially conflicting names for forwarders: $conflictingNames")
492501

493502
for (m0 <- sortedMembersBasedOnFlags(moduleClass.info, required = Method, excluded = ExcludedForwarder)) {
494-
val m = if (m0.is(Bridge)) m0.nextOverriddenSymbol else m0
503+
val m = if (m0.isOneOf(Bridge | MixedIn)) m0.nextOverriddenSymbol else m0
495504
if (m == NoSymbol)
496505
report.log(s"$m0 is a bridge method that overrides nothing, something went wrong in a previous phase.")
497506
else if (m.isType || m.is(Deferred) || (m.owner eq defn.ObjectClass) || m.isConstructor || m.name.is(ExpandedName))
@@ -507,10 +516,7 @@ trait BCodeHelpers extends BCodeIdiomatic {
507516
// we generate ACC_SYNTHETIC forwarders so Java compilers ignore them.
508517
val isSynthetic =
509518
m0.name.is(NameKinds.SyntheticSetterName) ||
510-
// Only hide bridges generated at Erasure, mixin forwarders are also
511-
// marked as bridge but shouldn't be hidden since they don't have a
512-
// non-bridge overload.
513-
m0.is(Bridge) && m0.initial.validFor.firstPhaseId == erasurePhase.next.id
519+
m0.is(Bridge)
514520
addForwarder(jclass, moduleClass, m, isSynthetic)
515521
}
516522
}

compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ class BTypesFromSymbols[I <: DottyBackendInterface](val int: I, val frontendAcce
299299
// illegal combination of modifiers at the bytecode level so
300300
// suppress final if abstract if present.
301301
&& !sym.isOneOf(AbstractOrTrait)
302-
// Mixin forwarders are bridges and can be final, but final bridges confuse some frameworks
302+
// Bridges can be final, but final bridges confuse some frameworks
303303
&& !sym.is(Bridge), ACC_FINAL)
304304
.addFlagIf(sym.isStaticMember, ACC_STATIC)
305305
.addFlagIf(sym.is(Bridge), ACC_BRIDGE | ACC_SYNTHETIC)

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,10 +2321,6 @@ object desugar {
23212321
Annotated(
23222322
AppliedTypeTree(ref(defn.SeqType), t),
23232323
New(ref(defn.RepeatedAnnot.typeRef), Nil :: Nil))
2324-
else if op.name == nme.CC_REACH then
2325-
Annotated(t, New(ref(defn.ReachCapabilityAnnot.typeRef), Nil :: Nil))
2326-
else if op.name == nme.CC_READONLY then
2327-
Annotated(t, New(ref(defn.ReadOnlyCapabilityAnnot.typeRef), Nil :: Nil))
23282324
else
23292325
assert(ctx.mode.isExpr || ctx.reporter.errorsReported || ctx.mode.is(Mode.Interactive), ctx.mode)
23302326
Select(t, op.name)

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,29 @@ object NavigateAST {
9494
* When choosing better fit we compare spans. If candidate span has starting or ending point inside (exclusive)
9595
* current best fit it is selected as new best fit. This means that same spans are failing the first predicate.
9696
*
97-
* In case when spans start and end at same offsets we prefer non synthethic one.
97+
* In case when spans start and end at same offsets we prefer non synthethic one,
98+
* and then one with better point (see isBetterPoint below).
9899
*/
99100
def isBetterFit(currentBest: List[Positioned], candidate: List[Positioned]): Boolean =
100101
if currentBest.isEmpty && candidate.nonEmpty then true
101102
else if currentBest.nonEmpty && candidate.nonEmpty then
102103
val bestSpan = currentBest.head.span
103104
val candidateSpan = candidate.head.span
104105

105-
bestSpan != candidateSpan &&
106-
envelops(bestSpan, candidateSpan) ||
107-
bestSpan.contains(candidateSpan) && bestSpan.isSynthetic && !candidateSpan.isSynthetic
106+
def isBetterPoint =
107+
// Given two spans with same end points,
108+
// we compare their points in relation to the point we are looking for (span.point)
109+
// The candidate (candidateSpan.point) is better than what we have so far (bestSpan.point), when:
110+
// 1) candidate is closer to target from the right
111+
span.point <= candidateSpan.point && candidateSpan.point < bestSpan.point
112+
// 2) candidate is closer to target from the left
113+
|| bestSpan.point < candidateSpan.point && candidateSpan.point <= span.point
114+
// 3) candidate is to on the left side of target, and best so far is on the right
115+
|| candidateSpan.point <= span.point && span.point < bestSpan.point
116+
117+
bestSpan != candidateSpan && envelops(bestSpan, candidateSpan)
118+
|| bestSpan.contains(candidateSpan) && bestSpan.isSynthetic && !candidateSpan.isSynthetic
119+
|| candidateSpan.start == bestSpan.start && candidateSpan.end == bestSpan.end && isBetterPoint
108120
else false
109121

110122
def isRecoveryTree(sel: untpd.Select): Boolean =

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
550550
annot.putAttachment(RetainsAnnot, ())
551551
Annotated(parent, annot)
552552

553+
def makeReachAnnot()(using Context): Tree =
554+
New(ref(defn.ReachCapabilityAnnot.typeRef), Nil :: Nil)
555+
556+
def makeReadOnlyAnnot()(using Context): Tree =
557+
New(ref(defn.ReadOnlyCapabilityAnnot.typeRef), Nil :: Nil)
558+
559+
def makeOnlyAnnot(qid: Tree)(using Context) =
560+
New(AppliedTypeTree(ref(defn.OnlyCapabilityAnnot.typeRef), qid :: Nil), Nil :: Nil)
561+
553562
def makeConstructor(tparams: List[TypeDef], vparamss: List[List[ValDef]], rhs: Tree = EmptyTree)(using Context): DefDef =
554563
DefDef(nme.CONSTRUCTOR, joinParams(tparams, vparamss), TypeTree(), rhs)
555564

compiler/src/dotty/tools/dotc/cc/CCState.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ class CCState:
8181
def start(): Unit =
8282
iterCount = 1
8383

84+
private var mySepCheck = false
85+
86+
/** Are we currently running separation checks? */
87+
def isSepCheck = mySepCheck
88+
89+
def inSepCheck(op: => Unit): Unit =
90+
val saved = mySepCheck
91+
mySepCheck = true
92+
try op finally mySepCheck = saved
93+
8494
// ------ Global counters -----------------------
8595

8696
/** Next CaptureSet.Var id */

0 commit comments

Comments
 (0)