Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--standalone type forwarding #7462

Merged
merged 7 commits into from
Sep 4, 2019

Conversation

KevinRansom
Copy link
Member

There has long been a bug with the coreclr version of the compiler:

Fixes: #3924 : Support for --standalone on .NET Core

This happens because --standalone takes the Il from FSharp.Core and embeds it in the binary being built. When FSharp.Core references framework assemblies and those assemblies rely on type forwarders to get to the correct type the compiler does not know how to unify the generated method signatures with the type forwarded ones.

The fix in this PR is to follow the type forwarders for everything in thethe generated code and embedded code.
This only happens in the static linker, and so will have no impact to the majority of applications.

Static linking occurs for:

  1. Apps compiled with --standalone
  2. Apps that rely on generative type providers
  3. Apps that use --staticlink: to link multiple assemblies into a single dll

This fix is also necessary for us to move to a single netstandard 2.0 version of FSharp.Core rather than dual desktop and netstandard versions. Because even the desktop --standalone which has always work would start failing for that scenario.

Note:
The pr also contains this fix: #7461

src/fsharp/fsc.fs Outdated Show resolved Hide resolved
let typeForwardILTypeRef (tref: ILTypeRef) =
let scoref1 = tref.Scope
let scoref2 = followTypeForwardForILTypeRef tref
if scoref1 === scoref2 then tref
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

===

wat

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-)
I read that operator as "is the same as"
It is defined here: https://github.com/dotnet/fsharp/blob/master/src/absil/illib.fs#L44

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, so it's objEq (box x) (box y)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not =?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not instance equality, it's are the contents equal.

@KevinRansom KevinRansom merged commit 321296b into dotnet:master Sep 4, 2019
@KevinRansom KevinRansom deleted the StandaloneTypeForwarding branch October 2, 2019 22:40
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
* Add type forwarding to static linker

* Type forward using simple matches when required

* Fix native resource issue with emptry streams

* reduce churn

* Use typeref morpher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for --standalone on .NET Core
4 participants