@@ -80,7 +80,8 @@ class TreeChecker extends Phase with SymTransformer {
80
80
81
81
if (sym.isClass && ! sym.isAbsent) {
82
82
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
84
85
85
86
assert(validSuperclass, i " $sym has no superclass set " )
86
87
testDuplicate(sym, seenClasses, " class" )
@@ -97,7 +98,10 @@ class TreeChecker extends Phase with SymTransformer {
97
98
def phaseName : String = " Ycheck"
98
99
99
100
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)
101
105
}
102
106
103
107
private def previousPhases (phases : List [Phase ])(implicit ctx : Context ): List [Phase ] = phases match {
@@ -305,7 +309,7 @@ class TreeChecker extends Phase with SymTransformer {
305
309
306
310
override def typedIdent (tree : untpd.Ident , pt : Type )(implicit ctx : Context ): Tree = {
307
311
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}" )
309
313
assertDefined(tree)
310
314
311
315
checkNotRepeated(super .typedIdent(tree, pt))
@@ -443,7 +447,8 @@ class TreeChecker extends Phase with SymTransformer {
443
447
if (ctx.mode.isExpr &&
444
448
! tree.isEmpty &&
445
449
! isPrimaryConstructorReturn &&
446
- ! pt.isInstanceOf [FunProto ])
450
+ ! pt.isInstanceOf [FunProto ] &&
451
+ ! pt.isInstanceOf [PolyProto ])
447
452
assert(tree.tpe <:< pt, {
448
453
val mismatch = err.typeMismatchMsg(tree.tpe, pt)
449
454
i """ | ${mismatch.msg}
0 commit comments