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

Remove internal to allow usage without the need to source include or using reflection #223

Closed 7sharp9 closed 6 years ago

7sharp9 commented 6 years ago

Addresses #222

7sharp9 commented 6 years ago

Anyone have any comments on this or the #222 issue?

dsyme commented 6 years ago

This file should really be source included into the test projects, not the type provider project. The problem is that GetInvokeCode() is internal

But agree this will do for now

7sharp9 commented 6 years ago

@dsyme The problem is circular dependencies, you can only really add providedtypes.fs to one project.

if you need something from providedtypes.fs from an assembly that differs from where you are generating provided types and methods then you get into a situation where you would have to source include in two projects, you now have a new issue that the types are not interchangeable: type ProvidedType is not assignable to ProvidedType etc because there are the same types in difference assemblies.

Im using provided types to generate provided types in one assembly, and to test provided types from a test assembly.

Im also using provided types with an alternative backend to produce source code rather than injected IL. But the first scenario still required access to an internal.

dsyme commented 6 years ago

Either use InternalsVisibleTo, or do your testing via the System.Type API?

Which internals do you need access to? I removed the use of internals by ProvidedTypesTesting.fs

7sharp9 commented 6 years ago

Only ProvidedTypesTesting.Testing.MakeSimulatedTypeProviderConfig which was internal.

Im instantiating the type provider via an instance of that configuration, then iterating over the provided types (I have created a ProvidedRecord) and methods, extracting the quotations and reassembling them into an untyped ast before reconstituting them into generated .fs files.