summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-12-10 15:50:20 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-12-10 15:50:20 -0800
commit47562e7adbf8577789b3432f4bfbb36d786c6b32 (patch)
tree55b7f2bbd5e65ecb66eec9454e702525e3a3f727
parent9cdbe28c00b39c51ae9afe3066c8b44a6e5f6f96 (diff)
downloadscala-47562e7adbf8577789b3432f4bfbb36d786c6b32.tar.gz
scala-47562e7adbf8577789b3432f4bfbb36d786c6b32.tar.bz2
scala-47562e7adbf8577789b3432f4bfbb36d786c6b32.zip
Revert "SI-6426, importable _."
This reverts commit d2316df920ffa4804fe51e8f8780240c46efa982. We can't make `_` an illegal identifier -- it's legal in Java, so we must be able to name these Java underscores.
-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, 6 insertions, 18 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 996287dea8..b9e4109623 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -980,8 +980,11 @@ self =>
/** Assumed (provisionally) to be TermNames. */
def ident(skipIt: Boolean): Name =
- if (isIdent) rawIdent().encode
- else {
+ if (isIdent) {
+ val name = in.name.encode
+ in.nextToken()
+ name
+ } 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 1aa50be83a..8d295a28d0 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -611,10 +611,7 @@ trait Scanners extends ScannersCommon {
if (ch == '`') {
nextChar()
finishNamed(BACKQUOTED_IDENT)
- if (name.length == 0)
- syntaxError("empty quoted identifier")
- else if (name == nme.WILDCARD)
- syntaxError("wildcard invalid as backquoted identifier")
+ if (name.length == 0) syntaxError("empty quoted identifier")
}
else syntaxError("unclosed quoted identifier")
}
diff --git a/test/files/neg/t6426.check b/test/files/neg/t6426.check
deleted file mode 100644
index 149f74c4de..0000000000
--- a/test/files/neg/t6426.check
+++ /dev/null
@@ -1,7 +0,0 @@
-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
deleted file mode 100644
index a27d18eb58..0000000000
--- a/test/files/neg/t6426.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-class A {
- import collection.{mutable => _, _}
-
- println(`_`.Buffer(0))
-}