Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: disallow line break after -> in function return type, fix #1945 #1950

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

fridis
Copy link
Member

@fridis fridis commented Sep 3, 2023

This is an somewhat ugly special handling but the best solution that I could find so far to avoid the ambiguity between a feature declaration with a function result type and a call with a lambda argument.

Now, it is no longer legal to write declarations such as

  f () ->
    i32 := ()->42

one must use either

  f (() ->
     i32  ) := ()->42

or

  f () -> i32 := ()->42

while a call

  f ()->
    x := 42

can not be written as

  f ()->x:=42

This patch adds a positive and a negative regression test for #1945.

…1945

This is an somewhat ugly special handling but the best solution that I could
find so far to avoid the ambiguity between a feature declaration with a function
result type and a call with a lambda argument.

Now, it is no longer legal to write declarations such as

  f () ->
    i32 := ()->42

one must use either

  f (() ->
     i32  ) := ()->42

or

  f () -> i32 := ()->42

while a call

  f ()->
    x := 42

can not be written as

  f ()->x:=42

This patch adds a positive and a negative regression test for #1945.
@fridis
Copy link
Member Author

fridis commented Sep 3, 2023

Merging this since I need it for examples in my TyDe talk. Please review anyway.

@fridis fridis merged commit b2954de into main Sep 3, 2023
5 checks passed
@maxteufel maxteufel linked an issue Sep 4, 2023 that may be closed by this pull request
Copy link
Collaborator

@maxteufel maxteufel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I don't have a better idea to avoid the special handling either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

strange errors with lambdas
2 participants