Skip to content

Commit 341e927

Browse files
committed
Merge branch 'main' into sip-67-strict-equality-improvements
2 parents f23deba + dc33947 commit 341e927

File tree

294 files changed

+2603
-1666
lines changed

Some content is hidden

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

294 files changed

+2603
-1666
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -51,58 +51,6 @@ env:
5151
# text on stderr and so can break tests which check the output of a program).
5252

5353
jobs:
54-
test_non_bootstrapped:
55-
runs-on: [self-hosted, Linux]
56-
container:
57-
image: lampepfl/dotty:2024-10-18
58-
options: --cpu-shares 4096
59-
volumes:
60-
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
61-
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
62-
- ${{ github.workspace }}/../../cache/general:/root/.cache
63-
if: "github.event_name == 'schedule' && github.repository == 'scala/scala3'
64-
|| github.event_name == 'push'
65-
|| (
66-
github.event_name == 'pull_request'
67-
&& !contains(github.event.pull_request.body, '[skip ci]')
68-
&& contains(github.event.pull_request.body, '[test_non_bootstrapped]')
69-
)
70-
|| (
71-
github.event_name == 'workflow_dispatch'
72-
&& github.repository == 'scala/scala3'
73-
)"
74-
steps:
75-
- name: Set JDK 17 as default
76-
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
77-
78-
## Workaround for https://github.com/actions/runner/issues/2033 (See https://github.com/scala/scala3/pull/19720)
79-
- name: Reset existing repo
80-
run: |
81-
git config --global --add safe.directory $GITHUB_WORKSPACE
82-
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
83-
84-
- name: Checkout cleanup script
85-
uses: actions/checkout@v5
86-
87-
- name: Cleanup
88-
run: .github/workflows/cleanup.sh
89-
90-
- name: Git Checkout
91-
uses: actions/checkout@v5
92-
93-
- name: Add SBT proxy repositories
94-
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
95-
96-
- name: Test
97-
# DON'T add dist/Universal/stage!
98-
# Adding dist/Universal/stage bootstraps the compiler
99-
# which undermines the point of these tests:
100-
# to quickly run the tests without the cost of bootstrapping
101-
# and also to run tests when the compiler doesn't bootstrap
102-
run: |
103-
./project/scripts/sbt ";compile ;test"
104-
./project/scripts/cmdTests
105-
10654
test:
10755
runs-on: [self-hosted, Linux]
10856
container:
@@ -224,16 +172,8 @@ jobs:
224172
- name: Git Checkout
225173
uses: actions/checkout@v5
226174

227-
- name: build binary
228-
run: sbt "dist-win-x86_64/Universal/stage"
229-
shell: cmd
230-
231175
- name: Test
232-
run: sbt ";scala3-bootstrapped/compile ;scala3-bootstrapped/test"
233-
shell: cmd
234-
235-
- name: Scala.js Test
236-
run: sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
176+
run: sbt ";scala3-bootstrapped-new/compile ;scala3-compiler-bootstrapped-new/test"
237177
shell: cmd
238178

239179
community_build_a:
@@ -463,7 +403,7 @@ jobs:
463403
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
464404
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
465405
- ${{ github.workspace }}/../../cache/general:/root/.cache
466-
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
406+
needs: [test, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
467407
if: "github.event_name == 'push'
468408
&& startsWith(github.event.ref, 'refs/tags/')"
469409

.github/workflows/lts-backport.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
with:
1717
fetch-depth: 0
1818
- uses: coursier/cache-action@v6
19-
- uses: VirtusLab/scala-cli-setup@v1.9.0
19+
- uses: VirtusLab/scala-cli-setup@v1.9.1
2020
- run: scala-cli ./project/scripts/addToBackportingProject.scala -- ${{ github.sha }}
2121
env:
2222
GRAPHQL_API_TOKEN: ${{ secrets.GRAPHQL_API_TOKEN }}

.github/workflows/stdlib.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ jobs:
304304
mima-scala-library-nonbootstrapped:
305305
runs-on: ubuntu-latest
306306
needs: scala-library-nonbootstrapped
307+
if: false
307308
steps:
308309
- name: Git Checkout
309310
uses: actions/checkout@v5

.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
Submodule scas updated 253 files

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

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
155155
stack.pop()
156156

157157
(code: @switch) match {
158-
case ADD => bc add resKind
159-
case SUB => bc sub resKind
160-
case MUL => bc mul resKind
161-
case DIV => bc div resKind
162-
case MOD => bc rem resKind
158+
case ADD => bc.add(resKind)
159+
case SUB => bc.sub(resKind)
160+
case MUL => bc.mul(resKind)
161+
case DIV => bc.div(resKind)
162+
case MOD => bc.rem(resKind)
163163

164164
case OR | XOR | AND => bc.genPrimitiveLogical(code, resKind)
165165

@@ -271,11 +271,11 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
271271
genCond(tree, success, failure, targetIfNoJump = success)
272272
// success block
273273
markProgramPoint(success)
274-
bc boolconst true
275-
bc goTo after
274+
bc.boolconst(true)
275+
bc.goTo(after)
276276
// failure block
277277
markProgramPoint(failure)
278-
bc boolconst false
278+
bc.boolconst(false)
279279
// after
280280
markProgramPoint(after)
281281

@@ -501,16 +501,16 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
501501
val stackDiff = stack.heightDiffWrt(targetStackSize)
502502
if stackDiff != 0 then
503503
if expectedType == UNIT then
504-
bc dropMany stackDiff
504+
bc.dropMany(stackDiff)
505505
else
506506
val loc = locals.makeTempLocal(expectedType)
507507
bc.store(loc.idx, expectedType)
508-
bc dropMany stackDiff
508+
bc.dropMany(stackDiff)
509509
bc.load(loc.idx, expectedType)
510510
end if
511-
bc goTo label
511+
bc.goTo(label)
512512
case LoadDestination.Return =>
513-
bc emitRETURN returnType
513+
bc.emitRETURN(returnType)
514514
case LoadDestination.Throw =>
515515
val thrownType = expectedType
516516
// `throw null` is valid although scala.Null (as defined in src/libray-aux) isn't a subtype of Throwable.
@@ -634,7 +634,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
634634
}
635635
locals.store(earlyReturnVar)
636636
}
637-
bc goTo nextCleanup
637+
bc.goTo(nextCleanup)
638638
shouldEmitCleanup = true
639639
}
640640
} else {
@@ -697,20 +697,20 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
697697
if (l.isPrimitive && r.isPrimitive)
698698
genConversion(l, r, cast)
699699
else if (l.isPrimitive) {
700-
bc drop l
700+
bc.drop(l)
701701
if (cast) {
702702
mnode.visitTypeInsn(asm.Opcodes.NEW, jlClassCastExceptionRef.internalName)
703-
bc dup ObjectRef
703+
bc.dup(ObjectRef)
704704
emit(asm.Opcodes.ATHROW)
705705
} else {
706-
bc boolconst false
706+
bc.boolconst(false)
707707
}
708708
}
709709
else if (r.isPrimitive && cast) {
710710
abort(s"Erasure should have added an unboxing operation to prevent this cast. Tree: $t")
711711
}
712712
else if (r.isPrimitive) {
713-
bc isInstance boxedClassOfPrimitive(r.asPrimitiveBType)
713+
bc.isInstance(boxedClassOfPrimitive(r.asPrimitiveBType))
714714
}
715715
else {
716716
assert(r.isRef, r) // ensure that it's not a method
@@ -737,7 +737,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
737737
}
738738
genLoadArguments(args, List.fill(args.size)(INT))
739739
(argsSize /*: @switch*/) match {
740-
case 1 => bc newarray elemKind
740+
case 1 => bc.newarray(elemKind)
741741
case _ =>
742742
val descr = ("[" * argsSize) + elemKind.descriptor // denotes the same as: arrayN(elemKind, argsSize).descriptor
743743
mnode.visitMultiANewArrayInsn(descr, argsSize)
@@ -792,7 +792,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
792792
case rt: ClassBType =>
793793
assert(classBTypeFromSymbol(ctor.owner) == rt, s"Symbol ${ctor.owner.showFullName} is different from $rt")
794794
mnode.visitTypeInsn(asm.Opcodes.NEW, rt.internalName)
795-
bc dup generatedType
795+
bc.dup(generatedType)
796796
stack.push(rt)
797797
stack.push(rt)
798798
genLoadArguments(args, paramTKs(app))
@@ -888,8 +888,8 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
888888
val elmKind = toTypeKind(elemType)
889889
val generatedType = ArrayBType(elmKind)
890890

891-
bc iconst elems.length
892-
bc newarray elmKind
891+
bc.iconst(elems.length)
892+
bc.newarray(elmKind)
893893

894894
// during the genLoad below, there is the result, its dup, and the index
895895
stack.push(generatedType)
@@ -899,10 +899,10 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
899899
var i = 0
900900
var rest = elems
901901
while (!rest.isEmpty) {
902-
bc dup generatedType
903-
bc iconst i
902+
bc.dup( generatedType)
903+
bc.iconst( i)
904904
genLoad(rest.head, elmKind)
905-
bc astore elmKind
905+
bc.astore( elmKind)
906906
rest = rest.tail
907907
i = i + 1
908908
}
@@ -1070,7 +1070,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10701070
}
10711071
markProgramPoint(keepGoing)
10721072
}
1073-
bc goTo default
1073+
bc.goTo(default)
10741074
}
10751075

10761076
// emit blocks for common patterns
@@ -1111,7 +1111,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
11111111
def adapt(from: BType, to: BType): Unit = {
11121112
if (!from.conformsTo(to)) {
11131113
to match {
1114-
case UNIT => bc drop from
1114+
case UNIT => bc.drop(from)
11151115
case _ => bc.emitT2T(from, to)
11161116
}
11171117
} else if (from.isNothingType) {
@@ -1174,7 +1174,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
11741174
* inserted instead - after all, an expression of type scala.runtime.Null$ can only be null.
11751175
*/
11761176
if (lastInsn.getOpcode != asm.Opcodes.ACONST_NULL) {
1177-
bc drop from
1177+
bc.drop(from)
11781178
emit(asm.Opcodes.ACONST_NULL)
11791179
}
11801180
}
@@ -1248,14 +1248,14 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
12481248
def genConversion(from: BType, to: BType, cast: Boolean): Unit = {
12491249
if (cast) { bc.emitT2T(from, to) }
12501250
else {
1251-
bc drop from
1252-
bc boolconst (from == to)
1251+
bc.drop(from)
1252+
bc.boolconst(from == to)
12531253
}
12541254
}
12551255

12561256
def genCast(to: RefBType, cast: Boolean): Unit = {
1257-
if (cast) { bc checkCast to }
1258-
else { bc isInstance to }
1257+
if cast then bc.checkCast(to)
1258+
else bc.isInstance(to)
12591259
}
12601260

12611261
/* Is the given symbol a primitive operation? */
@@ -1504,7 +1504,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
15041504
}
15051505
bc.emitIF(op, success)
15061506
}
1507-
if (targetIfNoJump != failure) bc goTo failure
1507+
if (targetIfNoJump != failure) bc.goTo(failure)
15081508
}
15091509
}
15101510

@@ -1517,8 +1517,8 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
15171517
bc.emitIF(op, success)
15181518
} else if (tk.isRef) { // REFERENCE(_) | ARRAY(_)
15191519
(op: @unchecked) match { // references are only compared with EQ and NE
1520-
case EQ => bc emitIFNULL success
1521-
case NE => bc emitIFNONNULL success
1520+
case EQ => bc.emitIFNULL( success)
1521+
case NE => bc.emitIFNONNULL(success)
15221522
}
15231523
} else {
15241524
def useCmpG = if (negated) op == GT || op == GE else op == LT || op == LE
@@ -1535,7 +1535,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
15351535
}
15361536
bc.emitIF(op, success)
15371537
}
1538-
if (targetIfNoJump != failure) bc goTo failure
1538+
if (targetIfNoJump != failure) bc.goTo(failure)
15391539
}
15401540
}
15411541

@@ -1663,12 +1663,12 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
16631663
val areSameFinals = l.tpe.typeSymbol.is(Final) && r.tpe.typeSymbol.is(Final) && (l.tpe =:= r.tpe)
16641664
// todo: remove
16651665
def isMaybeBoxed(sym: Symbol): Boolean = {
1666-
(sym == defn.ObjectClass) ||
1667-
(sym == defn.JavaSerializableClass) ||
1668-
(sym == defn.ComparableClass) ||
1669-
(sym derivesFrom defn.BoxedNumberClass) ||
1670-
(sym derivesFrom defn.BoxedCharClass) ||
1671-
(sym derivesFrom defn.BoxedBooleanClass)
1666+
sym == defn.ObjectClass
1667+
|| sym == defn.JavaSerializableClass
1668+
|| sym == defn.ComparableClass
1669+
|| sym.derivesFrom(defn.BoxedNumberClass)
1670+
|| sym.derivesFrom(defn.BoxedCharClass)
1671+
|| sym.derivesFrom(defn.BoxedBooleanClass)
16721672
}
16731673
!areSameFinals && isMaybeBoxed(l.tpe.typeSymbol) && isMaybeBoxed(r.tpe.typeSymbol)
16741674
}
@@ -1722,11 +1722,11 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
17221722
genLoad(r, ObjectRef)
17231723
stack.pop()
17241724
locals.store(eqEqTempLocal)
1725-
bc dup ObjectRef
1725+
bc.dup(ObjectRef)
17261726
genCZJUMP(lNull, lNonNull, Primitives.EQ, ObjectRef, targetIfNoJump = lNull)
17271727

17281728
markProgramPoint(lNull)
1729-
bc drop ObjectRef
1729+
bc.drop(ObjectRef)
17301730
locals.load(eqEqTempLocal)
17311731
genCZJUMP(success, failure, Primitives.EQ, ObjectRef, targetIfNoJump = lNonNull)
17321732

0 commit comments

Comments
 (0)