@@ -2240,7 +2240,16 @@ object Parsers {
22402240 in.nextToken()
22412241 if in.token == LBRACE && sourceVersion.isAtLeast(`3.6`)
22422242 then inBraces(commaSeparated(() => contextBound(pname)))
2243- else contextBound(pname) :: contextBounds(pname)
2243+ else
2244+ val bound = contextBound(pname)
2245+ val rest =
2246+ if in.isColon then
2247+ report.errorOrMigrationWarning(
2248+ em " Multiple context bounds should be enclosed in `{ ... }` " ,
2249+ in.sourcePos(), MigrationVersion .GivenSyntax )
2250+ contextBounds(pname)
2251+ else Nil
2252+ bound :: rest
22442253 else if in.token == VIEWBOUND then
22452254 report.errorOrMigrationWarning(
22462255 em " view bounds `<%' are no longer supported, use a context bound `:' instead " ,
@@ -4261,6 +4270,9 @@ object Parsers {
42614270 in.nextToken()
42624271 newSignature()
42634272 else if hasEmbeddedColon then
4273+ report.errorOrMigrationWarning(
4274+ em " This old given syntax is no longer supported; use `=>` instead of `:` " ,
4275+ in.sourcePos(), MigrationVersion .GivenSyntax )
42644276 newSyntaxAllowed = false
42654277 val tparamsOld = typeParamClauseOpt(ParamOwner .Given )
42664278 newLineOpt()
@@ -4294,6 +4306,11 @@ object Parsers {
42944306 // old-style abstract given
42954307 if name.isEmpty then
42964308 syntaxError(em " Anonymous given cannot be abstract, or maybe you want to define a concrete given and are missing a `()` argument? " , in.lastOffset)
4309+ if newSyntaxAllowed then
4310+ report.errorOrMigrationWarning(
4311+ em """ This defines an abstract given, which is no longer supported. Use a `deferred` given instead.
4312+ |Or, if you intend to define a concrete given, follow the type with `()` arguments. """ ,
4313+ in.sourcePos(in.lastOffset), MigrationVersion .GivenSyntax )
42974314 DefDef (name, adjustDefParams(joinParams(tparams, vparamss)), parents.head, EmptyTree )
42984315 else
42994316 // structural instance
@@ -4483,6 +4500,9 @@ object Parsers {
44834500
44844501 /** with Template, with EOL <indent> interpreted */
44854502 def withTemplate (constr : DefDef , parents : List [Tree ]): Template =
4503+ report.errorOrMigrationWarning(
4504+ em " Given member definitions starting with `with` are no longer supported; use `{...}` or `:` followed by newline instead " ,
4505+ in.sourcePos(), MigrationVersion .GivenSyntax )
44864506 accept(WITH )
44874507 val (self, stats) = templateBody(parents, rewriteWithColon = false )
44884508 Template (constr, parents, Nil , self, stats)
0 commit comments