Skip to content

Regression in 1.4.13 with SYNC_ONLY #90

@persn

Description

@persn

I have the following code using version 1.4.11, it generates the code as I expect it to

        [Zomp.SyncMethodGenerator.CreateSyncVersion(OmitNullableDirective = true)]
        public async Task Foo3Async()
        {
            string a = await Task.FromResult("");
            int b = 0;

            if (a != null)
            {
                b = 50;
            }

#if SYNC_ONLY
            _ = a + b;
#else
            _ = a + b + await Task.FromResult(30);
#endif
        }

However if I upgrade to 1.4.13 the generated code drops the if, this happens completely silently without compiler failures so an unknown amount of code is affected by this problem. As a result I cannot upgrade the NuGet for my project because it's too dangerous. This issue is similar to #45, but is different because the #if SYNC_ONLY doesn't touch the if keyword directly, and it wasn't present in the versions before 1.4.13

        public void Foo()
        {
            string a = "";
            int b = 0;

            _ = a + b;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions