Skip to content

Commit da4b5e8

Browse files
committed
Coarser variance checking for match types
Only check the bound, instead of all branches, in the definition of a match type.
1 parent 825db1b commit da4b5e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class VarianceChecker()(implicit ctx: Context) {
9595
this(status, tp.resultType) // params will be checked in their TypeDef or ValDef nodes.
9696
case AnnotatedType(_, annot) if annot.symbol == defn.UncheckedVarianceAnnot =>
9797
status
98+
case tp: MatchType =>
99+
apply(status, tp.bound)
98100
case tp: ClassInfo =>
99101
foldOver(status, tp.classParents)
100102
case _ =>

0 commit comments

Comments
 (0)