Skip to content

Abstract extension methods are not covered by the EBNF #19667

Closed
@susliko

Description

@susliko

The following code is valid in Scala 3.3.1

trait A:
  extension (x: Int) def foo: Int

But it seems to be not covered by the ebnf grammar:

Extension         ::=  ‘extension’ [DefTypeParamClause] {UsingParamClause}
                       ‘(’ DefTermParam ‘)’ {UsingParamClause} ExtMethods
ExtMethods        ::=  ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
ExtMethod         ::=  {Annotation [nl]} {Modifier} ‘def’ DefDef
                    |  Export
DefDef            ::=  DefSig [‘:’ Type] ‘=’ Expr
                    |  ‘this’ TypelessClauses [DefImplicitClause] ‘=’ ConstrExpr

DefDef requires a function body to be defined (unlike DefDcl)

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions