Skip to content

Commit b046500

Browse files
authored
Merge pull request #2428 from dotty-staging/error-on-phantom-in-value-class
Error on value class with phantom value
2 parents 3ae3b08 + daaedb8 commit b046500

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ object Checking {
464464
case List(param) =>
465465
if (param.is(Mutable))
466466
ctx.error("value class parameter must not be a var", param.pos)
467+
if (param.info.isPhantom)
468+
ctx.error("value class parameter must not be phantom", param.pos)
467469
case _ =>
468470
ctx.error("value class needs to have exactly one val parameter", clazz.pos)
469471
}

0 commit comments

Comments
 (0)