aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/package.scala
blob: 68d24e2297e0cb8f2cf3816c393c108aeb18b0a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package dotty
import scala.annotation.Annotation

package object tools {
  class sharable extends Annotation
  class unshared extends Annotation

  val ListOfNil = Nil :: Nil

  /** True if two lists have the same length.  Since calling length on linear sequences
   *  is O(n), it is an inadvisable way to test length equality.
   */
  final def sameLength[T](xs: List[T], ys: List[T]): Boolean = xs match {
    case _ :: xs1 =>
      ys match {
        case _ :: ys1 => sameLength(xs1, ys1)
        case _ => false
      }
    case _ => ys.isEmpty
  }
}