@@ -28,7 +28,6 @@ trait Variances {
28
28
* TODO - eliminate duplication with varianceInType
29
29
*/
30
30
class VarianceValidator extends InternalTraverser {
31
- private [this ] val escapedLocals = mutable.HashSet [Symbol ]()
32
31
// A flag for when we're in a refinement, meaning method parameter types
33
32
// need to be checked.
34
33
private [this ] var inRefinement = false
@@ -38,17 +37,6 @@ trait Variances {
38
37
try body finally inRefinement = saved
39
38
}
40
39
41
- /** Is every symbol in the owner chain between `site` and the owner of `sym`
42
- * either a term symbol or private[this]? If not, add `sym` to the set of
43
- * escaped locals.
44
- * @pre sym.isLocalToThis
45
- */
46
- @ tailrec final def checkForEscape (sym : Symbol , site : Symbol ): Unit = {
47
- if (site == sym.owner || site == sym.owner.moduleClass || site.hasPackageFlag) () // done
48
- else if (site.isTerm || site.isPrivateLocal) checkForEscape(sym, site.owner) // ok - recurse to owner
49
- else escapedLocals += sym
50
- }
51
-
52
40
protected def issueVarianceError (base : Symbol , sym : Symbol , required : Variance , tpe : Type ): Unit = ()
53
41
54
42
// Flip occurrences of type parameters and parameters, unless
@@ -62,10 +50,9 @@ trait Variances {
62
50
)
63
51
64
52
// Is `sym` is local to a term or is private[this] or protected[this]?
65
- def isExemptFromVariance (sym : Symbol ): Boolean = ! sym.owner.isClass || (
66
- (sym.isLocalToThis || sym.isSuperAccessor) // super accessors are implicitly local #4345
67
- && ! escapedLocals(sym)
68
- )
53
+ def isExemptFromVariance (sym : Symbol ): Boolean =
54
+ // super accessors are implicitly local #4345
55
+ ! sym.owner.isClass || sym.isLocalToThis || sym.isSuperAccessor
69
56
70
57
private object ValidateVarianceMap extends VariancedTypeMap {
71
58
private [this ] var base : Symbol = _
0 commit comments