Skip to content

Commit

Permalink
Merge remote-tracking branch 'remote/main' into ref-assembly-output
Browse files Browse the repository at this point in the history
  • Loading branch information
TIHan committed Jun 3, 2021
2 parents cfa275c + 6034e99 commit 1604fa0
Show file tree
Hide file tree
Showing 94 changed files with 1,189 additions and 834 deletions.
7 changes: 6 additions & 1 deletion FSharpBuild.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
</PropertyGroup>

<!-- directory locations -->

<PropertyGroup Condition="'$(OS)' != 'Unix' and '$(DisableAutoSetFscCompilerPath)' != 'true' and '$(Configuration)' != 'Proto' and '$(DOTNET_HOST_PATH)' != ''">
<DisableAutoSetFscCompilerPath>true</DisableAutoSetFscCompilerPath>
</PropertyGroup>

<PropertyGroup>
<FSharpSourcesRoot>$(RepoRoot)src</FSharpSourcesRoot>
<FSharpTestsRoot>$(RepoRoot)tests</FSharpTestsRoot>
Expand All @@ -16,7 +21,7 @@
<ValueTupleImplicitPackageVersion>4.4.0</ValueTupleImplicitPackageVersion>
<WarningsAsErrors>1182;0025;$(WarningsAsErrors)</WarningsAsErrors>
<OtherFlags>$(OtherFlags) --nowarn:3384</OtherFlags>
</PropertyGroup>
</PropertyGroup>

<!-- nuget -->
<PropertyGroup>
Expand Down
14 changes: 7 additions & 7 deletions src/fsharp/AttributeChecking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ type AttribInfo =
let ty = tyOfExpr g origExpr
let obj = evalFSharpAttribArg g evaluatedExpr
ty, obj)
| ILAttribInfo (g, amap, scoref, cattr, m) ->
let parms, _args = decodeILAttribData g.ilg cattr
| ILAttribInfo (_g, amap, scoref, cattr, m) ->
let parms, _args = decodeILAttribData cattr
[ for (argty, argval) in Seq.zip cattr.Method.FormalArgTypes parms ->
let ty = ImportILType scoref amap m [] argty
let obj = evalILAttribElem argval
Expand All @@ -113,8 +113,8 @@ type AttribInfo =
let ty = tyOfExpr g origExpr
let obj = evalFSharpAttribArg g evaluatedExpr
ty, nm, isField, obj)
| ILAttribInfo (g, amap, scoref, cattr, m) ->
let _parms, namedArgs = decodeILAttribData g.ilg cattr
| ILAttribInfo (_g, amap, scoref, cattr, m) ->
let _parms, namedArgs = decodeILAttribData cattr
[ for (nm, argty, isProp, argval) in namedArgs ->
let ty = ImportILType scoref amap m [] argty
let obj = evalILAttribElem argval
Expand Down Expand Up @@ -198,7 +198,7 @@ let TryBindMethInfoAttribute g (m: range) (AttribInfo(atref, _) as attribSpec) m
ignore f3
#endif
BindMethInfoAttributes m minfo
(fun ilAttribs -> TryDecodeILAttribute g atref ilAttribs |> Option.bind f1)
(fun ilAttribs -> TryDecodeILAttribute atref ilAttribs |> Option.bind f1)
(fun fsAttribs -> TryFindFSharpAttribute g attribSpec fsAttribs |> Option.bind f2)
#if !NO_EXTENSIONTYPING
(fun provAttribs ->
Expand Down Expand Up @@ -230,7 +230,7 @@ let MethInfoHasAttribute g m attribSpec minfo =
/// Check IL attributes for 'ObsoleteAttribute', returning errors and warnings as data
let private CheckILAttributes (g: TcGlobals) isByrefLikeTyconRef cattrs m =
let (AttribInfo(tref,_)) = g.attrib_SystemObsolete
match TryDecodeILAttribute g tref cattrs with
match TryDecodeILAttribute tref cattrs with
| Some ([ILAttribElem.String (Some msg) ], _) when not isByrefLikeTyconRef ->
WarnD(ObsoleteWarning(msg, m))
| Some ([ILAttribElem.String (Some msg); ILAttribElem.Bool isError ], _) when not isByrefLikeTyconRef ->
Expand Down Expand Up @@ -329,7 +329,7 @@ let private CheckProvidedAttributes (g: TcGlobals) m (provAttribs: Tainted<IProv
/// Indicate if a list of IL attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
let CheckILAttributesForUnseen (g: TcGlobals) cattrs _m =
let (AttribInfo(tref, _)) = g.attrib_SystemObsolete
Option.isSome (TryDecodeILAttribute g tref cattrs)
Option.isSome (TryDecodeILAttribute tref cattrs)

/// Checks the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
/// items to be suppressed from intellisense.
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9532,7 +9532,7 @@ and TcAttribute canFail cenv (env: TcEnv) attrTgt (synAttr: SynAttribute) =
let tdef = tcref.ILTyconRawMetadata
let tref = cenv.g.attrib_AttributeUsageAttribute.TypeRef

match TryDecodeILAttribute cenv.g tref tdef.CustomAttrs with
match TryDecodeILAttribute tref tdef.CustomAttrs with
| Some ([ILAttribElem.Int32 validOn ], named) ->
let inherited =
match List.tryPick (function ("Inherited", _, _, ILAttribElem.Bool res) -> Some res | _ -> None) named with
Expand Down
3 changes: 2 additions & 1 deletion src/fsharp/CheckFormatStrings.fs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ let parseFormatStringInternal (m: range) (fragRanges: range list) (g: TcGlobals)
appendToDotnetFormatString "%"
parseLoop acc (i+1, fragLine, fragCol+1) fragments

| ('d' | 'i' | 'o' | 'u' | 'x' | 'X') ->
| ('d' | 'i' | 'u' | 'B' | 'o' | 'x' | 'X') ->
if ch = 'B' then ErrorLogger.checkLanguageFeatureError g.langVersion Features.LanguageFeature.PrintfBinaryFormat m
if info.precision then failwithf "%s" <| FSComp.SR.forFormatDoesntSupportPrecision(ch.ToString())
collectSpecifierLocation fragLine fragCol 1
let i = skipPossibleInterpolationHole (i+1)
Expand Down
30 changes: 15 additions & 15 deletions src/fsharp/CompilerConfig.fs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ type VersionFlag =
if not(FileSystem.FileExistsShim s) then
errorR(Error(FSComp.SR.buildInvalidVersionFile s, rangeStartup)); "0.0.0.0"
else
use fs = FileSystem.OpenFileForReadShim(s).AsReadOnlyStream()
use fs = FileSystem.OpenFileForReadShim(s)
use is = new StreamReader(fs)
is.ReadLine()
| VersionNone -> "0.0.0.0"
Expand All @@ -148,10 +148,10 @@ type VersionFlag =
/// reference backed by information generated by the the compiler service.
type IRawFSharpAssemblyData =
/// The raw list AutoOpenAttribute attributes in the assembly
abstract GetAutoOpenAttributes: ILGlobals -> string list
abstract GetAutoOpenAttributes: unit -> string list

/// The raw list InternalsVisibleToAttribute attributes in the assembly
abstract GetInternalsVisibleToAttributes: ILGlobals -> string list
abstract GetInternalsVisibleToAttributes: unit -> string list

/// The raw IL module definition in the assembly, if any. This is not present for cross-project references
/// in the language service
Expand All @@ -175,7 +175,7 @@ type IRawFSharpAssemblyData =

abstract HasAnyFSharpSignatureDataAttribute: bool

abstract HasMatchingFSharpSignatureDataAttribute: ILGlobals -> bool
abstract HasMatchingFSharpSignatureDataAttribute: bool

/// Cache of time stamps as we traverse a project description
type TimeStampCache(defaultTimeStamp: DateTime) =
Expand Down Expand Up @@ -762,7 +762,7 @@ type TcConfigBuilder =
let absolutePath = ComputeMakePathAbsolute pathIncludedFrom path
let ok =
let existsOpt =
try Some(Directory.Exists absolutePath)
try Some(FileSystem.DirectoryExistsShim absolutePath)
with e -> warning(Error(FSComp.SR.buildInvalidSearchDirectory path, m)); None
match existsOpt with
| Some exists ->
Expand Down Expand Up @@ -1076,7 +1076,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
let clrRoot = tcConfig.MakePathAbsolute x
yield clrRoot
let clrFacades = Path.Combine(clrRoot, "Facades")
if Directory.Exists(clrFacades) then yield clrFacades
if FileSystem.DirectoryExistsShim(clrFacades) then yield clrFacades

| None ->
// "there is no really good notion of runtime directory on .NETCore"
Expand All @@ -1095,13 +1095,13 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
//
// In the current way of doing things, F# Interactive refers to implementation assemblies.
yield runtimeRoot
if Directory.Exists runtimeRootFacades then
if FileSystem.DirectoryExistsShim runtimeRootFacades then
yield runtimeRootFacades // System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if Directory.Exists runtimeRootWPF then
if FileSystem.DirectoryExistsShim runtimeRootWPF then
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF

match tcConfig.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when Directory.Exists(path) ->
| Some path when FileSystem.DirectoryExistsShim(path) ->
yield path
| _ -> ()

Expand All @@ -1113,16 +1113,16 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
// On Mono, the default references come from the implementation assemblies.
// This is because we have had trouble reliably using MSBuild APIs to compute DotNetFrameworkReferenceAssembliesRootDirectory on Mono.
yield runtimeRoot
if Directory.Exists runtimeRootFacades then
if FileSystem.DirectoryExistsShim runtimeRootFacades then
yield runtimeRootFacades // System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if Directory.Exists runtimeRootWPF then
if FileSystem.DirectoryExistsShim runtimeRootWPF then
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
// On Mono we also add a default reference to the 4.5-api and 4.5-api/Facades directories.
let runtimeRootApi = runtimeRootWithoutSlash + "-api"
let runtimeRootApiFacades = Path.Combine(runtimeRootApi, "Facades")
if Directory.Exists runtimeRootApi then
if FileSystem.DirectoryExistsShim runtimeRootApi then
yield runtimeRootApi
if Directory.Exists runtimeRootApiFacades then
if FileSystem.DirectoryExistsShim runtimeRootApiFacades then
yield runtimeRootApiFacades
else
#endif
Expand All @@ -1133,10 +1133,10 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
let frameworkRootVersion = Path.Combine(frameworkRoot, tcConfig.targetFrameworkVersion)
yield frameworkRootVersion
let facades = Path.Combine(frameworkRootVersion, "Facades")
if Directory.Exists facades then
if FileSystem.DirectoryExistsShim facades then
yield facades
match tcConfig.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when Directory.Exists(path) ->
| Some path when FileSystem.DirectoryExistsShim(path) ->
yield path
| _ -> ()
]
Expand Down
6 changes: 3 additions & 3 deletions src/fsharp/CompilerConfig.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ exception LoadedSourceNotFoundIgnoring of (*filename*) string * range
type IRawFSharpAssemblyData =

/// The raw list AutoOpenAttribute attributes in the assembly
abstract GetAutoOpenAttributes: ILGlobals -> string list
abstract GetAutoOpenAttributes: unit -> string list

/// The raw list InternalsVisibleToAttribute attributes in the assembly
abstract GetInternalsVisibleToAttributes: ILGlobals -> string list
abstract GetInternalsVisibleToAttributes: unit -> string list

/// The raw IL module definition in the assembly, if any. This is not present for cross-project references
/// in the language service
abstract TryGetILModuleDef: unit -> ILModuleDef option

abstract HasAnyFSharpSignatureDataAttribute: bool

abstract HasMatchingFSharpSignatureDataAttribute: ILGlobals -> bool
abstract HasMatchingFSharpSignatureDataAttribute: bool

/// The raw F# signature data in the assembly, if any
abstract GetRawFSharpSignatureData: range * ilShortAssemName: string * fileName: string -> (string * (unit -> ReadOnlyByteMemory)) list
Expand Down
Loading

0 comments on commit 1604fa0

Please sign in to comment.