Skip to content

Commit 0326a8f

Browse files
committed
Use checkUndesiredProperties on New
1 parent 72aa1a4 commit 0326a8f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,8 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
257257
case tree: MemberDef =>
258258
transformMemberDef(tree)
259259
super.transform(tree)
260-
case tree: New =>
261-
if (tree.tpe.classSymbol.hasAnnotation(defn.DeprecatedAnnot))
262-
ctx.deprecationWarning(s"${tree.tpe.typeSymbol} is deprecated", tree.pos)
263-
if (isCheckable(tree))
264-
Checking.checkInstantiable(tree.tpe, tree.pos)
260+
case tree: New if isCheckable(tree) =>
261+
Checking.checkInstantiable(tree.tpe, tree.pos)
265262
super.transform(tree)
266263
case tree @ Annotated(annotated, annot) =>
267264
cpy.Annotated(tree)(transform(annotated), transformAnnot(annot))

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ class RefChecks extends MiniPhase { thisPhase =>
879879
}
880880

881881
override def transformNew(tree: New)(implicit ctx: Context) = {
882+
checkUndesiredProperties(tree.tpe.typeSymbol, tree.pos)
882883
currentLevel.enterReference(tree.tpe.typeSymbol, tree.pos)
883884
tree
884885
}

0 commit comments

Comments
 (0)