Skip to content

Wrong delegate type returned (with closure) #308

@exyi

Description

@exyi

Hi! Awesome project, I tried to migrate DotVVM to this expression compiler and the performance figures are awesome. CompileFast is literally faster than .Compile(preferInterpretation: true) (of course, not counting the execution time)

However, I encountered few bugs, one of them can be replicated with this test:

delegate string Command();
[Test]
public void Bug3()
{
  var p = Parameter(typeof(string), "vm");
  var expr = Lambda<Func<string, Command>>(Lambda<Command>(p), p);


  var ff = expr.Compile();
  Assert.IsInstanceOf<Command>(ff(null));
  var f = expr.CompileFast();
  Assert.IsInstanceOf<Command>(f(null));
}

The fast expression always returns Func<string> even though it should return Command. If I don't use the parameter inside the lambda, it works correctly and returns Command

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions