diff options
author | Paul Phillips <paulp@improving.org> | 2013-09-18 07:48:57 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-09-18 12:11:05 -0700 |
commit | 1c8bbd7ec5b8859f75abfbc4e70482dede2b7007 (patch) | |
tree | bc0daf08322afb83c9e55c0e7b31c758625fb8cc /test/files/run | |
parent | 7f3a7a4e39642f03f3fc32467c14ea718036cf6c (diff) | |
download | scala-1c8bbd7ec5b8859f75abfbc4e70482dede2b7007.tar.gz scala-1c8bbd7ec5b8859f75abfbc4e70482dede2b7007.tar.bz2 scala-1c8bbd7ec5b8859f75abfbc4e70482dede2b7007.zip |
Position#show prints the point.
Can't ensure range position points are meaningful when we never
see them. To limit noise, only print the point when it != start.
[x:y] // point=x, start=x, end=y
[p/x:y] // point=p, start=x, end=y
I'm open to a different syntax.
Also prints NoPosition as [X] rather than [NoPosition] because
noise is for construction workers and attenders of rock concerts.
Some range position and parser tests are included so we can see
the checkfile change when the forthcoming fix happens (either an
error message improvement or a positional one.)
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/existential-rangepos.check | 6 | ||||
-rw-r--r-- | test/files/run/t5064.check | 8 | ||||
-rw-r--r-- | test/files/run/t5385.check | 16 | ||||
-rw-r--r-- | test/files/run/t5603.check | 22 | ||||
-rw-r--r-- | test/files/run/t6288.check | 6 | ||||
-rw-r--r-- | test/files/run/t6768.check | 12 | ||||
-rw-r--r-- | test/files/run/t6768.scala | 12 | ||||
-rw-r--r-- | test/files/run/t7271.check | 2 |
8 files changed, 54 insertions, 30 deletions
diff --git a/test/files/run/existential-rangepos.check b/test/files/run/existential-rangepos.check index 1212b60bae..6c4e86dedc 100644 --- a/test/files/run/existential-rangepos.check +++ b/test/files/run/existential-rangepos.check @@ -1,13 +1,13 @@ [[syntax trees at end of patmat]] // newSource1.scala [0:76]package [0:0]<empty> { - [0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef { + [15/0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef { [76]def <init>(): [20]A[T] = [76]{ [76][76][76]A.super.<init>(); [20]() }; - [24:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null; + [28/24:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null; [28]<stable> <accessor> def foo: [28]Set[_ <: T] = [28][28]A.this.foo; - [54:74]<stable> <accessor> def bar: [58]Set[_ <: T] + [58/54:74]<stable> <accessor> def bar: [58]Set[_ <: T] } } diff --git a/test/files/run/t5064.check b/test/files/run/t5064.check index 61ccfd16e7..7b92e40c35 100644 --- a/test/files/run/t5064.check +++ b/test/files/run/t5064.check @@ -1,19 +1,19 @@ [53] T5064.super.<init>() [53] T5064.super.<init> [53] this -[16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[20/16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) [16:20] immutable.this.List.apply <16:20> immutable.this.List <16:20> immutable.this -[16:23] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[20/16:23] scala.this.Predef.wrapIntArray(Array[Int]{1}) [20] scala.this.Predef.wrapIntArray [20] scala.this.Predef [20] scala.this -[26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[29/26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) [26:29] collection.this.Seq.apply <26:29> collection.this.Seq <26:29> collection.this -[26:32] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[29/26:32] scala.this.Predef.wrapIntArray(Array[Int]{1}) [29] scala.this.Predef.wrapIntArray [29] scala.this.Predef [29] scala.this diff --git a/test/files/run/t5385.check b/test/files/run/t5385.check index 1df74fcfb5..f56464facd 100644 --- a/test/files/run/t5385.check +++ b/test/files/run/t5385.check @@ -1,8 +1,8 @@ -[0:9] class Azz -[0:9] class Bzz -[0:9] class Czz -[0:9] class Dzz -[0:11] class Ezz -[0:11] class Fzz -[0:13] class Gzz -[0:13] class Hzz +[6/0:9] class Azz +[6/0:9] class Bzz +[6/0:9] class Czz +[6/0:9] class Dzz +[6/0:11] class Ezz +[6/0:11] class Fzz +[6/0:13] class Gzz +[6/0:13] class Hzz diff --git a/test/files/run/t5603.check b/test/files/run/t5603.check index 188f39ff82..255e9356b9 100644 --- a/test/files/run/t5603.check +++ b/test/files/run/t5603.check @@ -1,29 +1,29 @@ [[syntax trees at end of parser]] // newSource1.scala [0:241]package [0:0]<empty> { - [0:82]abstract trait Greeting extends [15:82][83]scala.AnyRef { + [6/0:82]abstract trait Greeting extends [15:82][83]scala.AnyRef { [15]def $init$() = [15]{ [15]() }; - [23:39]val name: [33:39]String; - [46:76]val msg = [56:76][56:72][56:71]"How are you, ".$plus([72:76]name) + [27/23:39]val name: [33:39]String; + [50/46:76]val msg = [71/56:76][71/56:72][56:71]"How are you, ".$plus([72:76]name) }; - [87:209]class C extends [94:209][151:159]Greeting { - [119:139]val nameElse = _; + [93/87:209]class C extends [94:209][151:159]Greeting { + [123/119:139]val nameElse = _; [95:101]<paramaccessor> private[this] val i: [98:101]Int = _; <119:139>def <init>([95]i: [98]Int) = <119:139>{ <119:139>val nameElse = <134:139>"Bob"; - [NoPosition][NoPosition][NoPosition]super.<init>(); + [X][X][X]super.<init>(); [94]() }; - [168:184]val name = [179:184]"avc"; - [191:203][191:198]println([199:202]msg) + [172/168:184]val name = [179:184]"avc"; + [198/191:203][191:198]println([199:202]msg) }; - [215:241]object Test extends [227:241][235:238]App { + [222/215:241]object Test extends [227:241][235:238]App { [227]def <init>() = [227]{ - [NoPosition][NoPosition][NoPosition]super.<init>(); + [X][X][X]super.<init>(); [227]() }; - [NoPosition]<empty> + [X]<empty> } } diff --git a/test/files/run/t6288.check b/test/files/run/t6288.check index a032a10de6..0da03c0439 100644 --- a/test/files/run/t6288.check +++ b/test/files/run/t6288.check @@ -18,7 +18,7 @@ [64]case6(){ [64][64]matchEnd4([64]throw [64][64][64]new [64]MatchError([64]x1)) }; - [64]matchEnd4(x: [NoPosition]Unit){ + [64]matchEnd4(x: [X]Unit){ [64]x } } @@ -44,7 +44,7 @@ [175]case6(){ [175][175]matchEnd4([175]throw [175][175][175]new [175]MatchError([175]x1)) }; - [175]matchEnd4(x: [NoPosition]Unit){ + [175]matchEnd4(x: [X]Unit){ [175]x } } @@ -70,7 +70,7 @@ [273]case6(){ [273][273]matchEnd4([273]throw [273][273][273]new [273]MatchError([273]x1)) }; - [273]matchEnd4(x: [NoPosition]Unit){ + [273]matchEnd4(x: [X]Unit){ [273]x } } diff --git a/test/files/run/t6768.check b/test/files/run/t6768.check new file mode 100644 index 0000000000..bf4f6ea2a1 --- /dev/null +++ b/test/files/run/t6768.check @@ -0,0 +1,12 @@ +[[syntax trees at end of typer]] // newSource1.scala +[1:58]package [1:1]<empty> { + [7/1:58]class A extends [9:58][58]scala.AnyRef { + [58]def <init>(): [9]A = [58]{ + [58][58][58]A.super.<init>(); + [9]() + }; + [17/13:31]def f1: [17]Some[String] = [26/22:31][22:26][22:26]scala.Some.apply[[22]String]([27:30]"a"); + [38/34:56]def f2: [38]Some[String] = [43:56][43/47:51][43/47:51]new [47:51]<type: [47:51]scala.Some>([52:55]"b") + } +} + diff --git a/test/files/run/t6768.scala b/test/files/run/t6768.scala new file mode 100644 index 0000000000..11470a0ef8 --- /dev/null +++ b/test/files/run/t6768.scala @@ -0,0 +1,12 @@ +import scala.tools.partest._ + +object Test extends DirectTest { + override def extraSettings: String = "-usejavacp -Xprint:typer -Yrangepos -Xprint-pos -d " + testOutput.path + override def show() = Console.withErr(System.out)(compile()) + + override def code = """ +class A { + def f1 = Some("a") + def f2 = new Some("b") +}""" +} diff --git a/test/files/run/t7271.check b/test/files/run/t7271.check index f7a23018ca..86b5230fd7 100644 --- a/test/files/run/t7271.check +++ b/test/files/run/t7271.check @@ -2,7 +2,7 @@ [6]package [6]<empty> { [6]class C extends [8][91]scala.AnyRef { [8]def <init>() = [8]{ - [NoPosition][NoPosition][NoPosition]super.<init>(); + [X][X][X]super.<init>(); [8]() }; [20]def quote = [28][28][28][28]StringContext([30]"foo", [40]"baz").s([35]this); |