Skip to content

[automated] Merge branch 'main' => 'feature/lsp' #18515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: feature/lsp
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
264a54e
Update dependencies from https://github.com/dotnet/arcade build 20250…
dotnet-maestro[bot] Apr 28, 2025
9995898
Allow `_` in `use!` bindings values (#18487)
edgarfgp Apr 28, 2025
54fb3da
Checker: don't capture environment for checked modules (#18519)
auduchinok Apr 30, 2025
cf6b53e
reuse fsi sessions in tests (#18527)
majocha Apr 30, 2025
34dbfc1
Code completion: fix getting qualifier expression in `do` statements …
auduchinok Apr 30, 2025
05500b8
Enable TypeSubsumptionCache for IDE use (#18499)
majocha May 1, 2025
172dc31
include accessibility range in `SynPat.Named` (#18526)
edgarfgp May 2, 2025
abffd37
Fix mixed emit-multi+/- sessions (#18465)
KevinRansom May 5, 2025
63dd8ca
[main] Update dependencies from dotnet/arcade (#18535)
dotnet-maestro[bot] May 6, 2025
aa4550e
Update VisualFSharp.Core.targets (#18536)
AlexDelepine May 7, 2025
5a239f6
Update dependencies from https://github.com/dotnet/arcade build 20250…
dotnet-maestro[bot] May 7, 2025
f78ce10
Keep parens around records in interpolated strings (#18534)
brianrourkeboll May 12, 2025
c4ed80c
Clean up Conformance UnitsOfMeasure (#18537)
KevinRansom May 13, 2025
66e1637
Scoped nowarn (#18049)
Martin521 May 14, 2025
230df0c
Make attribute target mismatch a warning and not an error. (#18492)
edgarfgp May 14, 2025
9e74c0e
Fix race in cache eviction (#18528)
majocha May 14, 2025
29bcaf1
Cancellable: always catch internal cancellations (#18531)
majocha May 14, 2025
c4dfbd5
Merge branch 'merge/main-to-feature/lsp' of https://github.com/dotnet…
abonie May 14, 2025
190dccd
Merge branch 'feature/lsp' into merge/main-to-feature/lsp
abonie May 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 9 additions & 2 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Unsafe downcast from `obj` to generic `T` no longer requires `not null` constraint on `T`([Issue #18275](https://github.com/dotnet/fsharp/issues/18275), [PR #18343](https://github.com/dotnet/fsharp/pull/18343))
* Fix "type inference problem too complicated" for SRTP with T:null and T:struct dummy constraint([Issue #18288](https://github.com/dotnet/fsharp/issues/18288), [PR #18345](https://github.com/dotnet/fsharp/pull/18345))
* Fix for missing parse diagnostics in TransparentCompiler.ParseAndCheckProject ([PR #18366](https://github.com/dotnet/fsharp/pull/18366))
* Miscellanous parentheses analyzer fixes. ([PR #18350](https://github.com/dotnet/fsharp/pull/18350))
* Miscellanous parentheses analyzer fixes. ([PR #18350](https://github.com/dotnet/fsharp/pull/18350), [PR #18534](https://github.com/dotnet/fsharp/pull/18534))
* Fix duplicate parse error reporting for GetBackgroundCheckResultsForFileInProject ([Issue #18379](https://github.com/dotnet/fsharp/issues/18379) [PR #18380](https://github.com/dotnet/fsharp/pull/18380))
* Fix MethodDefNotFound when compiling code invoking delegate with option parameter ([Issue #5171](https://github.com/dotnet/fsharp/issues/5171), [PR #18385](https://github.com/dotnet/fsharp/pull/18385))
* Fix #r nuget ..." downloads unneeded packages ([Issue #18231](https://github.com/dotnet/fsharp/issues/18231), [PR #18393](https://github.com/dotnet/fsharp/pull/18393))
Expand All @@ -25,7 +25,12 @@
* Fixed [#18433](https://github.com/dotnet/fsharp/issues/18433), a rare case of an internal error in xml comment processing. ([PR #18436](https://github.com/dotnet/fsharp/pull/18436))
* Fix confusing type inference error in task expression ([Issue #13789](https://github.com/dotnet/fsharp/issues/13789), [PR #18450](https://github.com/dotnet/fsharp/pull/18450))
* Fix missing `null` highlighting in tooltips ([PR #18457](https://github.com/dotnet/fsharp/pull/18457))
* Fix range of SynPat.Named doesn't include accessibility ([PR #18526](https://github.com/dotnet/fsharp/pull/18526))
* Allow `_` in `use!` bindings values (lift FS1228 restriction) ([PR #18487](https://github.com/dotnet/fsharp/pull/18487))
* Make `[<CallerMemberName; Struct>]` combination work([PR #18444](https://github.com/dotnet/fsharp/pull/18444/))
* Fix code completion considers types from own namespace non-imported ([PR #18518](https://github.com/dotnet/fsharp/issues/18518))
* Code completion: fix getting qualifier expression in do statements in type decls ([PR #18524](https://github.com/dotnet/fsharp/pull/18524))
* Fixed: [#18441](https://github.com/dotnet/fsharp/issues/18441) FSI multi-emit unstable. ([PR #18465](https://github.com/dotnet/fsharp/pull/18465))

### Added
* Added missing type constraints in FCS. ([PR #18241](https://github.com/dotnet/fsharp/pull/18241))
Expand All @@ -37,7 +42,8 @@
* Type parameter constraint `null` in generic code will now automatically imply `not struct` ([Issue #18320](https://github.com/dotnet/fsharp/issues/18320), [PR #18323](https://github.com/dotnet/fsharp/pull/18323))
* Add a switch to determine whether to generate a default implementation body for overridden method when completing. [PR #18341](https://github.com/dotnet/fsharp/pull/18341)
* Use a more accurate range for CE Combine methods. [PR #18394](https://github.com/dotnet/fsharp/pull/18394)

* Enable TypeSubsumptionCache for IDE use. [PR #18499](https://github.com/dotnet/fsharp/pull/18499)
* Scoped Nowarn: Add the #warnon compiler directive ([Language suggestion #278](https://github.com/fsharp/fslang-suggestions/issues/278), [RFC FS-1146 PR](https://github.com/fsharp/fslang-design/pull/782), [PR #18049](https://github.com/dotnet/fsharp/pull/18049))

### Changed
* FSharpCheckFileResults.ProjectContext.ProjectOptions will not be available when using the experimental Transparent Compiler feature. ([PR #18205](https://github.com/dotnet/fsharp/pull/18205))
Expand All @@ -48,6 +54,7 @@
* Warning for "useless null handling" works with piped syntax constructs now ([PR #18331](https://github.com/dotnet/fsharp/pull/18331))
* Make indent in generated overridden member code depend on the context, not fix to 4. ([PR #18341](https://github.com/dotnet/fsharp/pull/18341))
* Adjust caller info attribute error message range ([PR #18388](https://github.com/dotnet/fsharp/pull/18388))
* Make attribute targets mismatch a warning and not an error ([PR #18492](https://github.com/dotnet/fsharp/pull/18492))

### Breaking Changes
* Struct unions with overlapping fields now generate mappings needed for reading via reflection ([Issue #18121](https://github.com/dotnet/fsharp/issues/17797), [PR #18274](https://github.com/dotnet/fsharp/pull/17877))
2 changes: 2 additions & 0 deletions docs/release-notes/.Language/preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* Deprecate places where `seq` can be omitted. ([Language suggestion #1033](https://github.com/fsharp/fslang-suggestions/issues/1033), [PR #17772](https://github.com/dotnet/fsharp/pull/17772))
* Added type conversions cache, only enabled for compiler runs ([PR#17668](https://github.com/dotnet/fsharp/pull/17668))
* Support ValueOption + Struct attribute as optional parameter for methods ([Language suggestion #1136](https://github.com/fsharp/fslang-suggestions/issues/1136), [PR #18098](https://github.com/dotnet/fsharp/pull/18098))
* Allow `_` in `use!` bindings values (lift FS1228 restriction) ([PR #18487](https://github.com/dotnet/fsharp/pull/18487))
* Warn when `unit` is passed to an `obj`-typed argument ([PR #18330](https://github.com/dotnet/fsharp/pull/18330))
* Scoped Nowarn: added the #warnon compiler directive ([Language suggestion #278](https://github.com/fsharp/fslang-suggestions/issues/278), [RFC FS-1146 PR](https://github.com/fsharp/fslang-design/pull/782), [PR #18049](https://github.com/dotnet/fsharp/pull/18049))

### Fixed

Expand Down
4 changes: 4 additions & 0 deletions eng/DotNetBuild.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<!-- When altering this file, include @dotnet/product-construction as a reviewer. -->
<Project>

<!-- TODO: Remove this file when fsharp upgrades to Arcade 10 -->
<PropertyGroup>
<GitHubRepositoryName>fsharp</GitHubRepositoryName>
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
<ReportPrebuiltUsage Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(DotNetBuildOrchestrator)</ReportPrebuiltUsage>
<SetUpSourceBuildIntermediateNupkgCache>false</SetUpSourceBuildIntermediateNupkgCache>
<CreateIntermediatePackage>false</CreateIntermediatePackage>
</PropertyGroup>

<!--
Expand Down
33 changes: 0 additions & 33 deletions eng/SourceBuildPrebuiltBaseline.xml

This file was deleted.

21 changes: 2 additions & 19 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.25223.3">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>19eb5ea4e5f9c4e5256843a92805c8c9e942207d</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.msbuild" Version="17.13.25-preview-25214-09">
<Uri>https://github.com/dotnet/msbuild</Uri>
<Sha>7ad4e1c76585d0ed6e438da2d4f9394326934399</Sha>
<SourceBuild RepoName="msbuild" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.Build" Version="17.13.25">
<Uri>https://github.com/dotnet/msbuild</Uri>
<Sha>7ad4e1c76585d0ed6e438da2d4f9394326934399</Sha>
Expand Down Expand Up @@ -42,15 +31,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25208.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>aa61e8c20a869bcc994f8b29eb07d927d2bec6f4</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.25208.6">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25255.5">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>aa61e8c20a869bcc994f8b29eb07d927d2bec6f4</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
<Sha>1cfa39f82d00b3659a3d367bc344241946e10681</Sha>
</Dependency>
<Dependency Name="optimization.windows_nt-x64.MIBC.Runtime" Version="1.0.0-prerelease.24462.2">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function Test() {
projectname="${projectname%.*}"
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame-hang-timeout 5minutes --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
args+=" -- xUnit.MaxParallelThreads=1"

"$DOTNET_INSTALL_DIR/dotnet" $args || exit $?
}

Expand Down
4 changes: 2 additions & 2 deletions eng/common/core-templates/job/source-index-stage1.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
runAsPublic: false
sourceIndexUploadPackageVersion: 2.0.0-20240522.1
sourceIndexProcessBinlogPackageVersion: 1.0.1-20240522.1
sourceIndexUploadPackageVersion: 2.0.0-20250425.2
sourceIndexProcessBinlogPackageVersion: 1.0.1-20250425.2
sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci"
preSteps: []
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"perl": "5.38.2.2"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25208.6",
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25255.5",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2"
}
}
15 changes: 7 additions & 8 deletions src/Compiler/Checking/CheckDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ let AddNonLocalCcu g amap scopem env assemblyName (ccu: CcuThunk, internalsVisib
env

/// Adjust the TcEnv to account for a fully processed "namespace" declaration in this file
let AddLocalRootModuleOrNamespace tcSink g amap scopem env (moduleTy: ModuleOrNamespaceType) =
let AddLocalRootModuleOrNamespace g amap scopem env (moduleTy: ModuleOrNamespaceType) =
// Compute the top-rooted module or namespace references
let modrefs = moduleTy.ModuleAndNamespaceDefinitions |> List.map mkLocalModuleRef
// Compute the top-rooted type definitions
Expand All @@ -350,7 +350,6 @@ let AddLocalRootModuleOrNamespace tcSink g amap scopem env (moduleTy: ModuleOrNa
let env = { env with
eNameResEnv = if isNil tcrefs then env.eNameResEnv else AddTyconRefsToNameEnv BulkAdd.No false g amap env.eAccessRights scopem true env.eNameResEnv tcrefs
eUngeneralizableItems = addFreeItemOfModuleTy moduleTy env.eUngeneralizableItems }
CallEnvSink tcSink (scopem, env.NameEnv, env.eAccessRights)
env

/// Inside "namespace X.Y.Z" there is an implicit open of "X.Y.Z"
Expand Down Expand Up @@ -4978,7 +4977,7 @@ let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcE
CallNameResolutionSink cenv.tcSink (moduleEntity.Range, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights))

// For 'namespace rec' and 'module rec' we add the thing being defined
let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m envNS modTyRoot else envNS
let envNS = if isRec then AddLocalRootModuleOrNamespace g cenv.amap m envNS modTyRoot else envNS
let nsInfo = Some (modulNSOpt, envNS.eModuleOrNamespaceTypeAccumulator)
let mutRecNSInfo = if isRec then nsInfo else None

Expand All @@ -4990,7 +4989,7 @@ let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcE
if isNil enclosingNamespacePath then
envAtEnd
else
let env = AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m env modTyRoot
let env = AddLocalRootModuleOrNamespace g cenv.amap m env modTyRoot

// If the namespace is an interactive fragment e.g. FSI_0002, then open FSI_0002 in the subsequent environment.
let env, _openDecls =
Expand Down Expand Up @@ -5440,7 +5439,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
CallNameResolutionSink cenv.tcSink (moduleEntity.Range, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights))

// For 'namespace rec' and 'module rec' we add the thing being defined
let envNS = if isRec then AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m envNS modTyRoot else envNS
let envNS = if isRec then AddLocalRootModuleOrNamespace g cenv.amap m envNS modTyRoot else envNS
let nsInfo = Some (modulNSOpt, envNS.eModuleOrNamespaceTypeAccumulator)
let mutRecNSInfo = if isRec then nsInfo else None

Expand All @@ -5453,7 +5452,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
if isNil enclosingNamespacePath then
envAtEnd, []
else
let env = AddLocalRootModuleOrNamespace cenv.tcSink g cenv.amap m env modTyRoot
let env = AddLocalRootModuleOrNamespace g cenv.amap m env modTyRoot

// If the namespace is an interactive fragment e.g. FSI_0002, then open FSI_0002 in the subsequent environment
let env, openDecls =
Expand Down Expand Up @@ -5753,7 +5752,7 @@ let CheckOneImplFile
synImplFile,
diagnosticOptions) =

let (ParsedImplFileInput (fileName, isScript, qualNameOfFile, scopedPragmas, _, implFileFrags, isLastCompiland, _, _)) = synImplFile
let (ParsedImplFileInput (fileName, isScript, qualNameOfFile, _, implFileFrags, isLastCompiland, _, _)) = synImplFile
let infoReader = InfoReader(g, amap)

cancellable {
Expand Down Expand Up @@ -5892,7 +5891,7 @@ let CheckOneImplFile
|> Array.map (fun (KeyValue(k,v)) -> (k,v))
|> Map

let implFile = CheckedImplFile (qualNameOfFile, scopedPragmas, implFileTy, implFileContents, hasExplicitEntryPoint, isScript, anonRecdTypes, namedDebugPointsForInlinedCode)
let implFile = CheckedImplFile (qualNameOfFile, implFileTy, implFileContents, hasExplicitEntryPoint, isScript, anonRecdTypes, namedDebugPointsForInlinedCode)

return (topAttrs, implFile, envAtEnd, cenv.createsGeneratedProvidedTypes)
}
Expand Down
3 changes: 1 addition & 2 deletions src/Compiler/Checking/CheckDeclarations.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ open FSharp.Compiler.TcGlobals
open FSharp.Compiler.Text
open FSharp.Compiler.TypedTree

val AddLocalRootModuleOrNamespace:
TcResultsSink -> TcGlobals -> ImportMap -> range -> TcEnv -> ModuleOrNamespaceType -> TcEnv
val AddLocalRootModuleOrNamespace: TcGlobals -> ImportMap -> range -> TcEnv -> ModuleOrNamespaceType -> TcEnv

val CreateInitialTcEnv:
TcGlobals * ImportMap * range * assemblyName: string * (CcuThunk * string list * string list) list ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/// with generalization at appropriate points.
module internal FSharp.Compiler.CheckComputationExpressions

open FSharp.Compiler.TcGlobals
open Internal.Utilities.Library
open FSharp.Compiler.AccessibilityLogic
open FSharp.Compiler.AttributeChecking
Expand Down Expand Up @@ -1783,12 +1784,33 @@ let rec TryTranslateComputationExpression
if ceenv.isQuery then
error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind))

match pat, andBangs with
| (SynPat.Named(ident = SynIdent(id, _); isThisVal = false) | SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ]))), [] ->
match andBangs with
| [] ->
// Valid pattern case - handle with Using + Bind
requireBuilderMethod "Using" mBind cenv ceenv.env ceenv.ad ceenv.builderTy mBind
requireBuilderMethod "Bind" mBind cenv ceenv.env ceenv.ad ceenv.builderTy mBind

let supportsUseBangBindingValueDiscard =
ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.UseBangBindingValueDiscard

// use! x = ...
// use! (x) = ...
// use! (__) = ...
// use! _ = ...
// use! (_) = ...
let rec extractIdentifierFromPattern pat =
match pat with
| SynPat.Named(ident = SynIdent(id, _); isThisVal = false) -> id, pat
| SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ])) -> id, pat
| SynPat.Wild(m) when supportsUseBangBindingValueDiscard ->
// To properly call the Using(disposable) CE member, we need to convert the wildcard to a SynPat.Named
let tmpIdent = mkSynId m "_"
tmpIdent, SynPat.Named(SynIdent(tmpIdent, None), false, None, m)
| SynPat.Paren(pat = pat) -> extractIdentifierFromPattern pat
| _ -> error (Error(FSComp.SR.tcInvalidUseBangBinding (), pat.Range))

let ident, pat = extractIdentifierFromPattern pat

let bindExpr =
let consumeExpr =
SynExpr.MatchLambda(
Expand All @@ -1809,14 +1831,14 @@ let rec TryTranslateComputationExpression
)

let consumeExpr =
mkSynCall "Using" mBind [ SynExpr.Ident id; consumeExpr ] ceenv.builderValName
mkSynCall "Using" mBind [ SynExpr.Ident ident; consumeExpr ] ceenv.builderValName

let consumeExpr =
SynExpr.MatchLambda(
false,
mBind,
[
SynMatchClause(pat, None, consumeExpr, id.idRange, DebugPointAtTarget.No, SynMatchClauseTrivia.Zero)
SynMatchClause(pat, None, consumeExpr, ident.idRange, DebugPointAtTarget.No, SynMatchClauseTrivia.Zero)
],
DebugPointAtBinding.NoneAtInvisible,
mBind
Expand All @@ -1829,8 +1851,7 @@ let rec TryTranslateComputationExpression
|> addBindDebugPoint spBind

Some(translatedCtxt bindExpr)
| _pat, [] -> error (Error(FSComp.SR.tcInvalidUseBangBinding (), mBind))
| _pat, _ands ->
| _ ->
// Has andBangs
let m =
match andBangs with
Expand Down
Loading
Loading