Skip to content

Commit 203e472

Browse files
authored
Merge pull request #9789 from dotnet/merges/master-to-release/dev16.8
Merge master to release/dev16.8
2 parents 9abe1ba + 87114ec commit 203e472

File tree

15 files changed

+161
-969
lines changed

15 files changed

+161
-969
lines changed

FSharp.Profiles.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<DefineConstants>$(DefineConstants);FX_NO_WINFORMS</DefineConstants>
2020
<DefineConstants>$(DefineConstants);FX_NO_INDENTED_TEXT_WRITER</DefineConstants>
2121
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFEMIT</DefineConstants>
22-
<DefineConstants>$(DefineConstants);FX_RESHAPED_MSBUILD</DefineConstants>
2322
<OtherFlags>$(OtherFlags) --simpleresolution</OtherFlags>
2423
</PropertyGroup>
2524

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.17</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
107107
<MicrosoftVisualStudioLanguageServicesVersion>$(RoslynVersion)</MicrosoftVisualStudioLanguageServicesVersion>
108108
<!-- Microsoft Build packages -->
109-
<MicrosoftBuildOverallPackagesVersion>16.4</MicrosoftBuildOverallPackagesVersion>
109+
<MicrosoftBuildOverallPackagesVersion>16.6</MicrosoftBuildOverallPackagesVersion>
110110
<MicrosoftBuildVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildVersion>
111111
<MicrosoftBuildFrameworkVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildFrameworkVersion>
112112
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildTasksCoreVersion>

fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,6 @@
283283
<Compile Include="$(FSharpSourcesRoot)/absil/ilreflect.fs">
284284
<Link>AbsIL/ilreflect.fs</Link>
285285
</Compile>
286-
<Compile Include="$(FSharpSourcesRoot)\utils\reshapedmsbuild.fs">
287-
<Link>ReferenceResolution/reshapedmsbuild.fs</Link>
288-
</Compile>
289286
<Compile Include="$(FSharpSourcesRoot)/fsharp/ReferenceResolver.fs">
290287
<Link>ReferenceResolution/ReferenceResolver.fs</Link>
291288
</Compile>

setup/Swix/Microsoft.FSharp.Compiler.MSBuild/Microsoft.FSharp.Compiler.MSBuild.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp"
103103
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.sigdata"
104104
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
105105
file source="$(BinariesFolder)\Microsoft.DotNet.DependencyManager\$(Configuration)\net472\Microsoft.DotNet.DependencyManager.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
106-
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.dll"
107106
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll"
108107
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Tasks.Core.dll"
109108
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Utilities.Core.dll"

src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
</PropertyGroup>
2323
<ItemGroup>
2424
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.Framework.dll" />
25-
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.dll" />
2625
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.Utilities.Core.dll" />
2726
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\Microsoft.Build.Tasks.Core.dll" />
2827
<BuiltProjectOutputGroupKeyOutput Include="$(BuildOutputGroupLocation)\System.Buffers.dll" />
@@ -273,9 +272,6 @@
273272
<Compile Include="..\ReferenceResolver.fs">
274273
<Link>ReferenceResolution\ReferenceResolver.fs</Link>
275274
</Compile>
276-
<Compile Include="..\..\utils\reshapedmsbuild.fs">
277-
<Link>ReferenceResolution/reshapedmsbuild.fs</Link>
278-
</Compile>
279275
<!-- A legacy resolver used to help with scripting diagnostics in the Visual Studio tools -->
280276
<Compile Include="..\LegacyMSBuildReferenceResolver.fsi">
281277
<Link>ReferenceResolution/LegacyMSBuildReferenceResolver.fsi</Link>
@@ -734,10 +730,6 @@
734730

735731
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
736732
<Reference Include="ISymWrapper, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
737-
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildVersion)" />
738-
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
739-
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildVersion)" />
740-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
741733
<PackageReference Include="System.IO.Compression" Version="$(SystemIoCompressionVersion)" />
742734
</ItemGroup>
743735

@@ -766,6 +758,9 @@
766758
<PackageReference Include="System.Threading.ThreadPool" Version="$(SystemThreadingThreadPoolVersion)" />
767759
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
768760
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
761+
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
762+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildVersion)" />
763+
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
769764
</ItemGroup>
770765

771766
</Project>

src/fsharp/FSharp.Core/string.fs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace Microsoft.FSharp.Core
88
open Microsoft.FSharp.Core.Operators
99
open Microsoft.FSharp.Core.Operators.Checked
1010
open Microsoft.FSharp.Collections
11+
open Microsoft.FSharp.Primitives.Basics
1112

1213
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
1314
[<RequireQualifiedAccess>]
@@ -22,7 +23,25 @@ namespace Microsoft.FSharp.Core
2223

2324
[<CompiledName("Concat")>]
2425
let concat sep (strings : seq<string>) =
25-
String.Join(sep, strings)
26+
27+
let concatArray sep (strings: string []) =
28+
match length sep with
29+
| 0 -> String.Concat strings
30+
// following line should be used when this overload becomes part of .NET Standard (it's only in .NET Core)
31+
//| 1 -> String.Join(sep.[0], strings, 0, strings.Length)
32+
| _ -> String.Join(sep, strings, 0, strings.Length)
33+
34+
match strings with
35+
| :? array<string> as arr ->
36+
concatArray sep arr
37+
38+
| :? list<string> as lst ->
39+
lst
40+
|> List.toArray
41+
|> concatArray sep
42+
43+
| _ ->
44+
String.Join(sep, strings)
2645

2746
[<CompiledName("Iterate")>]
2847
let iter (action : (char -> unit)) (str:string) =
@@ -52,13 +71,19 @@ namespace Microsoft.FSharp.Core
5271

5372
[<CompiledName("MapIndexed")>]
5473
let mapi (mapping: int -> char -> char) (str:string) =
55-
if String.IsNullOrEmpty str then
74+
let len = length str
75+
if len = 0 then
5676
String.Empty
5777
else
58-
let res = StringBuilder str.Length
78+
let result = str.ToCharArray()
5979
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(mapping)
60-
str |> iteri (fun i c -> res.Append(f.Invoke(i, c)) |> ignore)
61-
res.ToString()
80+
81+
let mutable i = 0
82+
while i < len do
83+
result.[i] <- f.Invoke(i, result.[i])
84+
i <- i + 1
85+
86+
new String(result)
6287

6388
[<CompiledName("Filter")>]
6489
let filter (predicate: char -> bool) (str:string) =

src/fsharp/LegacyMSBuildReferenceResolver.fs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ module LegacyMSBuildReferenceResolver
55
open System
66
open System.IO
77
open System.Reflection
8-
9-
#if FX_RESHAPED_MSBUILD
10-
open FSharp.Compiler.MsBuildAdapters
11-
open FSharp.Compiler.ToolLocationHelper
12-
#endif
13-
148
open FSharp.Compiler.AbstractIL.Internal.Library
159
open FSharp.Compiler.ReferenceResolver
1610
open Microsoft.Build.Tasks
@@ -137,7 +131,6 @@ module LegacyMSBuildReferenceResolver
137131
else Net45 // version is 4.5 assumed since this code is running.
138132
with _ -> Net45
139133

140-
#if !FX_RESHAPED_MSBUILD
141134
// 1. First look to see if we can find the highest installed set of dotnet reference assemblies, if yes then select that framework
142135
// 2. Otherwise ask msbuild for the highestinstalled framework
143136
let checkFrameworkForReferenceAssemblies (dotNetVersion:string) =
@@ -153,9 +146,6 @@ module LegacyMSBuildReferenceResolver
153146
match SupportedDesktopFrameworkVersions |> Seq.tryFind(fun v -> checkFrameworkForReferenceAssemblies v) with
154147
| Some v -> v
155148
| None -> getHighestInstalledDotNETFramework()
156-
#else
157-
getHighestInstalledDotNETFramework()
158-
#endif
159149

160150
/// Derive the target framework directories.
161151
let DeriveTargetFrameworkDirectories (targetFrameworkVersion:string, logMessage) =
@@ -270,17 +260,10 @@ module LegacyMSBuildReferenceResolver
270260
let engine =
271261
{ new IBuildEngine with
272262
member __.BuildProjectFile(projectFileName, targetNames, globalProperties, targetOutputs) = true
273-
#if FX_RESHAPED_MSBUILD
274-
member __.LogCustomEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string))
275-
member __.LogErrorEvent(e) = protect (fun () -> logDiagnostic true ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string))
276-
member __.LogMessageEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string))
277-
member __.LogWarningEvent(e) = protect (fun () -> logDiagnostic false ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string))
278-
#else
279263
member __.LogCustomEvent(e) = protect (fun () -> logMessage e.Message)
280264
member __.LogErrorEvent(e) = protect (fun () -> logDiagnostic true e.Code e.Message)
281265
member __.LogMessageEvent(e) = protect (fun () -> logMessage e.Message)
282266
member __.LogWarningEvent(e) = protect (fun () -> logDiagnostic false e.Code e.Message)
283-
#endif
284267
member __.ColumnNumberOfTaskNode with get() = 1
285268
member __.LineNumberOfTaskNode with get() = 1
286269
member __.ContinueOnError with get() = true
@@ -329,15 +312,10 @@ module LegacyMSBuildReferenceResolver
329312
|]
330313

331314
let assemblies =
332-
#if FX_RESHAPED_MSBUILD
333-
ignore references
334-
[||]
335-
#else
336315
[| for (referenceName,baggage) in references ->
337316
let item = new Microsoft.Build.Utilities.TaskItem(referenceName) :> ITaskItem
338317
item.SetMetadata("Baggage", baggage)
339318
item |]
340-
#endif
341319
let rar =
342320
ResolveAssemblyReference(BuildEngine=engine, TargetFrameworkDirectories=targetFrameworkDirectories,
343321
FindRelatedFiles=false, FindDependencies=false, FindSatellites=false,

src/fsharp/SimulatedMSBuildReferenceResolver.fs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ let private SimulatedMSBuildResolver =
3535
| None -> "v4.5"
3636

3737
member __.DotNetFrameworkReferenceAssembliesRootDirectory =
38-
#if !FX_RESHAPED_MSBUILD
3938
if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then
4039
let PF =
4140
match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with
4241
| null -> Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF
4342
| s -> s
4443
PF + @"\Reference Assemblies\Microsoft\Framework\.NETFramework"
4544
else
46-
#endif
4745
""
4846

4947
member __.Resolve(resolutionEnvironment, references, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture,
@@ -105,7 +103,6 @@ let private SimulatedMSBuildResolver =
105103
success r
106104
with e -> logWarningOrError false "SR001" (e.ToString())
107105

108-
#if !FX_RESHAPED_MSBUILD
109106
// For this one we need to get the version search exactly right, without doing a load
110107
try
111108
if not found && r.StartsWithOrdinal("FSharp.Core, Version=") && Environment.OSVersion.Platform = PlatformID.Win32NT then
@@ -120,7 +117,6 @@ let private SimulatedMSBuildResolver =
120117
if FileSystem.SafeExists trialPath then
121118
success trialPath
122119
with e -> logWarningOrError false "SR001" (e.ToString())
123-
#endif
124120

125121
let isFileName =
126122
r.EndsWith("dll", StringComparison.OrdinalIgnoreCase) ||
@@ -136,7 +132,6 @@ let private SimulatedMSBuildResolver =
136132
success trialPath
137133
with e -> logWarningOrError false "SR001" (e.ToString())
138134

139-
#if !FX_RESHAPED_MSBUILD
140135
try
141136
// Search the GAC on Windows
142137
if not found && not isFileName && Environment.OSVersion.Platform = PlatformID.Win32NT then
@@ -178,7 +173,6 @@ let private SimulatedMSBuildResolver =
178173
if FileSystem.SafeExists trialPath then
179174
success trialPath
180175
with e -> logWarningOrError false "SR001" (e.ToString())
181-
#endif
182176

183177
results.ToArray() }
184178

src/fsharp/TcGlobals.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,11 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
16011601
Some (g.array_set_info, [ety], argExprs)
16021602
| "get_Item", [sty; _; _], _, [_; _] when isStringTy g sty ->
16031603
Some (g.getstring_info, [], argExprs)
1604+
| "op_UnaryPlus", [aty], _, [_] ->
1605+
// Call Operators.id
1606+
let info = makeOtherIntrinsicValRef (fslib_MFOperators_nleref, "id", None, None, [vara], ([[varaTy]], varaTy))
1607+
let tyargs = [aty]
1608+
Some (info, tyargs, argExprs)
16041609
| _ ->
16051610
None
16061611

0 commit comments

Comments
 (0)