Skip to content

Commit dbb9602

Browse files
author
Niklas Vest
committed
merge from master
2 parents 800febf + 0535f59 commit dbb9602

File tree

219 files changed

+3739
-1462
lines changed

Some content is hidden

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

219 files changed

+3739
-1462
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
container: lampepfl/dotty:2020-04-24
1616

1717
steps:
18+
- name: Set JDK 11 as default
19+
run: echo "::add-path::/usr/lib/jvm/java-11-openjdk-amd64/bin"
20+
1821
- name: Checkout cleanup script
1922
uses: actions/checkout@v2
2023

@@ -55,6 +58,9 @@ jobs:
5558
container: lampepfl/dotty:2020-04-24
5659

5760
steps:
61+
- name: Set JDK 11 as default
62+
run: echo "::add-path::/usr/lib/jvm/java-11-openjdk-amd64/bin"
63+
5864
- name: Checkout cleanup script
5965
uses: actions/checkout@v2
6066

@@ -174,7 +180,7 @@ jobs:
174180
- name: Test
175181
run: ./project/scripts/sbt sbt-dotty/scripted
176182

177-
test_java11:
183+
test_java8:
178184
runs-on: self-hosted
179185
container: lampepfl/dotty:2020-04-24
180186
if: (
@@ -184,6 +190,9 @@ jobs:
184190
github.event_name == 'schedule'
185191

186192
steps:
193+
- name: Set JDK 8 as default
194+
run: echo "::add-path::/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin"
195+
187196
- name: Checkout cleanup script
188197
uses: actions/checkout@v2
189198

@@ -215,14 +224,12 @@ jobs:
215224
restore-keys: ${{ runner.os }}-general-
216225

217226
- name: Test
218-
run: |
219-
export PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH"
220-
./project/scripts/sbt ";compile ;test"
227+
run: ./project/scripts/sbt ";compile ;test"
221228

222229
publish_nightly:
223230
runs-on: self-hosted
224231
container: lampepfl/dotty:2020-04-24
225-
needs: [test, test_bootstrapped, community_build, test_sbt, test_java11]
232+
needs: [test, test_bootstrapped, community_build, test_sbt, test_java8]
226233
if: github.event_name == 'schedule'
227234
env:
228235
NIGHTLYBUILD: yes
@@ -323,7 +330,7 @@ jobs:
323330
publish_release:
324331
runs-on: self-hosted
325332
container: lampepfl/dotty:2020-04-24
326-
needs: [test, test_bootstrapped, community_build, test_sbt, test_java11]
333+
needs: [test, test_bootstrapped, community_build, test_sbt, test_java8]
327334
if: github.event_name == 'push' &&
328335
startsWith(github.event.ref, 'refs/tags/') &&
329336
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
@@ -475,7 +482,7 @@ jobs:
475482
publish_sbt_release:
476483
runs-on: self-hosted
477484
container: lampepfl/dotty:2020-04-24
478-
needs: [test, test_bootstrapped, community_build, test_sbt, test_java11]
485+
needs: [test, test_bootstrapped, community_build, test_sbt, test_java8]
479486
if: github.event_name == 'push' &&
480487
startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
481488

Submodule stdLib213 updated 2517 files

community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -361,39 +361,39 @@ class CommunityBuildTest:
361361
}
362362
}
363363

364-
@Test def intent = projects.intent.run()
365364
@Test def algebra = projects.algebra.run()
365+
@Test def betterfiles = projects.betterfiles.run()
366+
@Test def dottyCpsAsync = projects.dottyCpsAsync.run()
367+
@Test def effpi = projects.effpi.run()
368+
@Test def endpoints = projects.endpoints.run()
369+
@Test def fastparse = projects.fastparse.run()
370+
@Test def geny = projects.geny.run()
371+
@Test def intent = projects.intent.run()
372+
@Test def minitest = projects.minitest.run()
373+
@Test def munit = projects.munit.run()
374+
@Test def oslib = projects.oslib.run()
375+
// @Test def oslibWatch = projects.oslibWatch.run()
366376
@Test def scalacheck = projects.scalacheck.run()
377+
@Test def scalap = projects.scalap.run()
378+
@Test def scalaParserCombinators = projects.scalaParserCombinators.run()
379+
@Test def ScalaPB = projects.ScalaPB.run()
367380
@Test def scalatest = projects.scalatest.run()
368381
@Test def scalatestplusScalacheck = projects.scalatestplusScalacheck.run()
369382
@Test def scalaXml = projects.scalaXml.run()
383+
@Test def scalaz = projects.scalaz.run()
384+
@Test def scodec = projects.scodec.run()
385+
@Test def scodecBits = projects.scodecBits.run()
386+
@Test def sconfig = projects.sconfig.run()
370387
@Test def scopt = projects.scopt.run()
371-
@Test def scalap = projects.scalap.run()
372-
@Test def squants = projects.squants.run()
373-
@Test def betterfiles = projects.betterfiles.run()
374-
@Test def ScalaPB = projects.ScalaPB.run()
375-
@Test def minitest = projects.minitest.run()
376-
@Test def fastparse = projects.fastparse.run()
377-
@Test def utest = projects.utest.run()
388+
@Test def shapeless = projects.shapeless.run()
378389
@Test def sourcecode = projects.sourcecode.run()
379-
@Test def oslib = projects.oslib.run()
390+
@Test def squants = projects.squants.run()
391+
@Test def stdLib213 = projects.stdLib213.run()
380392
@Test def ujson = projects.ujson.run()
381393
// @Test def upickle = projects.upickle.run()
382-
// @Test def oslibWatch = projects.oslibWatch.run()
383-
@Test def geny = projects.geny.run()
384-
@Test def stdLib213 = projects.stdLib213.run()
385-
@Test def shapeless = projects.shapeless.run()
394+
@Test def utest = projects.utest.run()
386395
@Test def xmlInterpolator = projects.xmlInterpolator.run()
387-
@Test def effpi = projects.effpi.run()
388-
@Test def sconfig = projects.sconfig.run()
389396
@Test def zio = projects.zio.run()
390-
@Test def munit = projects.munit.run()
391-
@Test def scodecBits = projects.scodecBits.run()
392-
@Test def scodec = projects.scodec.run()
393-
@Test def scalaParserCombinators = projects.scalaParserCombinators.run()
394-
@Test def dottyCpsAsync = projects.dottyCpsAsync.run()
395-
@Test def scalaz = projects.scalaz.run()
396-
@Test def endpoints = projects.endpoints.run()
397397
end CommunityBuildTest
398398

399399
class TestCategory

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

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,13 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
364364
}
365365
else {
366366
mnode.visitVarInsn(asm.Opcodes.ALOAD, 0)
367-
generatedType =
368-
if (tree.symbol == defn.ArrayClass) ObjectReference
369-
else classBTypeFromSymbol(claszSymbol)
367+
// When compiling Array.scala, the constructor invokes `Array.this.super.<init>`. The expectedType
368+
// is `[Object` (computed by typeToBType, the type of This(Array) is `Array[T]`). If we would set
369+
// the generatedType to `Array` below, the call to adapt at the end would fail. The situation is
370+
// similar for primitives (`I` vs `Int`).
371+
if (tree.symbol != defn.ArrayClass && !tree.symbol.isPrimitiveValueClass) {
372+
generatedType = classBTypeFromSymbol(claszSymbol)
373+
}
370374
}
371375

372376
case DesugaredSelect(Ident(nme.EMPTY_PACKAGE), module) =>
@@ -512,9 +516,16 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
512516

513517
case ClazzTag =>
514518
val tp = toTypeKind(const.typeValue)
515-
// classOf[Int] is transformed to Integer.TYPE by ClassOf
516-
assert(!tp.isPrimitive, s"expected class type in classOf[T], found primitive type $tp")
517-
mnode.visitLdcInsn(tp.toASMType)
519+
if tp.isPrimitive then
520+
val boxedClass = boxedClassOfPrimitive(tp.asPrimitiveBType)
521+
mnode.visitFieldInsn(
522+
asm.Opcodes.GETSTATIC,
523+
boxedClass.internalName,
524+
"TYPE", // field name
525+
jlClassRef.descriptor
526+
)
527+
else
528+
mnode.visitLdcInsn(tp.toASMType)
518529

519530
case EnumTag =>
520531
val sym = const.symbolValue
@@ -703,33 +714,18 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
703714
if (t.symbol ne defn.Object_synchronized) genTypeApply(t)
704715
else genSynchronized(app, expectedType)
705716

706-
case Apply(fun @ DesugaredSelect(Super(_, _), _), args) =>
707-
def initModule(): Unit = {
708-
// we initialize the MODULE$ field immediately after the super ctor
709-
if (!isModuleInitialized &&
710-
jMethodName == INSTANCE_CONSTRUCTOR_NAME &&
711-
fun.symbol.javaSimpleName == INSTANCE_CONSTRUCTOR_NAME &&
712-
claszSymbol.isStaticModuleClass) {
713-
isModuleInitialized = true
714-
mnode.visitVarInsn(asm.Opcodes.ALOAD, 0)
715-
mnode.visitFieldInsn(
716-
asm.Opcodes.PUTSTATIC,
717-
thisName,
718-
str.MODULE_INSTANCE_FIELD,
719-
"L" + thisName + ";"
720-
)
721-
}
722-
}
717+
case Apply(fun @ DesugaredSelect(Super(superQual, _), _), args) =>
723718
// 'super' call: Note: since constructors are supposed to
724719
// return an instance of what they construct, we have to take
725720
// special care. On JVM they are 'void', and Scala forbids (syntactically)
726721
// to call super constructors explicitly and/or use their 'returned' value.
727722
// therefore, we can ignore this fact, and generate code that leaves nothing
728723
// on the stack (contrary to what the type in the AST says).
729-
mnode.visitVarInsn(asm.Opcodes.ALOAD, 0)
724+
725+
// scala/bug#10290: qual can be `this.$outer()` (not just `this`), so we call genLoad (not just ALOAD_0)
726+
genLoad(superQual)
730727
genLoadArguments(args, paramTKs(app))
731728
generatedType = genCallMethod(fun.symbol, InvokeStyle.Super, app.span)
732-
initModule()
733729

734730
// 'new' constructor call: Note: since constructors are
735731
// thought to return an instance of what they construct,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ trait BCodeIdiomatic {
2929
case "jvm-1.6" => asm.Opcodes.V1_6
3030
case "jvm-1.7" => asm.Opcodes.V1_7
3131
case "jvm-1.8" => asm.Opcodes.V1_8
32+
case "jvm-9" => asm.Opcodes.V9
3233
}
3334

3435
lazy val majorVersion: Int = (classfileVersion & 0xFF)

0 commit comments

Comments
 (0)