Skip to content

Commit 5b2c464

Browse files
committed
Merge pull request scala#3041 from gkossakowski/merge-2.10.x
Merge 2.10.x into master
2 parents 2af071d + cd0f48c commit 5b2c464

File tree

6 files changed

+40
-5
lines changed

6 files changed

+40
-5
lines changed

src/compiler/scala/tools/nsc/typechecker/RefChecks.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,11 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
14141414

14151415
private def checkTypeRef(tp: Type, tree: Tree, skipBounds: Boolean) = tp match {
14161416
case TypeRef(pre, sym, args) =>
1417-
checkDeprecated(sym, tree.pos)
1417+
tree match {
1418+
case tt: TypeTree if tt.original == null => // SI-7783 don't warn about inferred types
1419+
case _ =>
1420+
checkDeprecated(sym, tree.pos)
1421+
}
14181422
if(sym.isJavaDefined)
14191423
sym.typeParams foreach (_.cookJavaRawInfo())
14201424
if (!tp.isHigherKinded && !skipBounds)

test/files/jvm/deprecation.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
warning: there were 5 deprecation warning(s); re-run with -deprecation for details
1+
warning: there were 4 deprecation warning(s); re-run with -deprecation for details
22
Note: deprecation/Use_2.java uses or overrides a deprecated API.
33
Note: Recompile with -Xlint:deprecation for details.

test/files/neg/t7783.check

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
t7783.scala:1: warning: type D in object O is deprecated:
2+
object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
3+
^
4+
t7783.scala:11: warning: type D in object O is deprecated:
5+
type T = O.D
6+
^
7+
t7783.scala:12: warning: type D in object O is deprecated:
8+
locally(null: O.D)
9+
^
10+
t7783.scala:13: warning: type D in object O is deprecated:
11+
val x: O.D = null
12+
^
13+
t7783.scala:14: warning: type D in object O is deprecated:
14+
locally(null.asInstanceOf[O.D])
15+
^
16+
error: No warnings can be incurred under -Xfatal-warnings.
17+
5 warnings found
18+
one error found

test/files/neg/t7783.flags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-deprecation -Xfatal-warnings

test/files/neg/t7783.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
2+
3+
object NoWarn {
4+
O.foo // nowarn
5+
O.foo +: Nil // nowarn
6+
def bar(a: Any, b: Any) = () // nowarn
7+
bar(b = O.foo, a = ()) // nowarn
8+
}
9+
10+
object Warn {
11+
type T = O.D
12+
locally(null: O.D)
13+
val x: O.D = null
14+
locally(null.asInstanceOf[O.D])
15+
}

test/files/run/t4542.check

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() {
77
defined class Foo
88

99
scala> val f = new Foo
10-
<console>:8: warning: class Foo is deprecated: foooo
11-
val f = new Foo
12-
^
1310
<console>:8: warning: class Foo is deprecated: foooo
1411
val f = new Foo
1512
^

0 commit comments

Comments
 (0)