void fix for TPSDK running in .NET Core tooling #5621
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The F# compiler type provider API transacts System.Type/MethodInfo etc. object to describe the provided code.
The compiler (and compiler service) side of this has a few niggling warts which need really gnarly workarounds in the TPSDK . While we're still going to need to workaround these (in order for type providers to work with existing tooling), I'm going to try to push a few fixes into the compiler to make things slightly easier in the very long term.
This is the first such fix: the compiler hardwires a comparison with the compiler-runtime
typeof<System.Void>
as opposed to the target version of this type. This is wrong and leads to nasty workaround in the TPSDK here, which itself only works on some code paths, since not all code paths go through the comparison in the compiler. This is causing problems for type providers running in .NET Core tooling here:(It didn't cause a problem for .NET Framework tooling because "Void" was always in "mscorlib" even at runtime.)
My belief is the easiest thing is to change the compiler to just use a string comparison on the
System.Void
type name here. I've made it additional just for safety. The TPSDK is doing this anyway, and is the only feasible means of authoring type providers, so there is no compat issue.There's no point testing this in this repo as it would be hard to arrange and effectively need an import of the whole TPSDK into this repo.