summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/reference/ReferencePart.tex8
-rw-r--r--sources/scala/tools/scalac/typechecker/Analyzer.scala5
-rw-r--r--sources/scalac/symtab/Type.java4
3 files changed, 10 insertions, 7 deletions
diff --git a/doc/reference/ReferencePart.tex b/doc/reference/ReferencePart.tex
index 6f4455a71d..e8fae6419d 100644
--- a/doc/reference/ReferencePart.tex
+++ b/doc/reference/ReferencePart.tex
@@ -62,14 +62,14 @@ id ::= upper idrest
| varid
| op
| ```string chars`''
-idrest ::= {letter $|$ digit} {'_' (op | idrest)}
+idrest ::= {letter $|$ digit} [`_' op | `_' idrest]
\end{lstlisting}
There are three ways to form an identifier. First, an identifier can
start with a letter which can be followed by an arbitrary sequence of
letters and digits. This may be followed by underscore `\lstinline@_@'
characters and other string composed of either letters and digits or
-of special characeters. Second, an identifier can start with a
+of special characters. Second, an identifier can start with a
special character followed by an arbitrary sequence of special
characters. Finally, an identifier may also be formed by an arbitrary
string between back-quotes (host systems may impose some restrictions
@@ -77,11 +77,11 @@ on which strings are legal for identifiers). As usual, a longest
match rule applies. For instance, the string
\begin{lstlisting}
-big_bob++=z3
+big_bob++=`def`
\end{lstlisting}
decomposes into the three identifiers \lstinline@big_bob@, \lstinline@++=@, and
-\code{z3}. The rules for pattern matching further distinguish between
+\code{def}. The rules for pattern matching further distinguish between
{\em variable identifiers}, which start with a lower case letter, and
{\em constant identifiers}, which do not.
diff --git a/sources/scala/tools/scalac/typechecker/Analyzer.scala b/sources/scala/tools/scalac/typechecker/Analyzer.scala
index 8373a6495b..4bd10404ec 100644
--- a/sources/scala/tools/scalac/typechecker/Analyzer.scala
+++ b/sources/scala/tools/scalac/typechecker/Analyzer.scala
@@ -1974,7 +1974,7 @@ class Analyzer(global: scalac_Global, descr: AnalyzerPhase) extends Transformer(
* @return The vector of instantiated argument types, or null if error.
*/
def transformArgs(pos: int, meth: Symbol, tparams: Array[Symbol], methtype: Type, argMode: int, args: Array[Tree], pt: Type): Array[Type] = {
- //System.out.println("trans args " + meth + ArrayApply.toString(tparams) + ":" + methtype + "," + pt);//DEBUG
+ //System.out.println("trans args " + meth + ArrayApply.toString(tparams.asInstanceOf[Array[Object]]) + ":" + methtype + "," + pt);//DEBUG
val argtypes = new Array[Type](args.length);
methtype match {
case Type$MethodType(params, restp) =>
@@ -2076,6 +2076,9 @@ class Analyzer(global: scalac_Global, descr: AnalyzerPhase) extends Transformer(
}
argtypes
+ case Type.OverloadedType(alts, alttypes) if (alts.length == 1) =>
+ transformArgs(pos, alts(0), tparams, alttypes(0), argMode, args, pt)
+
case _ =>
var i = 0; while (i < args.length) {
args(i) = transform(args(i), argMode, Type.AnyType);
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index 5901fc75fa..94083d5155 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -197,8 +197,6 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
}
public static Type typeRef(Type pre, Symbol sym, Type[] args) {
- if (sym.kind == TYPE && !pre.isLegalPrefix() && !pre.isError())
- throw new Type.Malformed(pre, sym.nameString());
rebind:
if (sym.isAbstractType()) {
Symbol owner = sym.owner();
@@ -213,6 +211,8 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
"illegal cyclic reference involving " + rebind);
sym = rebind.rebindSym();
}
+ if (sym.isAbstractType() && !pre.isLegalPrefix() && !pre.isError())
+ throw new Type.Malformed(pre, sym.nameString());
if (sym.isTypeAlias()) {
Symbol[] params = sym.typeParams();
if (args.length == params.length)