New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Range positions for default arguments are incorrect #4287
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4287?orig=1 |
@lrytz said: |
@VladUreche said: |
@JamesIry said: |
1 similar comment
@JamesIry said: |
@dragos said: |
@dotta said (edited on Nov 19, 2013 1:21:57 PM UTC): [[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
}
} Looks like offset position are assigned to the |
@dotta said: |
@paulp said: |
@dotta said (edited on Dec 12, 2013 4:37:16 PM UTC): |
=== What steps will reproduce the problem (please be specific and use wikiformatting)? ===
Compile the following code with Scaladoc:
The generated Scaladoc, which uses range positions to extract default arguments from source, has the following signatures for A:
Notice:
startOrPoint
andendOrPoint
indices are equal).(
because itsstartOrPoint
index is one too much.=== Additional information ===
Ranged positions are not generated in a normal compiler run. Scaladoc is a way to demonstrate this issue because it forces the compiler to generate ranged positions, and outputs an artefact based upon them. Running the compiler in interactive mode for an IDE should have the same issue, but I do not know how to visualise the issue in the IDE.
To debug directly on position rather than indirectly through the resulting documentation, a possible entry point is at the beginning of method
makeTree
in classscala.tools.nsc.doc.model.TreeFactory
.Tested in 2.9 trunk r24334.
The text was updated successfully, but these errors were encountered: