Skip to content

Commit 69ece79

Browse files
authored
Rename FSharpReferencedProject.ProjectFileName for clarity (#12431)
This renames the `projectFileName` field and `FileName` property to reflect the actual use: the project's output file. This was unclear based on docs, but clear based on usage, and so docs were added to help ensure correct usage.
1 parent 2080a47 commit 69ece79

File tree

3 files changed

+47
-31
lines changed

3 files changed

+47
-31
lines changed

src/fsharp/service/FSharpCheckerResults.fs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,41 +106,41 @@ type internal DelayedILModuleReader =
106106

107107
[<RequireQualifiedAccess;NoComparison;CustomEquality>]
108108
type FSharpReferencedProject =
109-
| FSharpReference of projectFileName: string * options: FSharpProjectOptions
110-
| PEReference of projectFileName: string * getStamp: (unit -> DateTime) * delayedReader: DelayedILModuleReader
111-
| ILModuleReference of projectFileName: string * getStamp: (unit -> DateTime) * getReader: (unit -> ILModuleReader)
109+
| FSharpReference of projectOutputFile: string * options: FSharpProjectOptions
110+
| PEReference of projectOutputFile: string * getStamp: (unit -> DateTime) * delayedReader: DelayedILModuleReader
111+
| ILModuleReference of projectOutputFile: string * getStamp: (unit -> DateTime) * getReader: (unit -> ILModuleReader)
112112

113-
member this.FileName =
113+
member this.OutputFile =
114114
match this with
115-
| FSharpReference(projectFileName=projectFileName)
116-
| PEReference(projectFileName=projectFileName)
117-
| ILModuleReference(projectFileName=projectFileName) -> projectFileName
115+
| FSharpReference(projectOutputFile=projectOutputFile)
116+
| PEReference(projectOutputFile=projectOutputFile)
117+
| ILModuleReference(projectOutputFile=projectOutputFile) -> projectOutputFile
118118

119-
static member CreateFSharp(projectFileName, options) =
120-
FSharpReference(projectFileName, options)
119+
static member CreateFSharp(projectOutputFile, options) =
120+
FSharpReference(projectOutputFile, options)
121121

122-
static member CreatePortableExecutable(projectFileName, getStamp, getStream) =
123-
PEReference(projectFileName, getStamp, DelayedILModuleReader(projectFileName, getStream))
122+
static member CreatePortableExecutable(projectOutputFile, getStamp, getStream) =
123+
PEReference(projectOutputFile, getStamp, DelayedILModuleReader(projectOutputFile, getStream))
124124

125-
static member CreateFromILModuleReader(projectFileName, getStamp, getReader) =
126-
ILModuleReference(projectFileName, getStamp, getReader)
125+
static member CreateFromILModuleReader(projectOutputFile, getStamp, getReader) =
126+
ILModuleReference(projectOutputFile, getStamp, getReader)
127127

128128
override this.Equals(o) =
129129
match o with
130130
| :? FSharpReferencedProject as o ->
131131
match this, o with
132-
| FSharpReference(projectFileName1, options1), FSharpReference(projectFileName2, options2) ->
133-
projectFileName1 = projectFileName2 && options1 = options2
134-
| PEReference(projectFileName1, getStamp1, _), PEReference(projectFileName2, getStamp2, _) ->
135-
projectFileName1 = projectFileName2 && (getStamp1()) = (getStamp2())
136-
| ILModuleReference(projectFileName1, getStamp1, _), ILModuleReference(projectFileName2, getStamp2, _) ->
137-
projectFileName1 = projectFileName2 && (getStamp1()) = (getStamp2())
132+
| FSharpReference(projectOutputFile1, options1), FSharpReference(projectOutputFile2, options2) ->
133+
projectOutputFile1 = projectOutputFile2 && options1 = options2
134+
| PEReference(projectOutputFile1, getStamp1, _), PEReference(projectOutputFile2, getStamp2, _) ->
135+
projectOutputFile1 = projectOutputFile2 && (getStamp1()) = (getStamp2())
136+
| ILModuleReference(projectOutputFile1, getStamp1, _), ILModuleReference(projectOutputFile2, getStamp2, _) ->
137+
projectOutputFile1 = projectOutputFile2 && (getStamp1()) = (getStamp2())
138138
| _ ->
139139
false
140140
| _ ->
141141
false
142142

143-
override this.GetHashCode() = this.FileName.GetHashCode()
143+
override this.GetHashCode() = this.OutputFile.GetHashCode()
144144

145145
// NOTE: may be better just to move to optional arguments here
146146
and FSharpProjectOptions =

src/fsharp/service/FSharpCheckerResults.fsi

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,39 @@ type public FSharpProjectOptions =
9696

9797
and [<NoComparison;CustomEquality>] public FSharpReferencedProject =
9898
internal
99-
| FSharpReference of projectFileName: string * options: FSharpProjectOptions
100-
| PEReference of projectFileName: string * getStamp: (unit -> DateTime) * delayedReader: DelayedILModuleReader
101-
| ILModuleReference of projectFileName: string * getStamp: (unit -> DateTime) * getReader: (unit -> ILModuleReader)
99+
| FSharpReference of projectOutputFile: string * options: FSharpProjectOptions
100+
| PEReference of projectOutputFile: string * getStamp: (unit -> DateTime) * delayedReader: DelayedILModuleReader
101+
| ILModuleReference of projectOutputFile: string * getStamp: (unit -> DateTime) * getReader: (unit -> ILModuleReader)
102102

103-
member FileName : string
103+
///<summary>
104+
/// The fully qualified path to the output of the referenced project. This should be the same value as the <code>-r</code>
105+
/// reference in the project options for this referenced project.
106+
///</summary>
107+
member OutputFile : string
104108

109+
///<summary>
105110
/// Creates a reference for an F# project. The physical data for it is stored/cached inside of the compiler service.
106-
static member CreateFSharp : projectFileName: string * options: FSharpProjectOptions -> FSharpReferencedProject
111+
///</summary>
112+
///<param name="projectOutputFile">The fully qualified path to the output of the referenced project. This should be the same value as the <code>-r</code> reference in the project options for this referenced project.</param>
113+
///<param name="options">The Project Options for this F# project</param>
114+
static member CreateFSharp : projectOutputFile: string * options: FSharpProjectOptions -> FSharpReferencedProject
107115

116+
///<summary>
108117
/// Creates a reference for any portable executable, including F#. The stream is owned by this reference.
109118
/// The stream will be automatically disposed when there are no references to FSharpReferencedProject and is GC collected.
110119
/// Once the stream is evaluated, the function that constructs the stream will no longer be referenced by anything.
111120
/// If the stream evaluation throws an exception, it will be automatically handled.
112-
static member CreatePortableExecutable : projectFileName: string * getStamp: (unit -> DateTime) * getStream: (CancellationToken -> Stream option) -> FSharpReferencedProject
113-
114-
/// Creates a reference from an ILModuleReader.
115-
static member CreateFromILModuleReader : projectFileName: string * getStamp: (unit -> DateTime) * getReader: (unit -> ILModuleReader) -> FSharpReferencedProject
121+
///</summary>
122+
///<param name="projectOutputFile">The fully qualified path to the output of the referenced project. This should be the same value as the <code>-r</code> reference in the project options for this referenced project.</param>
123+
///<param name="getStamp">A function that calculates a last-modified timestamp for this reference. This will be used to determine if the reference is up-to-date.</param>
124+
///<param name="getStream">A function that opens a Portable Executable data stream for reading.</param>
125+
static member CreatePortableExecutable : projectOutputFile: string * getStamp: (unit -> DateTime) * getStream: (CancellationToken -> Stream option) -> FSharpReferencedProject
126+
127+
///<summary>Creates a reference from an ILModuleReader.</summary>
128+
///<param name="projectOutputFile">The fully qualified path to the output of the referenced project. This should be the same value as the <code>-r</code> reference in the project options for this referenced project.</param>
129+
///<param name="getStamp">A function that calculates a last-modified timestamp for this reference. This will be used to determine if the reference is up-to-date.</param>
130+
///<param name="getReader">A function that creates an ILModuleReader for reading module data.</param>
131+
static member CreateFromILModuleReader : projectOutputFile: string * getStamp: (unit -> DateTime) * getReader: (unit -> ILModuleReader) -> FSharpReferencedProject
116132

117133
/// Represents the use of an F# symbol from F# source code
118134
[<Sealed>]

tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,9 +2131,9 @@ FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: FSharp.Compiler.CodeAnalys
21312131
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: FSharp.Compiler.CodeAnalysis.FSharpReferencedProject CreateFromILModuleReader(System.String, Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.DateTime], Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader])
21322132
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: FSharp.Compiler.CodeAnalysis.FSharpReferencedProject CreatePortableExecutable(System.String, Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,System.DateTime], Microsoft.FSharp.Core.FSharpFunc`2[System.Threading.CancellationToken,Microsoft.FSharp.Core.FSharpOption`1[System.IO.Stream]])
21332133
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: Int32 GetHashCode()
2134-
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: System.String FileName
2134+
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: System.String OutputFile
21352135
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: System.String ToString()
2136-
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: System.String get_FileName()
2136+
FSharp.Compiler.CodeAnalysis.FSharpReferencedProject: System.String get_OutputFile()
21372137
FSharp.Compiler.CodeAnalysis.FSharpSymbolUse
21382138
FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsFromAttribute
21392139
FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsFromComputationExpression

0 commit comments

Comments
 (0)