File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -159,10 +159,12 @@ class CrossVersionChecks extends MiniPhase:
159159 val tpe = tree.tpe
160160 tpe.foreachPart {
161161 case TypeRef (_, sym : Symbol ) =>
162- checkDeprecated(sym, tree.srcPos)
162+ if tree.span.isSourceDerived then
163+ checkDeprecated(sym, tree.srcPos)
163164 checkExperimentalRef(sym, tree.srcPos)
164165 case TermRef (_, sym : Symbol ) =>
165- checkDeprecated(sym, tree.srcPos)
166+ if tree.span.isSourceDerived then
167+ checkDeprecated(sym, tree.srcPos)
166168 checkExperimentalRef(sym, tree.srcPos)
167169 case _ =>
168170 }
Original file line number Diff line number Diff line change 1+ -- Deprecation Warning: tests/warn/i19302.scala:8:20 -------------------------------------------------------------------
2+ 8 | def doo(): Option[Thing] = // warn
3+ | ^^^^^
4+ | class Thing is deprecated since n/a: is deprecated
5+ -- Deprecation Warning: tests/warn/i19302.scala:9:13 -------------------------------------------------------------------
6+ 9 | Some(new Thing(1)) // warn
7+ | ^^^^^
8+ | class Thing is deprecated since n/a: is deprecated
9+ -- Deprecation Warning: tests/warn/i19302.scala:10:23 ------------------------------------------------------------------
10+ 10 | def wop(x: => Option[Thing]) = println(x) // warn
11+ | ^^^^^
12+ | class Thing is deprecated since n/a: is deprecated
13+ -- Deprecation Warning: tests/warn/i19302.scala:13:16 ------------------------------------------------------------------
14+ 13 | doo().map((t: Thing) => println(t)) // warn
15+ | ^^^^^
16+ | class Thing is deprecated since n/a: is deprecated
17+ -- Deprecation Warning: tests/warn/i19302.scala:18:18 ------------------------------------------------------------------
18+ 18 | val thing = new Thing(42) // warn
19+ | ^^^^^
20+ | class Thing is deprecated since n/a: is deprecated
Original file line number Diff line number Diff line change 1+ //> using options -deprecation
2+
3+ @ deprecated(" is deprecated" , " n/a" )
4+ class Thing (val value : Int )
5+
6+ object Main extends App {
7+
8+ def doo (): Option [Thing ] = // warn
9+ Some (new Thing (1 )) // warn
10+ def wop (x : => Option [Thing ]) = println(x) // warn
11+
12+ doo().map(t => println(t))
13+ doo().map((t : Thing ) => println(t)) // warn
14+ doo().map(println)
15+ doo().foreach(println)
16+ for (x <- doo()) println(x)
17+
18+ val thing = new Thing (42 ) // warn
19+ println(thing)
20+
21+ val something = Some (thing)
22+ wop(something)
23+ }
You can’t perform that action at this time.
0 commit comments