@@ -1146,46 +1146,48 @@ object messages {
1146
1146
| """ .stripMargin
1147
1147
}
1148
1148
1149
+ case class AnnotatedPrimaryConstructorRequiresModifierOrThis (cls : Name )(implicit ctx : Context )
1150
+ extends Message (AnnotatedPrimaryConstructorRequiresModifierOrThisID ) {
1151
+ val kind = " Syntax"
1152
+ val msg = hl """ ${" private" }, ${" protected" }, or ${" this" } expected for annotated primary constructor """
1153
+ val explanation =
1154
+ hl """ |When using annotations with a primary constructor of a class,
1155
+ |the annotation must be followed by an access modifier
1156
+ |( ${" private" } or ${" protected" }) or ${" this" }.
1157
+ |
1158
+ |For example:
1159
+ | ${" class Sample @deprecated this(param: Parameter) { ..." }
1160
+ | ^^^^
1161
+ | """ .stripMargin
1162
+ }
1163
+
1149
1164
case class OverloadedOrRecursiveMethodNeedsResultType (tree : Names .TermName )(implicit ctx : Context )
1150
1165
extends Message (OverloadedOrRecursiveMethodNeedsResultTypeID ) {
1151
1166
val kind = " Syntax"
1152
1167
val msg = hl """ overloaded or recursive method ${tree} needs result type """
1153
1168
val explanation =
1154
- hl """
1155
- |
1156
- """ .stripMargin
1169
+ hl """ | ${tree} is overloaded and at least one definition of it calls another.
1170
+ |You need to specify the calling method's return type.
1171
+ """ .stripMargin
1157
1172
}
1158
1173
1159
1174
case class RecursiveValueNeedsResultType (tree : Names .TermName )(implicit ctx : Context )
1160
- extends Message (RecursiveValueNeedsResultTypeID ) {
1175
+ extends Message (RecursiveValueNeedsResultTypeID ) {
1161
1176
val kind = " Syntax"
1162
1177
val msg = hl """ recursive value ${tree.name} needs type """
1163
1178
val explanation =
1164
- hl """ """ .stripMargin
1179
+ hl """ |The definition of ` ${tree.name}` is recursive and you need to specify its type.
1180
+ """ .stripMargin
1165
1181
}
1166
1182
1167
1183
case class CyclicReferenceInvolvingImplicit (cycleSym : Symbol )(implicit ctx : Context )
1168
- extends Message (CyclicReferenceInvolvingImplicitID ) {
1184
+ extends Message (CyclicReferenceInvolvingImplicitID ) {
1169
1185
val kind = " Syntax"
1170
1186
val msg = hl """ cyclic reference involving implicit $cycleSym"""
1171
1187
val explanation =
1172
1188
hl """ |This happens when the right hand-side of $cycleSym's definition involves an implicit search.
1173
- |To avoid the error, give $ cycleSym an explicit type.
1189
+ |To avoid this error, give ` ${ cycleSym.name} ` an explicit type.
1174
1190
| """ .stripMargin
1175
1191
}
1176
1192
1177
- case class AnnotatedPrimaryConstructorRequiresModifierOrThis (cls : Name )(implicit ctx : Context )
1178
- extends Message (AnnotatedPrimaryConstructorRequiresModifierOrThisID ) {
1179
- val kind = " Syntax"
1180
- val msg = hl """ ${" private" }, ${" protected" }, or ${" this" } expected for annotated primary constructor """
1181
- val explanation =
1182
- hl """ |When using annotations with a primary constructor of a class,
1183
- |the annotation must be followed by an access modifier
1184
- |( ${" private" } or ${" protected" }) or ${" this" }.
1185
- |
1186
- |For example:
1187
- | ${" class Sample @deprecated this(param: Parameter) { ..." }
1188
- | ^^^^
1189
- | """ .stripMargin
1190
- }
1191
1193
}
0 commit comments