Skip to content

Commit 03965db

Browse files
committed
Drop redundant error message + tests
1 parent a037261 commit 03965db

File tree

4 files changed

+1
-41
lines changed

4 files changed

+1
-41
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ enum ErrorMessageID extends java.lang.Enum[ErrorMessageID] {
9191
ExpectedTopLevelDefID,
9292
AnonymousFunctionMissingParamTypeID,
9393
SuperCallsNotAllowedInlineableID,
94-
ModifiersNotAllowedID,
9594
WildcardOnTypeArgumentNotAllowedOnNewID,
9695
FunctionTypeNeedsNonEmptyParameterListID,
9796
WrongNumberOfParametersID,

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,27 +1695,6 @@ object messages {
16951695
val explanation: String = "Method inlining prohibits calling superclass methods, as it may lead to confusion about which super is being called."
16961696
}
16971697

1698-
case class ModifiersNotAllowed(flags: FlagSet, printableType: Option[String])(implicit ctx: Context)
1699-
extends Message(ModifiersNotAllowedID) {
1700-
val kind: String = "Syntax"
1701-
val msg: String = em"Modifier(s) `${flags.flagsString}` not allowed for ${printableType.getOrElse("combination")}"
1702-
val explanation: String = {
1703-
val first = "sealed def y: Int = 1"
1704-
val second = "sealed lazy class z"
1705-
em"""You tried to use a modifier that is inapplicable for the type of item under modification
1706-
|
1707-
| Please see the official Scala Language Specification section on modifiers:
1708-
| https://www.scala-lang.org/files/archive/spec/2.11/05-classes-and-objects.html#modifiers
1709-
|
1710-
|Consider the following example:
1711-
|$first
1712-
|In this instance, the modifier 'sealed' is not applicable to the item type 'def' (method)
1713-
|$second
1714-
|In this instance, the modifier combination is not supported
1715-
"""
1716-
}
1717-
}
1718-
17191698
case class WrongNumberOfParameters(expected: Int)(implicit ctx: Context)
17201699
extends Message(WrongNumberOfParametersID) {
17211700
val kind: String = "Syntax"

compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,24 +1005,6 @@ class ErrorMessagesTests extends ErrorMessagesTest {
10051005
assertEquals("method bar", symbol.show)
10061006
}
10071007

1008-
@Test def modifiersNotAllowed =
1009-
verifyModifiersNotAllowed("lazy trait T", "lazy", Some("trait"))
1010-
1011-
@Test def modifiersOtherThanTraitMethodVariable =
1012-
verifyModifiersNotAllowed("sealed lazy class x", "sealed")
1013-
1014-
private def verifyModifiersNotAllowed(code: String, modifierAssertion: String,
1015-
typeAssertion: Option[String] = None) = {
1016-
checkMessagesAfter(RefChecks.name)(code)
1017-
.expect { (ictx, messages) =>
1018-
implicit val ctx: Context = ictx
1019-
assertMessageCount(1, messages)
1020-
val ModifiersNotAllowed(flags, sort) :: Nil = messages
1021-
assertEquals(modifierAssertion, flags.flagsString)
1022-
assertEquals(typeAssertion, sort)
1023-
}
1024-
}
1025-
10261008
@Test def wildcardOnTypeArgumentNotAllowedOnNew =
10271009
checkMessagesAfter(RefChecks.name) {
10281010
"""

tests/neg/i5495.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
lazy enum LazyList[+A] { // error
1+
lazy enum LazyList[+A] { // error: sealed abstract types cannot be lazy enum
22
case :: (head: A, tail: LazyList[A])
33
case Nil
44
}

0 commit comments

Comments
 (0)