Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down
11 changes: 10 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
14 changes: 14 additions & 0 deletions tests/neg-custom-args/deprecation/14034b.scala
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions tests/neg-custom-args/no-experimental/14034.scala
Original file line number Diff line number Diff line change
@@ -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