scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Regression in parser for usage of user defined `inflix trait as`

Open WojciechMazur opened this issue 4 months ago • 1 comments

Based on OpenCB failure in makiftutuncu/as - build logs

Based on the current syntax as keyword can be present only in NamedSelector which can be placed only in the import statement. AFAIK under the new givens syntax as keyword can be present only within type definition context bounds, however, it is not documented in any form.

Compiler version

Last good release: 3.6.0-RC1-bin-20241003-a672e05-NIGHTLY First bad release: 3.6.0-RC1-bin-20241005-6fa81cf-NIGHTLY

Bisect points to 14acdc06067a202f381fa9066a961cebb1314d6a

Minimized code

infix trait as[From, To]

val conv: (String as Int) = ???
given instance: (String as Int) = ???
def test(ev: (String as Int)) = ???

Output

-- [E040] Syntax Error: /Users/wmazur/projects/sandbox/test.scala:3:18 --------------------------------------------------------------------------------------------------------------------
3 |val conv: (String as Int) = ???
  |                  ^^
  |                  ')' expected, but identifier found
-- [E040] Syntax Error: /Users/wmazur/projects/sandbox/test.scala:4:24 --------------------------------------------------------------------------------------------------------------------
4 |given instance: (String as Int) = ???
  |                        ^^
  |                        ',' or ')' expected, but identifier found
-- [E040] Syntax Error: /Users/wmazur/projects/sandbox/test.scala:5:21 --------------------------------------------------------------------------------------------------------------------
5 |def test(ev: (String as Int)) = ???
  |                     ^^
  |                     ')' expected, but identifier found
3 errors found

Expectation

Should be parsable or syntax reference should be updated.

WojciechMazur avatar Oct 15 '24 11:10 WojciechMazur