Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbcac3b

Browse files
committed
Deprecate specialized and elidable under -Xsource:3
1 parent0e30133 commitbbcac3b

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-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
@@ -4000,6 +4000,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
40004000
reportAnnotationError(DoesNotExtendAnnotation(typedFun, annTypeSym))
40014001
return finish(ErroneousAnnotation)
40024002
}
4003+
if (currentRun.isScala3&& (annTypeSym.eq(SpecializedClass)|| annTypeSym.eq(ElidableMethodClass)))
4004+
context.deprecationWarning(ann.pos, annTypeSym,s"@${annTypeSym.fullNameString} is ignored in Scala 3","2.13.12")
40034005

40044006
/* Calling constfold right here is necessary because some trees (negated
40054007
* floats and literals in particular) are not yet folded.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
no-specialized.scala:4: warning: @scala.specialized is ignored in Scala 3
2+
class C[@specialized A]
3+
^
4+
no-specialized.scala:7: warning: @scala.specialized is ignored in Scala 3
5+
def f[@specialized A](a: A): A = a
6+
^
7+
no-specialized.scala:9: warning: @scala.annotation.elidable is ignored in Scala 3
8+
@annotation.elidable(42)
9+
^
10+
error: No warnings can be incurred under -Werror.
11+
3 warnings
12+
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+
classC[@specializedA]
5+
6+
classD {
7+
deff[@specializedA](a:A):A= a
8+
9+
@annotation.elidable(42)
10+
defg()= println("hello, world")
11+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp