Skip to content

Commit b73be15

Browse files
dsymevzarytovskiiT-Grodotnet-botKevinRansom
authored
[RFC FS-1060] Nullness checking (#15181)
* squash * squash * move adhoc tests and clean errors * fix up constraint solving and adhoc testing * remove tests * fantomas * skip fails * fix tests * fix up test baselines for change in order in checking * update tests * don't overwrite baselines * fix some test failures * skip warnings * skip warnings * fix warning logic * fix tests * fix sizes * fix build * fantomas and validation update * corrections to self-use * [WIP] [RFC FS-1060] Nullness checking (applied to codebase) (#15265) * enablement * enablement * fix build * fix build * fantomas * selective adoption * Revert "[WIP] [RFC FS-1060] Nullness checking (applied to codebase) (#15265)" (#15309) This reverts commit 559c058. * Fixes * Feature/nullness - parsing of constraints (#15753) * Feature/nullness - parsing of constraints for: 'T: not null .... syntax in Type argument specification appType | NULL ... for specifying types * applying changed syntax * positive.fs updated * positive.fs paranthesis * fixing "parse warning Remove spaces between the type name and type parameter, e.g. "C<'T>", not "C <'T>". Type parameters must be placed directly adjacent to the type name." * positive .bsl updated * Please mighty fantomas * Feature nullness metadata export (#15981) * fix merge mistake * fix build * fantomas * bsl fix * il tests update * fix test * tests fixed * fantomas * fix tests * trim test * trimming test * trim check * now? * IL tests * il tests * trim test * trim * one more time * Merge main to feature/nullness (#16366) * Fixes #16359 - correctly handle imports with 0 length public key tokens (#16363) * Parser: recover on unfinished record decls, fix field ranges (#16357) * Parser: recover on unfinished record decls, fix field ranges * Fantomas * Better diagnostic ranges for fields * More parser tests * Update surface area * Fix xml doc test * Update baselines * Update src/Compiler/SyntaxTree/SyntaxTree.fsi Co-authored-by: Edgar Gonzalez <[email protected]> * Add MutableKeyword to SynFieldTrivia. (#11) * Simplify * Fantomas --------- Co-authored-by: Edgar Gonzalez <[email protected]> Co-authored-by: Florian Verdonck <[email protected]> --------- Co-authored-by: Kevin Ransom (msft) <[email protected]> Co-authored-by: Eugene Auduchinok <[email protected]> Co-authored-by: Edgar Gonzalez <[email protected]> Co-authored-by: Florian Verdonck <[email protected]> Co-authored-by: Tomas Grosup <[email protected]> * syntax tree layout * Nullness-related aggressive trimming of FSharp.Core (#16387) * Merge main to feature/nullness (#16397) * [main] Update dependencies from dnceng/internal/dotnet-optimization (#16150) * Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231019.5 optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23519.5 * Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231019.5 optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23519.5 * Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231021.3 optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23521.3 * Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231021.3 optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23521.3 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * [main] Update dependencies from dotnet/arcade (#16241) * Update dependencies from https://github.com/dotnet/arcade build 20231106.5 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231106.5 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231106.5 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231106.5 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231106.5 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231106.5 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231106.5 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231114.4 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231130.1 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231130.1 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231130.1 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231130.1 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk * Update dependencies from https://github.com/dotnet/arcade build 20231130.1 Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1 Dependency coherency updates Microsoft.DotNet.XliffTasks From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Vlad Zarytovskii <[email protected]> Co-authored-by: Tomas Grosup <[email protected]> * Name resolution: don't search extension members in type abbreviations (#16390) * Name resolution: don't search extension members in type abbreviations * Add test * Revert "[main] Update dependencies from dotnet/arcade (#16241)" (#16396) This reverts commit f219a99. * trimmed size updated --------- Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Vlad Zarytovskii <[email protected]> Co-authored-by: Tomas Grosup <[email protected]> Co-authored-by: Eugene Auduchinok <[email protected]> * Nullness interop - import of C#-emitted metadata (#16423) * Nullness - include in QuickInfo and in general in "typeEnc" (string representation of a type) (#16555) * failing test * todo for IL import * explanation added * il meta parsing * flags evaluation * you shall passs * evaluateFirstOrderNullnessAndAdvance * import il type with nullness * type import * IL nullness import fields, props, events, method args, method return types - nullness imported from IL * test rename * fantomas * get stack trace on error * split ilmethod's type * fix crashes for Csharp style extensions * solve coexistance of nullness and Is* properties of DUs * updating tests * clean tests * fantomas * fantomas one more time * importing nullness for generic typars * print failing ivals, let's see * write even more! * isolated failing test - combo of module rec, signature file, IVT * another attempt * format * test * hide tests * Remove 'specialname' for DU case tester * format * warning as error * update baseline netcore * nullable errors not in desktop framework * surface area, trimming * surface area * cosmetic cleanup & annotations * Rename to ILMethParentTypeInfo * making vMapFold tail recursive * physical nullnessEquiv * format * Commenting SkipNullness usages * Nullness work - activity module * Remove strict generic 'T:null' import * Null|NonNull pattern also for regular compilation * Backported Null|NonNull active pattern * one more time * revert * Show nullness in quickinfo and in general in type representations * Merge main to feature/nullness (#16539) Merge of main + syntax conflict resolution + semantic conflict resolution * release notes * Fix ILType.Array import (#16585) * Nullness - reading+writing metadata for 'inherits' and interface implementations (#16597) * ILGenerator test case * Nullness :: Format string %s should allow nullable string (#16656) * Nullness:: Unchecked.nonNull for FSharp.Core (#16654) * Nullness :: Pattern matching with null should mark input for subsequent clauses as without null + support for matching nulls in tuples (#16659) * Feature nullness - support overrides of nullness annotation in the imported object hierarchy (#16711) * Improve type inference w.r.t. nullness in printing (#16681) * Update tests/AheadOfTime/Trimming/check.ps1 * Fix merge errors * il tests reflecting visibility change * Nullness feature :: New warning for functions insisting on a (WithNull) argument + typar equality fix (#16853) Null-handling functions now have the option to raise a warning when they are called with a known-to-be-withoutNull argument. That way, API authors (incl. Fsharp.Core) can help with cleaning code from superflous null checks. While doing it, a strange error kept coming when using Option.ofObj and other functions with a (T | null) typar. It turned out that nullness info had been striped from nullable typars on stripTyparEqnsAux calls in some occasions, leading to treating all typars as 'KnownWithoutNull' even when that was not true. * Feature nullness - propper guards against ` | null ` on unsupported types (#16907) TODOs resolved: * mkAppTy resolved * mkFunTyWithNullness * delayed checks of post-infered values for nullness-carrying capabilities * Feature nullness :: warn also for 'obj' type (since it can be infered for null literal) (#16962) * Nullness feature :: various bugfixes (#17080) * Bugfix - matching aliased nullable should strip nullness Eliminating nullness after pattern matching null (that is , for subsequent patterns) must visit contents of abbreviations as well. Otherwise it does not work with the Maybe<T> type whcih we use in the compiler. * Making 'obj' work with new 'not null' constraints in fslib functions Bugfix: obj cannot be passed to generic typars which require T: not null, such as the NonNull active pattern. This commit fixes it. * Bugfix - false 'useless null' warning in nested applications Error fixed: Error on useless null checkwith nullness constraint propagation in code like this:let meTry = Option.ofObj (Path.GetDirectoryName "")`. The warning about 'useless Option.ofObj' points to the string literal, ignoring the string literal is first passed to an API which may return null * Fix import for C# extension methods Bugfix for: C# extension methods which put "?" on the this argument are wrongly interpreted by moving the nullability elsewhere. See AsMemory<T> from System.Memory.dll , this treats byteArray.ToMemory() as resulting in a Memory<byte | null> which is clearly wrong. Also, this now allows to call C# extension methods with ?this to be invoked on a nullable value. * LinkedList First,Last bugfix There was a bug of LinkedList .First and .Last properties not returning nullable nodes. This was fixed by improved byte import in previous commit, adding a regression test for guarding this. * Bugfix: Solve nullness for typars This fixes a bug where `not null` generic constraint was incorrectly passed between two typars:`T1 | null` with not null constraint on T1, and T2 without constraints. This occured when calling Option.ofObj(..) when the inner expression caused solving of generic type arguments, e.g. after (|>) or (id) function. This uses additional inference variable to unify them. * updating IL tests * One more try * surface area * trimmed size * trimmed size * fix issues for plain 'dotnet build Fsharp.Compiler.Service.sln` * update FSharpCoreShippedPackageVersionValue * Wkraround attributetargets issue by using 'obj'. This removes 3x box and adds 1x unbox. * Feature nullness :: Bugfixes (#17102) * Ignore Nullness applied on structs (C# allows T? when when T is a struct) * Bigfix: Working with CLI events in Fsharp * Bugfix: Mutable binding initially assigned to null should not need type annotation * Solving `let mutable cache = null` via type inference * Enforcing TyparConstraint.IsReferenceType when WithNull type is used * Nullness-related constraint consistency * Bugfix for emitting Nullable attrs for C# * Automated command ran: fantomas Co-authored-by: T-Gro <[email protected]> * Feature nullness :: Try infer without null even when function/method arg is marked as nullable (#17269) * Feature nullness :: apply nullness annotations to usages of 'obj' in Fsharp.Core (#17284) * resolve build error from auto-merge * Feature nullness :: Cleanups, Test reorg, fix incrementalbuild cache behavior (#17309) * Fix TransparentCompiler - it should report PostInference errors if it only encountered a warning (reported as an error due to confiig) * fix build issues * resolve semantic merge error * Nullness subsumption when used for contravariant typars * fix nullness plain build (#17404) * Update docs/release-notes/.FSharp.Compiler.Service/8.0.300.md * Update release notes * Update check.ps1 * Update check.ps1 --------- Co-authored-by: Vlad Zarytovskii <[email protected]> Co-authored-by: Tomas Grosup <[email protected]> Co-authored-by: dotnet bot <[email protected]> Co-authored-by: Kevin Ransom (msft) <[email protected]> Co-authored-by: Eugene Auduchinok <[email protected]> Co-authored-by: Edgar Gonzalez <[email protected]> Co-authored-by: Florian Verdonck <[email protected]> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: psfinaki <[email protected]>
1 parent 3125875 commit b73be15

File tree

381 files changed

+20622
-2630
lines changed

Some content is hidden

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

381 files changed

+20622
-2630
lines changed

.fantomasignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@ src/FSharp.Core/Query.fs
8888
src/FSharp.Core/seqcore.fs
8989

9090

91+
# fsharp (to investigate)
92+
93+
**/TypeProviders.fsi
94+
**/tainted.fsi
95+
96+
# uses nullness features
97+
98+
**/DependencyProvider.fsi
99+
src/FSharp.Core/array.fs
100+
src/FSharp.Core/option.fsi
101+
src/FSharp.Core/option.fs
102+
src/fsi/console.fs
103+
src/FSharp.Build/FSharpCommandLineBuilder.fs
104+
src/Compiler/Utilities/sformat.fs
105+
src/Compiler/Utilities/illib.fsi
106+
src/Compiler/Utilities/illib.fs
107+
91108
# Fantomas limitations on implementation files (to investigate)
92109

93110
src/Compiler/AbstractIL/ilwrite.fs

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ nCrunchTemp_*
127127
tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.actual
128128
*.vsp
129129
/tests/AheadOfTime/Trimming/output.txt
130+
*.svclog
131+
micro.exe
132+
positive.exe

FSharp.Benchmarks.sln

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio Version 17
43
VisualStudioVersion = 17.1.32113.165
54
MinimumVisualStudioVersion = 10.0.40219.1

FSharp.Profiles.props

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
33
<Project>
4+
<PropertyGroup>
5+
<!-- This turns on/off the use of the feature within the codebase -->
6+
<!-- The default is off - it is selectively enabled -->
7+
<CheckNulls Condition="'$(CheckNulls)' == ''">false</CheckNulls>
8+
</PropertyGroup>
9+
10+
<PropertyGroup Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">
11+
<!-- nullness checking isn't possible when using shipped FSharp.Core package until it's updated -->
12+
<CheckNulls>false</CheckNulls>
13+
</PropertyGroup>
14+
15+
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
16+
<CheckNulls>false</CheckNulls>
17+
<DefineConstants>NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)</DefineConstants>
18+
<NullCheckingSupportInLibrary>false</NullCheckingSupportInLibrary>
19+
</PropertyGroup>
20+
21+
<PropertyGroup Condition="'$(Configuration)' != 'Proto' and '$(BUILDING_USING_DOTNET)' != 'true'">
22+
<OtherFlags>$(OtherFlags) /langversion:preview</OtherFlags>
23+
</PropertyGroup>
24+
25+
<PropertyGroup Condition="'$(CheckNulls)' == 'true'">
26+
<OtherFlags>$(OtherFlags) /checknulls</OtherFlags>
27+
</PropertyGroup>
28+
29+
<PropertyGroup Condition="'$(CheckNulls)' == 'false'">
30+
<!-- 3271: warning nullness annotations being ignored -->
31+
<NoWarn>$(NoWarn);3271</NoWarn>
32+
<DefineConstants>NO_CHECKNULLS;$(DefineConstants)</DefineConstants>
33+
</PropertyGroup>
434

535
<Choose>
636
<When Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
### Fixed
2+
23
* Compiler hangs when compiling inline recursive invocation ([Issue #17376](https://github.com/dotnet/fsharp/issues/17376), [PR #17394](https://github.com/dotnet/fsharp/pull/17394))
34

45
### Added
56

7+
* Support for nullable reference types ([PR #15181](https://github.com/dotnet/fsharp/pull/15181))
8+
69
### Changed
10+
711
* Change compiler default setting realsig+ when building assemblies ([Issue #17384](https://github.com/dotnet/fsharp/issues/17384), [PR #17378](https://github.com/dotnet/fsharp/pull/17385))
812
* Change compiler default setting for compressedMetadata ([Issue #17379](https://github.com/dotnet/fsharp/issues/17379), [PR #17383](https://github.com/dotnet/fsharp/pull/17383))
913

docs/release-notes/.Language/preview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Speed up `for x in xs -> …` in list & array comprehensions in certain scenarios. ([PR #16948](https://github.com/dotnet/fsharp/pull/16948))
44
* Lower integral ranges to fast loops in more cases and optimize list and array construction from ranges. ([PR #16650](https://github.com/dotnet/fsharp/pull/16650), [PR #16832](https://github.com/dotnet/fsharp/pull/16832))
5+
* Support for nullable reference types ([PR #15181](https://github.com/dotnet/fsharp/pull/15181))
56
* Better generic unmanaged structs handling. ([Language suggestion #692](https://github.com/fsharp/fslang-suggestions/issues/692), [PR #12154](https://github.com/dotnet/fsharp/pull/12154))
67
* Bidirectional F#/C# interop for 'unmanaged' constraint. ([PR #12154](https://github.com/dotnet/fsharp/pull/12154))
78
* Make `.Is*` discriminated union properties visible. ([Language suggestion #222](https://github.com/fsharp/fslang-suggestions/issues/222), [PR #16341](https://github.com/dotnet/fsharp/pull/16341))

src/Compiler/AbstractIL/il.fs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,6 +2629,7 @@ type ILTypeDef
26292629
attributes: TypeAttributes,
26302630
layout: ILTypeDefLayout,
26312631
implements: ILTypes,
2632+
implementsCustomAttrs: (ILAttributesStored * int) list option,
26322633
genericParams: ILGenericParameterDefs,
26332634
extends: ILType option,
26342635
methods: ILMethodDefs,
@@ -2651,6 +2652,7 @@ type ILTypeDef
26512652
attributes,
26522653
layout,
26532654
implements,
2655+
implementsCustomAttrs,
26542656
genericParams,
26552657
extends,
26562658
methods,
@@ -2667,6 +2669,7 @@ type ILTypeDef
26672669
attributes,
26682670
layout,
26692671
implements,
2672+
implementsCustomAttrs,
26702673
genericParams,
26712674
extends,
26722675
methods,
@@ -2677,7 +2680,7 @@ type ILTypeDef
26772680
properties,
26782681
additionalFlags,
26792682
storeILSecurityDecls securityDecls,
2680-
customAttrs,
2683+
storeILCustomAttrs customAttrs,
26812684
NoMetadataIdx
26822685
)
26832686

@@ -2693,6 +2696,8 @@ type ILTypeDef
26932696

26942697
member _.Implements = implements
26952698

2699+
member _.ImplementsCustomAttrs = implementsCustomAttrs
2700+
26962701
member _.Extends = extends
26972702

26982703
member _.Methods = methods
@@ -2732,7 +2737,8 @@ type ILTypeDef
27322737
?properties,
27332738
?newAdditionalFlags,
27342739
?customAttrs,
2735-
?securityDecls
2740+
?securityDecls,
2741+
?implementsCustomAttrs
27362742
) =
27372743
ILTypeDef(
27382744
name = defaultArg name x.Name,
@@ -2741,6 +2747,7 @@ type ILTypeDef
27412747
genericParams = defaultArg genericParams x.GenericParams,
27422748
nestedTypes = defaultArg nestedTypes x.NestedTypes,
27432749
implements = defaultArg implements x.Implements,
2750+
implementsCustomAttrs = defaultArg implementsCustomAttrs x.ImplementsCustomAttrs,
27442751
extends = defaultArg extends x.Extends,
27452752
methods = defaultArg methods x.Methods,
27462753
securityDecls = defaultArg securityDecls x.SecurityDecls,
@@ -2749,7 +2756,7 @@ type ILTypeDef
27492756
events = defaultArg events x.Events,
27502757
properties = defaultArg properties x.Properties,
27512758
additionalFlags = defaultArg newAdditionalFlags additionalFlags,
2752-
customAttrs = defaultArg customAttrs (storeILCustomAttrs x.CustomAttrs)
2759+
customAttrs = defaultArg customAttrs (x.CustomAttrs)
27532760
)
27542761

27552762
member x.CustomAttrs: ILAttributes =
@@ -3439,6 +3446,11 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly
34393446

34403447
let mkSysILTypeRef nm = mkILTyRef (primaryScopeRef, nm)
34413448

3449+
let byteIlType = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_Byte))
3450+
3451+
let stringIlType =
3452+
mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_String))
3453+
34423454
member _.primaryAssemblyScopeRef = primaryScopeRef
34433455

34443456
member x.primaryAssemblyRef =
@@ -3456,7 +3468,7 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly
34563468

34573469
member val typ_Object = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Object))
34583470

3459-
member val typ_String = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_String))
3471+
member val typ_String = stringIlType
34603472

34613473
member val typ_Array = mkILBoxedType (mkILNonGenericTySpec (mkSysILTypeRef tname_Array))
34623474

@@ -3470,7 +3482,11 @@ type ILGlobals(primaryScopeRef: ILScopeRef, equivPrimaryAssemblyRefs: ILAssembly
34703482

34713483
member val typ_Int64 = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_Int64))
34723484

3473-
member val typ_Byte = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_Byte))
3485+
member val typ_Byte = byteIlType
3486+
3487+
member val typ_ByteArray = ILType.Array(ILArrayShape.SingleDimensional, byteIlType)
3488+
3489+
member val typ_StringArray = ILType.Array(ILArrayShape.SingleDimensional, stringIlType)
34743490

34753491
member val typ_UInt16 = ILType.Value(mkILNonGenericTySpec (mkSysILTypeRef tname_UInt16))
34763492

@@ -4231,12 +4247,13 @@ let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nes
42314247
attributes = attributes,
42324248
genericParams = genparams,
42334249
implements = impl,
4250+
implementsCustomAttrs = None,
42344251
layout = ILTypeDefLayout.Auto,
42354252
extends = Some extends,
42364253
methods = methods,
42374254
fields = fields,
42384255
nestedTypes = nestedTypes,
4239-
customAttrs = storeILCustomAttrs attrs,
4256+
customAttrs = attrs,
42404257
methodImpls = emptyILMethodImpls,
42414258
properties = props,
42424259
events = events,
@@ -4255,12 +4272,13 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) =
42554272
||| TypeAttributes.BeforeFieldInit
42564273
||| TypeAttributes.AnsiClass),
42574274
implements = [],
4275+
implementsCustomAttrs = None,
42584276
extends = Some iltyp_ValueType,
42594277
layout = ILTypeDefLayout.Explicit { Size = Some size; Pack = Some pack },
42604278
methods = emptyILMethods,
42614279
fields = emptyILFields,
42624280
nestedTypes = emptyILTypeDefs,
4263-
customAttrs = emptyILCustomAttrsStored,
4281+
customAttrs = emptyILCustomAttrs,
42644282
methodImpls = emptyILMethodImpls,
42654283
properties = emptyILProperties,
42664284
events = emptyILEvents,

src/Compiler/AbstractIL/il.fsi

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,13 @@ type ILAttributes =
869869

870870
/// Represents the efficiency-oriented storage of ILAttributes in another item.
871871
[<NoEquality; NoComparison>]
872-
type ILAttributesStored
872+
type ILAttributesStored =
873+
/// Computed by ilread.fs based on metadata index
874+
| Reader of (int32 -> ILAttribute[])
875+
/// Already computed
876+
| Given of ILAttributes
877+
878+
member GetCustomAttrs: int32 -> ILAttributes
873879

874880
/// Method parameters and return values.
875881
[<RequireQualifiedAccess; NoEquality; NoComparison>]
@@ -1070,6 +1076,8 @@ type ILMethodDef =
10701076
member IsEntryPoint: bool
10711077
member GenericParams: ILGenericParameterDefs
10721078
member CustomAttrs: ILAttributes
1079+
member MetadataIndex: int32
1080+
member CustomAttrsStored: ILAttributesStored
10731081
member ParameterTypes: ILTypes
10741082
member IsIL: bool
10751083
member Code: ILCode option
@@ -1243,6 +1251,10 @@ type ILFieldDef =
12431251

12441252
member CustomAttrs: ILAttributes
12451253

1254+
member MetadataIndex: int32
1255+
1256+
member CustomAttrsStored: ILAttributesStored
1257+
12461258
member IsStatic: bool
12471259

12481260
member IsSpecialName: bool
@@ -1326,6 +1338,8 @@ type ILEventDef =
13261338
member FireMethod: ILMethodRef option
13271339
member OtherMethods: ILMethodRef list
13281340
member CustomAttrs: ILAttributes
1341+
member MetadataIndex: int32
1342+
member CustomAttrsStored: ILAttributesStored
13291343
member IsSpecialName: bool
13301344
member IsRTSpecialName: bool
13311345

@@ -1388,6 +1402,8 @@ type ILPropertyDef =
13881402
member Init: ILFieldInit option
13891403
member Args: ILTypes
13901404
member CustomAttrs: ILAttributes
1405+
member MetadataIndex: int32
1406+
member CustomAttrsStored: ILAttributesStored
13911407
member IsSpecialName: bool
13921408
member IsRTSpecialName: bool
13931409

@@ -1498,6 +1514,7 @@ type ILTypeDef =
14981514
attributes: TypeAttributes *
14991515
layout: ILTypeDefLayout *
15001516
implements: ILTypes *
1517+
implementsCustomAttrs: (ILAttributesStored * int) list option *
15011518
genericParams: ILGenericParameterDefs *
15021519
extends: ILType option *
15031520
methods: ILMethodDefs *
@@ -1518,6 +1535,7 @@ type ILTypeDef =
15181535
attributes: TypeAttributes *
15191536
layout: ILTypeDefLayout *
15201537
implements: ILTypes *
1538+
implementsCustomAttrs: (ILAttributesStored * int) list option *
15211539
genericParams: ILGenericParameterDefs *
15221540
extends: ILType option *
15231541
methods: ILMethodDefs *
@@ -1528,7 +1546,7 @@ type ILTypeDef =
15281546
properties: ILPropertyDefs *
15291547
additionalFlags: ILTypeDefAdditionalFlags *
15301548
securityDecls: ILSecurityDecls *
1531-
customAttrs: ILAttributesStored ->
1549+
customAttrs: ILAttributes ->
15321550
ILTypeDef
15331551

15341552
member Name: string
@@ -1537,6 +1555,7 @@ type ILTypeDef =
15371555
member Layout: ILTypeDefLayout
15381556
member NestedTypes: ILTypeDefs
15391557
member Implements: ILTypes
1558+
member ImplementsCustomAttrs: (ILAttributesStored * int) list option
15401559
member Extends: ILType option
15411560
member Methods: ILMethodDefs
15421561
member SecurityDecls: ILSecurityDecls
@@ -1545,6 +1564,8 @@ type ILTypeDef =
15451564
member Events: ILEventDefs
15461565
member Properties: ILPropertyDefs
15471566
member CustomAttrs: ILAttributes
1567+
member MetadataIndex: int32
1568+
member CustomAttrsStored: ILAttributesStored
15481569
member IsClass: bool
15491570
member IsStruct: bool
15501571
member IsInterface: bool
@@ -1593,8 +1614,9 @@ type ILTypeDef =
15931614
?events: ILEventDefs *
15941615
?properties: ILPropertyDefs *
15951616
?newAdditionalFlags: ILTypeDefAdditionalFlags *
1596-
?customAttrs: ILAttributesStored *
1597-
?securityDecls: ILSecurityDecls ->
1617+
?customAttrs: ILAttributes *
1618+
?securityDecls: ILSecurityDecls *
1619+
?implementsCustomAttrs: (ILAttributesStored * int) list option ->
15981620
ILTypeDef
15991621

16001622
/// Represents a prefix of information for ILTypeDef.
@@ -1890,11 +1912,13 @@ type internal ILGlobals =
18901912
member typ_Enum: ILType
18911913
member typ_Object: ILType
18921914
member typ_String: ILType
1915+
member typ_StringArray: ILType
18931916
member typ_Type: ILType
18941917
member typ_Array: ILType
18951918
member typ_IntPtr: ILType
18961919
member typ_UIntPtr: ILType
18971920
member typ_Byte: ILType
1921+
member typ_ByteArray: ILType
18981922
member typ_Int16: ILType
18991923
member typ_Int32: ILType
19001924
member typ_Int64: ILType

src/Compiler/AbstractIL/ilmorph.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ let rec tdef_ty2ty_ilmbody2ilmbody_mdefs2mdefs isInKnownSet enc fs (tdef: ILType
378378
methodImpls = mimpls_ty2ty fTyInCtxtR tdef.MethodImpls,
379379
events = edefs_ty2ty fTyInCtxtR tdef.Events,
380380
properties = pdefs_ty2ty fTyInCtxtR tdef.Properties,
381-
customAttrs = storeILCustomAttrs (cattrs_ty2ty fTyInCtxtR tdef.CustomAttrs)
381+
customAttrs = cattrs_ty2ty fTyInCtxtR tdef.CustomAttrs
382382
)
383383

384384
and tdefs_ty2ty_ilmbody2ilmbody_mdefs2mdefs isInKnownSet enc fs tdefs =

0 commit comments

Comments
 (0)