Skip to content

Commit 8d852e4

Browse files
authored
Merge pull request #16934 from dotnet/merges/main-to-release/dev17.10
Merge main to release/dev17.10
2 parents 891a53a + 9425295 commit 8d852e4

File tree

7 files changed

+60
-7
lines changed

7 files changed

+60
-7
lines changed

docs/release-notes/.FSharp.Compiler.Service/8.0.300.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* `[<CliEvent>]` member should not produce property symbol. ([Issue #16640](https://github.com/dotnet/fsharp/issues/16640), [PR #16658](https://github.com/dotnet/fsharp/pull/16658))
1414
* Fix discriminated union initialization. ([#PR 16661](https://github.com/dotnet/fsharp/pull/16661))
1515
* Allow calling method with both Optional and ParamArray. ([#PR 16688](https://github.com/dotnet/fsharp/pull/16688), [suggestions #1120](https://github.com/fsharp/fslang-suggestions/issues/1120))
16+
* Return diagnostics that got suppressed by errors in previous files. ([PR #16719](https://github.com/dotnet/fsharp/pull/16719))
1617
* Fix release inline optimization, which leads to MethodAccessException if used with `assembly:InternalsVisibleTo`` attribute. ([Issue #16105](https://github.com/dotnet/fsharp/issues/16105), ([PR #16737](https://github.com/dotnet/fsharp/pull/16737))
1718
* Enforce AttributeTargets on let values and functions. ([PR #16692](https://github.com/dotnet/fsharp/pull/16692))
1819
* Enforce AttributeTargets on union case declarations. ([PR #16764](https://github.com/dotnet/fsharp/pull/16764))
@@ -25,6 +26,7 @@
2526
* Enforce AttributeTargets on enums ([PR #16887](https://github.com/dotnet/fsharp/pull/16887))
2627
* Completion: fix for unfinished record field decl ([PR #16893](https://github.com/dotnet/fsharp/pull/16893))
2728
* Enforce AttributeTargets on delegates ([PR #16891](https://github.com/dotnet/fsharp/pull/16891))
29+
* Completion: fix completion in empty dot lambda prefix ([#16829](https://github.com/dotnet/fsharp/pull/16829))
2830
* Fix StackOverflow when checking non-recursive bindings in module or namespace in `fscAnyCpu`/`fsiAnyCpu`. ([PR #16908](https://github.com/dotnet/fsharp/pull/16908))
2931

3032
### Added

eng/Version.Details.xml

Lines changed: 2 additions & 2 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="9.0.0-alpha.1.24154.2">
4+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24162.2">
55
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
6-
<Sha>936b4a4b4b8a74b65098983660c5814fb4afee15</Sha>
6+
<Sha>c0b5d69a1a1513528c77fffff708c7502d57c35c</Sha>
77
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
88
</Dependency>
99
<!-- Intermediate is necessary for source build. -->

src/Compiler/Service/FSharpCheckerResults.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2909,11 +2909,6 @@ module internal ParseAndCheckFile =
29092909
// update the error handler with the modified tcConfig
29102910
errHandler.DiagnosticOptions <- tcConfig.diagnosticsOptions
29112911

2912-
// Play background errors and warnings for this file.
2913-
do
2914-
for err, severity in backgroundDiagnostics do
2915-
diagnosticSink (err, severity)
2916-
29172912
// If additional references were brought in by the preprocessor then we need to process them
29182913
ApplyLoadClosure(tcConfig, parsedMainInput, mainInputFileName, loadClosure, tcImports, backgroundDiagnostics)
29192914

@@ -2957,6 +2952,11 @@ module internal ParseAndCheckFile =
29572952
return ((tcState.TcEnvFromSignatures, EmptyTopAttrs, [], [ mty ]), tcState)
29582953
}
29592954

2955+
// Play background errors and warnings for this file.
2956+
do
2957+
for err, severity in backgroundDiagnostics do
2958+
diagnosticSink (err, severity)
2959+
29602960
let (tcEnvAtEnd, _, implFiles, ccuSigsForFiles), tcState = resOpt
29612961

29622962
let symbolEnv = SymbolEnv(tcGlobals, tcState.Ccu, Some tcState.CcuSig, tcImports)

src/Compiler/SyntaxTree/SyntaxTreeOps.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ let rec pushUnaryArg expr arg =
100100
| SynExpr.TypeApp(innerExpr, mLess, tyargs, mCommas, mGreater, mTypars, m) ->
101101
let innerExpr = pushUnaryArg innerExpr arg
102102
SynExpr.TypeApp(innerExpr, mLess, tyargs, mCommas, mGreater, mTypars, m)
103+
| SynExpr.ArbitraryAfterError(_, m) when m.Start = m.End ->
104+
SynExpr.DiscardAfterMissingQualificationAfterDot(SynExpr.Ident arg, m.StartRange, unionRanges arg.idRange m)
103105
| _ ->
104106
errorR (Error(FSComp.SR.tcDotLambdaAtNotSupportedExpression (), expr.Range))
105107
expr

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,31 @@ let GetAllUsesOfAllSymbols() =
166166
traceProvider.Dispose()
167167

168168
if result.Length <> 79 then failwith $"Expected 79 symbolUses, got {result.Length}:\n%A{result}"
169+
170+
[<Fact>]
171+
let ``We don't lose subsequent diagnostics when there's error in one file`` () =
172+
let project =
173+
{ SyntheticProject.Create(
174+
{ sourceFile "First" [] with
175+
Source = """module AbstractBaseClass.File1
176+
177+
let foo x = ()
178+
179+
a""" },
180+
{ sourceFile "Second" [] with
181+
Source = """module AbstractBaseClass.File2
182+
183+
open AbstractBaseClass.File1
184+
185+
let goo = foo 1
186+
187+
type AbstractBaseClass() =
188+
189+
abstract P: int""" }) with
190+
AutoAddModules = false
191+
SkipInitialCheck = true }
192+
193+
project.Workflow {
194+
checkFile "First" (expectErrorCodes ["FS0039"])
195+
checkFile "Second" (expectErrorCodes ["FS0054"; "FS0365"])
196+
}

tests/FSharp.Test.Utilities/ProjectGeneration.fs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,19 @@ module ProjectOperations =
725725
then
726726
failwith "Expected errors, but there were none"
727727

728+
let expectErrorCodes codes parseAndCheckResults _ =
729+
let (parseResult: FSharpParseFileResults), _checkResult = parseAndCheckResults
730+
731+
if not parseResult.ParseHadErrors then
732+
let checkResult = getTypeCheckResult parseAndCheckResults
733+
let actualCodes = checkResult.Diagnostics |> Seq.map (fun d -> d.ErrorNumberText) |> Set
734+
let codes = Set.ofSeq codes
735+
if actualCodes <> codes then
736+
failwith $"Expected error codes {codes} but got {actualCodes}. \n%A{checkResult.Diagnostics}"
737+
738+
else
739+
failwith $"There were parse errors: %A{parseResult.Diagnostics}"
740+
728741
let expectSignatureChanged result (oldSignature: string, newSignature: string) =
729742
expectOk result ()
730743
Assert.NotEqual<string>(oldSignature, newSignature)

tests/service/CompletionTests.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ let myFancyFunc (x:string) =
8282
|> _.ToL"""
8383
assertHasItemWithNames ["ToLower"] info
8484

85+
[<Test>]
86+
let ``Underscore dot lambda - No prefix`` () =
87+
let info = getCompletionInfo "[s] |> List.map _. " (3, 18) """
88+
let s = ""
89+
[s] |> List.map _.
90+
"""
91+
assertHasItemWithNames ["Length"] info
92+
8593
[<Test>]
8694
let ``Type decl - Record - Field type 01`` () =
8795
let info = getCompletionInfo "type Record = { Field: }" (2, 23) """

0 commit comments

Comments
 (0)