Skip to content

Commit d421f88

Browse files
Do not flag match types as Deferred
This already wasn't the case for unpickled match types, which caused varying results for `ImplicitRunInfo#isAnchor`, by not reaching the `isMatchAlias` condition. Ensures both #20071 and #20136 each have the same result, when compiled with a classpath dependency as when merged. Note that they both still fail (20071 compiles but shouldn't), but at least do so consistently. Also update TreeUnpickler MATCHtpt doc to align with changes from #19871 Co-authored-by: Guillaume Martres <[email protected]>
1 parent dd9831b commit d421f88

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1542,8 +1542,6 @@ class TreeUnpickler(reader: TastyReader,
15421542
// as the reduction of the match type definition!
15431543
//
15441544
// We also override the type, as that's what Typer does.
1545-
// The difference here is that a match type that reduces to a non-match type
1546-
// makes the TypeRef for that definition will have a TypeAlias info instead of a MatchAlias.
15471545
tpt.overwriteType(tpt.tpe.normalized)
15481546
tpt
15491547
case TYPEBOUNDStpt =>

compiler/src/dotty/tools/dotc/typer/Namer.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ class Namer { typer: Typer =>
268268
else if flags.isAllOf(EnumValue) && ctx.owner.isStaticOwner then flags |= JavaStatic
269269
case tree: TypeDef =>
270270
def analyzeRHS(rhs: Tree): Unit = rhs match
271-
case _: TypeBoundsTree | _: MatchTypeTree =>
272-
flags |= Deferred // Typedefs with Match rhs classify as abstract
271+
case _: TypeBoundsTree =>
272+
flags |= Deferred
273273
case LambdaTypeTree(_, body) =>
274274
analyzeRHS(body)
275275
case _ =>

0 commit comments

Comments
 (0)