summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-04-27 18:36:04 +0000
committerPaul Phillips <paulp@improving.org>2011-04-27 18:36:04 +0000
commit6a988aeff0f426480ce50ebfbe0dcb50c3f4753a (patch)
tree041fa2490174f12bf3bc1fe099b61ee44ae2e5f6
parent1a443ebb205a2e79951d212567fca0d7bd7dcd7e (diff)
downloadscala-6a988aeff0f426480ce50ebfbe0dcb50c3f4753a.tar.gz
scala-6a988aeff0f426480ce50ebfbe0dcb50c3f4753a.tar.bz2
scala-6a988aeff0f426480ce50ebfbe0dcb50c3f4753a.zip
Fixed a booch I made in io.Position's positioning.
Closes #4498, no review.
-rw-r--r--src/library/scala/io/Position.scala2
-rw-r--r--test/files/run/io-position.checkbin0 -> 126 bytes
-rw-r--r--test/files/run/io-position.scala13
3 files changed, 14 insertions, 1 deletions
diff --git a/src/library/scala/io/Position.scala b/src/library/scala/io/Position.scala
index 5b6accfea3..917d61ec25 100644
--- a/src/library/scala/io/Position.scala
+++ b/src/library/scala/io/Position.scala
@@ -51,7 +51,7 @@ abstract class Position {
if (line >= LINE_MASK)
LINE_MASK << COLUMN_BITS
else
- (line << COLUMN_BITS) | math.min(LINE_MASK, line)
+ (line << COLUMN_BITS) | math.min(COLUMN_MASK, column)
}
/** Returns the line number of the encoded position. */
diff --git a/test/files/run/io-position.check b/test/files/run/io-position.check
new file mode 100644
index 0000000000..09f743d750
--- /dev/null
+++ b/test/files/run/io-position.check
Binary files differ
diff --git a/test/files/run/io-position.scala b/test/files/run/io-position.scala
new file mode 100644
index 0000000000..7e570ea29e
--- /dev/null
+++ b/test/files/run/io-position.scala
@@ -0,0 +1,13 @@
+object Test {
+ Console.setErr(Console.out)
+
+ def main(args: Array[String]): Unit = {
+ try {
+ xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<foo>"), false).document()
+ } catch {
+ case e:Exception => println(e.getMessage)
+ }
+ }
+
+}
+