Skip to content

Conversation

@eiriktsarpalis
Copy link
Member

@eiriktsarpalis eiriktsarpalis commented Nov 28, 2019

The FSCS untyped AST compilation facility is currently broken in .NET Core since the implementation is hardcoding the target profile to mscorlib.

This PR:

  • Exposes a PrimaryAssembly parameter in the AST Compile* functions.
  • Adds a couple of smoke tests to verify correctness.
  • Add missing compilation phase to ast compilation pipeline.

@eiriktsarpalis eiriktsarpalis changed the title [WIP] Fix AST compilation in netcoreapp Fix AST compilation in netcoreapp Nov 28, 2019
@eiriktsarpalis
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 7912 in repo dotnet/fsharp

Copy link
Contributor

@TIHan TIHan left a comment

Choose a reason for hiding this comment

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

IMHO, we should not expose PrimaryAssembly. Instead, we should be thinking about trying to remove PrimaryAssembly altogether and getting the compiler to be framework agnostic.

@TIHan
Copy link
Contributor

TIHan commented Dec 11, 2019

After talking with @terrajobst , having the notion of a PrimaryAssembly is fine but we should not be explicit about what PrimaryAssembly we want. Instead, it should decide what the PrimaryAssembly is based on the given references and there are rules about it, which are described here for C#: http://sourceroslyn.io/#Microsoft.CodeAnalysis/ReferenceManager/CommonReferenceManager.Binding.cs,536628815dfdb8a2

@eiriktsarpalis
Copy link
Member Author

IMHO, we should not expose PrimaryAssembly. Instead, we should be thinking about trying to remove PrimaryAssembly altogether and getting the compiler to be framework agnostic.

That's fair, however the scope of this PR is to bring the ast compiler on par with the cli arguments, as they currently stand.

@eiriktsarpalis eiriktsarpalis force-pushed the fix-astcompiler branch 2 times, most recently from 663d0c0 to 3c4e39c Compare January 7, 2020 18:11
@eiriktsarpalis
Copy link
Member Author

Rebased on top of latest changes

@eiriktsarpalis
Copy link
Member Author

Following conversations with @TIHan, I've changed the api surface so that PrimaryAssembly is no longer exposed. Until #8043 is merged, it will determine that value based on the current runtime.

@cartermp
Copy link
Contributor

@eiriktsarpalis is this work dependent on #8043?

@eiriktsarpalis
Copy link
Member Author

@cartermp not exactly, but we decided it would be less work if we let #8043 merge first.

@cartermp
Copy link
Contributor

Makes sense.

@eiriktsarpalis
Copy link
Member Author

Are you planning on merging #8043 for 5.0? If not I think I should just go ahead and merge this, since it fixes a broken component of the compiler.

@cartermp
Copy link
Contributor

I think that's @TIHan's call, but conservatively I'm going to estimate that it won't get in for F# 5.

@eiriktsarpalis
Copy link
Member Author

I've rebased on top of latest master.

@terrajobst
Copy link

After talking with @terrajobst , having the notion of a PrimaryAssembly is fine but we should not be explicit about what PrimaryAssembly we want. Instead, it should decide what the PrimaryAssembly is based on the given references and there are rules about it, which are described here for C#: http://sourceroslyn.io/#Microsoft.CodeAnalysis/ReferenceManager/CommonReferenceManager.Binding.cs,536628815dfdb8a2

To expand on this: you should chat with @jaredpar and how Roslyn solved this. AFAIK the core assembly is determined by picking the assembly that in turn has no references. If checking that is expensive, you could try a fast pass by checking for mscorlib and System.Runtime first and see whether they have references and if they do, probe all references.

@jaredpar
Copy link
Member

AFAIK the core assembly is determined by picking the assembly that in turn has no references.

The core assembly has no references and contains System.Object. There are completely valid cases where assemblies have no references but are not in fact the core assembly.

If checking that is expensive, you could try a fast pass by checking for mscorlib and System.Runtime first and see whether they have references and if they do, probe all references

FWIW: This check hasn't ever come up as a perf issue for us

@brettfo brettfo changed the base branch from master to main August 19, 2020 20:04
@KevinRansom
Copy link
Contributor

KevinRansom commented Sep 15, 2020

Thanks for this @eiriktsarpalis

@KevinRansom KevinRansom reopened this Sep 15, 2020
@cartermp cartermp merged commit 7fb50b1 into dotnet:main Sep 17, 2020
@eiriktsarpalis eiriktsarpalis deleted the fix-astcompiler branch September 17, 2020 06:56
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
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.

7 participants