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 not producing correct output in generic method calls #125

Open eiriktsarpalis opened 8 years ago

eiriktsarpalis commented 8 years ago

Consider the code:

decompile <@ typeof<int> @>     // correct: "typeof<int>"
decompile <@ Unchecked.defaultof<int> @> // wrong: "Unchecked.defaultof"

and

type Foo<'T>() = class end
decompile <@ new Foo<int>() @> // correct: "new Bar<int>()"

type Bar =
    static member Bar<'T>() = Unchecked.defaultof<'T>

decompile <@ Bar.Bar<int> () @> // wrong: "Bar.Bar()"
stephen-swensen commented 8 years ago

Thanks @eiriktsarpalis for reporting these issues with decompile! I will definitely look into them and see what improvements can be made. Please do note that decompile is a sort of "best effort" with trade-offs for readability vs. correctness. (whereas eval and reduce need to be rock-solid for correctness of test evaluations).