fsprojects / FSharp.TypeProviders.SDK

The SDK for creating F# type providers
https://fsprojects.github.io/FSharp.TypeProviders.SDK/
MIT License
298 stars 94 forks source link

Support operators in CodeGenerator #313

Closed kevmal closed 5 years ago

kevmal commented 5 years ago

Addresses issue #206

Shadows (|SpecificCall|_|) in CodeGenerator to match on target methods. Otherwise https://github.com/fsprojects/FSharp.TypeProviders.SDK/blob/592d23a96db79b4248ed23a062db3a17433282ce/src/ProvidedTypes.fs#L13893-L13906 never matches.

Still some missing operators and more testing is needed (particularly for unsigned ints).

Certain operators don't have a NoDynamicInvocation such as (+) and (*) but are still included here. Ops so far:

~-
~+
-
+
*
/
% 
|||
^^^
~~~
&&&
int32/int
float/double
float32/single
int16
int64
byte
sbyte
uint32
uint16
uint64

@dsyme Any general feedback on this before continuing?

dsyme commented 5 years ago

The general direction is looking good

See also https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1071-witness-passing-quotations.md which would mean we don't have to do this thing, as FSharp.Core would have callable entrypoints for all operators.

dsyme commented 5 years ago

@kevmal This looks ready to go?

kevmal commented 5 years ago

This should be good for now.

Some of what's not included here:

Included the System.Math ops which could also moved out of CodeGenerator since most don't emit specific IL.

dsyme commented 5 years ago

Thank you!!