@@ -16,6 +16,7 @@ import ContextFunctionResults.annotateContextResults
1616import config .Printers .typr
1717import util .SrcPos
1818import reporting ._
19+ import NameKinds .WildcardParamName
1920
2021object PostTyper {
2122 val name : String = " posttyper"
@@ -280,8 +281,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
280281 ctx
281282 super .transform(tree)(using gadtCtx)
282283 case tree : Ident =>
283- if tree.isType && ! tree.symbol.is(Param ) then
284- Checking .checkGoodBounds(tree.tpe, tree.srcPos)
284+ if tree.isType then
285285 checkNotPackage(tree)
286286 else
287287 if tree.symbol.is(Inline ) && ! Inlines .inInlineMethod then
@@ -296,7 +296,6 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
296296 ctx.compilationUnit.needsInlining = true
297297 if name.isTypeName then
298298 Checking .checkRealizable(qual.tpe, qual.srcPos)
299- Checking .checkGoodBounds(tree.tpe, tree.srcPos)
300299 withMode(Mode .Type )(super .transform(checkNotPackage(tree)))
301300 else
302301 checkNoConstructorProxy(tree)
@@ -399,13 +398,20 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
399398 val reference = ctx.settings.sourceroot.value
400399 val relativePath = util.SourceFile .relativePath(ctx.compilationUnit.source, reference)
401400 sym.addAnnotation(Annotation .makeSourceFile(relativePath))
402- else (tree.rhs, sym.info) match
403- case (rhs : LambdaTypeTree , bounds : TypeBounds ) =>
404- VarianceChecker .checkLambda(rhs, bounds)
405- if sym.isOpaqueAlias then
406- VarianceChecker .checkLambda(rhs, TypeBounds .upper(sym.opaqueAlias))
407- case _ =>
401+ else
402+ if ! sym.is(Param ) then
403+ Checking .checkGoodBounds(tree.symbol)
404+ (tree.rhs, sym.info) match
405+ case (rhs : LambdaTypeTree , bounds : TypeBounds ) =>
406+ VarianceChecker .checkLambda(rhs, bounds)
407+ if sym.isOpaqueAlias then
408+ VarianceChecker .checkLambda(rhs, TypeBounds .upper(sym.opaqueAlias))
409+ case _ =>
408410 processMemberDef(super .transform(tree))
411+ case tree : Bind =>
412+ if tree.symbol.isType && ! tree.symbol.name.is(WildcardParamName ) then
413+ Checking .checkGoodBounds(tree.symbol)
414+ super .transform(tree)
409415 case tree : New if isCheckable(tree) =>
410416 Checking .checkInstantiable(tree.tpe, tree.srcPos)
411417 super .transform(tree)
0 commit comments