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

Primtive type array will fail to compile #71

Closed
persn opened this issue Apr 9, 2024 · 2 comments
Closed

Primtive type array will fail to compile #71

persn opened this issue Apr 9, 2024 · 2 comments

Comments

@persn
Copy link

persn commented Apr 9, 2024

Consider the following cases

[Zomp.SyncMethodGenerator.CreateSyncVersion]
public async Task Foo1Async(int bar) => await Task.Delay(100);

[Zomp.SyncMethodGenerator.CreateSyncVersion]
public async Task Foo2Async(Int32 bar) => await Task.Delay(100);

[Zomp.SyncMethodGenerator.CreateSyncVersion]
public async Task Foo3Async(int[] bar) => await Task.Delay(100);

[Zomp.SyncMethodGenerator.CreateSyncVersion]
public async Task Foo4Async(Int32[] bar) => await Task.Delay(100);

1, 2, 3 works, but Foo4Async will fail to compile because it cannot find Int32 in the following generated code

public void Foo4(Int32[] bar) => global::System.Threading.Thread.Sleep(100);

Int32 needs to be qualified with a System. to be used, alternatively Int32 works in Foo2Async because it gets transformed to the syntax keyword int.

Please note that if you have <ImplicitUsings>enable</ImplicitUsings> in your csproj, props or targets you will not be able to reproduce this, because then the System namespace will be implicit.

@virzak virzak closed this as completed in 2bc3cc9 Apr 9, 2024
@virzak
Copy link
Contributor

virzak commented Apr 9, 2024

@persn. thanks for reporting.

Version 1.3.39 will be available shortly with the fix.

@persn
Copy link
Author

persn commented Apr 9, 2024

Looks like it's working, thanks

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

No branches or pull requests

2 participants