Safe-DS / DSL

Statically checked Data Science programs.
https://dsl.safeds.com
MIT License
11 stars 0 forks source link

Type cast + less than #1150

Closed lars-reimann closed 2 months ago

lars-reimann commented 2 months ago

Describe the bug

The parser confuses type argument lists and the less than operator. That's the same issues we've had with type argument lists of calls.

To Reproduce

Place this code into the editor:

val filtered = houseRentData.filterRows((data) -> data.getValue("Bathroom") as Int < 5);

Expected behavior

No error. The < should be treated as the less than operator, not the start of a type argument list.

Screenshots (optional)

No response

Additional Context (optional)

No response

lars-reimann commented 2 months ago

We cannot generally fix this. Adjusting the lexer only fixes the issue in some cases. Other languages, like TypeScript, have the same behavior.

We could give as and later is the lowest precedence, so parentheses must always be used when they occur inside another expression.

Or we could leave it as is, and document that parentheses must be used in this specific case (type cast followed by less than).

lars-reimann commented 1 month ago

:tada: This issue has been resolved in version 0.15.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: