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

Issue #279: Fix FSharpFunc unit type args #317

Closed kevmal closed 4 years ago

kevmal commented 5 years ago

Fixes #279

Problem is emitLambda relies on body.Type to build the FSharpFunc type. body.Type in the case of a _ -> unit function is System.Void so the type getting built is FSharpFunc<_,void>. Meanwhile a function of the form unit -> _ is fine since the first type argument uses the type of the lambda var.

I resorted to using FullName on the generic type definitions to check for FSharpFunc type, maybe there's a better way?

dsyme commented 4 years ago

Could you add a corresponding test case for this please? THanks

kevmal commented 4 years ago

Added some tests. Also there's a skipped test for #323.