Describe the bug
The bracket is not correct.
To Reproduce
Bind().To(ctx => new Func<WorkerType, IWorker>(workerType =>
{
switch (workerType)
{
case WorkerType.A:
ctx.Inject(out WorkerA workerA);
return workerA;
case WorkerType.B:
ctx.Inject(out WorkerB workerB);
return workerB;
default:
return null;
}
}))
Generated:
switch (workerType)
{
case WorkerType.A:
{
global::My.WorkerA localWorkerA = new global::My.WorkerA());
}
return localWorkerA;
case WorkerType.B:
{
global::My.WorkerB localWorkerB = new global::My.WorkerB());
}
return localWorkerB;
default:
return null;
}
Expected behavior
Should be able to compile
Additional context
A workaround is to add bracket in setup code:
Bind().To(ctx => new Func<WorkerType, IWorker>(workerType =>
{
switch (workerType)
{
case WorkerType.A:
{
ctx.Inject(out WorkerA workerA);
return workerA;
}
case WorkerType.B:
{
ctx.Inject(out WorkerB workerB);
return workerB;
}
default:
return null;
}
}))
Describe the bug
The bracket is not correct.
To Reproduce
Generated:
Expected behavior
Should be able to compile
Additional context
A workaround is to add bracket in setup code: