dadhi/FastExpressionCompiler

Incorrect il for struct indexer

quifi opened this issue · 0 comments

Test cases in the attachment source file, passed when compiled by system expression, but failed by FastExpressionCompiler.

My environment:

  • Windows 10, VS 2022
  • .Net 8.0
  • Newest FastExpressCompiler code from github

For struct parameter x
return x[1]
emits

ldarg.1 (should be ldarga, as x is struct)
ldc.i4.1
call Int32 get_Item(Int32)
ret

For struct variable x
return x[1]
emits

ldloc.0 (should be ldloca)
ldc.i4.1
call Int32 get_Item(Int32)
ret

StructIndexer.zip