summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-11-03 11:51:37 -0700
committerPaul Phillips <paulp@improving.org>2012-11-03 11:51:37 -0700
commitb5e3eafabe4b9cfe1e6de9eeedfe1140afeaa4eb (patch)
tree6c11462db2bc0862ecc1eef42cb235a775155cfb
parent0475fbd6e0cad15460d87eda52c9487f7ff171d3 (diff)
parent357f45c1152728a5e461312f462aa7ab63e2adec (diff)
downloadscala-b5e3eafabe4b9cfe1e6de9eeedfe1140afeaa4eb.tar.gz
scala-b5e3eafabe4b9cfe1e6de9eeedfe1140afeaa4eb.tar.bz2
scala-b5e3eafabe4b9cfe1e6de9eeedfe1140afeaa4eb.zip
Merge pull request #1567 from paulp/issue/6426
Fix for SI-6426, importable _.
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala7
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala5
-rw-r--r--test/files/neg/t6426.check7
-rw-r--r--test/files/neg/t6426.scala5
4 files changed, 18 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 380fd1fcaa..d7ee09c808 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -976,11 +976,8 @@ self =>
/** Assumed (provisionally) to be TermNames. */
def ident(skipIt: Boolean): Name =
- if (isIdent) {
- val name = in.name.encode
- in.nextToken()
- name
- } else {
+ if (isIdent) rawIdent().encode
+ else {
syntaxErrorOrIncomplete(expectedMsg(IDENTIFIER), skipIt)
nme.ERROR
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 5b828ded79..270a7fc8bf 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -613,7 +613,10 @@ trait Scanners extends ScannersCommon {
if (ch == '`') {
nextChar()
finishNamed(BACKQUOTED_IDENT)
- if (name.length == 0) syntaxError("empty quoted identifier")
+ if (name.length == 0)
+ syntaxError("empty quoted identifier")
+ else if (name == nme.WILDCARD)
+ syntaxError("wildcard invalid as backquoted identifier")
}
else syntaxError("unclosed quoted identifier")
}
diff --git a/test/files/neg/t6426.check b/test/files/neg/t6426.check
new file mode 100644
index 0000000000..149f74c4de
--- /dev/null
+++ b/test/files/neg/t6426.check
@@ -0,0 +1,7 @@
+t6426.scala:4: error: wildcard invalid as backquoted identifier
+ println(`_`.Buffer(0))
+ ^
+t6426.scala:5: error: ')' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/t6426.scala b/test/files/neg/t6426.scala
new file mode 100644
index 0000000000..a27d18eb58
--- /dev/null
+++ b/test/files/neg/t6426.scala
@@ -0,0 +1,5 @@
+class A {
+ import collection.{mutable => _, _}
+
+ println(`_`.Buffer(0))
+}