internal partial class Class17
{
[Zomp.SyncMethodGenerator.CreateSyncVersion(OmitNullableDirective = true)]
public async Task FooAsync()
{
var bar = new Bar2();
var delay = bar?.GetInt() ?? 0;
await Task.Delay(delay);
}
}
internal class Bar2
{
}
internal static class Bar2Extensions
{
public static int GetInt(this Bar2 bar2) => 0;
}
Produces the following
public void Foo()
{
var bar = new global::ClassLibrary1.Bar2();
var delay = (!bar.HasValue?(int?)null: global::ClassLibrary1.Bar2Extensions.GetInt(bar))?? 0;
global::System.Threading.Thread.Sleep(delay);
}
The class Bar2 doesn't have a HasValue method so this produces compile fails
error CS1061: 'Bar2' does not contain a definition for 'HasValue' and no accessible extension method 'HasValue' accepting a first argument of type 'Bar2' could be found (are you missing a using directive or an assembly reference?)
warning CS8603: Possible null reference return.
The following code
Produces the following
The class
Bar2
doesn't have a HasValue method so this produces compile fails