Skip to content

Error with genrics and lambda #106

@persn

Description

@persn

I have the following code

        [Zomp.SyncMethodGenerator.CreateSyncVersion(OmitNullableDirective = true)]
        public async Task<bool> FooAsync()
        {
            return await Bar(() => Task.FromResult(true));
        }

        public T Bar<T>(Func<T> innerLogic) => innerLogic();

which ends up producing

        public bool Foo()
        {
        }

which gives the following error

FooAsync.g.cs(6,21,6,24): error CS0161: 'Foo()': not all code paths return a value

I expected it to produce

        public bool Foo()
        {
             return Bar(() => true);
        }

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