From 1c8bbd7ec5b8859f75abfbc4e70482dede2b7007 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 18 Sep 2013 07:48:57 -0700 Subject: 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.) --- src/reflect/scala/reflect/internal/util/Position.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/reflect/scala/reflect/internal/util/Position.scala b/src/reflect/scala/reflect/internal/util/Position.scala index 8e7df28167..d62ab40a9d 100644 --- a/src/reflect/scala/reflect/internal/util/Position.scala +++ b/src/reflect/scala/reflect/internal/util/Position.scala @@ -197,10 +197,11 @@ private[util] trait InternalPositionImpl { } def showDebug: String = toString def show = ( - if (isOpaqueRange) s"[$start:$end]" + if (isOpaqueRange && start != point) s"[$point/$start:$end]" + else if (isOpaqueRange) s"[$start:$end]" else if (isTransparent) s"<$start:$end>" else if (isDefined) s"[$point]" - else "[NoPosition]" + else "[X]" ) private def asOffset(point: Int): Position = Position.offset(source, point) -- cgit v1.2.3