diff options
27 files changed, 107 insertions, 241 deletions
diff --git a/doc/reference/ScalaReference.tex b/doc/reference/ScalaReference.tex index a53c8798c5..b0b076358e 100644 --- a/doc/reference/ScalaReference.tex +++ b/doc/reference/ScalaReference.tex @@ -1885,24 +1885,21 @@ $t$. \syntax\begin{lstlisting} FunDef ::= this ParamClause `=' ConstrExpr ConstrExpr ::= this ArgumentExpr - | `{' {BlockStat `;'} ConstrExpr `}' + | `{' this ArgumentExpr {`;' BlockStat} `}' \end{lstlisting} A class may have additional constructors besides the primary constructor. These are defined by constructor definitions of the form -~\lstinline@def this($ps\,$) = $e$@. Such a definition introduces an additional -constructor for the enclosing class, with parameters as given in the -formal parameter list $ps$, and whose evaluation is defined by -the constructor expression $e$. The scope of each formal -parameter is the constructor expression $e$. A constructor -expression is either a self constructor invocation \lstinline@this($\args\,$)@ -or a block which ends in a constructor expression. In terms of -visibility rules, constructor definitions are conceptually outside -their enclosing class. Hence, they can access neither value -parameters nor members of the enclosing class by simple name, and the -value \code{this} refers to an object of the class enclosing the class -of the object being constructed. However, constructor definitions can -access type parameters of the enclosing class. +~\lstinline@def this($ps\,$) = $e$@. Such a definition introduces an +additional constructor for the enclosing class, with parameters as +given in the formal parameter list $ps$, and whose evaluation is +defined by the constructor expression $e$. The scope of each formal +parameter is the constructor expression $e$. A constructor expression +is either a self constructor invocation \lstinline@this($\args\,$)@ or +a block which begins with a self constructor invocation. Neither the +signature, nor the self constructor invocation of a constructor +definition may refer to \verb@this@, or refer to `value parameters or +members of the enclosing class by simple name. If there are auxiliary constructors of a class $C$, they define together with $C$'s primary constructor an overloaded constructor @@ -1923,22 +1920,22 @@ type parameters. \example Consider the class definition \begin{lstlisting} -class LinkedList[a <: AnyRef](x: a, xs: LinkedList[a]) { - var head = x; - var tail = xs; +class LinkedList[a]() { + var head = _; + var tail = null; def isEmpty = tail != null; - def this() = this(null, null); - def this(x: a) = { val empty = new LinkedList(); this(x, empty) } + def this(head: a) = { this(); this.head = head; } + def this(head: a, tail: List[a]) = { this(head); this.tail = tail } } \end{lstlisting} This defines a class \code{LinkedList} with an overloaded constructor of type \begin{lstlisting} -[a <: AnyRef](x: a, xs: LinkList[a]): LinkedList[a] $\overload$ [a <: AnyRef](): LinkedList[a] $\overload$ -[a <: AnyRef](x: a): LinkedList[a] . +[a <: AnyRef](x: a): LinkedList[a] $\overload$ +[a <: AnyRef](x: a, xs: LinkList[a]): LinkedList[a] . \end{lstlisting} -The second constructor alternative constructs an empty list, while the -third one constructs a list with one element. +The second constructor alternative constructs an singleton list, while the +third one constructs a list with a given head and tail. \subsection{Case Classes} \label{sec:case-classes} @@ -4258,7 +4255,7 @@ grammar. | TemplateBody | ConstrExpr ::= this ArgumentExpr - | `{' {BlockStat `;'} ConstrExpr `}' + | `{' this ArgumentExpr {`;' BlockStat} `}' CompilationUnit ::= [package QualId `;'] {TopStat `;'} TopStat TopStat ::= {Modifier} ClsDef diff --git a/sources/scalac/ast/parser/Parser.java b/sources/scalac/ast/parser/Parser.java index 4f105b5369..6aee3fc844 100644 --- a/sources/scalac/ast/parser/Parser.java +++ b/sources/scalac/ast/parser/Parser.java @@ -423,26 +423,6 @@ public class Parser implements Tokens { } } - /** Convert this(...) application to constructor invocation - */ - Tree convertToSelfConstr(Tree t) { - switch (t) { - case Block(Tree[] stats): - if (stats.length > 0) { - stats[stats.length - 1] = convertToSelfConstr(stats[stats.length - 1]); - return t; - } - break; - case Apply(Tree fn, Tree[] args): - switch (fn) { - case This(TypeNames.EMPTY): - return make.Apply( - t.pos, make.Ident(t.pos, Names.CONSTRUCTOR), args); - } - } - return syntaxError(t.pos, "class constructor expected", false); - } - /** Complete unapplied constructor with `()' arguments */ Tree applyConstr(Tree t) { @@ -1779,7 +1759,7 @@ public class Parser implements Tokens { return make.DefDef( pos, mods, Names.CONSTRUCTOR, Tree.AbsTypeDef_EMPTY_ARRAY, vparams, Tree.Empty, - convertToSelfConstr(expr())); + constrExpr()); } else { Name name = ident(); AbsTypeDef[] tparams = typeParamClauseOpt(false); @@ -1794,6 +1774,35 @@ public class Parser implements Tokens { } } + /** ConstrExpr ::= SelfInvocation + * | `{' SelfInvocation {`;' BlockStat} `}' + * SelfInvocation ::= this ArgumentExpr + */ + Tree constrExpr() { + if (s.token == LBRACE) { + int pos = s.skipToken(); + TreeList stats = new TreeList(); + stats.append(selfInvocation()); + if (s.token == SEMI) { + s.nextToken(); + stats = blockStatSeq(stats); + } + accept(RBRACE); + return make.Block(pos, stats); + } else { + return selfInvocation(); + } + } + + /** SelfInvocation ::= this ArgumentExprs + */ + Tree selfInvocation() { + int pos = s.pos; + accept(THIS); + return make.Apply( + s.pos, make.Ident(pos, Names.CONSTRUCTOR, argumentExprs())); + } + /** TypeDef ::= Id `=' Type * TypeDcl ::= Id TypeBounds */ diff --git a/sources/scalac/symtab/EntryTags.java b/sources/scalac/symtab/EntryTags.java index 236733b8bc..71df3f73ff 100644 --- a/sources/scalac/symtab/EntryTags.java +++ b/sources/scalac/symtab/EntryTags.java @@ -65,8 +65,5 @@ public interface EntryTags { // flag encodings - int COVARflag = 1, - CONTRAVARflag = 2, - REPEATEDflag = 4, - DEFflag = 8; + int REPEATEDflag = 4, DEFflag = 8; } diff --git a/sources/scalac/symtab/Modifiers.java b/sources/scalac/symtab/Modifiers.java index 242e6c64ce..78c7e81214 100644 --- a/sources/scalac/symtab/Modifiers.java +++ b/sources/scalac/symtab/Modifiers.java @@ -42,7 +42,9 @@ public interface Modifiers { int STABLE = 0x00800000; // functions that are assumed to be stable // (typically, access methods for valdefs) - int CAPTURED = 0x01000000; // variables is accessed from nested function. + int CAPTURED = 0x01000000; // variables is accessed from + // nested function. Set by LambdaLift + int INCONSTRUCTOR = 0x01000000; // transient flag for Analyzer int CASEACCESSOR = 0x02000000; // function is a case constructor int ACCESSOR = 0x04000000; // function is an access function for a diff --git a/sources/scalac/symtab/classfile/Pickle.java b/sources/scalac/symtab/classfile/Pickle.java index 3d19855e90..6b58cbf72c 100644 --- a/sources/scalac/symtab/classfile/Pickle.java +++ b/sources/scalac/symtab/classfile/Pickle.java @@ -183,7 +183,7 @@ public class Pickle implements Kinds, Modifiers, EntryTags { Type ptype = vparams[i].type(); putType(ptype); int pflags = vparams[i].flags; - if ((pflags & (COVARIANT | CONTRAVARIANT | REPEATED | DEF)) != 0) + if ((pflags & (REPEATED | DEF)) != 0) putEntry(new FlagsAndType(encodeFlags(pflags), ptype)); } break; @@ -388,7 +388,7 @@ public class Pickle implements Kinds, Modifiers, EntryTags { for (int i = 0; i < vparams.length; i++) { Type ptype = vparams[i].type(); int pflags = vparams[i].flags; - if ((pflags & (COVARIANT | CONTRAVARIANT | REPEATED | DEF)) != 0) + if ((pflags & (REPEATED | DEF)) != 0) writeRef(new FlagsAndType(encodeFlags(pflags), ptype)); else writeRef(ptype); @@ -443,8 +443,6 @@ public class Pickle implements Kinds, Modifiers, EntryTags { private static int encodeFlags(int flags) { int n = 0; - if ((flags & COVARIANT) != 0) n |= COVARflag; - if ((flags & CONTRAVARIANT) != 0) n |= CONTRAVARflag; if ((flags & REPEATED) != 0) n |= REPEATEDflag; if ((flags & DEF) != 0) n |= DEFflag; return n; diff --git a/sources/scalac/symtab/classfile/UnPickle.java b/sources/scalac/symtab/classfile/UnPickle.java index 22fa3fba78..7274bfa448 100644 --- a/sources/scalac/symtab/classfile/UnPickle.java +++ b/sources/scalac/symtab/classfile/UnPickle.java @@ -426,8 +426,6 @@ public class UnPickle implements Kinds, Modifiers, EntryTags { private static int decodeFlags(int n) { int flags = 0; - if ((n & COVARflag) != 0) flags |= COVARIANT; - if ((n & CONTRAVARflag) != 0) flags |= CONTRAVARIANT; if ((n & REPEATEDflag) != 0) flags |= REPEATED; if ((n & DEFflag) != 0) flags |= DEF; return flags; diff --git a/sources/scalac/transformer/LambdaLift.java b/sources/scalac/transformer/LambdaLift.java index c12b7c8a79..61eb290c40 100644 --- a/sources/scalac/transformer/LambdaLift.java +++ b/sources/scalac/transformer/LambdaLift.java @@ -473,7 +473,7 @@ public class LambdaLift extends OwnerTransformer for (int i = 0; i < params.length; i++) { params[i] = freevars[i].cloneSymbol(owner); params[i].pos = owner.pos; - params[i].flags &= CAPTURED; + params[i].flags &= ~CAPTURED; params[i].flags |= PARAM | SYNTHETIC; params[i].setInfo(freevars[i].type()); } diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java index 8d05fbc465..c456a33f7a 100644 --- a/sources/scalac/typechecker/Analyzer.java +++ b/sources/scalac/typechecker/Analyzer.java @@ -213,6 +213,11 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { /** Check that `sym' is accessible as a member of tree `site' in current context. */ Type checkAccessible(int pos, Symbol sym, Type symtype, Tree site) { + if ((sym.owner().flags & INCONSTRUCTOR) != 0 && + !(sym.kind == TYPE && sym.isParameter())) { + error(pos, sym + " cannot be accessed from constructor"); + return Type.ErrorType; + } switch (symtype) { case OverloadedType(Symbol[] alts, Type[] alttypes): int nacc = 0; @@ -1006,30 +1011,24 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { Symbol[] tparamSyms; Symbol[][] vparamSyms; Type restype; - if (name == Names.CONSTRUCTOR) { - Context prevContext = context; - Symbol clazz = context.enclClass.owner; - context = context.enclClass.outer.outer; - pushContext(tree, sym, new Scope(context.scope)); - tparamSyms = enterParams(tparams); - vparamSyms = enterParams(vparams); - restype = clazz.type().subst( - clazz.typeParams(), tparamSyms); - context = prevContext; + pushContext(tree, sym, new Scope(context.scope)); + if (name == Names.CONSTRUCTOR) + context.enclClass.owner.flags |= INCONSTRUCTOR; + tparamSyms = enterParams(tparams); + vparamSyms = enterParams(vparams); + if (tpe != Tree.Empty) { + ((DefDef) tree).tpe = tpe = transform(tpe, TYPEmode); + restype = tpe.type; + } else if (name == Names.CONSTRUCTOR) { + restype = context.enclClass.owner.type().subst( + context.enclClass.owner.typeParams(), tparamSyms); + context.enclClass.owner.flags &= ~INCONSTRUCTOR; } else { - pushContext(tree, sym, new Scope(context.scope)); - tparamSyms = enterParams(tparams); - vparamSyms = enterParams(vparams); - if (tpe != Tree.Empty) { - ((DefDef) tree).tpe = tpe = transform(tpe, TYPEmode); - restype = tpe.type; - } else { - ((DefDef) tree).rhs = rhs = transform(rhs, EXPRmode); - restype = rhs.type; - } - restype = checkNoEscape(tpe.pos, restype); - popContext(); + ((DefDef) tree).rhs = rhs = transform(rhs, EXPRmode); + restype = rhs.type; } + restype = checkNoEscape(tpe.pos, restype); + popContext(); owntype = makeMethodType(tparamSyms, vparamSyms, restype); //System.out.println("methtype " + name + ":" + owntype);//DEBUG break; @@ -1657,10 +1656,9 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { argpts[i] = formals[i].subst(tparams, targs); // transform arguments with [targs/tparams]formals as prototypes - for (int i = 0; i < args.length; i++) { + for (int i = 0; i < args.length; i++) args[i] = transform( args[i], argMode | POLYmode, formals[i].subst(tparams, targs)); - } // targs1: same as targs except that every AnyType is mapped to // formal parameter type. @@ -1827,26 +1825,20 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { .setType(definitions.UNIT_TYPE); case DefDef(_, Name name, Tree.AbsTypeDef[] tparams, Tree.ValDef[][] vparams, Tree tpe, Tree rhs): - Context prevContext = context; - Symbol enclClass = context.enclClass.owner; - if (name == Names.CONSTRUCTOR) { - context = context.enclClass.outer.outer; - } pushContext(tree, sym, new Scope(context.scope)); reenterParams(tparams, vparams, sym.type()); + if (name == Names.CONSTRUCTOR) + context.enclClass.owner.flags |= INCONSTRUCTOR; Tree.AbsTypeDef[] tparams1 = transform(tparams); Tree.ValDef[][] vparams1 = transform(vparams); Tree tpe1 = (tpe == Tree.Empty) ? gen.mkType(tree.pos, sym.type().resultType()) : transform(tpe, TYPEmode); - Tree rhs1 = rhs; - if (name == Names.CONSTRUCTOR) { - context.constructorClass = enclClass; - rhs1 = transform(rhs, CONSTRmode, tpe1.type); - } - else if (rhs != Tree.Empty) - rhs1 = transform(rhs, EXPRmode, tpe1.type); - context = prevContext; + Tree rhs1 = transform( + rhs, + (name == Names.CONSTRUCTOR) ? CONSTRmode : EXPRmode, + tpe1.type); + context.enclClass.owner.flags &= ~INCONSTRUCTOR; sym.flags |= LOCKED; checkNonCyclic(tree.pos, tpe1.type); sym.flags &= ~LOCKED; @@ -1894,19 +1886,26 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { case Block(Tree[] stats): pushContext(tree, context.owner, new Scope(context.scope)); - int lastmode = mode & ~FUNmode; Tree[] stats1 = desugarize.Statements(stats, true); enterSyms(stats1); context.imports = context.outer.imports; - for (int i = 0; i < stats1.length - 1; i++) - stats1[i] = transform(stats1[i], EXPRmode); - Type owntype; - if (stats1.length > 0) { - stats1[stats1.length - 1] = - transform(stats1[stats1.length - 1], lastmode, pt); - owntype = checkNoEscape(tree.pos, stats1[stats1.length - 1].type); + if (mode == CONSTRmode) { + stats1[0] = transform(stats1[0], mode, pt); + context.enclClass.owner.flags &= ~INCONSTRUCTOR; + for (int i = 1; i < stats1.length; i++) + stats1[i] = transform(stats1[i], EXPRmode); + owntype = stats1[0].type; } else { - owntype = definitions.UNIT_TYPE; + for (int i = 0; i < stats1.length - 1; i++) + stats1[i] = transform(stats1[i], EXPRmode); + Type owntype; + if (stats1.length > start) { + stats1[stats1.length - 1] = + transform(stats1[stats1.length - 1], EXPRmode, pt); + owntype = checkNoEscape(tree.pos, stats1[stats1.length - 1].type); + } else { + owntype = definitions.UNIT_TYPE; + } } popContext(); return copy.Block(tree, stats1) @@ -2219,7 +2218,7 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { fn1.type = Type.PolyType( tsym.typeParams(), fn1.type); } - //System.out.println(TreeInfo.methSymbol(fn1) + " --> " + fn1.type + " of " + fn1);//DEBUG + //System.out.println(TreeInfo.methSymbol(fn1) + ":" + tp + " --> " + fn1.type + " of " + fn1);//DEBUG selfcc = TreeInfo.isSelfConstrCall(fn0); } break; @@ -2386,10 +2385,8 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { case Ident(Name name): if (name == Names.CONSTRUCTOR) { assert (mode & CONSTRmode) != 0 : tree; - return copy.Ident(tree, context.constructorClass) - .setType(context.constructorClass.nextType()); - /* - */ + return copy.Ident(tree, context.enclClass.owner) + .setType(context.enclClass.owner.type()); } else if (((mode & (PATTERNmode | FUNmode)) == PATTERNmode) && name.isVariable()) { diff --git a/sources/scalac/typechecker/Context.java b/sources/scalac/typechecker/Context.java index 61bf0a8299..4c5f761c1f 100644 --- a/sources/scalac/typechecker/Context.java +++ b/sources/scalac/typechecker/Context.java @@ -20,7 +20,6 @@ public class Context { Context enclClass = this; // The next outer context whose tree // is a class template int variance; // Variance relative to enclosing class. - Symbol constructorClass; // Class for auxiliary constructor public Context() {} @@ -30,14 +29,13 @@ public class Context { public Context(Tree tree, Symbol owner, Scope scope, Context outer) { this.tree = tree; - this.owner = owner; +Pa this.owner = owner; this.scope = scope; this.imports = outer.imports; if (tree instanceof Tree.Template || tree instanceof Tree.CompoundType) this.enclClass = this; else this.enclClass = outer.enclClass; this.variance = outer.variance; - this.constructorClass = outer.constructorClass; this.outer = outer; } diff --git a/test/files/neg/bug136.scala b/test/files/neg/bug136.scala deleted file mode 100644 index 205e12d704..0000000000 --- a/test/files/neg/bug136.scala +++ /dev/null @@ -1,10 +0,0 @@ -class Foo; -class Bar: Foo { - val bar: Bar = null; - val foo1: Foo = this; - val foo2: Foo = bar; -} -object bar: Foo { - val foo1: Foo = this; - val foo2: Foo = bar; -} diff --git a/test/files/neg/bug139.check b/test/files/neg/bug139.check deleted file mode 100644 index 8f8d7421a2..0000000000 --- a/test/files/neg/bug139.check +++ /dev/null @@ -1,5 +0,0 @@ -bug139.scala:5: error overriding type T in class A; - type T in class B may not be parameterized - type T[A] = Int; - ^ -one error found diff --git a/test/files/neg/bug139.scala b/test/files/neg/bug139.scala deleted file mode 100644 index 433ba7bf6f..0000000000 --- a/test/files/neg/bug139.scala +++ /dev/null @@ -1,6 +0,0 @@ -abstract class A { - type T; -} -class B extends A { - type T[A] = Int; -} diff --git a/test/files/neg/bug140.check b/test/files/neg/bug140.check deleted file mode 100644 index f8415be2f0..0000000000 --- a/test/files/neg/bug140.check +++ /dev/null @@ -1,4 +0,0 @@ -bug140.scala:4: object bar does not implement Foo -object bar: Foo { - ^ -one error found diff --git a/test/files/neg/bug140.scala b/test/files/neg/bug140.scala deleted file mode 100644 index 8bdd5f2b6d..0000000000 --- a/test/files/neg/bug140.scala +++ /dev/null @@ -1,7 +0,0 @@ -class Foo { - def foo: Int = 0 -} -object bar: Foo { - bar.foo; - def main(args: Array[String]): Unit = (); -} diff --git a/test/files/neg/bug143.check b/test/files/neg/bug143.check deleted file mode 100644 index 479966107a..0000000000 --- a/test/files/neg/bug143.check +++ /dev/null @@ -1,4 +0,0 @@ -bug143.scala:7: illegal cyclic reference involving type Inner - override type Inner = Alias; - ^ -one error found diff --git a/test/files/neg/bug143.scala b/test/files/neg/bug143.scala deleted file mode 100644 index 9414d426d5..0000000000 --- a/test/files/neg/bug143.scala +++ /dev/null @@ -1,8 +0,0 @@ -abstract class Foo { - type Inner; - type Alias = Inner; -} - -class Bar extends Foo { - override type Inner = Alias; -} diff --git a/test/files/pos/bug137.scala b/test/files/pos/bug137.scala deleted file mode 100644 index 79eb6e67f8..0000000000 --- a/test/files/pos/bug137.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - type Two[A] = Tuple2[A, A]; - type TwoInt = Two[Int]; -} diff --git a/test/files/pos/starargs.scala b/test/files/pos/starargs.scala deleted file mode 100644 index 40b9124637..0000000000 --- a/test/files/pos/starargs.scala +++ /dev/null @@ -1,17 +0,0 @@ -case class C[a](x: a*) { - def elems: Seq[a] = x; -} - -object Test with Executable { - def foo(x: int*) = { - C(x: _*); - } - System.out.println(foo(1, 2, 3).elems); - System.out.println(foo(List(1, 2, 3): _*).elems); - System.out.println(new C(1, 2, 3).elems); - val xs = List(1, 2, 3); - System.out.println(new C(xs: _*).elems); -} - - - diff --git a/test/neg/bug136.scala b/test/neg/bug136.scala deleted file mode 100644 index 205e12d704..0000000000 --- a/test/neg/bug136.scala +++ /dev/null @@ -1,10 +0,0 @@ -class Foo; -class Bar: Foo { - val bar: Bar = null; - val foo1: Foo = this; - val foo2: Foo = bar; -} -object bar: Foo { - val foo1: Foo = this; - val foo2: Foo = bar; -} diff --git a/test/neg/bug139.check b/test/neg/bug139.check deleted file mode 100644 index 8f8d7421a2..0000000000 --- a/test/neg/bug139.check +++ /dev/null @@ -1,5 +0,0 @@ -bug139.scala:5: error overriding type T in class A; - type T in class B may not be parameterized - type T[A] = Int; - ^ -one error found diff --git a/test/neg/bug139.scala b/test/neg/bug139.scala deleted file mode 100644 index 433ba7bf6f..0000000000 --- a/test/neg/bug139.scala +++ /dev/null @@ -1,6 +0,0 @@ -abstract class A { - type T; -} -class B extends A { - type T[A] = Int; -} diff --git a/test/neg/bug140.check b/test/neg/bug140.check deleted file mode 100644 index f8415be2f0..0000000000 --- a/test/neg/bug140.check +++ /dev/null @@ -1,4 +0,0 @@ -bug140.scala:4: object bar does not implement Foo -object bar: Foo { - ^ -one error found diff --git a/test/neg/bug140.scala b/test/neg/bug140.scala deleted file mode 100644 index 8bdd5f2b6d..0000000000 --- a/test/neg/bug140.scala +++ /dev/null @@ -1,7 +0,0 @@ -class Foo { - def foo: Int = 0 -} -object bar: Foo { - bar.foo; - def main(args: Array[String]): Unit = (); -} diff --git a/test/neg/bug143.check b/test/neg/bug143.check deleted file mode 100644 index 479966107a..0000000000 --- a/test/neg/bug143.check +++ /dev/null @@ -1,4 +0,0 @@ -bug143.scala:7: illegal cyclic reference involving type Inner - override type Inner = Alias; - ^ -one error found diff --git a/test/neg/bug143.scala b/test/neg/bug143.scala deleted file mode 100644 index 9414d426d5..0000000000 --- a/test/neg/bug143.scala +++ /dev/null @@ -1,8 +0,0 @@ -abstract class Foo { - type Inner; - type Alias = Inner; -} - -class Bar extends Foo { - override type Inner = Alias; -} diff --git a/test/pos/bug137.scala b/test/pos/bug137.scala deleted file mode 100644 index 79eb6e67f8..0000000000 --- a/test/pos/bug137.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - type Two[A] = Tuple2[A, A]; - type TwoInt = Two[Int]; -} diff --git a/test/pos/starargs.scala b/test/pos/starargs.scala deleted file mode 100644 index 40b9124637..0000000000 --- a/test/pos/starargs.scala +++ /dev/null @@ -1,17 +0,0 @@ -case class C[a](x: a*) { - def elems: Seq[a] = x; -} - -object Test with Executable { - def foo(x: int*) = { - C(x: _*); - } - System.out.println(foo(1, 2, 3).elems); - System.out.println(foo(List(1, 2, 3): _*).elems); - System.out.println(new C(1, 2, 3).elems); - val xs = List(1, 2, 3); - System.out.println(new C(xs: _*).elems); -} - - - |