SwensenSoftware / unquote

Write F# unit test assertions as quoted expressions, get step-by-step failure messages for free
http://www.swensensoftware.com/unquote
Apache License 2.0
285 stars 26 forks source link

Decompile Record construction #150

Closed thinkbeforecoding closed 5 years ago

thinkbeforecoding commented 5 years ago

This PR improves the decompilation of Records constucts.

Previously it looked like 'NewRecord Record("hello",42)'

It is now ' { Text = "hello"; Value = 42}' which is way nicer 😸

stephen-swensen commented 5 years ago

Very cool - thanks so much! Looks good at first glance. I'll review a little deeper and merge ASAP. I think I can get this folded into https://github.com/SwensenSoftware/unquote/pull/146 for the planned 5.0 release (let's say, 1-6 weeks depending on where I can find the time).

stephen-swensen commented 5 years ago

@thinkbeforecoding alright, I got this merged into the fs46 branch with two further enhancements:

  1. support literal decompilation of anonymous record construction: https://github.com/SwensenSoftware/unquote/pull/146/files#diff-f32453a927ec891deb2a24f9f93144b3R204
  2. consider NewRecord expressions reduced if all their args are reduced (this ensures we don't output extra, near duplicate expressions during reduction. i.e. we don't want NewRecord -> Value to be a 2-step reduction): https://github.com/SwensenSoftware/unquote/pull/146/files#diff-9886de549f3d1bfff12314cdf514dcc5R51

Thanks again!

stephen-swensen commented 5 years ago

@thinkbeforecoding FYI - this is released as part of Unquote 5.0.0 today!