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

extern C-like parameters are not supported #1216

Closed
auduchinok opened this issue Nov 3, 2020 · 1 comment
Closed

extern C-like parameters are not supported #1216

auduchinok opened this issue Nov 3, 2020 · 1 comment

Comments

@auduchinok
Copy link
Contributor

auduchinok commented Nov 3, 2020

Issue created from fantomas-online

Code

extern int M1(int)

extern int M2(int i)

extern int M3([<A>] int i)

extern int M4(int[] i)

extern int M5(int* i)

extern int M5(int& i)

extern int M5(void* i)

extern int M6(void* i1, void* i2)

Error

Fantomas was able to format the code but the result appears to be invalid F# code.
Please open an issue.

Formatted result:

let M1 _: int: int =
    failwith "extern was not given a DllImport attribute"

let M2 i: int: int =
    failwith "extern was not given a DllImport attribute"

let M3 [<A>] i: int: int =
    failwith "extern was not given a DllImport attribute"

let M4 i: int ``[]``: int =
    failwith "extern was not given a DllImport attribute"

let M5 i: int nativeptr: int =
    failwith "extern was not given a DllImport attribute"

let M5 i: int byref: int =
    failwith "extern was not given a DllImport attribute"

let M5 i: nativeint: int =
    failwith "extern was not given a DllImport attribute"

let M6 i1: nativeint, i2: nativeint: int =
    failwith "extern was not given a DllImport attribute"

Related parser rules:
https://github.com/dotnet/fsharp/blob/05b0569a7d6acefd21ad31bce49f780d961db651/src/fsharp/pars.fsy#L2654

@nojaf
Copy link
Contributor

nojaf commented Dec 5, 2022

This is available in the 5.1 series.

@nojaf nojaf closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants