Skip to content

Commit f37cb30

Browse files
committed
WIP
1 parent 3a830c8 commit f37cb30

File tree

3 files changed

+55
-38
lines changed

3 files changed

+55
-38
lines changed

compiler/src/dotty/tools/dotc/typer/CrossVersionChecks.scala

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,16 @@ class CrossVersionChecks extends MiniPhase:
6060
* a module that declares `sym`, or the companion class of the
6161
* module that declares `sym`.
6262
*/
63-
def skipWarning(using Context) =
64-
ctx.owner.ownersIterator.exists(if sym.isEnumCase then isDeprecatedOrEnum else _.isDeprecated)
63+
def skipWarning(using Context): Boolean = {
64+
val owners = ctx.owner.ownersIterator.toList
65+
val result = //(sym.isConstructor && sym.owner.is(Flags.CaseClass) && ctx.owner.is(Flags.Synthetic)) &&
66+
owners.exists(owner => if sym.isEnumCase then isDeprecatedOrEnum(owner) else ctx.owner.is(Flags.Synthetic) || owner.isDeprecated)
67+
if (!result)
68+
println(i"sym: $sym flags: ${sym.flagsString}")
69+
println(i"owner: ${ctx.owner} deprecated: ${ctx.owner.isDeprecated} constructor: ${ctx.owner.isConstructor} flags: ${ctx.owner.flagsString}")
70+
println(i"tree: ${ctx.tree}")
71+
result
72+
}
6573

6674
for annot <- sym.getAnnotation(defn.DeprecatedAnnot) do
6775
if !skipWarning then

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

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,43 @@ class CompilationTests {
3030
@Test def pos: Unit = {
3131
implicit val testGroup: TestGroup = TestGroup("compilePos")
3232
aggregateTests(
33-
compileFile("tests/pos/nullarify.scala", defaultOptions.and("-Ycheck:nullarify")),
34-
compileFile("tests/pos-special/utf8encoded.scala", explicitUTF8),
35-
compileFile("tests/pos-special/utf16encoded.scala", explicitUTF16),
36-
compileFilesInDir("tests/pos-special/sourcepath/outer", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
37-
compileFile("tests/pos-special/sourcepath/outer/nested/Test4.scala", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
38-
compileFilesInDir("tests/pos-special/fatal-warnings", defaultOptions.and("-Xfatal-warnings", "-deprecation", "-feature")),
39-
compileFilesInDir("tests/pos-special/spec-t5545", defaultOptions),
40-
compileFilesInDir("tests/pos-special/strawman-collections", allowDeepSubtypes),
41-
compileFilesInDir("tests/pos-special/isInstanceOf", allowDeepSubtypes.and("-Xfatal-warnings")),
42-
compileFilesInDir("tests/new", defaultOptions.and("-source", "3.2")), // just to see whether 3.2 works
43-
compileFilesInDir("tests/pos-scala2", scala2CompatMode),
44-
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
45-
compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
46-
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
47-
// Run tests for legacy lazy vals
48-
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
49-
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
50-
compileFilesInDir("tests/pos-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
51-
compileFilesInDir("tests/pos-custom-args/strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
52-
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
53-
compileFile(
54-
// succeeds despite -Xfatal-warnings because of -nowarn
55-
"tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala",
56-
defaultOptions.and("-nowarn", "-Xfatal-warnings")
57-
),
58-
compileFile("tests/pos-special/typeclass-scaling.scala", defaultOptions.and("-Xmax-inlines", "40")),
59-
compileFile("tests/pos-special/i7575.scala", defaultOptions.andLanguageFeature("dynamics")),
60-
compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
61-
compileFile("tests/pos-special/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")),
62-
compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")),
63-
compileFile("tests/pos-custom-args/i8875.scala", defaultOptions.and("-Xprint:getters")),
64-
compileFile("tests/pos-custom-args/i9267.scala", defaultOptions.and("-Ystop-after:erasure")),
65-
compileFile("tests/pos-special/extend-java-enum.scala", defaultOptions.and("-source", "3.0-migration")),
66-
compileFile("tests/pos-custom-args/help.scala", defaultOptions.and("-help", "-V", "-W", "-X", "-Y")),
67-
compileFile("tests/pos-custom-args/i13044.scala", defaultOptions.and("-Xmax-inlines:33")),
68-
compileFile("tests/pos-custom-args/jdk-8-app.scala", defaultOptions.and("-release:8")),
33+
// compileFile("tests/pos/nullarify.scala", defaultOptions.and("-Ycheck:nullarify")),
34+
// compileFile("tests/pos-special/utf8encoded.scala", explicitUTF8),
35+
// compileFile("tests/pos-special/utf16encoded.scala", explicitUTF16),
36+
// compileFilesInDir("tests/pos-special/sourcepath/outer", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
37+
// compileFile("tests/pos-special/sourcepath/outer/nested/Test4.scala", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
38+
// compileFilesInDir("tests/pos-special/fatal-warnings", defaultOptions.and("-Xfatal-warnings", "-deprecation", "-feature")),
39+
// compileFilesInDir("tests/pos-special/spec-t5545", defaultOptions),
40+
// compileFilesInDir("tests/pos-special/strawman-collections", allowDeepSubtypes),
41+
// compileFilesInDir("tests/pos-special/isInstanceOf", allowDeepSubtypes.and("-Xfatal-warnings")),
42+
// compileFilesInDir("tests/new", defaultOptions.and("-source", "3.2")), // just to see whether 3.2 works
43+
// compileFilesInDir("tests/pos-scala2", scala2CompatMode),
44+
// compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
45+
// compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
46+
// compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
47+
// // Run tests for legacy lazy vals
48+
// compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
49+
// compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
50+
// compileFilesInDir("tests/pos-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
51+
// compileFilesInDir("tests/pos-custom-args/strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
52+
// compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
53+
// compileFile(
54+
// // succeeds despite -Xfatal-warnings because of -nowarn
55+
// "tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala",
56+
// defaultOptions.and("-nowarn", "-Xfatal-warnings")
57+
// ),
58+
// compileFile("tests/pos-special/typeclass-scaling.scala", defaultOptions.and("-Xmax-inlines", "40")),
59+
// compileFile("tests/pos-special/i7575.scala", defaultOptions.andLanguageFeature("dynamics")),
60+
// compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
61+
// compileFile("tests/pos-special/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")),
62+
// compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")),
63+
// compileFile("tests/pos-custom-args/i8875.scala", defaultOptions.and("-Xprint:getters")),
64+
// compileFile("tests/pos-custom-args/i9267.scala", defaultOptions.and("-Ystop-after:erasure")),
65+
// compileFile("tests/pos-special/extend-java-enum.scala", defaultOptions.and("-source", "3.0-migration")),
66+
// compileFile("tests/pos-custom-args/help.scala", defaultOptions.and("-help", "-V", "-W", "-X", "-Y")),
67+
// compileFile("tests/pos-custom-args/i13044.scala", defaultOptions.and("-Xmax-inlines:33")),
68+
// compileFile("tests/pos-custom-args/jdk-8-app.scala", defaultOptions.and("-release:8")),
69+
compileFile("tests/pos-custom-args/i11022.scala", defaultOptions.and("-Xfatal-warnings", "-deprecation")),
6970
).checkCompile()
7071
}
7172

tests/pos-custom-args/i11022.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@deprecated("no CaseClass")
2+
case class CaseClass(rgb: Int)
3+
//def magic(): Unit = ()
4+
5+
//@deprecated("no CaseClass")
6+
//object CaseClass
7+
8+
//val a = CaseClass(42).magic()

0 commit comments

Comments
 (0)