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

Unexpected FS3571 shorthand lambda atomic error #16457

Closed
cmeeren opened this issue Dec 20, 2023 · 5 comments
Closed

Unexpected FS3571 shorthand lambda atomic error #16457

cmeeren opened this issue Dec 20, 2023 · 5 comments

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Dec 20, 2023

let call (f: string -> int) x = f x

let x = call _.Length ""

Expected behavior

Compiles.

Actual behavior

0>Program.fs(10,1): Error FS0010 : Incomplete structured construct at or before this point in expression
0>Program.fs(10,14): Error FS3571 : _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses.

Known workarounds

Enclose shorthand lambda in parentheses:

let x = call (_.Length) ""
@github-actions github-actions bot added this to the Backlog milestone Dec 20, 2023
@brianrourkeboll
Copy link
Contributor

I think this was fixed by #16240. That error number no longer exists in main.

@psfinaki
Copy link
Member

psfinaki commented Jan 3, 2024

@cmeeren can you please check this case on the latest VS or FCS?

@cmeeren
Copy link
Contributor Author

cmeeren commented Jan 3, 2024

Still happens with VS 17.8.3.

@vzarytovskii
Copy link
Member

It won't go into 17.8.*, only in 17.9. Also not sure if 17.9 preview with the fix was released. It was inserted November 21st: #16320

@psfinaki
Copy link
Member

psfinaki commented Jan 3, 2024

Doesn't reproduce in 17.9.0 Preview 2.0. Should be good.

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

No branches or pull requests

4 participants