Skip to content

Commit 063208d

Browse files
authored
Merge pull request scala#10377 from som-snytt/deprecate/specialized
Warn about elidable under -Xsource:3
2 parents 910c59d + f92fd37 commit 063208d

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4015,6 +4015,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
40154015
reportAnnotationError(DoesNotExtendAnnotation(typedFun, annTypeSym))
40164016
return finish(ErroneousAnnotation)
40174017
}
4018+
if (currentRun.isScala3 && (/*annTypeSym.eq(SpecializedClass) ||*/ annTypeSym.eq(ElidableMethodClass)))
4019+
context.deprecationWarning(ann.pos, annTypeSym, s"@${annTypeSym.fullNameString} is ignored in Scala 3", "2.13.12")
40184020

40194021
/* Calling constfold right here is necessary because some trees (negated
40204022
* floats and literals in particular) are not yet folded.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
deprecated-annots.scala:9: warning: @scala.annotation.elidable is ignored in Scala 3
2+
@annotation.elidable(42)
3+
^
4+
error: No warnings can be incurred under -Werror.
5+
1 warning
6+
1 error
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
// scalac: -Werror -Xlint -Xsource:3
3+
4+
class C[@specialized A]
5+
6+
class D {
7+
def f[@specialized A](a: A): A = a
8+
9+
@annotation.elidable(42)
10+
def g() = println("hello, world")
11+
}

0 commit comments

Comments
 (0)