This repository was archived by the owner on Sep 1, 2020. It is now read-only.
File tree 3 files changed +9
-5
lines changed
src/compiler/scala/tools/nsc/typechecker 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1287,6 +1287,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
1287
1287
private def checkUndesiredProperties (sym : Symbol , pos : Position ) {
1288
1288
// If symbol is deprecated, and the point of reference is not enclosed
1289
1289
// in either a deprecated member or a scala bridge method, issue a warning.
1290
+ // TODO: x.hasBridgeAnnotation doesn't seem to be needed here...
1290
1291
if (sym.isDeprecated && ! currentOwner.ownerChain.exists(x => x.isDeprecated || x.hasBridgeAnnotation))
1291
1292
currentRun.reporting.deprecationWarning(pos, sym)
1292
1293
@@ -1305,7 +1306,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
1305
1306
reporter.warning(pos, s " ${sym.fullLocationString} has changed semantics in version ${sym.migrationVersion.get}: \n ${sym.migrationMessage.get}" )
1306
1307
}
1307
1308
// See an explanation of compileTimeOnly in its scaladoc at scala.annotation.compileTimeOnly.
1308
- if (sym.isCompileTimeOnly) {
1309
+ if (sym.isCompileTimeOnly && ! currentOwner.ownerChain.exists(x => x.isCompileTimeOnly) ) {
1309
1310
def defaultMsg =
1310
1311
sm """ Reference to ${sym.fullLocationString} should not have survived past type checking,
1311
1312
|it should have been processed and eliminated during expansion of an enclosing macro. """
Original file line number Diff line number Diff line change @@ -4,9 +4,6 @@ compile-time-only-a.scala:10: error: C3
4
4
compile-time-only-a.scala:12: error: C4
5
5
@compileTimeOnly("C4") case class C4(x: Int)
6
6
^
7
- compile-time-only-a.scala:17: error: C5
8
- implicit class C5(val x: Int) {
9
- ^
10
7
compile-time-only-a.scala:32: error: C1
11
8
new C1()
12
9
^
@@ -76,4 +73,4 @@ compile-time-only-a.scala:75: error: placebo
76
73
compile-time-only-a.scala:75: error: placebo
77
74
@placebo def x = (2: @placebo)
78
75
^
79
- 26 errors found
76
+ 25 errors found
Original file line number Diff line number Diff line change
1
+ import scala .annotation .compileTimeOnly
2
+
3
+ class C (val s : String ) extends AnyVal {
4
+ @ compileTimeOnly(" error" )
5
+ def error = ???
6
+ }
You can’t perform that action at this time.
0 commit comments