Skip to content

Commit 052b696

Browse files
committed
Fix tests
1 parent 1a953e5 commit 052b696

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ jobs:
205205
##############################################################################################
206206
- name: Set JDK 17 as default
207207
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
208-
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
209208
- name: Reset existing repo
210209
run: |
211210
git config --global --add safe.directory $GITHUB_WORKSPACE

compiler/src/dotty/tools/dotc/transform/LazyVals.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer {
491491
varHandleSymbol.addAnnotation(Annotation(defn.ScalaStaticAnnot, varHandleSymbol.span))
492492
val getVarHandle = Apply(
493493
Select(ref(varHandleInfo.methodHandlesLookupDef.symbol), defn.MethodHandlesLookup_FindVarHandle.name),
494-
List(thizClass, Literal(Constant(containerName.toString)), Literal(Constant(defn.ObjectType)))
494+
List(thizClass, Literal(Constant(containerName.mangledString)), Literal(Constant(defn.ObjectType)))
495495
)
496496
val varHandleTree = ValDef(varHandleSymbol, getVarHandle)
497497
val varHandle = ref(varHandleSymbol)

project/MiMaFilters.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ object MiMaFilters {
138138
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#MethodTypeMethods.isContextual"),
139139
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#ImplicitsModule.searchIgnoring"),
140140
ProblemFilters.exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#ValDefModule.let"),
141+
142+
// Changes to lazy vals (added static constructors)
143+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.Tuple.<clinit>"),
144+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.immutable.ArraySeq.<clinit>"),
145+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.concurrent.ExecutionContext.<clinit>"),
146+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.io.Codec.<clinit>"),
147+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.math.BigDecimal.<clinit>"),
148+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.sys.SystemProperties.<clinit>"),
149+
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.sys.process.Process.<clinit>"),
150+
141151
// Change `experimental` annotation to a final class
142152
ProblemFilters.exclude[FinalClassProblem]("scala.annotation.experimental"),
143153

tests/printing/transformed/lazy-vals-new.check

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ package <empty> {
99
}
1010
@static private def <clinit>(): Unit =
1111
{
12-
A.OFFSET$_m_0 =
13-
scala.runtime.LazyVals.getOffsetStatic(
14-
classOf[Object {...}].getDeclaredField("x$lzy1"))
12+
val A$$$methodHandleLookup:
13+
java.lang.invoke.MethodHandles.MethodHandles$Lookup =
14+
java.lang.invoke.MethodHandles.lookup()
15+
A.x$lzy1$$lzyHandle =
16+
A$$$methodHandleLookup.findVarHandle(classOf[Object {...}], "x$lzy1",
17+
classOf[Object])
1518
()
1619
}
17-
@static @static val OFFSET$_m_0: Long =
18-
scala.runtime.LazyVals.getOffsetStatic(
19-
classOf[Object {...}].getDeclaredField("x$lzy1"))
20+
@static val x$lzy1$$lzyHandle: java.lang.invoke.VarHandle =
21+
A.A$$$methodHandleLookup.findVarHandle(classOf[Object {...}], "x$lzy1",
22+
classOf[Object])
2023
private def writeReplace(): Object =
2124
new scala.runtime.ModuleSerializationProxy(classOf[A])
2225
@volatile private lazy var x$lzy1: Object = null
@@ -33,7 +36,7 @@ package <empty> {
3336
val current: Object = A.x$lzy1
3437
if current eq null then
3538
if
36-
scala.runtime.LazyVals.objCAS(this, A.OFFSET$_m_0, null,
39+
scala.runtime.LazyVals.objCAS2(this, A.x$lzy1$$lzyHandle, null,
3740
scala.runtime.LazyVals.Evaluating)
3841
then
3942
{
@@ -49,15 +52,15 @@ package <empty> {
4952
}
5053
finally
5154
if
52-
scala.runtime.LazyVals.objCAS(this, A.OFFSET$_m_0,
55+
scala.runtime.LazyVals.objCAS2(this, A.x$lzy1$$lzyHandle,
5356
scala.runtime.LazyVals.Evaluating, result).unary_!()
5457
then
5558
{
5659
val lock: scala.runtime.LazyVals.LazyVals$Waiting =
5760
A.x$lzy1.asInstanceOf[
5861
scala.runtime.LazyVals.LazyVals$Waiting]
59-
scala.runtime.LazyVals.objCAS(this, A.OFFSET$_m_0, lock,
60-
result)
62+
scala.runtime.LazyVals.objCAS2(this, A.x$lzy1$$lzyHandle,
63+
lock, result)
6164
lock.countDown()
6265
}
6366
else ()
@@ -71,8 +74,8 @@ package <empty> {
7174
then
7275
if current eq scala.runtime.LazyVals.Evaluating then
7376
{
74-
scala.runtime.LazyVals.objCAS(this, A.OFFSET$_m_0, current,
75-
new scala.runtime.LazyVals.LazyVals$Waiting())
77+
scala.runtime.LazyVals.objCAS2(this, A.x$lzy1$$lzyHandle,
78+
current, new scala.runtime.LazyVals.LazyVals$Waiting())
7679
()
7780
}
7881
else

0 commit comments

Comments
 (0)