Skip to content

Commit 47962dc

Browse files
Fix #6890: Disallow MT on the RHS of type aliases
1 parent 917599f commit 47962dc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ object desugar {
11281128
case TypeDef(_, rhs) =>
11291129
def rhsOK(tree: Tree): Boolean = tree match {
11301130
case bounds: TypeBoundsTree => !bounds.alias.isEmpty
1131-
case _: Template => false
1131+
case _: Template | _: MatchTypeTree => false
11321132
case LambdaTypeTree(_, body) => rhsOK(body)
11331133
case _ => true
11341134
}

tests/neg/6890.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object Test {
2+
opaque type A[T] = T match { case Int => Int } // error: Modifier `opaque` is not allowed for this definition
3+
}

0 commit comments

Comments
 (0)