Skip to content

Commit 4a2384e

Browse files
authored
Merge branch 'release/dev17.8' into darc-release/dev17.8-94379bbc-0d37-4308-8405-935e3d2ab7ff
2 parents 255da56 + 5527f0a commit 4a2384e

File tree

69 files changed

+883
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+883
-198
lines changed

azure-pipelines.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,29 @@ stages:
383383
ArtifactType: Container
384384
parallel: true
385385

386+
- job: WindowsNoStrictIndentation
387+
pool:
388+
name: $(DncEngPublicBuildPool)
389+
demands: ImageOverride -equals $(WindowsMachineQueueName)
390+
timeoutInMinutes: 120
391+
steps:
392+
- checkout: self
393+
clean: true
394+
395+
- script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:AdditionalFscCmdFlags=--strict-indentation-
396+
env:
397+
NativeToolsOnMachine: true
398+
displayName: Build
399+
400+
- task: PublishBuildArtifacts@1
401+
displayName: Publish Build BinLog
402+
condition: always()
403+
continueOnError: true
404+
inputs:
405+
PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog'
406+
ArtifactName: 'Windows Release build binlogs'
407+
ArtifactType: Container
408+
parallel: true
386409

387410
# Windows With Compressed Metadata
388411
- job: WindowsCompressedMetadata

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
33
<ProductDependencies>
4-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="8.0.0-alpha.1.23455.3">
4+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.23468.3">
55
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
6-
<Sha>75ec14a961f43446d952c64b5b3330df750db54f</Sha>
6+
<Sha>b88b567fbf54c5404d039b80cfb86f09a681f604</Sha>
77
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
88
</Dependency>
99
<Dependency Name="Microsoft.SourceBuild.Intermediate.msbuild" Version="17.7.0-preview-23217-02">
@@ -29,9 +29,9 @@
2929
</Dependency>
3030
</ProductDependencies>
3131
<ToolsetDependencies>
32-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23461.2">
32+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23463.1">
3333
<Uri>https://github.com/dotnet/arcade</Uri>
34-
<Sha>4a908c64757841121e67fda7adaf776c93893163</Sha>
34+
<Sha>1d451c32dda2314c721adbf8829e1c0cd4e681ff</Sha>
3535
<SourceBuild RepoName="arcade" ManagedOnly="true" />
3636
</Dependency>
3737
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="1.0.0-beta.23426.1" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
"Microsoft.VisualStudio.Component.FSharp"
1313
]
1414
},
15-
"xcopy-msbuild": "17.7.0-test"
15+
"xcopy-msbuild": "17.7.2"
1616
},
1717
"native-tools": {
1818
"perl": "5.38.0.1"
1919
},
2020
"msbuild-sdks": {
21-
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23461.2",
21+
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23463.1",
2222
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2"
2323
}
2424
}

src/Compiler/Service/FSharpCheckerResults.fs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -986,24 +986,32 @@ type internal TypeCheckInfo
986986
None
987987

988988
/// Suggest name based on type
989-
let SuggestNameBasedOnType g pos ty =
990-
if isNumericType g ty then
991-
CreateCompletionItemForSuggestedPatternName pos "num"
992-
else
993-
match tryTcrefOfAppTy g ty with
994-
| ValueSome tcref when not (tyconRefEq g g.system_Object_tcref tcref) ->
995-
CreateCompletionItemForSuggestedPatternName pos tcref.DisplayName
996-
| _ -> None
989+
let SuggestNameBasedOnType (g: TcGlobals) pos ty =
990+
match stripTyparEqns ty with
991+
| TType_app (tyconRef = tcref) when tcref.IsTypeAbbrev && (tcref.IsLocalRef || not (ccuEq g.fslibCcu tcref.nlr.Ccu)) ->
992+
// Respect user-defined aliases
993+
CreateCompletionItemForSuggestedPatternName pos tcref.DisplayName
994+
| ty ->
995+
if isNumericType g ty then
996+
CreateCompletionItemForSuggestedPatternName pos "num"
997+
else
998+
match tryTcrefOfAppTy g ty with
999+
| ValueSome tcref when not (tyconRefEq g g.system_Object_tcref tcref) ->
1000+
CreateCompletionItemForSuggestedPatternName pos tcref.DisplayName
1001+
| _ -> None
9971002

9981003
/// Suggest names based on field name and type, add them to the list
999-
let SuggestNameForUnionCaseFieldPattern g caseIdPos fieldPatternPos (uci: UnionCaseInfo) indexOrName completions =
1004+
let SuggestNameForUnionCaseFieldPattern g caseIdPos fieldPatternPos (uci: UnionCaseInfo) indexOrName isTheOnlyField completions =
10001005
let field =
10011006
match indexOrName with
10021007
| Choice1Of2 index ->
1003-
// Index is None when parentheses were not used, i.e. "| Some v ->" - suggest a name only when the case has a single field
10041008
match uci.UnionCase.RecdFieldsArray, index with
1005-
| [| field |], None -> Some field
1006-
| [| _ |], Some _
1009+
| [| field |], None ->
1010+
// Index is None when parentheses were not used, i.e. `| Some v ->` - suggest a name only when the case has a single field
1011+
Some field
1012+
| [| _ |], Some _ when not isTheOnlyField ->
1013+
// When completing `| Some (a| , b)`, we're binding the first tuple element, not the sole case field
1014+
None
10071015
| _, None -> None
10081016
| arr, Some index -> arr |> Array.tryItem index
10091017
| Choice2Of2 name -> uci.UnionCase.RecdFieldsArray |> Array.tryFind (fun x -> x.DisplayName = name)
@@ -1016,7 +1024,7 @@ type internal TypeCheckInfo
10161024
sResolutions.CapturedNameResolutions
10171025
|> ResizeArray.tryPick (fun r ->
10181026
match r.Item with
1019-
| Item.Value vref when r.Pos = fieldPatternPos -> Some(stripTyparEqns vref.Type)
1027+
| Item.Value vref when r.Pos = fieldPatternPos -> Some vref.Type
10201028
| _ -> None)
10211029
|> Option.defaultValue field.FormalType
10221030
else
@@ -1118,7 +1126,7 @@ type internal TypeCheckInfo
11181126
|> Option.defaultValue []
11191127
|> List.append (fields indexOrName isTheOnlyField uci)
11201128

1121-
Some(SuggestNameForUnionCaseFieldPattern g caseIdRange.End pos uci indexOrName list, r.DisplayEnv, r.Range)
1129+
Some(SuggestNameForUnionCaseFieldPattern g caseIdRange.End pos uci indexOrName isTheOnlyField list, r.DisplayEnv, r.Range)
11221130
| _ -> None)
11231131
|> Option.orElse declaredItems
11241132

src/Compiler/Service/IncrementalBuild.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ type IncrementalBuilderState with
10691069
HasSignature = hasSignature
10701070
Stamp = DateTime.MinValue
10711071
LogicalStamp = DateTime.MinValue
1072-
Notified = false
1072+
Notified = true
10731073
SyntaxTree = syntaxTree
10741074
BoundModel = model
10751075
}

src/Compiler/pars.fsy

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5173,6 +5173,7 @@ parenExpr:
51735173
{ let mComma = rhs parseState 2
51745174
let mLparen = rhs parseState 1
51755175
let mRparen = rhs parseState 3
5176+
reportParseErrorAt mComma (FSComp.SR.parsExpectingExpression ())
51765177
let errorExpr = arbExpr ("tupleExpr3", mComma.EndRange)
51775178
let mTuple = unionRanges mComma $3.Range
51785179
let tupleExpr =
@@ -5356,6 +5357,20 @@ recdExprCore:
53565357
(None, l)
53575358
| _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsFieldBinding()) }
53585359

5360+
| appExpr EQUALS recover
5361+
{ match $1 with
5362+
| LongOrSingleIdent(false, (SynLongIdent _ as f), None, m) ->
5363+
let f = mkRecdField f
5364+
let mEquals = rhs parseState 2
5365+
let l = rebindRanges (f, Some mEquals, None) [] None
5366+
None, l
5367+
| _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsFieldBinding ()) }
5368+
5369+
| appExpr
5370+
{ let mExpr = rhs parseState 1
5371+
reportParseErrorAt mExpr (FSComp.SR.parsFieldBinding ())
5372+
Some($1, (mExpr.EndRange, None)), [] }
5373+
53595374
/*
53605375
handles cases when identifier can start from the underscore
53615376
*/

tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
<EnablePreviewFeatures>true</EnablePreviewFeatures>
2222
</PropertyGroup>
2323

24+
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
25+
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
26+
<IntermediateOutputPath>$(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/</IntermediateOutputPath>
27+
</PropertyGroup>
28+
2429
<ItemGroup>
2530
<Compile Include="..\service\FsUnit.fs">
2631
<Link>FsUnit.fs</Link>

tests/FSharp.Compiler.ComponentTests/FSharpChecker/CommonWorkflows.fs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ open Xunit
99
open FSharp.Test.ProjectGeneration
1010
open FSharp.Compiler.Text
1111
open FSharp.Compiler.CodeAnalysis
12+
open FSharp.Compiler.Diagnostics
13+
14+
open OpenTelemetry
15+
open OpenTelemetry.Resources
16+
open OpenTelemetry.Trace
17+
18+
#nowarn "57"
1219

1320
let makeTestProject () =
1421
SyntheticProject.Create(
@@ -132,3 +139,30 @@ let ``Using getSource and notifications instead of filesystem`` () =
132139
checkFile middle expectSignatureChanged
133140
checkFile last expectSignatureChanged
134141
}
142+
143+
[<Fact>]
144+
let GetAllUsesOfAllSymbols() =
145+
let traceProvider =
146+
Sdk.CreateTracerProviderBuilder()
147+
.AddSource("fsc")
148+
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(serviceName="F#", serviceVersion = "1"))
149+
.AddJaegerExporter()
150+
.Build()
151+
152+
use _ = Activity.start "GetAllUsesOfAllSymbols" [ ]
153+
154+
let result =
155+
async {
156+
let project = makeTestProject()
157+
let checker = ProjectWorkflowBuilder(project, useGetSource=true, useChangeNotifications = true).Checker
158+
do! saveProject project false checker
159+
let options = project.GetProjectOptions checker
160+
let! checkProjectResults = checker.ParseAndCheckProject(options)
161+
return checkProjectResults.GetAllUsesOfAllSymbols()
162+
} |> Async.RunSynchronously
163+
164+
165+
traceProvider.ForceFlush() |> ignore
166+
traceProvider.Dispose()
167+
168+
Assert.Equal(80, result.Length)

tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<UnitTestType>nunit</UnitTestType>
2020
</PropertyGroup>
2121

22+
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
23+
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
24+
<IntermediateOutputPath>$(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/</IntermediateOutputPath>
25+
</PropertyGroup>
26+
2227
<ItemGroup>
2328
<Content Include="expected-help-output.bsl">
2429
<CopyToOutputDirectory>Never</CopyToOutputDirectory>

tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1515
</PropertyGroup>
1616

17+
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
18+
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
19+
<IntermediateOutputPath>$(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/</IntermediateOutputPath>
20+
</PropertyGroup>
21+
1722
<ItemGroup>
1823
<Compile Include="..\scripts\scriptlib.fsx">
1924
<Link>scriptlib.fsx</Link>

0 commit comments

Comments
 (0)