summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-11-09 10:02:50 +0000
committerMartin Odersky <odersky@gmail.com>2009-11-09 10:02:50 +0000
commitc490722ae1b7a9147bcdc884e362409b4017d19f (patch)
treedff943acc82cfd98cd3247bf17f43cd91863cf94 /src
parent6f4fba9c674d403372277b46c0455f38a1da1c4e (diff)
downloadscala-c490722ae1b7a9147bcdc884e362409b4017d19f.tar.gz
scala-c490722ae1b7a9147bcdc884e362409b4017d19f.tar.bz2
scala-c490722ae1b7a9147bcdc884e362409b4017d19f.zip
Fixed #2504
Fixed #2517
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala13
2 files changed, 11 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 1e07442eee..75a6796be6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -384,7 +384,7 @@ self: Analyzer =>
}
}
- if (traceImplicits) println("typed impl for "+wildPt+"? "+info.name+":"+depoly(info.tpe)+"/"+undetParams+"/"+isPlausiblyCompatible(info.tpe, wildPt)+"/"+matchesPt(depoly(info.tpe), wildPt, List()))
+ //if (traceImplicits) println("typed impl for "+wildPt+"? "+info.name+":"+depoly(info.tpe)+"/"+undetParams+"/"+isPlausiblyCompatible(info.tpe, wildPt)+"/"+matchesPt(depoly(info.tpe), wildPt, List()))
if (isPlausiblyCompatible(info.tpe, wildPt) &&
matchesPt(depoly(info.tpe), wildPt, List()) &&
isStable(info.pre)) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index c423258e00..3e83ecf272 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -841,6 +841,8 @@ trait Infer {
false
}
+ /** Todo: Try to make isApplicable always safe (i.e. not cause TypeErrors).
+ */
private[typechecker] def isApplicableSafe(undetparams: List[Symbol], ftpe: Type,
argtpes0: List[Type], pt: Type): Boolean = {
val reportAmbiguousErrors = context.reportAmbiguousErrors
@@ -849,7 +851,12 @@ trait Infer {
isApplicable(undetparams, ftpe, argtpes0, pt)
} catch {
case ex: TypeError =>
- false
+ try {
+ isApplicable(undetparams, ftpe, argtpes0, WildcardType)
+ } catch {
+ case ex: TypeError =>
+ false
+ }
} finally {
context.reportAmbiguousErrors = reportAmbiguousErrors
}
@@ -1379,7 +1386,7 @@ trait Infer {
check(pre, bound)
case TypeRef(pre, sym, args) =>
if (sym.isAbstractType)
- patternWarning(tp, "abstract type ")
+ if (!isLocalBinding(sym)) patternWarning(tp, "abstract type ")
else if (sym.isAliasType)
check(tp.normalize, bound)
else if (sym == NothingClass || sym == NullClass || sym == AnyValClass)
@@ -1624,7 +1631,7 @@ trait Infer {
log("infer method alt "+ tree.symbol +" with alternatives "+
(alts map pre.memberType) +", argtpes = "+ argtpes +", pt = "+ pt)
- val allApplicable = alts filter (alt =>
+ var allApplicable = alts filter (alt =>
isApplicable(undetparams, followApply(pre.memberType(alt)), argtpes, pt))
// if there are multiple, drop those that use a default