Skip to content

fix #10247: skip deprecation warnings in synthetic definitions #10996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class CompilationTests {
compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")),
compileFile("tests/pos-custom-args/i5498-postfixOps.scala", defaultOptions withoutLanguageFeature "postfixOps"),
compileFilesInDir("tests/pos-custom-args/deprecation", defaultOptions.and("-deprecation", "-Xfatal-warnings")),
compileFile("tests/pos-custom-args/i8875.scala", defaultOptions.and("-Xprint:getters")),
compileFile("tests/pos-custom-args/i9267.scala", defaultOptions.and("-Ystop-after:erasure")),
compileFile("tests/pos-special/extend-java-enum.scala", defaultOptions.and("-source", "3.0-migration")),
Expand Down
5 changes: 5 additions & 0 deletions tests/neg-custom-args/deprecation/i10247.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def usered = Color.Red // error: value Red is deprecated

enum Color {
@deprecated("no Red", "0.1") case Red
}
20 changes: 20 additions & 0 deletions tests/pos-custom-args/deprecation/i10247.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// check that deprecation warnings of Red are not caught in its enclosing scope
enum Color(rgb: Int) {

@deprecated("stop using Red", "0.1")
case Red extends Color(0xff0000)

case Green extends Color(0x00ff00)

case Blue extends Color(0x0000ff)

final def colorCode: Option[Int] = this match {
case Red => None
case _ => Some(rgb)
}

}

object Color {
val deprecatedMembers = Set(Red)
}