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

Make ProvidedMethod invokeCode parameter optional #180 #212

Closed panesofglass closed 6 years ago

panesofglass commented 6 years ago

This is an attempt to resolve #180 by making invokeCode an optional parameter on ProvidedMethod.

dsyme commented 6 years ago

@panesofglass This is basically good but we should do the following checking in the ProvidedMethod/ProvidedConstructor/ProvidedProperty construction process

  1. fail if the method is an interface instance method and has code
  2. fail if the method is a non-abstract method and does not have code

The tests can't be in the ProvidedMethod/ProvidedConstructor/ProvidedProperty constructor itself because the SetMethodAttrs call comes after. Perhaps it has to be when the constructed thing is added to its parent type.

In both cases give a good error message saying that the code parameter is/isn't not allowed.

Add unit tests for these in the test project.

panesofglass commented 6 years ago

@dsyme I would love to help more on this if possible. Would you be willing to do a pair programming session?

dsyme commented 6 years ago

@panesofglass I'll aim to take a look tomorrow

sergey-tihon commented 6 years ago

Build is green now

panesofglass commented 6 years ago

I'm amazed I got within one line!

panesofglass commented 6 years ago

Will this be merged soon?

dsyme commented 6 years ago

Thanks for this!