Skip to content

Regression in parser for usage of user defined inflix trait as #21769

Closed
@WojciechMazur

Description

@WojciechMazur

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 14acdc0

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions