diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t7757.check | 4 | ||||
-rw-r--r-- | test/files/neg/t7757.scala | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index d0b0c09d59..a4093f9afa 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2665,7 +2665,7 @@ self => syntaxError("traits cannot have type parameters with context bounds `: ...' nor view bounds `<% ...'", skipIt = false) classContextBounds = List() } - val constrAnnots = constructorAnnotations() + val constrAnnots = if (!mods.isTrait) constructorAnnotations() else Nil val (constrMods, vparamss) = if (mods.isTrait) (Modifiers(Flags.TRAIT), List()) else (accessModifierOpt(), paramClauses(name, classContextBounds, ofCaseClass = mods.isCase)) diff --git a/test/files/neg/t7757.check b/test/files/neg/t7757.check new file mode 100644 index 0000000000..8790cbc428 --- /dev/null +++ b/test/files/neg/t7757.check @@ -0,0 +1,4 @@ +t7757.scala:1: error: ';' expected but '@' found. +trait Foo @annot + ^ +one error found diff --git a/test/files/neg/t7757.scala b/test/files/neg/t7757.scala new file mode 100644 index 0000000000..24f6c16cb4 --- /dev/null +++ b/test/files/neg/t7757.scala @@ -0,0 +1 @@ +trait Foo @annot
\ No newline at end of file |