summaryrefslogtreecommitdiff
path: root/test/checker-tests/fail6.scala
blob: a43bada4007ce5b01e7326f30bc7630eeb6912af (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// BoxedUnit/Unit confusion involving while.
//
// Apply( // sym=method while$1, tpe=Unit, tpe.sym=class Unit, tpe.sym.owner=package scala
//   Ident("while$1"), // sym=method while$1, sym.owner=method f, sym.tpe=()Unit, tpe=()Unit, tpe.sym=<none>,
class Erasure {
  def f(b: Boolean) = {    
    if (b) "abc"
    else while (b) ()
  }
}

// % work/check all -Xprint:erasure work/fail6.scala  
// TypeStack init: REFERENCE(type AnyRef)
// [Not checkable: parser]
// [Not checkable: namer]
// [Not checkable: packageobjects]
// [Now checking: typer]
// [Now checking: superaccessors]
// [Now checking: pickler]
// [Now checking: refchecks]
// [Now checking: selectiveanf]
// [Now checking: liftcode]
// [Now checking: selectivecps]
// [Now checking: uncurry]
// [Now checking: tailcalls]
// [Not checkable: specialize]
// [Not checkable: explicitouter]
// [[syntax trees at end of erasure]]// Scala source: fail6.scala
// package <empty> {
//   class Erasure extends java.lang.Object with ScalaObject {
//     def this(): Erasure = {
//       Erasure.super.this();
//       ()
//     };
//     def f(b: Boolean): java.lang.Object = if (b)
//       "abc"
//     else
//       while$1(){
//         if (b)
//           {
//             ();
//             while$1()
//           }
//         else
//           ();
//         scala.runtime.BoxedUnit.UNIT
//       }
//   }
// }
// 
// [Now checking: erasure]
// work/fail6.scala:4: error: 
// **** ERROR DURING INTERNAL CHECKING ****
// type mismatch;
//  found   : scala.runtime.BoxedUnit
//  required: Unit
//     else while (b) ()
//          ^
// one error found
// 
//