diff options
author | Mirco Dotta <mirco.dotta@typesafe.com> | 2013-12-02 14:57:53 +0100 |
---|---|---|
committer | Mirco Dotta <mirco.dotta@typesafe.com> | 2013-12-12 17:20:36 +0100 |
commit | bdb0ac0fe55260d5ee5e14a963b73bf7d9166430 (patch) | |
tree | 5e2cdab713ffeb29b7c5703694d89717170ca7b9 /test/files/run/t5603.check | |
parent | 7f4720c5dbd0711983e1abb8be3781e7d53b049b (diff) | |
download | scala-bdb0ac0fe55260d5ee5e14a963b73bf7d9166430.tar.gz scala-bdb0ac0fe55260d5ee5e14a963b73bf7d9166430.tar.bz2 scala-bdb0ac0fe55260d5ee5e14a963b73bf7d9166430.zip |
SI-4827 Test to demonstrate wrong position of constructor default arg
As demonstrated by the attached test, hyperlinking on constructor's
default arg doesn't work (the returned tree is the parameter tree,
i.e., `f`, which is of course wrong).
Printing the tree reveals the issue:
``
[[syntax trees at end of typer]] // Foo.scala
[0:63]package [0:0]<empty> {
[0:37]class Baz extends [9:37][39]scala.AnyRef {
[10:31]<paramaccessor> private[this] val f: [14]Int = _;
[14]<stable> <accessor> <paramaccessor> def f: [14]Int = [14][14]Baz.this.f;
[39]def <init>([14]f: [17]<type: [17]scala.Int> = [30]B.a): [9]Baz = [39]{
[39][39][39]Baz.super.<init>();
[9]()
}
};
[6]<synthetic> object Baz extends [6][6]AnyRef {
[6]def <init>(): [9]Baz.type = [6]{
[6][6][6]Baz.super.<init>();
[9]()
};
[14]<synthetic> def <init>$default$1: [14]Int = [30]B.a
};
[39:63]object B extends [48:63][63]scala.AnyRef {
[63]def <init>(): [48]B.type = [63]{
[63][63][63]B.super.<init>();
[48]()
};
[52:61]private[this] val a: [56]Int = [60:61]2;
[56]<stable> <accessor> def a: [56]Int = [56][56]B.this.a
}
}
``
In short, the default argument in `<init>` (the constructor) has an
offset position, while we would expect it to have a range position.
Therefore, when locating a tree for any position between (start=) 10
and (end=) 31, the paramaccessor tree `f` is returned.
The next commit will correct the problem.
Diffstat (limited to 'test/files/run/t5603.check')
0 files changed, 0 insertions, 0 deletions