@@ -109,13 +109,6 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
109
109
try op finally noCheckNews = saved
110
110
}
111
111
112
- /** The set of all private class variables that are assigned
113
- * when selected with a qualifier other than the `this` of the owning class.
114
- * Such variables can contain only invariant type parameters in
115
- * their types.
116
- */
117
- private var privateVarsSetNonLocally : Set [Symbol ] = Set ()
118
-
119
112
def isCheckable (t : New ): Boolean = ! inJavaAnnot && ! noCheckNews.contains(t)
120
113
121
114
/** Mark parameter accessors that are aliases of like-named parameters
@@ -156,8 +149,6 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
156
149
private def processMemberDef (tree : Tree )(using Context ): tree.type = {
157
150
val sym = tree.symbol
158
151
Checking .checkValidOperator(sym)
159
- if sym.isClass then
160
- VarianceChecker .check(tree, privateVarsSetNonLocally)
161
152
sym.transformAnnotations(transformAnnot)
162
153
sym.defTree = tree
163
154
tree
@@ -266,14 +257,6 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
266
257
}
267
258
}
268
259
269
- /** Update privateVarsSetNonLocally is symbol is a private variable
270
- * that is selected from something other than `this` when assigned
271
- */
272
- private def markVarAccess (tree : Tree , qual : Tree )(using Context ): Unit =
273
- val sym = tree.symbol
274
- if sym.is(Private , butNot = Local ) && ! sym.isCorrectThisType(qual.tpe) then
275
- privateVarsSetNonLocally += sym
276
-
277
260
def checkNoConstructorProxy (tree : Tree )(using Context ): Unit =
278
261
if tree.symbol.is(ConstructorProxy ) then
279
262
report.error(em " constructor proxy ${tree.symbol} cannot be used as a value " , tree.srcPos)
@@ -412,6 +395,7 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
412
395
registerIfHasMacroAnnotations(tree)
413
396
val sym = tree.symbol
414
397
if (sym.isClass)
398
+ VarianceChecker .check(tree)
415
399
annotateExperimental(sym)
416
400
checkMacroAnnotation(sym)
417
401
if sym.isOneOf(GivenOrImplicit ) then
@@ -488,9 +472,6 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
488
472
case tpe => tpe
489
473
}
490
474
)
491
- case Assign (lhs @ Select (qual, _), _) =>
492
- markVarAccess(lhs, qual)
493
- super .transform(tree)
494
475
case Typed (Ident (nme.WILDCARD ), _) =>
495
476
withMode(Mode .Pattern )(super .transform(tree))
496
477
// The added mode signals that bounds in a pattern need not
0 commit comments