@@ -80,7 +80,8 @@ class TreeChecker extends Phase with SymTransformer {
8080
8181 if (sym.isClass && ! sym.isAbsent) {
8282 val validSuperclass = sym.isPrimitiveValueClass || defn.syntheticCoreClasses.contains(sym) ||
83- (sym eq defn.ObjectClass ) || (sym is NoSuperClass ) || (sym.asClass.superClass.exists)
83+ (sym eq defn.ObjectClass ) || (sym is NoSuperClass ) || (sym.asClass.superClass.exists) ||
84+ sym.isRefinementClass
8485
8586 assert(validSuperclass, i " $sym has no superclass set " )
8687 testDuplicate(sym, seenClasses, " class" )
@@ -97,7 +98,10 @@ class TreeChecker extends Phase with SymTransformer {
9798 def phaseName : String = " Ycheck"
9899
99100 def run (implicit ctx : Context ): Unit = {
100- check(ctx.allPhases, ctx)
101+ if (ctx.settings.YtestPickler .value && ctx.phase.prev.isInstanceOf [Pickler ])
102+ ctx.echo(" Skipping Ycheck after pickling with -Ytest-pickler, the returned tree contains stale symbols" )
103+ else
104+ check(ctx.allPhases, ctx)
101105 }
102106
103107 private def previousPhases (phases : List [Phase ])(implicit ctx : Context ): List [Phase ] = phases match {
@@ -305,7 +309,7 @@ class TreeChecker extends Phase with SymTransformer {
305309
306310 override def typedIdent (tree : untpd.Ident , pt : Type )(implicit ctx : Context ): Tree = {
307311 assert(tree.isTerm || ! ctx.isAfterTyper, tree.show + " at " + ctx.phase)
308- assert(tree.isType || ! needsSelect(tree.tpe), i " bad type ${tree.tpe} for $tree # ${tree.uniqueId}" )
312+ assert(tree.isType || ctx.mode.is( Mode . Pattern ) && untpd.isWildcardArg(tree) || ! needsSelect(tree.tpe), i " bad type ${tree.tpe} for $tree # ${tree.uniqueId}" )
309313 assertDefined(tree)
310314
311315 checkNotRepeated(super .typedIdent(tree, pt))
@@ -443,7 +447,8 @@ class TreeChecker extends Phase with SymTransformer {
443447 if (ctx.mode.isExpr &&
444448 ! tree.isEmpty &&
445449 ! isPrimaryConstructorReturn &&
446- ! pt.isInstanceOf [FunProto ])
450+ ! pt.isInstanceOf [FunProto ] &&
451+ ! pt.isInstanceOf [PolyProto ])
447452 assert(tree.tpe <:< pt, {
448453 val mismatch = err.typeMismatchMsg(tree.tpe, pt)
449454 i """ | ${mismatch.msg}
0 commit comments