File tree Expand file tree Collapse file tree 4 files changed +1
-41
lines changed
src/dotty/tools/dotc/reporting/diagnostic
test/dotty/tools/dotc/reporting Expand file tree Collapse file tree 4 files changed +1
-41
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,6 @@ enum ErrorMessageID extends java.lang.Enum[ErrorMessageID] {
91
91
ExpectedTopLevelDefID ,
92
92
AnonymousFunctionMissingParamTypeID ,
93
93
SuperCallsNotAllowedInlineableID ,
94
- ModifiersNotAllowedID ,
95
94
WildcardOnTypeArgumentNotAllowedOnNewID ,
96
95
FunctionTypeNeedsNonEmptyParameterListID ,
97
96
WrongNumberOfParametersID ,
Original file line number Diff line number Diff line change @@ -1695,27 +1695,6 @@ object messages {
1695
1695
val explanation : String = " Method inlining prohibits calling superclass methods, as it may lead to confusion about which super is being called."
1696
1696
}
1697
1697
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
-
1719
1698
case class WrongNumberOfParameters (expected : Int )(implicit ctx : Context )
1720
1699
extends Message (WrongNumberOfParametersID ) {
1721
1700
val kind : String = " Syntax"
Original file line number Diff line number Diff line change @@ -1005,24 +1005,6 @@ class ErrorMessagesTests extends ErrorMessagesTest {
1005
1005
assertEquals(" method bar" , symbol.show)
1006
1006
}
1007
1007
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
-
1026
1008
@ Test def wildcardOnTypeArgumentNotAllowedOnNew =
1027
1009
checkMessagesAfter(RefChecks .name) {
1028
1010
"""
Original file line number Diff line number Diff line change 1
- lazy enum LazyList [+ A ] { // error
1
+ lazy enum LazyList [+ A ] { // error: sealed abstract types cannot be lazy enum
2
2
case :: (head : A , tail : LazyList [A ])
3
3
case Nil
4
4
}
You can’t perform that action at this time.
0 commit comments