-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2333: Check if class is deprecated #3811
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
Conversation
What about this instead? diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala
index aaadbb66e..36ab320d7 100644
--- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala
+++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala
@@ -879,6 +879,7 @@ class RefChecks extends MiniPhase { thisPhase =>
}
override def transformNew(tree: New)(implicit ctx: Context) = {
+ checkUndesiredProperties(tree.tpe.typeSymbol, tree.pos)
currentLevel.enterReference(tree.tpe.typeSymbol, tree.pos)
tree
} |
@@ -879,6 +879,7 @@ class RefChecks extends MiniPhase { thisPhase => | |||
} | |||
|
|||
override def transformNew(tree: New)(implicit ctx: Context) = { | |||
checkUndesiredProperties(tree.tpe.typeSymbol, tree.pos) | |||
currentLevel.enterReference(tree.tpe.typeSymbol, tree.pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe store tree.tpe.typeSymbol
in a temporary val
tests/neg-custom-args/i2333.scala
Outdated
|
||
object Test { | ||
new Foo // error | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also slightly modify the test, to test secondary constructors:
@deprecated("bla", "2.11.0") class Foo {
def this(x: Int) = this()
}
object Test {
new Foo // error: deprecated
new Foo(1) // error: deprecated
}
Sorry for the multiple paths 😄 |
No description provided.