diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2007-08-20 15:40:50 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2007-08-20 15:40:50 +0000 |
commit | f69c8e975a7b5eee1566c63f9732a38a3f253407 (patch) | |
tree | 74964dad81ff3df0b29977656f389be3b05916c0 /src | |
parent | 62c04ef6b94ee2d8c18d220c486b3a8078873d93 (diff) | |
download | scala-f69c8e975a7b5eee1566c63f9732a38a3f253407.tar.gz scala-f69c8e975a7b5eee1566c63f9732a38a3f253407.tar.bz2 scala-f69c8e975a7b5eee1566c63f9732a38a3f253407.zip |
allow _ as wildcard higher-order type param in ...
allow _ as wildcard higher-order type param in *both* abstract type
members and type parameters (instead of just in type param)
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index c9916219b0..52f1194e60 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -115,7 +115,8 @@ trait Namers { self: Analyzer => (!prev.sym.isSourceMethod || nme.isSetterName(sym.name) || sym.owner.isPackageClass) && - !(sym.owner.isTypeParameter && sym.name.length==1 && sym.name(0)=='_')) { //@M: allow repeated use of `_' for higher-order type params + !((sym.owner.isTypeParameter || sym.owner.isAbstractType) + && sym.name.length==1 && sym.name(0)=='_')) { //@M: allow repeated use of `_' for higher-order type params doubleDefError(sym.pos, prev.sym) sym setInfo ErrorType } else context.scope enter sym @@ -235,7 +236,7 @@ trait Namers { self: Analyzer => class LazyPolyType(tparams: List[Tree], restp: Type, owner: Tree, ownerSym: Symbol, ctx: Context) extends LazyType { //@M override val typeParams: List[Symbol]= tparams map (_.symbol) //@M override def complete(sym: Symbol) { - if(ownerSym.isAbstractType) //@M an abstract type's type parameters are entered + if(ownerSym.isAbstractType) //@M an abstract type's type parameters are entered -- TODO: change to isTypeMember ? new Namer(ctx.makeNewScope(owner, ownerSym)).enterSyms(tparams) //@M restp.complete(sym) } @@ -251,7 +252,7 @@ trait Namers { self: Analyzer => //@M! TypeDef's type params are handled differently //@M e.g., in [A[x <: B], B], A and B are entered first as both are in scope in the definition of x //@M x is only in scope in `A[x <: B]' - if(!sym.isAbstractType) //@M + if(!sym.isAbstractType) //@M TODO: change to isTypeMember ? new Namer(context.makeNewScope(tree, sym)).enterSyms(tparams) ltype = new LazyPolyType(tparams, ltype, tree, sym, context) //@M if (sym.isTerm) skolemize(tparams) @@ -665,11 +666,10 @@ trait Namers { self: Analyzer => //@M! an abstract type definition (abstract type member/type parameter) may take type parameters, which are in scope in its bounds private def typeDefSig(tpsym: Symbol, tparams: List[TypeDef], rhs: Tree) = { val tparamSyms = typer.reenterTypeParams(tparams) //@M make tparams available in scope (just for this abstypedef) - var tp = typer.typedType(rhs).tpe - tp match { + val tp = typer.typedType(rhs).tpe match { case TypeBounds(lt, rt) if (lt.isError || rt.isError) => - tp = TypeBounds(AllClass.tpe, AnyClass.tpe) - case _ => + TypeBounds(AllClass.tpe, AnyClass.tpe) + case tp => tp } parameterizedType(tparamSyms, tp) //@M } |