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

WIP make TP context prep more fully on-demand #326

Closed dsyme closed 2 years ago

dsyme commented 4 years ago

WIP fix for #325

  1. delay work preparing a TP that has static parameters by avoiding type translation for the static parameters
  2. do not report the common custom attributes on TPs that have static parameters

The underlying problem is that the mere presence of a provided type like "FSharp.Data.HtmlProvider" (uninstantiated) causes the F# compiler to interrogate that type for its custom attributes. This eagerly translates both the static paramaters and information int he custom attributes to the target context, causing readers for all the assemblies in the target context to be created.

I've checked this removes the context preparation for unused FSHarp.Data reference

There is a problem with this fix however: the XML doc on a provided type with static parameters is no longer reported to the compiler. I need to think if/how this can be avoided, it's possible an F# compiler fix/change may be needed to stop it eagerly interrogating the attributes on some types.