summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sources/scalac/ast/parser/Parser.java8
-rw-r--r--sources/scalac/ast/parser/Scanner.java1
-rw-r--r--sources/scalac/typechecker/Infer.java3
-rw-r--r--sources/scalac/typechecker/RefCheck.java4
-rw-r--r--test/files/neg/stable.scala2
-rw-r--r--test/files/pos/infer.scala2
-rw-r--r--test/files/pos/infer2.scala2
-rw-r--r--test/files/pos/patterns3.scala4
-rw-r--r--test/files/run/Course-2002-05.scala10
-rw-r--r--test/files/run/arrays.scala4
-rw-r--r--test/neg/stable.scala2
-rw-r--r--test/pos/infer.scala2
-rw-r--r--test/pos/infer2.scala2
-rw-r--r--test/pos/patterns3.scala4
14 files changed, 23 insertions, 27 deletions
diff --git a/sources/scalac/ast/parser/Parser.java b/sources/scalac/ast/parser/Parser.java
index eb5d31426c..99610f4843 100644
--- a/sources/scalac/ast/parser/Parser.java
+++ b/sources/scalac/ast/parser/Parser.java
@@ -1637,26 +1637,22 @@ public class Parser implements Tokens {
/** ObjectDef ::= Id [`:' SimpleType] ClassTemplate
*/
Tree objectDef(int mods) {
- return make.ObjectDef(
+ return make.ModuleDef(
s.pos, mods, ident(), simpleTypedOpt(), classTemplate());
}
- /** ClassTemplate ::= `extends' Template
- * | TemplateBody
- * |
+ /** ClassTemplate ::= [`extends' Constr] {`with' Constr} [TemplateBody]
*/
Template classTemplate() {
int pos = s.pos;
if (s.token == EXTENDS) {
s.nextToken();
return template();
-/*
} else if (s.token == WITH) {
s.nextToken();
TreeList parents = new TreeList();
parents.append(scalaObjectConstr(pos));
return template(parents);
-*/
} else if (s.token == LBRACE) {
return (Template)make.Template(
pos, new Tree[]{scalaObjectConstr(pos)}, templateBody());
diff --git a/sources/scalac/ast/parser/Scanner.java b/sources/scalac/ast/parser/Scanner.java
index e2a95d3dbf..7d180b3ef3 100644
--- a/sources/scalac/ast/parser/Scanner.java
+++ b/sources/scalac/ast/parser/Scanner.java
@@ -491,7 +491,6 @@ public class Scanner extends TokenData {
name = Name.fromAscii(buf, start, end - start);
if (name.index <= maxKey) {
token = key[name.index];
- if (token == OBJECT1) token = OBJECT; //todo: elim
}
else
token = IDENTIFIER;
diff --git a/sources/scalac/typechecker/Infer.java b/sources/scalac/typechecker/Infer.java
index 0289eca05a..f413322284 100644
--- a/sources/scalac/typechecker/Infer.java
+++ b/sources/scalac/typechecker/Infer.java
@@ -981,7 +981,8 @@ public class Infer implements Modifiers, Kinds {
alts[best], alttypes[best], alts[i], alttypes[i]) +
" argument types " +
ArrayApply.toString(argtypes, "(", ",", ")") +
- " and expected result type " + pt);
+ ((pt == Type.AnyType) ? ""
+ : " and expected result type " + pt));
}
}
tree.setSymbol(alts[best]).setType(alttypes[best]);
diff --git a/sources/scalac/typechecker/RefCheck.java b/sources/scalac/typechecker/RefCheck.java
index 11486c645b..5731454a8b 100644
--- a/sources/scalac/typechecker/RefCheck.java
+++ b/sources/scalac/typechecker/RefCheck.java
@@ -258,7 +258,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds {
if (caseSeen.isCaseClass())
unit.error(
clazz.pos, "illegal combination of case " +
- caseSeen + "and case " + baseClazz + " in one object");
+ caseSeen + "and case " + baseclazz + " in one object");
else
caseSeen = baseclazz;
@@ -804,7 +804,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds {
if (sym.isLocal() && !sym.isModule() && index <= maxindex[level]) {
if (Global.instance.debug)
System.out.println(refsym[level] + ":" + refsym[level].type());
- String kind == ((sym.flags & MUTABLE) != 0) ? "variable" : "value";
+ String kind = ((sym.flags & MUTABLE) != 0) ? "variable" : "value";
unit.error(
refpos[level],
"forward reference extends over definition of " + kind + " " +
diff --git a/test/files/neg/stable.scala b/test/files/neg/stable.scala
index fc21df732b..ba051cd0e4 100644
--- a/test/files/neg/stable.scala
+++ b/test/files/neg/stable.scala
@@ -1,6 +1,6 @@
abstract class C { type T; val next: C = this }
-module test {
+object test {
val x: C = new C { type T = int };
var y: C = x;
diff --git a/test/files/pos/infer.scala b/test/files/pos/infer.scala
index adb586b73e..24871458b3 100644
--- a/test/files/pos/infer.scala
+++ b/test/files/pos/infer.scala
@@ -1,4 +1,4 @@
-module test {
+object test {
class List[+a] {
def ::[b >: a](x: b): List[b] = new Cons(x, this);
}
diff --git a/test/files/pos/infer2.scala b/test/files/pos/infer2.scala
index 5e93446cdf..66f3d76544 100644
--- a/test/files/pos/infer2.scala
+++ b/test/files/pos/infer2.scala
@@ -1,4 +1,4 @@
-module test {
+object test {
def f[a, b <: a](x: b): a = x: a;
def g[a >: b, b](x: b): a = x: a;
diff --git a/test/files/pos/patterns3.scala b/test/files/pos/patterns3.scala
index 6caa834852..001bd8989f 100644
--- a/test/files/pos/patterns3.scala
+++ b/test/files/pos/patterns3.scala
@@ -1,5 +1,5 @@
-module M {
+object M {
val Tuple2(Tuple2(x, y), _) = Tuple2(Tuple2(1, 2), 3);
-} \ No newline at end of file
+}
diff --git a/test/files/run/Course-2002-05.scala b/test/files/run/Course-2002-05.scala
index bc5e98592d..2d8a146624 100644
--- a/test/files/run/Course-2002-05.scala
+++ b/test/files/run/Course-2002-05.scala
@@ -3,7 +3,7 @@
//############################################################################
// $Id$
-module M0 {
+object M0 {
def partition[a](xs: List[a], pred: a => boolean): Pair[List[a], List[a]] = {
if (xs.isEmpty)
Pair(List(),List())
@@ -49,7 +49,7 @@ module M0 {
//############################################################################
-module M1 {
+object M1 {
def partition[a](xs: List[a], pred: a => boolean): Pair[List[a], List[a]] = {
xs.foldRight[Pair[List[a], List[a]]](Pair(List(), List())) {
(x, p) => if (pred (x)) Pair(x :: p._1, p._2) else Pair(p._1, x :: p._2)
@@ -89,7 +89,7 @@ module M1 {
//############################################################################
-module M2 {
+object M2 {
def powerset[a] (s : List[a]) : List[List[a]] = {
if (s.isEmpty)
@@ -113,7 +113,7 @@ module M2 {
//############################################################################
-module M3 {
+object M3 {
type Placement = List[Pair[int,int]];
@@ -156,7 +156,7 @@ module M3 {
//############################################################################
-module Test {
+object Test {
def main(args: Array[String]): unit = {
M0.test;
M1.test;
diff --git a/test/files/run/arrays.scala b/test/files/run/arrays.scala
index 605c3c2c4e..8d375166d3 100644
--- a/test/files/run/arrays.scala
+++ b/test/files/run/arrays.scala
@@ -5,7 +5,7 @@
//############################################################################
-module arrays {
+object arrays {
type JObject = java.lang.Object;
type JSet = java.util.Set;
@@ -146,7 +146,7 @@ module arrays {
//############################################################################
-module Test {
+object Test {
def main(args: Array[String]): Unit = {
arrays.test;
diff --git a/test/neg/stable.scala b/test/neg/stable.scala
index fc21df732b..ba051cd0e4 100644
--- a/test/neg/stable.scala
+++ b/test/neg/stable.scala
@@ -1,6 +1,6 @@
abstract class C { type T; val next: C = this }
-module test {
+object test {
val x: C = new C { type T = int };
var y: C = x;
diff --git a/test/pos/infer.scala b/test/pos/infer.scala
index adb586b73e..24871458b3 100644
--- a/test/pos/infer.scala
+++ b/test/pos/infer.scala
@@ -1,4 +1,4 @@
-module test {
+object test {
class List[+a] {
def ::[b >: a](x: b): List[b] = new Cons(x, this);
}
diff --git a/test/pos/infer2.scala b/test/pos/infer2.scala
index 5e93446cdf..66f3d76544 100644
--- a/test/pos/infer2.scala
+++ b/test/pos/infer2.scala
@@ -1,4 +1,4 @@
-module test {
+object test {
def f[a, b <: a](x: b): a = x: a;
def g[a >: b, b](x: b): a = x: a;
diff --git a/test/pos/patterns3.scala b/test/pos/patterns3.scala
index 6caa834852..001bd8989f 100644
--- a/test/pos/patterns3.scala
+++ b/test/pos/patterns3.scala
@@ -1,5 +1,5 @@
-module M {
+object M {
val Tuple2(Tuple2(x, y), _) = Tuple2(Tuple2(1, 2), 3);
-} \ No newline at end of file
+}