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

Add Reference Assembly support - 'refonly' and 'refout' compiler options #12334

Merged
merged 131 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
2411f75
Adding 'refonly' command line option
TIHan May 4, 2021
1b6dc26
Added a simple test, but it needs to fail
TIHan May 4, 2021
ee89986
We need to emit two kinds of reference assemblies. one with optimizat…
TIHan May 4, 2021
9dcdbb0
Passing reference assembly flag to IlxGen
TIHan May 4, 2021
84cd6a8
Emit ReferenceAssemblyAttribute
TIHan May 4, 2021
3a0a7be
Added ref-assembly rules for private and internal methods
TIHan May 4, 2021
5d78b77
use --refonly for now
TIHan May 4, 2021
2f1af9b
Use HasFSharpAttribute
TIHan May 4, 2021
512743c
Added a failing test
TIHan May 4, 2021
4af859b
Test passes
TIHan May 4, 2021
6b5c032
Trying to handle anonymous record types
TIHan May 5, 2021
84354ba
Cleaning up. Using ILMemberAccess instead of Accessibility due to how…
TIHan May 5, 2021
6d93c92
Using notlazy
TIHan May 5, 2021
c31ce72
Added another comment
TIHan May 5, 2021
0d02203
Added mkDummyParameterVal
TIHan May 5, 2021
8f5cbf5
Using taccessPublic
TIHan May 5, 2021
daf1847
More cleanup
TIHan May 5, 2021
9d0c7f6
Minor comment update
TIHan May 5, 2021
47d3b5a
more cleanup
TIHan May 5, 2021
5e4460e
merging
TIHan May 10, 2021
3468094
Adding FreeAnonRecdTypeInfos set
TIHan May 10, 2021
23d0da7
Adding options
TIHan May 10, 2021
8a1504f
Flowing free anonrecdtypeinfos
TIHan May 10, 2021
d7e491e
Fixing build
TIHan May 10, 2021
7ff20d6
Tests pass. Able to emit partial ref assembly with anon recds
TIHan May 10, 2021
a023c38
Minor rename
TIHan May 10, 2021
6801573
Added a failing test
TIHan May 11, 2021
91dbaa0
Added failing test
TIHan May 11, 2021
4931062
Simpler handling of building lambdas
TIHan May 11, 2021
e5c1cc8
Trying to figure out default param names
TIHan May 11, 2021
bb26684
Adding TryEmitReferenceAssembly
TIHan May 11, 2021
7415f4a
Merge remote-tracking branch 'remote/main' into ref-assembly-output
TIHan May 12, 2021
ee33c6d
Moving some reference assembly generation rules to ilwrite
TIHan May 13, 2021
180f339
Fixing build
TIHan May 13, 2021
e36c696
Added new compiler option '--refout:<file>'
TIHan May 18, 2021
32044c5
Fixing one of the tests
TIHan May 18, 2021
3088747
refonly/refout should only be part of fsc
TIHan May 18, 2021
f475e58
Merge remote-tracking branch 'remote/main' into ref-assembly-output
TIHan May 18, 2021
cfa275c
Updating help baseline
TIHan May 18, 2021
1604fa0
Merge remote-tracking branch 'remote/main' into ref-assembly-output
TIHan Jun 3, 2021
6f6b2a6
Merging
TIHan Jun 3, 2021
f4c9980
fixed build
TIHan Jun 3, 2021
193ba49
Fixing build. Added basic deterministic test
TIHan Jun 3, 2021
4793882
Failing determinism test
TIHan Jun 3, 2021
69fb788
Added DeterministicTests
TIHan Jun 3, 2021
067091b
Adding determinism task for CI
TIHan Jun 3, 2021
5e14bbc
moving yml to pipelines
TIHan Jun 3, 2021
2a9bcf1
Trying to fix determinism CI
TIHan Jun 3, 2021
7a5ba80
quick fix
TIHan Jun 3, 2021
cb85986
removing job
TIHan Jun 3, 2021
cebcc6c
Trying to fix ci
TIHan Jun 3, 2021
e4c046f
Removing this
TIHan Jun 3, 2021
3bdd39d
Turn on determinism for build
TIHan Jun 3, 2021
c0c83e4
Trying to fix
TIHan Jun 3, 2021
d4984eb
This works
TIHan Jun 3, 2021
1b3fdcf
Determinism
TIHan Jun 3, 2021
b6ac933
Building
TIHan Jun 3, 2021
447ab7a
Forgot to run test
TIHan Jun 3, 2021
2e4f679
Adding job
TIHan Jun 4, 2021
6f22cb8
Trying to fix job
TIHan Jun 4, 2021
50a041d
Remove job
TIHan Jun 4, 2021
78f53ac
Trying to figure out jobs
TIHan Jun 4, 2021
222dad3
Updating job
TIHan Jun 4, 2021
b22c2e5
Fixing determinism job
TIHan Jun 4, 2021
f1f2cc6
Fixing job
TIHan Jun 4, 2021
3c2d413
Update test-determinism.ps1
TIHan Jun 4, 2021
246bcfe
Update FSharp.Profiles.props
TIHan Jun 4, 2021
1da9044
Update test-determinism.ps1
TIHan Jun 4, 2021
9babedc
Update FSharpBuild.Directory.Build.props
TIHan Jun 4, 2021
c353628
Merged with main
TIHan Jul 28, 2021
2e6caaa
Merge branch 'ref-assembly-output' of github.com:TIHan/visualfsharp i…
TIHan Jul 28, 2021
62c3254
Merge branch 'main' into ref-assembly-output
vzarytovskii Aug 5, 2021
a452cba
Merge branch 'main' into ref-assembly-output
vzarytovskii Aug 9, 2021
19e9ce5
Merged with main
TIHan Aug 25, 2021
eac93e3
Trying to fix build
TIHan Aug 25, 2021
ee90edc
Merge branch 'ref-assembly-output' of github.com:TIHan/visualfsharp i…
TIHan Aug 25, 2021
ee77c70
Trying to fix build
TIHan Aug 25, 2021
f868a05
fixing build
TIHan Aug 25, 2021
e4b2e1e
Fixing build
TIHan Aug 25, 2021
70c2fb1
fixing build
TIHan Aug 25, 2021
a188671
Fixing build
TIHan Aug 25, 2021
ddd4103
Remove comment as it is not accurate
TIHan Aug 25, 2021
d29ffde
Removed generating metadata assembly for IDEs
TIHan Nov 4, 2021
eb998bf
Merged main. Removed metadataOnly changes in IlxGen
TIHan Nov 4, 2021
2284b7c
Fixing build
TIHan Nov 4, 2021
4873683
Removing tests
TIHan Nov 4, 2021
0d453b5
Update ParseAndCheckInputs.fs
TIHan Nov 4, 2021
c1bc0f7
Update TypedTree.fs
TIHan Nov 4, 2021
a461988
Fixing build
TIHan Nov 4, 2021
dca1a16
Update TypedTreeOps.fs
TIHan Nov 4, 2021
ed1bdc0
Fixing build
TIHan Nov 4, 2021
9d5c0d2
Fixing build
TIHan Nov 4, 2021
919c100
Fixing build
TIHan Nov 4, 2021
575d38a
Fixing build
TIHan Nov 4, 2021
aea1908
Merge branch 'main' into ref-assembly-output-part1
vzarytovskii Nov 25, 2021
c124e18
Merged 'upstream/main'
vzarytovskii Dec 8, 2021
c90d810
Update baseline for fcs 'help' test
vzarytovskii Dec 10, 2021
18717bc
Merge branch 'ref-assembly-output-part1' of https://github.com/tihan/…
vzarytovskii Dec 10, 2021
460e408
Added a test for '--refout', with outout and IL verification
vzarytovskii Dec 10, 2021
01bf4d9
Added tests to verify that static linking and refassemblies cannot be…
vzarytovskii Dec 10, 2021
42b783d
Add mvid test for refonly + private members. It is failing on purpose…
vzarytovskii Dec 14, 2021
1104455
WIP: Add some more to the tests
vzarytovskii Dec 15, 2021
f12e73b
Added more tests for MVID
vzarytovskii Dec 15, 2021
70ffc39
wip
vzarytovskii Dec 15, 2021
bafd958
Added some todos + have more readable canGenMethodDef
vzarytovskii Jan 3, 2022
94d29b7
Add some more tests
vzarytovskii Jan 4, 2022
1c39033
Merge remote-tracking branch 'upstream/main' into ref-assembly-output…
vzarytovskii Jan 10, 2022
6ef6eea
[WIP]: ignore properties if we don't have getter/setter, or we don't …
vzarytovskii Jan 25, 2022
e701883
Don't generate private types, generate nested internal types only if …
vzarytovskii Jan 26, 2022
dad0c8c
Merged upstream/main
vzarytovskii Jan 26, 2022
a93d820
Merge fix
vzarytovskii Jan 26, 2022
591cfb6
Another fix after merge + added more internal tests
vzarytovskii Jan 26, 2022
ad1e2c0
Fixed test framework after merge (output directory). Add check whethe…
vzarytovskii Jan 28, 2022
00ed291
Merge branch 'main' of https://github.com/dotnet/fsharp into ref-asse…
dsyme Jan 31, 2022
990e09b
Emit fields when the type is struct. Always emit types
vzarytovskii Feb 3, 2022
0e9c3ad
Merge branch 'ref-assembly-output-part1' of https://github.com/tihan/…
vzarytovskii Feb 3, 2022
f552651
WIP: added isAttribute to ILTypeRef if type extends Attribute
vzarytovskii Feb 3, 2022
22f89e5
Fix properties generation, fix generating getter/setter for attributes
vzarytovskii Feb 7, 2022
48f91d9
Only check properties to generate if we are emitting reference assembly
vzarytovskii Feb 7, 2022
095987d
Fixed surface area tests
vzarytovskii Feb 8, 2022
f204e20
Adjusted baselines for IL tests. Fixed events generation.
vzarytovskii Feb 14, 2022
b90c2fd
Merge branch 'ref-assembly-output-part1' of https://github.com/tihan/…
vzarytovskii Feb 14, 2022
7cf2676
Cleanup unused yaml files
vzarytovskii Feb 14, 2022
f1a7ff4
Fixed docs for ILMemberAccess
vzarytovskii Feb 28, 2022
2b7a114
Merge 'upstream/main'
vzarytovskii Mar 23, 2022
033a112
Update message + rename property for ILTypeDef to be more clear
vzarytovskii Mar 25, 2022
1b4ff9d
Surface area tests
vzarytovskii Mar 28, 2022
74ff369
Fixed baseline error message
vzarytovskii Mar 31, 2022
7ba8563
Merge remote-tracking branch 'upstream/main' into ref-assembly-output…
vzarytovskii Apr 20, 2022
51e9d5a
After-merge fixes
vzarytovskii Apr 20, 2022
897d9c1
Fix tests
vzarytovskii Apr 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/test-determinism.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
powershell -noprofile -executionPolicy RemoteSigned -file "%~dp0\test-determinism.ps1" %*
powershell -noprofile -executionPolicy RemoteSigned -file "%~dp0\test-determinism.ps1" %*
9 changes: 9 additions & 0 deletions src/fsharp/CompilerConfig.fs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,12 @@ type PackageManagerLine =
static member StripDependencyManagerKey (packageKey: string) (line: string): string =
line.Substring(packageKey.Length + 1).Trim()

[<RequireQualifiedAccess>]
type MetadataAssemblyGeneration =
| None
| ReferenceOut of outputPath: string
| ReferenceOnly

[<NoEquality; NoComparison>]
type TcConfigBuilder =
{
Expand Down Expand Up @@ -441,6 +447,7 @@ type TcConfigBuilder =
mutable emitTailcalls: bool
mutable deterministic: bool
mutable concurrentBuild: bool
mutable emitMetadataAssembly: MetadataAssemblyGeneration
mutable preferredUiLang: string option
mutable lcid: int option
mutable productNameForBannerText: string
Expand Down Expand Up @@ -654,6 +661,7 @@ type TcConfigBuilder =
emitTailcalls = true
deterministic = false
concurrentBuild = true
emitMetadataAssembly = MetadataAssemblyGeneration.None
preferredUiLang = None
lcid = None
productNameForBannerText = FSharpProductName
Expand Down Expand Up @@ -1121,6 +1129,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
member x.emitTailcalls = data.emitTailcalls
member x.deterministic = data.deterministic
member x.concurrentBuild = data.concurrentBuild
member x.emitMetadataAssembly = data.emitMetadataAssembly
member x.pathMap = data.pathMap
member x.langVersion = data.langVersion
member x.preferredUiLang = data.preferredUiLang
Expand Down
12 changes: 12 additions & 0 deletions src/fsharp/CompilerConfig.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ type PackageManagerLine =
static member SetLinesAsProcessed: string -> Map<string, PackageManagerLine list> -> Map<string, PackageManagerLine list>
static member StripDependencyManagerKey: string -> string -> string

[<RequireQualifiedAccess>]
type MetadataAssemblyGeneration =
| None
/// Includes F# signature and optimization metadata as resources in the emitting assembly.
/// Implementation assembly will still be emitted normally, but will emit the reference assembly with the specified output path.
| ReferenceOut of outputPath: string
/// Includes F# signature and optimization metadata as resources in the emitting assembly.
/// Only emits the assembly as a reference assembly.
| ReferenceOnly

[<NoEquality; NoComparison>]
type TcConfigBuilder =
{ mutable primaryAssembly: PrimaryAssembly
Expand Down Expand Up @@ -256,6 +266,7 @@ type TcConfigBuilder =
mutable emitTailcalls: bool
mutable deterministic: bool
mutable concurrentBuild: bool
mutable emitMetadataAssembly: MetadataAssemblyGeneration
mutable preferredUiLang: string option
mutable lcid : int option
mutable productNameForBannerText: string
Expand Down Expand Up @@ -452,6 +463,7 @@ type TcConfig =
member emitTailcalls: bool
member deterministic: bool
member concurrentBuild: bool
member emitMetadataAssembly: MetadataAssemblyGeneration
member pathMap: PathMap
member preferredUiLang: string option
member optsOn : bool
Expand Down
27 changes: 27 additions & 0 deletions src/fsharp/CompilerOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,23 @@ let SetTailcallSwitch (tcConfigB: TcConfigBuilder) switch =
let SetDeterministicSwitch (tcConfigB: TcConfigBuilder) switch =
tcConfigB.deterministic <- (switch = OptionSwitch.On)

let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =
match tcConfigB.emitMetadataAssembly with
| MetadataAssemblyGeneration.None ->
tcConfigB.emitMetadataAssembly <- if (switch = OptionSwitch.On) then MetadataAssemblyGeneration.ReferenceOnly else MetadataAssemblyGeneration.None
| _ ->
error(Error(FSComp.SR.optsInvalidRefAssembly(), rangeCmdArgs))

let SetReferenceAssemblyOutSwitch (tcConfigB: TcConfigBuilder) outputPath =
match tcConfigB.emitMetadataAssembly with
| MetadataAssemblyGeneration.None ->
if FileSystem.IsInvalidPathShim outputPath then
error(Error(FSComp.SR.optsInvalidRefOut(), rangeCmdArgs))
else
tcConfigB.emitMetadataAssembly <- MetadataAssemblyGeneration.ReferenceOut outputPath
| _ ->
error(Error(FSComp.SR.optsInvalidRefAssembly(), rangeCmdArgs))

let AddPathMapping (tcConfigB: TcConfigBuilder) (pathPair: string) =
match pathPair.Split([|'='|], 2) with
| [| oldPrefix; newPrefix |] ->
Expand Down Expand Up @@ -723,6 +740,16 @@ let outputFileFlagsFsc (tcConfigB: TcConfigBuilder) =
("nocopyfsharpcore", tagNone,
OptionUnit (fun () -> tcConfigB.copyFSharpCore <- CopyFSharpCoreFlag.No), None,
Some (FSComp.SR.optsNoCopyFsharpCore()))

CompilerOption
("refonly", tagNone,
OptionSwitch (SetReferenceAssemblyOnlySwitch tcConfigB), None,
Some (FSComp.SR.optsRefOnly()))

CompilerOption
("refout", tagFile,
OptionString (SetReferenceAssemblyOutSwitch tcConfigB), None,
Some (FSComp.SR.optsRefOut()))
]


Expand Down
4 changes: 4 additions & 0 deletions src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,8 @@ optsDebug,"Specify debugging type: full, portable, embedded, pdbonly. ('%s' is t
optsOptimize,"Enable optimizations (Short form: -O)"
optsTailcalls,"Enable or disable tailcalls"
optsDeterministic,"Produce a deterministic assembly (including module version GUID and timestamp)"
optsRefOnly,"Produce a reference assembly, instead of a full assembly, as the primary output"
optsRefOut,"Produce a reference assembly with the specified file path."
optsPathMap,"Maps physical paths to source path names output by the compiler"
optsCrossoptimize,"Enable or disable cross-module optimizations"
optsWarnaserrorPM,"Report all warnings as errors"
Expand Down Expand Up @@ -1168,6 +1170,8 @@ fscTooManyErrors,"Exiting - too many errors"
2026,fscDeterministicDebugRequiresPortablePdb,"Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded)"
2027,fscPathMapDebugRequiresPortablePdb,"--pathmap can only be used with portable PDBs (--debug:portable or --debug:embedded)"
2028,optsInvalidPathMapFormat,"Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath'"
2029,optsInvalidRefOut,"Invalid reference assembly path'"
2030,optsInvalidRefAssembly,"Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together."
3000,etIllegalCharactersInNamespaceName,"Character '%s' is not allowed in provided namespace name '%s'"
3001,etNullOrEmptyMemberName,"The provided type '%s' returned a member with a null or empty member name"
3002,etNullMember,"The provided type '%s' returned a null member"
Expand Down
13 changes: 9 additions & 4 deletions src/fsharp/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4875,8 +4875,8 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel
ILFieldDef(name = templateFld.LogicalName, fieldType = fty, attributes = enum 0, data = None, literalValue = None, offset = None, marshal = None, customAttrs = mkILCustomAttrs [])
.WithAccess(access)
.WithStatic(false)
yield fdef
yield fdef

// Fields for captured variables
for ilCloFreeVar in ilCloFreeVars do
let access = ComputeMemberAccess false
Expand All @@ -4901,6 +4901,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel
nestedTypes = emptyILTypeDefs,
implements = ilInterfaceTys,
extends = Some super,
isKnownToBeAttribute = false,
securityDecls = emptyILSecurityDecls)
.WithSealed(true)
.WithSpecialName(true)
Expand Down Expand Up @@ -5137,6 +5138,7 @@ and GenClosureTypeDefs cenv (tref: ILTypeRef, ilGenParams, attrs, ilCloAllFreeVa
nestedTypes=emptyILTypeDefs,
implements = ilIntfTys,
extends= Some ext,
isKnownToBeAttribute=false,
securityDecls= emptyILSecurityDecls)
.WithSealed(true)
.WithSerializable(true)
Expand Down Expand Up @@ -8298,6 +8300,8 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
else
ILTypeInit.BeforeField

let isKnownToBeAttribute = ExistsSameHeadTypeInHierarchy g cenv.amap m super g.mk_Attribute_ty

let tdef = mkILGenericClass (ilTypeName, access, ilGenParams, ilBaseTy, ilIntfTys,
mkILMethods ilMethods, ilFields, emptyILTypeDefs, ilProperties, ilEvents, mkILCustomAttrs ilAttrs,
typeDefTrigger)
Expand All @@ -8310,7 +8314,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
.WithSerializable(isSerializable)
.WithAbstract(isAbstract)
.WithImport(isComInteropTy g thisTy)
.With(methodImpls=mkILMethodImpls methodImpls)
.With(methodImpls=mkILMethodImpls methodImpls, isKnownToBeAttribute=isKnownToBeAttribute)

let tdLayout, tdEncoding =
match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with
Expand Down Expand Up @@ -8423,6 +8427,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
nestedTypes=emptyILTypeDefs,
implements = ilIntfTys,
extends= Some (if tycon.IsStructOrEnumTycon then g.iltyp_ValueType else g.ilg.typ_Object),
isKnownToBeAttribute=false,
securityDecls= emptyILSecurityDecls)
.WithLayout(layout)
.WithSerializable(isSerializable)
Expand Down Expand Up @@ -8847,4 +8852,4 @@ type IlxAssemblyGenerator(amap: ImportMap, tcGlobals: TcGlobals, tcVal: Constrai
member _.ForceSetGeneratedValue (ctxt, v, value: obj) = SetGeneratedValue ctxt tcGlobals ilxGenEnv true v value

/// Invert the compilation of the given value and return its current dynamic value and its compiled System.Type
member _.LookupGeneratedValue (ctxt, v) = LookupGeneratedValue amap ctxt ilxGenEnv v
member _.LookupGeneratedValue (ctxt, v) = LookupGeneratedValue amap ctxt ilxGenEnv v
11 changes: 7 additions & 4 deletions src/fsharp/ParseAndCheckInputs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ open FSharp.Compiler.Text.Range
open FSharp.Compiler.Xml
open FSharp.Compiler.TypedTree
open FSharp.Compiler.TypedTreeOps
open FSharp.Compiler.TypedTreeBasics
open FSharp.Compiler.TcGlobals

let CanonicalizeFilename filename =
Expand Down Expand Up @@ -827,6 +828,11 @@ let GetInitialTcState(m, ccuName, tcConfig: TcConfig, tcGlobals, tcImports: TcIm
tcsImplicitOpenDeclarations = openDecls0
}

/// Dummy typed impl file that contains no definitions and is not used for emitting any kind of assembly.
let CreateEmptyDummyTypedImplFile qualNameOfFile sigTy =
let dummyExpr = ModuleOrNamespaceExprWithSig.ModuleOrNamespaceExprWithSig(sigTy, ModuleOrNamespaceExpr.TMDefs [], range.Zero)
TypedImplFile.TImplFile(qualNameOfFile, [], dummyExpr, false, false, StampMap [], Map.empty)

/// Typecheck a single file (or interactive entry into F# Interactive)
let CheckOneInput
(
Expand Down Expand Up @@ -906,10 +912,7 @@ let CheckOneInput
// Typecheck the implementation file
let typeCheckOne =
if skipImplIfSigExists && hadSig then
let dummyExpr = ModuleOrNamespaceExprWithSig.ModuleOrNamespaceExprWithSig(rootSigOpt.Value, ModuleOrNamespaceExpr.TMDefs [], range.Zero)
let dummyImplFile = TypedImplFile.TImplFile(qualNameOfFile, [], dummyExpr, false, false, StampMap [], Map.empty)

(EmptyTopAttrs, dummyImplFile, Unchecked.defaultof<_>, tcImplEnv, false)
(EmptyTopAttrs, CreateEmptyDummyTypedImplFile qualNameOfFile rootSigOpt.Value, Unchecked.defaultof<_>, tcImplEnv, false)
|> Cancellable.ret
else
CheckOneImplFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, tcState.tcsImplicitOpenDeclarations, checkForErrors, conditionalDefines, tcSink, tcConfig.internalTestSpanStackReferring, tcImplEnv, rootSigOpt, file)
Expand Down
5 changes: 5 additions & 0 deletions src/fsharp/StaticLinking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ let StaticLink (ctok, tcConfig: TcConfig, tcImports: TcImports, ilGlobals: ILGlo
id
else
(fun ilxMainModule ->
match tcConfig.emitMetadataAssembly with
| MetadataAssemblyGeneration.None -> ()
| _ ->
error(Error(FSComp.SR.optsInvalidRefAssembly(), rangeCmdArgs))

ReportTime tcConfig "Find assembly references"

let dependentILModules = FindDependentILModulesForStaticLinking (ctok, tcConfig, tcImports, ilGlobals, ilxMainModule)
Expand Down
11 changes: 8 additions & 3 deletions src/fsharp/TcGlobals.fs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ let tname_RuntimeFieldHandle = "System.RuntimeFieldHandle"
[<Literal>]
let tname_CompilerGeneratedAttribute = "System.Runtime.CompilerServices.CompilerGeneratedAttribute"
[<Literal>]
let tname_ReferenceAssemblyAttribute = "System.Runtime.CompilerServices.ReferenceAssemblyAttribute"
[<Literal>]
let tname_DebuggableAttribute = "System.Diagnostics.DebuggableAttribute"
[<Literal>]
let tname_AsyncCallback = "System.AsyncCallback"
Expand Down Expand Up @@ -1197,7 +1199,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
member val system_Nullable_tcref = v_nullable_tcr
member val system_GenericIComparable_tcref = findSysTyconRef sys "IComparable`1"
member val system_GenericIEquatable_tcref = findSysTyconRef sys "IEquatable`1"
member val mk_IComparable_ty = mkSysNonGenericTy sys "IComparable"
member val mk_IComparable_ty = mkSysNonGenericTy sys "IComparable"
member val mk_Attribute_ty = mkSysNonGenericTy sys "Attribute"
vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
member val system_LinqExpression_tcref = v_linqExpression_tcr

member val mk_IStructuralComparable_ty = mkSysNonGenericTy sysCollections "IStructuralComparable"
Expand Down Expand Up @@ -1245,7 +1248,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
member val iltyp_ValueType = findSysILTypeRef tname_ValueType |> mkILNonGenericBoxedTy
member val iltyp_RuntimeFieldHandle = findSysILTypeRef tname_RuntimeFieldHandle |> mkILNonGenericValueTy
member val iltyp_RuntimeMethodHandle = findSysILTypeRef tname_RuntimeMethodHandle |> mkILNonGenericValueTy
member val iltyp_RuntimeTypeHandle = findSysILTypeRef tname_RuntimeTypeHandle |> mkILNonGenericValueTy
member val iltyp_RuntimeTypeHandle = findSysILTypeRef tname_RuntimeTypeHandle |> mkILNonGenericValueTy
member val iltyp_ReferenceAssemblyAttributeOpt = tryFindSysILTypeRef tname_ReferenceAssemblyAttribute |> Option.map mkILNonGenericBoxedTy


member val attrib_AttributeUsageAttribute = findSysAttrib "System.AttributeUsageAttribute"
Expand Down Expand Up @@ -1284,7 +1288,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
member val attrib_CallerLineNumberAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerLineNumberAttribute"
member val attrib_CallerFilePathAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerFilePathAttribute"
member val attrib_CallerMemberNameAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerMemberNameAttribute"
member val attrib_SkipLocalsInitAttribute = findSysAttrib "System.Runtime.CompilerServices.SkipLocalsInitAttribute"
member val attrib_ReferenceAssemblyAttribute = findSysAttrib "System.Runtime.CompilerServices.ReferenceAssemblyAttribute"
member val attrib_SkipLocalsInitAttribute = findSysAttrib "System.Runtime.CompilerServices.SkipLocalsInitAttribute"
member val attribs_Unsupported = v_attribs_Unsupported

member val attrib_ProjectionParameterAttribute = mk_MFCore_attrib "ProjectionParameterAttribute"
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ let tryRescopeEntity viewedCcu (entity: Entity) : ValueOption<EntityRef> =
| None -> ValueNone

/// Try to create a ValRef suitable for accessing the given Val from another assembly
let tryRescopeVal viewedCcu (entityRemap: Remap) (vspec: Val) : ValueOption<ValRef> =
let tryRescopeVal viewedCcu (entityRemap: Remap) (vspec: Val) : ValueOption<ValRef> =
match vspec.PublicPath with
| Some (ValPubPath(p, fullLinkageKey)) ->
// The type information in the val linkage doesn't need to keep any information to trait solutions.
Expand Down Expand Up @@ -2047,7 +2047,7 @@ let emptyFreeTyvars =
{ FreeTycons = emptyFreeTycons
// The summary of values used as trait solutions
FreeTraitSolutions = emptyFreeLocals
FreeTypars = emptyFreeTypars}
FreeTypars = emptyFreeTypars }

let isEmptyFreeTyvars ftyvs =
Zset.isEmpty ftyvs.FreeTypars &&
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/TypedTreeOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ val emptyFreeLocals: FreeLocals

val unionFreeLocals: FreeLocals -> FreeLocals -> FreeLocals

type FreeVarOptions
type FreeVarOptions

val CollectLocalsNoCaching: FreeVarOptions

Expand Down
Loading