File tree Expand file tree Collapse file tree 4 files changed +23
-8
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 4 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -1014,19 +1014,16 @@ trait ContextErrors {
1014
1014
}
1015
1015
1016
1016
def MacroAnnotationMustBeStaticError (clazz : Symbol ) =
1017
- issueSymbolTypeError(clazz, s " macro annotation must extend scala.annotation.StaticAnnotation " )
1017
+ issueSymbolTypeError(clazz, " macro annotation must extend scala.annotation.StaticAnnotation" )
1018
1018
1019
1019
def MacroAnnotationCannotBeInheritedError (clazz : Symbol ) =
1020
- issueSymbolTypeError(clazz, s " macro annotation cannot be @Inherited " )
1020
+ issueSymbolTypeError(clazz, " macro annotation cannot be @Inherited" )
1021
1021
1022
1022
def MacroAnnotationCannotBeMemberError (clazz : Symbol ) =
1023
- issueSymbolTypeError(clazz, s " macro annotation cannot be a member of another class " )
1023
+ issueSymbolTypeError(clazz, " macro annotation cannot be a member of another class" )
1024
1024
1025
- def MacroAnnotationNotExpandedMessage : String = {
1026
- " macro annotation could not be expanded " + (
1027
- if (! settings.YmacroAnnotations ) " (since these are experimental, you must enable them with -Ymacro-annotations)"
1028
- else " (you cannot use a macro annotation in the same compilation run that defines it)" )
1029
- }
1025
+ def MacroAnnotationNotExpandedMessage : String =
1026
+ " macro annotation could not be expanded (since these are experimental, you must enable them with -Ymacro-annotations)"
1030
1027
1031
1028
def MacroAnnotationOnlyDefinitionError (ann : Tree ) =
1032
1029
issueNormalTypeError(ann, " macro annotations can only be put on definitions" )
Original file line number Diff line number Diff line change
1
+ Test_2.scala:2: error: macro annotation could not be expanded (since these are experimental, you must enable them with -Ymacro-annotations)
2
+ class Test
3
+ ^
4
+ 1 error
Original file line number Diff line number Diff line change
1
+ // scalac: -Ymacro-annotations
2
+ import scala .language .experimental .macros
3
+ import scala .reflect .macros .blackbox
4
+ import scala .annotation .StaticAnnotation
5
+
6
+ object Macros {
7
+ def annotImpl (c : blackbox.Context )(annottees : c.Expr [Any ]* ): c.Expr [Any ] = ???
8
+ }
9
+
10
+ class annot extends StaticAnnotation {
11
+ def macroTransform (annottees : Any * ): Any = macro Macros .annotImpl
12
+ }
Original file line number Diff line number Diff line change
1
+ @ annot
2
+ class Test
You can’t perform that action at this time.
0 commit comments