diff --git a/compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala b/compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala index 78dfd8e0a869..25a05077626a 100644 --- a/compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala +++ b/compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala @@ -5,7 +5,7 @@ package jvm import scala.tools.asm import scala.annotation.threadUnsafe import scala.collection.mutable -import scala.collection.generic.Clearable +import scala.collection.mutable.Clearable import dotty.tools.dotc.core.Flags._ import dotty.tools.dotc.core.Contexts._ diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index 4c20f5821ca4..dcc4ac09d5ec 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -1339,7 +1339,16 @@ class RefChecks extends MiniPhase { thisPhase => } override def transformTypeTree(tree: TypeTree)(using Context): TypeTree = { - checkExperimental(tree.symbol, tree.srcPos) + val tpe = tree.tpe + tpe.foreachPart { + case TypeRef(_, sym: Symbol) => + checkDeprecated(sym, tree.srcPos) + checkExperimental(sym, tree.srcPos) + case TermRef(_, sym: Symbol) => + checkDeprecated(sym, tree.srcPos) + checkExperimental(sym, tree.srcPos) + case _ => + } tree } diff --git a/tests/neg-custom-args/deprecation/14034b.scala b/tests/neg-custom-args/deprecation/14034b.scala new file mode 100644 index 000000000000..d22a945fe10d --- /dev/null +++ b/tests/neg-custom-args/deprecation/14034b.scala @@ -0,0 +1,14 @@ + +@deprecated trait Exp +@deprecated val exp = 1 + +def test1 = exp // error +def test2(a: Exp) = () // error + +type Foo0 = Exp // error +type Foo = Option[Exp] // error +type Bar = Option[exp.type] // error +type Baz = Exp | Int // error +type Quux = [X] =>> X match // error + case Exp => Int +type Quuz[A <: Exp] = Int // error diff --git a/tests/neg-custom-args/no-experimental/14034.scala b/tests/neg-custom-args/no-experimental/14034.scala new file mode 100644 index 000000000000..c0b4cc6899db --- /dev/null +++ b/tests/neg-custom-args/no-experimental/14034.scala @@ -0,0 +1,12 @@ +import annotation.experimental + +@experimental trait Exp +@experimental val exp = 1 + +type Foo0 = Exp // error +type Foo = Option[Exp] // error +type Bar = Option[exp.type] // error +type Baz = Exp | Int // error +type Quux = [X] =>> X match // error + case Exp => Int +type Quuz[A <: Exp] = Int // error