dotnet-websharper / core

WebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
https://websharper.com
Apache License 2.0
593 stars 52 forks source link

Broken Unary Operator Overload #1317

Closed JaceEgMotivity closed 1 year ago

JaceEgMotivity commented 1 year ago

I'm seeing an issue with unary operator overloads. Here's a snippet showing an unexpected undefined value: https://try.websharper.com/snippet/0000ZV

granicz commented 1 year ago

Confirmed to exist in the latest 6.1.2 bits, indeed.

Jand42 commented 1 year ago

@JaceEgMotivity @granicz Thanks for the report. Indeed. All F# operators should be translated via macro or trait call, otherwise they do not translate to custom operators as C# ones do...

I have reviewed https://github.com/dotnet-websharper/core/blob/master/src/stdlib/WebSharper.Main.Proxies/Operators.fs to make a full list here that will be updated, which only have Inline at the moment instead of a macro/trait call:

Also possibly, but at a lower priority: all the trigonometric and other math functions (e.g. ceil translating to Ceiling method call).

Jand42 commented 1 year ago

@JaceEgMotivity @granicz Hello, there is a new build that has fixes for all F# operators for which WebSharper proxy did not support overloading properly. https://github.com/dotnet-websharper/core/pkgs/nuget/WebSharper Currently on GH feed, but we will push to nuget if nothing else new comes up tomorrow

Jand42 commented 1 year ago

Released as https://github.com/dotnet-websharper/core/releases/tag/6.1.3.266