diff options
author | Martin Odersky <odersky@gmail.com> | 2006-06-21 10:36:06 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-06-21 10:36:06 +0000 |
commit | 2933e3f3cce9221a1fbe76b434957f8affb54548 (patch) | |
tree | afce1c862f9f24d3d456a31edd1c1b0c59b7663b /src/compiler/scala/tools/nsc/typechecker | |
parent | b444420b5b136e8f6e3439c100fbcc5236e0100b (diff) | |
download | scala-2933e3f3cce9221a1fbe76b434957f8affb54548.tar.gz scala-2933e3f3cce9221a1fbe76b434957f8affb54548.tar.bz2 scala-2933e3f3cce9221a1fbe76b434957f8affb54548.zip |
Fixed test files after syntax change for closures.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 14 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 64a0c72416..f85c5040e4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -362,6 +362,7 @@ trait Contexts requires Analyzer { if (tpeCache == null) tpeCache = pre.memberType(sym) tpeCache } + override def toString = "ImplicitInfo("+name+","+pre+","+sym+")" } val NoImplicitInfo = new ImplicitInfo(null, null, null) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 82af6dbaad..3991798aa1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1163,8 +1163,10 @@ trait Typers requires Analyzer { context.undetparams = undetparams val args1 = tryTypedArgs(args map (arg => UnTyper.apply(arg))) context.reportGeneralErrors = reportGeneralErrors + def templateArgType(arg: Tree) = + new BoundedWildcardType(TypeBounds(arg.tpe, AnyClass.tpe)) val qual1 = if (args1 == null || pt.isError) qual - else adaptToMember(qual, name, MethodType(args1 map (.tpe), pt)) + else adaptToMember(qual, name, MethodType(args1 map templateArgType, pt)) val tree1 = Apply(Select(qual1, name) setPos fun.pos, args map (arg => UnTyper.apply(arg))) setPos tree.pos typed1(tree1, mode | SNDTRYmode, pt) } finally { @@ -1572,7 +1574,9 @@ trait Typers requires Analyzer { fun1.isInstanceOf[Select] && !fun1.tpe.isInstanceOf[ImplicitMethodType] && (mode & (EXPRmode | SNDTRYmode)) == EXPRmode) tryTypedApply(fun1, args) - else typedApply(fun1, args) + else { + typedApply(fun1, args) + } } case Super(qual, mix) => @@ -1785,7 +1789,7 @@ trait Typers requires Analyzer { * @returns A typed tree if the implicit info can be made to conform to `pt', EmptyTree otherwise. * @pre info.tpe does not contain an error */ - private def typedImplicit(pos: int, info: ImplicitInfo, pt: Type, isLocal: boolean): Tree = + private def typedImplicit(pos: int, info: ImplicitInfo, pt: Type, isLocal: boolean): Tree = { if (isCompatible(depoly(info.tpe), pt)) { val tree = Ident(info.name) setPos pos def fail(reason: String, sym1: Symbol, sym2: Symbol): Tree = { @@ -1799,12 +1803,14 @@ trait Typers requires Analyzer { if (settings.debug.value) log("typed implicit "+tree1+":"+tree1.tpe+", pt = "+pt); val tree2 = adapt(tree1, EXPRmode, pt) if (settings.debug.value) log("adapted implicit "+tree1.symbol+":"+tree2.tpe+" to "+pt); - if (!tree2.tpe.isError && info.sym == tree1.symbol) tree2 + if (tree2.tpe.isError) EmptyTree + else if (info.sym == tree1.symbol) tree2 else fail("syms differ: ", tree1.symbol, info.sym) } catch { case ex: TypeError => fail(ex.getMessage(), NoSymbol, NoSymbol) } } else EmptyTree + } /** Infer implicit argument or view * @param pos position for error reporting |