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

Allow TP to provide compile errors/warnings #294

Open rojepp opened 5 years ago

rojepp commented 5 years ago

Description

Feature suggestion: It would be nice if a TP could contribute compile errors and warnings, with a file and a location in the file. For instance, if say the json parser for a json TP fails to parse and gives a line number in its error, we could propagate that info out to the user, with squigglies in the json file even.

Maybe TypeProviderConfig could have a mechanism to allow adding this info?

dsyme commented 5 years ago

Yes, I agree, providing warnings is important

smoothdeveloper commented 5 years ago

related: https://github.com/fsharp/fslang-suggestions/issues/729

Thorium commented 5 years ago

Warnings would be nice. Then we could really do dependant types as warnings: TypeProviders "compile" information sources to .NET types. However we have more knowledge on the types that what we really want to use: we want to use normal .NET types to make the usability easy. Compiler warnings could solve this.

Concrete example: a varchar(3) has max length 3 but for .NET usability reasons we don't want to create String3-class. So a string-class with compiler warning "You tried to insert "asdf" to varchar(3)" could be a good compromise.