google-code-export / unquote

Automatically exported from code.google.com/p/unquote
Apache License 2.0
1 stars 1 forks source link

Locally defined / redefined custom and standard operators should be decompiled same as top-level operators #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Test 'DecompilationTests.locally redefined standard prefix op sprinted as 
prefix op when fully applied' failed: 

"op_UnaryNegation 1" = "-x"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1070,0): at DecompilationTests.locally redefined standard prefix op sprinted as prefix op when fully applied()

Test 'DecompilationTests.locally redefined standard prefix op sprints leading 
tilda when required when no args applied' failed:

"op_UnaryNegation" = "(~-)"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1064,0): at DecompilationTests.locally redefined standard prefix op sprints leading tilda when required when no args applied()

Test 'DecompilationTests.locally defined standard prefix op sprinted as prefix 
op when fully applied' failed: 

"op_TwiddlePlusDot 1" = "+.1"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1059,0): at DecompilationTests.locally defined standard prefix op sprinted as prefix op when fully applied()

Test 'DecompilationTests.locally defined standard infix op sprinted as symbol 
when partially applied' failed: 

"op_PlusPlusPlus 1" = "(+++) 1"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1085,0): at DecompilationTests.locally defined standard infix op sprinted as symbol when partially applied()

Test 'DecompilationTests.locally defined standard infix op sprinted as infix op 
when fully applied' failed: 

"op_PlusPlusPlus 1 1" = "1 +++ 1"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1090,0): at DecompilationTests.locally defined standard infix op sprinted as infix op when fully applied()

Test 'DecompilationTests.locally defined standard prefix op sprints leading 
tilda when required when no args applied' failed:

"op_TwiddlePlusDot" = "(~+.)"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1054,0): at DecompilationTests.locally defined standard prefix op sprints leading tilda when required when no args applied()

Test 'DecompilationTests.locally redefined standard infix op sprinted as infix 
op when fully applied' failed: 

"op_Addition 1 1" = "1 + 1"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1080,0): at DecompilationTests.locally redefined standard infix op sprinted as infix op when fully applied()

Test 'DecompilationTests.locally redefined standard infix op sprinted as symbol 
when partially applied' failed: 

"op_Addition 1" = "(+) 1"
false

    C:\Users\Stephen\Documents\Visual Studio 11\Projects\Unquote\code\UnquoteTests\DecompilationTests.fs(1075,0): at DecompilationTests.locally redefined standard infix op sprinted as symbol when partially applied()

Original issue reported on code.google.com by stephen....@gmail.com on 30 Apr 2012 at 12:05

GoogleCodeExporter commented 9 years ago
let ``locally redefined standard infix op sprinted as infix op when fully 
applied`` () =
    let (+) x y = x + y : int
    <@ 1 + 1 @>

``locally redefined standard infix op sprinted as infix op when fully applied`` 
();;

val it : Quotations.Expr<int> =
  Application (Application (Value (<fun:op_Addition@1128-1>), Value (1)),
             Value (1))

Original comment by stephen....@gmail.com on 12 May 2012 at 4:00

GoogleCodeExporter commented 9 years ago
A bit of a revelation:

let (+) x y z = x + y + z : int
<@ (1 + 2) 3 @>

is valid. That is, 

let (+) x y z = x + y + z 

is semantically equivalent to 

let (+) x y = fun z -> x + y + z

(of course, we knew this as it relates to currying in general, but didn't make 
the leap that it applies to operators as well. the lesson being that 
definitions of (+) are always infix operators, even if they appear to take more 
than two args at the definition point.).

Original comment by stephen....@gmail.com on 13 May 2012 at 12:56

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r535.

Original comment by stephen....@gmail.com on 13 May 2012 at 3:11

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 20 May 2012 at 4:23