File tree 2 files changed +20
-0
lines changed
compiler/src/dotty/tools/dotc/core
library/src/scala/annotation
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -923,6 +923,7 @@ class Definitions {
923
923
@ tu lazy val FunctionalInterfaceAnnot : ClassSymbol = requiredClass(" java.lang.FunctionalInterface" )
924
924
@ tu lazy val TargetNameAnnot : ClassSymbol = requiredClass(" scala.annotation.targetName" )
925
925
@ tu lazy val VarargsAnnot : ClassSymbol = requiredClass(" scala.annotation.varargs" )
926
+ @ tu lazy val CoversAnnot : ClassSymbol = requiredClass(" scala.annotation.covers" )
926
927
927
928
@ tu lazy val JavaRepeatableAnnot : ClassSymbol = requiredClass(" java.lang.annotation.Repeatable" )
928
929
Original file line number Diff line number Diff line change
1
+ package scala .annotation
2
+
3
+ /** An annotation specifying that an extractor is irrefutable
4
+ * if the scrutinee is a subtype of `T`.
5
+ *
6
+ * For example, the extractor `:+` covers non-empty list (`::[T]`):
7
+ *
8
+ * object :+ {
9
+ * def unapply[T](l: List[T]): Option[(List[T], T)] @covers[::[T]] = ...
10
+ * }
11
+ *
12
+ * def f(xs: List[Int]) =
13
+ * xs match
14
+ * case init :+ last => ()
15
+ * case Nil => ()
16
+ *
17
+ * Therefore, the pattern match above is exhaustive.
18
+ */
19
+ final class covers [T ] extends StaticAnnotation
You can’t perform that action at this time.
0 commit comments