terrajobst / nquery-vnext

A Roslyn inspired rewrite of NQuery
MIT License
72 stars 16 forks source link

Evaluate `CASE WHEN` expressions lazily #66

Open dallmair opened 2 months ago

dallmair commented 2 months ago

This PR adds unit tests for the existing behavior to ensure single and eager evaluation of most expressions, and a unit test that provokes the bug reported in #65. Obviously, it also contains a fix for the issue at hand: It moves evaluation of all CASE WHEN expressions (conditions, then clauses, else clause) to dedicated functions with their own scope, such that extraction and assignment of subexpression result values to temporary variables does not cross the condition scope anymore.

Closes #65