aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/desugar.scala
blob: ca52ac6ece979f85a9d0d087a932fbbd4e4e36d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
object desugar {

  // variables
  var x: Int = 2
  var y = x * x
  
  { var z: Int = y }
 
  def foo0(first: Int, second: Int = 2, third: Int = 3) = first + second
  def foo1(first: Int, second: Int = 2)(third: Int = 3) = first + second
  def foo2(first: Int)(second: Int = 2)(third: Int = 3) = first + second
  
  object lists {
    trait List[+T] {
      def head: T
      def tail: List[T]
    }

    case class Cons[+T](val head: T, val tail: List[T]) extends List[T]

    object Cons {
      def apply[T](head: T): Cons[T] = apply(head, Nil)
    }

    case object Nil extends List[Nothing]
  }
}