diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-23 00:31:00 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-23 00:31:00 -0700 |
commit | 4e7bf2f519d3008411922737fab9050bd00535b0 (patch) | |
tree | cb1acbb67296adf9056fb82cda7bb80632235df4 /src | |
parent | 078a1c5fae09970d22b886831e36745b7f7e25db (diff) | |
parent | 186f57ab4b1611820ad6d532eaafc7b12c6994cf (diff) | |
download | scala-4e7bf2f519d3008411922737fab9050bd00535b0.tar.gz scala-4e7bf2f519d3008411922737fab9050bd00535b0.tar.bz2 scala-4e7bf2f519d3008411922737fab9050bd00535b0.zip |
Merge pull request #973 from paulp/topic/unchecked-hk
Improve unchecked warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 2f9bb24079..94dfcfa7dd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1278,8 +1278,10 @@ trait Infer { } else { for (arg <- args) { if (sym == ArrayClass) check(arg, bound) - else if (arg.typeArgs.nonEmpty) () // avoid spurious warnings with higher-kinded types - else if (sym == NonLocalReturnControlClass) () // no way to suppress unchecked warnings on try/catch + // avoid spurious warnings with higher-kinded types + else if (arg.typeArgs exists (_.typeSymbol.isTypeParameterOrSkolem)) () + // no way to suppress unchecked warnings on try/catch + else if (sym == NonLocalReturnControlClass) () else arg match { case TypeRef(_, sym, _) if isLocalBinding(sym) => ; @@ -1423,7 +1425,7 @@ trait Infer { ) // Intentionally *not* using `Type#typeSymbol` here, which would normalize `tp` - // and collect symbols from the result type of any resulting `PolyType`s, which + // and collect symbols from the result type of any resulting `PolyType`s, which // are not free type parameters of `tp`. // // Contrast with `isFreeTypeParamNoSkolem`. @@ -1456,7 +1458,7 @@ trait Infer { def inferExprAlternative(tree: Tree, pt: Type) = tree.tpe match { case OverloadedType(pre, alts) => tryTwice { isSecondTry => val alts0 = alts filter (alt => isWeaklyCompatible(pre.memberType(alt), pt)) - val noAlternatives = alts0.isEmpty + val noAlternatives = alts0.isEmpty val alts1 = if (noAlternatives) alts else alts0 //println("trying "+alts1+(alts1 map (_.tpe))+(alts1 map (_.locationString))+" for "+pt) @@ -1614,7 +1616,7 @@ trait Infer { val saved = context.state var fallback = false context.setBufferErrors() - // We cache the current buffer because it is impossible to + // We cache the current buffer because it is impossible to // distinguish errors that occurred before entering tryTwice // and our first attempt in 'withImplicitsDisabled'. If the // first attempt fails we try with implicits on *and* clean |