Skip to content

Fix error message for value class with var parameter #2517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ object Checking {
if (isCyclic(clazz.asClass))
ctx.error(ValueClassesMayNotWrapItself(clazz), clazz.pos)
else {
val clParamAccessors = clazz.asClass.paramAccessors.filter(_.isTerm)
val clParamAccessors = clazz.asClass.paramAccessors.filter { param =>
param.isTerm && !param.is(Flags.Accessor)
}
clParamAccessors match {
case List(param) =>
if (param.is(Mutable))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import diagnostic.messages._
import dotty.tools.dotc.core.Types.WildcardType
import dotty.tools.dotc.parsing.Tokens
import org.junit.Assert._
import org.junit.{Ignore, Test}
import org.junit.Test

class ErrorMessagesTests extends ErrorMessagesTest {
// In the case where there are no errors, we can do "expectNoErrors" in the
Expand Down Expand Up @@ -758,7 +758,7 @@ class ErrorMessagesTests extends ErrorMessagesTest {
assertEquals("class MyValue", valueClass.show)
}

@Test @Ignore def valueClassParameterMayNotBeVar =
@Test def valueClassParameterMayNotBeVar =
checkMessagesAfter("refchecks") {
"""class MyValue(var i: Int) extends AnyVal"""
}
Expand Down