From 6e585e1261552c29a9d463057fd7977072bb824b Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 10 Sep 2013 00:52:10 +0200 Subject: Avoid spurious tree checker warning for higher order type params TreeCheckers is trying to find references to a) local types (term owned) or b) to type parameters from a trees that are not ancestors of the a) term or b) type param owner. Such references are ill-scoped and suggest that a tree has been transplanted without proper substitution. However, this check failed to account for higher order type parameters, as seen in the spurious warning emitted by: test/pending/pos/treecheckers/c5.scala. --- src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala index c354f8707b..3a188c0044 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala @@ -376,7 +376,7 @@ abstract class TreeCheckers extends Analyzer { val treeInfo = infoOf(tree) val treeTpe = typeOf(tree) - def isOk(sym: Symbol) = treeSym hasTransOwner sym.safeOwner + def isOk(sym: Symbol) = treeSym hasTransOwner sym.enclosingSuchThat(x => !x.isTypeParameterOrSkolem) // account for higher order type params def isEligible(sym: Symbol) = (sym ne NoSymbol) && ( sym.isTypeParameter || sym.isLocal -- cgit v1.2.3