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

Reduction Bug: error reducing sprintf Application; lhs match of Application needs to be loosened #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For example,

> unquote <@ sprintf "%A" 23 @>;;

(let clo1 = sprintf (PrintfFormat`5("%A")) in fun arg10 -> clo1 arg10) 23
System.Exception: Expected Application((Lambda _ | Value _), rhs) or 
Application(lhs,rhs), got 

Let (clo1,
     Call (None,
           Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.String] PrintFormatToString[FSharpFunc`2](Microsoft.FSharp.Core.PrintfFormat`4[Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.String],Microsoft.FSharp.Core.Unit,System.String,System.String]),
           [Coerce (NewObject (Void .ctor(System.String), Value ("%A")),
                    Microsoft.FSharp.Core.PrintfFormat`4[[Microsoft.FSharp.Core.FSharpFunc`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[Microsoft.FSharp.Core.Unit, FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]])]),
     Lambda (arg10, Application (clo1, arg10)))

within

Application (Let (clo1,
                  Call (None,
                        Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.String] PrintFormatToString[FSharpFunc`2](Microsoft.FSharp.Core.PrintfFormat`4[Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.String],Microsoft.FSharp.Core.Unit,System.String,System.String]),
                        [Coerce (NewObject (Void .ctor(System.String),
                                            Value ("%A")),
                                 Microsoft.FSharp.Core.PrintfFormat`4[[Microsoft.FSharp.Core.FSharpFunc`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[Microsoft.FSharp.Core.Unit, FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]])]),
                  Lambda (arg10, Application (clo1, arg10))), Value (23))

   at FSI_0008.Swensen.Unquote.Reduce.allArgsReduced@58(FSharpExpr expr, FSharpExpr subexpr) in ...\Reduce.fs:line 64
   at FSI_0008.Swensen.Unquote.Reduce.reduce(FSharpExpr expr) in ...\Reduce.fs:line 73
   at FSI_0008.Swensen.Unquote.Reduce.loop@87-3(FSharpExpr expr, FSharpList`1 acc) in ...\Reduce.fs:line 89

val it : unit = ()

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

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 28 Mar 2011 at 2:35

GoogleCodeExporter commented 9 years ago

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