*** empty log message ***

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@870 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
odersky 2003-06-24 16:42:49 +00:00
parent b0d7619920
commit 68270aa813
14 changed files with 23 additions and 27 deletions

View File

@ -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());

View File

@ -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;

View File

@ -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]);

View File

@ -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 + " " +

View File

@ -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;

View File

@ -1,4 +1,4 @@
module test {
object test {
class List[+a] {
def ::[b >: a](x: b): List[b] = new Cons(x, this);
}

View File

@ -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;

View File

@ -1,4 +1,4 @@
module M {
object M {
val Tuple2(Tuple2(x, y), _) = Tuple2(Tuple2(1, 2), 3);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1,4 +1,4 @@
module test {
object test {
class List[+a] {
def ::[b >: a](x: b): List[b] = new Cons(x, this);
}

View File

@ -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;

View File

@ -1,4 +1,4 @@
module M {
object M {
val Tuple2(Tuple2(x, y), _) = Tuple2(Tuple2(1, 2), 3);