diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2015-10-29 09:50:19 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-10-29 09:50:19 +0100 |
commit | 40d493580bfed7d59f1802d0d45c56cee97e466d (patch) | |
tree | 93852e3b6ff55e0d642a2f9a1df9a3bf8c429454 | |
parent | c1facd5c40fa7208d7549e6727e6e7498d4d3f34 (diff) | |
download | dotty-40d493580bfed7d59f1802d0d45c56cee97e466d.tar.gz dotty-40d493580bfed7d59f1802d0d45c56cee97e466d.tar.bz2 dotty-40d493580bfed7d59f1802d0d45c56cee97e466d.zip |
Set position on annotations parsed from Java
Fix a crash in Typer#assertPositioned
-rw-r--r-- | src/dotty/tools/dotc/parsing/JavaParsers.scala | 2 | ||||
-rw-r--r-- | tests/pos/java-interop/volatile/volatile.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/parsing/JavaParsers.scala b/src/dotty/tools/dotc/parsing/JavaParsers.scala index 297f3c0f9..7b9d29ce3 100644 --- a/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -356,7 +356,7 @@ object JavaParsers { // assumed true unless we see public/private/protected var isPackageAccess = true var annots: List[Tree] = Nil - def addAnnot(sym: ClassSymbol) = annots :+= New(TypeTree(sym.typeRef)) + def addAnnot(sym: ClassSymbol) = annots :+= New(TypeTree(sym.typeRef)).withPos(Position(in.offset)) while (true) { in.token match { diff --git a/tests/pos/java-interop/volatile/volatile.java b/tests/pos/java-interop/volatile/volatile.java new file mode 100644 index 000000000..c6a607b4d --- /dev/null +++ b/tests/pos/java-interop/volatile/volatile.java @@ -0,0 +1,3 @@ +public class Foo { + volatile int x = 1; +} |