blob: d5f619c674855254bbb53b86e0643889b8b368a5 (
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
62
63
64
65
66
67
68
69
70
71
|
// Constructor rewriting does not preserve ordering.
// Oddly the error is not issued without the thrown exception, even
// though the same reordering takes place.
class Foo(x: Int) {
def this(x1: Int, x2: Int) = {
this(x1 + x2)
throw new Exception
}
}
// Here it is at lambda lift:
//
// [[syntax trees at end of lambdalift]]// Scala source: fail11.scala
// package <empty> {
// class Foo extends java.lang.Object with ScalaObject {
// <paramaccessor> private[this] val x: Int = _;
// def this(x: Int): Foo = {
// Foo.super.this();
// ()
// };
// def this(x1: Int, x2: Int): Foo = {
// Foo.this.this(x1.+(x2));
// throw new java.lang.Exception();
// ()
// }
// }
// }
//
// % scalac -d /tmp -Xprint:constr -Ycheck-debug -Ycheck:all test/checker-tests/fail11.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]
// [Now checking: erasure]
// [Now checking: lazyvals]
// [Now checking: lambdalift]
// [[syntax trees at end of constructors]]// Scala source: fail11.scala
// package <empty> {
// class Foo extends java.lang.Object with ScalaObject {
// def this(x1: Int, x2: Int): Foo = {
// Foo.this.this(x1.+(x2));
// throw new java.lang.Exception();
// ()
// };
// def this(x: Int): Foo = {
// Foo.super.this();
// ()
// }
// }
// }
//
// [Now checking: constructors]
// test/checker-tests/fail11.scala:4: error:
// **** ERROR DURING INTERNAL CHECKING ****
// called constructor's definition must precede calling constructor's definition
// this(x1 + x2)
// ^
// one error found
|