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
287 stars 25 forks source link

Decompiler Bug or F# Quotation Bug: exception with certain list NewUnionCases #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This appears to be due to the "local optimization" of list union cases which 
aren't literal constructions:

> let x = [1;1;1];;

val x : int list = [1; 1; 1]

> <@ 1::x @> |> source;;
System.Exception: local list cons case not expected: Value (1)
   at FSI_0157.Swensen.Unquote.Sprint.sprint@400-397.Invoke(String message) in C:\Users\Stephen\Documents\Visual Studio 2010\Projects\Unquote\Unquote\Sprint.fs:line 400
   at Microsoft.FSharp.Core.PrintfImpl.go@512-3[b,c,d](String fmt, Int32 len, FSharpFunc`2 outputChar, FSharpFunc`2 outa, b os, FSharpFunc`2 finalize, FSharpList`1 args, Int32 i)
   at Microsoft.FSharp.Core.PrintfImpl.run@510[b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args)
   at Microsoft.FSharp.Core.PrintfImpl.capture@529[b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args, Type ty, Int32 i)
   at <StartupCode$FSharp-Core>.$Reflect.Invoke@617-4.Invoke(T1 inp)
   at FSI_0157.Swensen.Unquote.Sprint.sprint@392-394(Int32 context, FSharpExpr expr) in C:\Users\Stephen\Documents\Visual Studio 2010\Projects\Unquote\Unquote\Sprint.fs:line 398
   at <StartupCode$FSI_0171>.$FSI_0171.main@()
Stopped due to error

Original issue reported on code.google.com by stephen....@gmail.com on 27 Mar 2011 at 1:58

GoogleCodeExporter commented 9 years ago
fixed: this was caused by "local sprint optimization" as mentioned, and was 
overlooked due to missing Fact attribute on relevant tests.

Original comment by stephen....@gmail.com on 27 Mar 2011 at 2:07

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 2 Apr 2011 at 7:59