Skip to content

Commit 467f160

Browse files
committed
Pre-review lazy vals adjustments
1 parent 09775c5 commit 467f160

File tree

166 files changed

+140
-71
lines changed

Some content is hidden

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

166 files changed

+140
-71
lines changed

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/InitializedAccess.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ class InitializedAccess {
2727
bh.consume(holder)
2828
bh.consume(holder.value)
2929
}
30-
}
30+
}

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/InitializedAccessAny.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ class InitializedAccessAny {
2727
bh.consume(holder)
2828
bh.consume(holder.value)
2929
}
30-
}
30+
}

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/InitializedAccessGeneric.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ class InitializedAccessGeneric {
2727
bh.consume(holder)
2828
bh.consume(holder.value)
2929
}
30-
}
30+
}

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/InitializedAccessMultiple.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ class InitializedAccessMultiple {
3131
i = i + 1
3232
}
3333
}
34-
}
34+
}

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/InitializedAccessString.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ class InitializedAccessString {
2727
bh.consume(holder)
2828
bh.consume(holder.value)
2929
}
30-
}
30+
}

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/LazyVals.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ object LazyVals {
5050
}
5151
}
5252
}
53-
}
53+
}

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/UninitializedAccess.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ class UninitializedAccess {
2222
bh.consume(holder.value)
2323
i = i + 1
2424
}
25-
}
25+
}

bench-micro/src/main/scala/dotty/tools/benchmarks/lazyvals/UninitializedAccessMultiple.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ class UninitializedAccessMultiple {
2424
i = i + 1
2525
}
2626
}
27-
}
27+
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import Types._, Contexts._, Flags._
77
import Symbols._, Annotations._, Trees._, Symbols._, Constants.Constant
88
import Decorators._
99
import dotty.tools.dotc.transform.SymUtils._
10-
import transform.LazyVals
1110

1211
/** A map that applies three functions and a substitution together to a tree and
1312
* makes sure they are coordinated so that the result is well-typed. The functions are

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ private sealed trait XSettings:
240240
val XcheckMacros: Setting[Boolean] = BooleanSetting("-Xcheck-macros", "Check some invariants of macro generated code while expanding macros", aliases = List("--Xcheck-macros"))
241241
val XmainClass: Setting[String] = StringSetting("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d <jar>)", "")
242242
val XimplicitSearchLimit: Setting[Int] = IntSetting("-Ximplicit-search-limit", "Maximal number of expressions to be generated in an implicit search", 50000)
243-
val XlegacyLazyVals: Setting[Boolean] = BooleanSetting("-Xlegacy-lazy-values", "Use legacy lazy vals implementations")
244243

245244
val XmixinForceForwarders = ChoiceSetting(
246245
name = "-Xmixin-force-forwarders",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Repeated.scala
2+
byname-implicits-8.scala
3+
existentials.scala
4+
i1235.scala
5+
i13332super.scala
6+
i13349.scala
7+
i13460.scala
8+
i14626.scala
9+
i1753.scala
10+
i4031.scala
11+
i4328.scala
12+
i6450.scala
13+
i6565.scala
14+
i8031.scala
15+
i8111.scala
16+
i8900-unflip.scala
17+
lazyvals.scala
18+
singletons.scala
19+
spec-traits.scala
20+
spurious-overload.scala
21+
t1591_pos.scala
22+
t2910.scala
23+
t3411.scala
24+
t3420.scala
25+
t3452f.scala
26+
t3670.scala
27+
t3927.scala
28+
t4432.scala
29+
t4716.scala
30+
t4717.scala
31+
t5099.scala
32+
t5796.scala
33+
t6278-synth-def.scala
34+
t6925b.scala
35+
t7011.scala
36+
t8306.scala
37+
zipped.scala

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,3 @@ i4176-gadt.scala
8686
i13974a.scala
8787

8888
java-inherited-type1
89-
90-
lazy-vals-all
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# CI only: cannot reduce summonFrom with
2-
sip23-valueof.scala
2+
sip23-valueof.scala
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
IArrayOps.scala
2+
Lazies1.scala
3+
Lazies2.scala
4+
OrderingTest.scala
5+
anon-mirror-gen-local.scala
6+
byname-implicits-28.scala
7+
byname-implicits-30.scala
8+
byname-implicits-5.scala
9+
exports.scala
10+
i13146.scala
11+
i13146a.scala
12+
i13332a.scala
13+
i13332shapeless.scala
14+
i13358.scala
15+
i1692.scala
16+
i1692b.scala
17+
i1856.scala
18+
i2266.scala
19+
i2275.scala
20+
i4451.scala
21+
i4559.scala
22+
i5340.scala
23+
i5350.scala
24+
i7675.scala
25+
i9473.scala
26+
isInstanceOf-eval.scala
27+
lazy-exprs.scala
28+
lazy-impl.scala
29+
lazy-implicit-lists.scala
30+
lazy-override-run.scala
31+
lazy-traits.scala
32+
lazyVals.scala
33+
lazyVals_c3.0.0.scala
34+
lazyVals_c3.1.0.scala
35+
nonLocalReturns.scala
36+
nothing-lazy-val.scala
37+
null-lazy-val.scala
38+
patmatch-classtag.scala
39+
priorityQueue.scala
40+
serialization-new-legacy.scala
41+
serialization-new.scala
42+
singletons.scala
43+
statics.scala
44+
stream_flatmap_odds.scala
45+
t1535.scala
46+
t1591.scala
47+
t2333.scala
48+
t3038.scala
49+
t3670.scala
50+
t3699.scala
51+
t3877.scala
52+
t3895.scala
53+
t3980.scala
54+
t429.scala
55+
t5552.scala
56+
t5610a.scala
57+
t603.scala
58+
t6272.scala
59+
t6443-by-name.scala
60+
t6443-varargs.scala
61+
t704.scala
62+
t7406.scala
63+
t8245.scala
64+
unapply.scala
65+
unit-lazy-val.scala
66+
view-iterator-stream.scala

compiler/test/dotc/run-test-pickling.blacklist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,4 @@ i12753
4343
t6138
4444
t6138-2
4545
i12656.scala
46-
trait-static-forwarder
47-
lazy-vals-all
46+
trait-static-forwarder

compiler/test/dotc/run-test-recheck.excludes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ i5976.scala
1010
tagless.scala
1111
safeThrowsStrawman2.scala
1212
t7584.scala
13-
function-arity.scala
14-
lazy-vals-all
13+
function-arity.scala

compiler/test/dotty/tools/TestSources.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,26 @@ object TestSources {
1313

1414
def posFromTastyBlacklistFile: String = "compiler/test/dotc/pos-from-tasty.blacklist"
1515
def posTestPicklingBlacklistFile: String = "compiler/test/dotc/pos-test-pickling.blacklist"
16-
def posTestRecheckExcludesFile = "compiler/test/dotc/pos-test-recheck.excludes"
16+
def posTestRecheckExcludesFile: String = "compiler/test/dotc/pos-test-recheck.excludes"
17+
def posLazyValsAllowlistFile: String = "compiler/test/dotc/pos-lazy-vals-tests.allowlist"
1718

1819
def posFromTastyBlacklisted: List[String] = loadList(posFromTastyBlacklistFile)
1920
def posTestPicklingBlacklisted: List[String] = loadList(posTestPicklingBlacklistFile)
20-
def posTestRecheckExcluded = loadList(posTestRecheckExcludesFile)
21+
def posTestRecheckExcluded: List[String] = loadList(posTestRecheckExcludesFile)
22+
def posLazyValsAllowlist: List[String] = loadList(posLazyValsAllowlistFile)
2123

2224
// run tests lists
2325

2426
def runFromTastyBlacklistFile: String = "compiler/test/dotc/run-from-tasty.blacklist"
2527
def runTestPicklingBlacklistFile: String = "compiler/test/dotc/run-test-pickling.blacklist"
26-
def runTestRecheckExcludesFile = "compiler/test/dotc/run-test-recheck.excludes"
28+
def runTestRecheckExcludesFile: String = "compiler/test/dotc/run-test-recheck.excludes"
29+
def runLazyValsAllowlistFile: String = "compiler/test/dotc/run-lazy-vals-tests.allowlist"
30+
2731

2832
def runFromTastyBlacklisted: List[String] = loadList(runFromTastyBlacklistFile)
2933
def runTestPicklingBlacklisted: List[String] = loadList(runTestPicklingBlacklistFile)
30-
def runTestRecheckExcluded = loadList(runTestRecheckExcludesFile)
34+
def runTestRecheckExcluded: List[String] = loadList(runTestRecheckExcludesFile)
35+
def runLazyValsAllowlist: List[String] = loadList(runLazyValsAllowlistFile)
3136

3237
// load lists
3338

compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ class DottyBytecodeTests extends DottyBytecodeTest {
597597
val clsIn = dir.lookupName("Test.class", directory = false).input
598598
val clsNode = loadClassNode(clsIn)
599599
val method = getMethod(clsNode, "test")
600-
assertEquals(36, instructionsFromMethod(method).size)
600+
assertEquals(88, instructionsFromMethod(method).size)
601601
}
602602
}
603603

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ class CompilationTests {
4242
compileFilesInDir("tests/pos-scala2", scala2CompatMode),
4343
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-Ycc")),
4444
compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
45-
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init"), FileFilter.exclude("lazy-vals-all")),
46-
// Run tests for experimental lightweight lazy vals and stable lazy vals
47-
compileFilesInDir("tests/pos/lazy-vals-all", defaultOptions.and("-Ysafe-init", "-Ylightweight-lazy-vals")),
48-
compileFilesInDir("tests/pos/lazy-vals-all", defaultOptions.and("-Ysafe-init")),
45+
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
46+
// Run tests for experimental lightweight lazy vals
47+
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylightweight-lazy-vals"), FileFilter.include(TestSources.posLazyValsAllowlist)),
4948
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
5049
compileFilesInDir("tests/pos-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
5150
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
@@ -218,10 +217,9 @@ class CompilationTests {
218217
compileDir("tests/run-custom-args/Xmacro-settings/compileTimeEnv", defaultOptions.and("-Xmacro-settings:a,b=1,c.b.a=x.y.z=1,myLogger.level=INFO")),
219218
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-Ycc")),
220219
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
221-
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init"), FileFilter.exclude("lazy-vals-all")),
222-
// Run tests for experimental lightweight lazy vals and stable lazy vals. serialization-new-legacy is kept to check all cases aside from not working transient (I removed the test that was not testing it)
223-
compileFilesInDir("tests/run/lazy-vals-all", defaultOptions.and("-Ysafe-init", "-Ylightweight-lazy-vals"), FileFilter.exclude("serialization-new-legacy.scala")),
224-
compileFilesInDir("tests/run/lazy-vals-all", defaultOptions.and("-Ysafe-init"), FileFilter.exclude("serialization-new.scala"))
220+
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init"), FileFilter.exclude("serialization-new.scala")),
221+
// Run tests for experimental lightweight lazy vals and stable lazy vals.
222+
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init", "-Ylightweight-lazy-vals"), FileFilter.include(TestSources.runLazyValsAllowlist)),
225223
).checkRuns()
226224
}
227225

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/run-custom-args/tasty-inspector/stdlibExperimentalDefinitions.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ val experimentalDefinitionInLibrary = Set(
6565
// Need experimental annotation macros to check that design works.
6666
"scala.quoted.Quotes.reflectModule.ClassDefModule.apply",
6767
"scala.quoted.Quotes.reflectModule.SymbolModule.newClass",
68+
69+
// New APIs: Lightweight lazy vals. Can be stabilized in 3.3.0
70+
"scala.runtime.LazyVals$.Evaluating",
71+
"scala.runtime.LazyVals$.Evaluating$",
72+
"scala.runtime.LazyVals$.LazyValControlState",
73+
"scala.runtime.LazyVals$.NullValue",
74+
"scala.runtime.LazyVals$.NullValue$",
75+
"scala.runtime.LazyVals$.Waiting",
76+
"scala.runtime.LazyVals$.getStaticFieldOffset",
77+
"scala.runtime.LazyVals$.objCAS"
6878
)
6979

7080

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/run/lazy-vals-all/lazyVals-legacy.check

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/run/lazy-vals-all/lazyVals-legacy.flags

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/run/lazy-vals-all/lazyVals-legacy.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/run/lazy-vals-all/lazyVals_c3.0.0.scala

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/run/lazy-vals-all/lazyVals_c3.1.0.scala

Lines changed: 0 additions & 13 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)