Skip to content
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

[RFC FS-1060] Nullness checking (applied to codebase) #15310

Merged
merged 303 commits into from
Aug 14, 2024
Merged
Changes from 2 commits
Commits
Show all changes
303 commits
Select commit Hold shift + click to select a range
ef15719
fantomas
T-Gro Nov 29, 2023
f230a6f
fix tests
T-Gro Nov 30, 2023
7ea37af
Merge branch 'main' into feature/nullness
T-Gro Nov 30, 2023
97a9c31
trim test
T-Gro Dec 1, 2023
51044a7
trimming test
T-Gro Dec 1, 2023
7182913
trim check
T-Gro Dec 1, 2023
26de6fe
now?
T-Gro Dec 1, 2023
8f48a32
IL tests
T-Gro Dec 4, 2023
3f763a5
il tests
T-Gro Dec 4, 2023
cbfe777
trim test
T-Gro Dec 4, 2023
5e296b9
trim
T-Gro Dec 4, 2023
dec61d6
one more time
T-Gro Dec 4, 2023
91429b4
Merge main to feature/nullness (#16366)
dotnet-bot Dec 4, 2023
3f55d8d
Merge branch 'main' into feature/nullness
T-Gro Dec 4, 2023
73d670d
syntax tree layout
T-Gro Dec 4, 2023
4a19eb4
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Dec 5, 2023
4ef4815
Merge pull request #16383 from dotnet/merges/main-to-feature/nullness
T-Gro Dec 5, 2023
80efaa2
Nullness-related aggressive trimming of FSharp.Core (#16387)
T-Gro Dec 5, 2023
fe42158
Merge branch 'main' into feature/nullness
T-Gro Dec 5, 2023
3de7178
Merge branch 'main' into feature/nullness
T-Gro Dec 5, 2023
bf45dee
Merge main to feature/nullness (#16397)
dotnet-bot Dec 8, 2023
ed7854b
Merge branch 'main' into feature/nullness
T-Gro Dec 8, 2023
2bca3d8
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jan 15, 2024
d697c63
Nullness interop - import of C#-emitted metadata (#16423)
T-Gro Jan 17, 2024
00a591c
Nullness - include in QuickInfo and in general in "typeEnc" (string r…
T-Gro Jan 23, 2024
38532af
Merge main to feature/nullness (#16539)
dotnet-bot Jan 24, 2024
ba6b0f2
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jan 24, 2024
c022d5a
applying nullness to the codebase, part 1
T-Gro Jan 24, 2024
9caf7bc
Adjusting codebase
T-Gro Jan 25, 2024
10aa5a2
DelayInitArrayMap nullness
T-Gro Jan 25, 2024
e7f4f1f
conflicts resolved
T-Gro Jan 25, 2024
3c53e3b
release notes
T-Gro Jan 25, 2024
dfada6a
Merge branch 'main' into feature/nullness
T-Gro Jan 25, 2024
dac9c76
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jan 25, 2024
5b792a0
fix NO_CHECKNULLS build
T-Gro Jan 25, 2024
71e209e
Update illib.fsi
T-Gro Jan 25, 2024
3250b7e
Fix ILType.Array import (#16585)
T-Gro Jan 25, 2024
cf735db
Merge branch 'main' into feature/nullness
T-Gro Jan 25, 2024
f73a1ff
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jan 25, 2024
e0f1634
Nullness - reading+writing metadata for 'inherits' and interface imp…
T-Gro Jan 30, 2024
33e5e27
Merge branch 'main' into feature/nullness
T-Gro Jan 30, 2024
ca3366b
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jan 30, 2024
d70d1fe
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
KevinRansom Jan 31, 2024
a2df473
Merge pull request #16620 from dotnet/merges/main-to-feature/nullness
KevinRansom Jan 31, 2024
60c4fb0
ILGenerator test case
T-Gro Jan 31, 2024
ca7e0b4
Merge branch 'feature/nullness' of https://github.com/dotnet/fsharp i…
T-Gro Jan 31, 2024
476d7ba
workaround a bug in ns20 API
T-Gro Jan 31, 2024
e3bfa71
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jan 31, 2024
29462f2
Merge pull request #16635 from dotnet/merges/main-to-feature/nullness
T-Gro Feb 1, 2024
f30c6a0
Merge branch 'main' into feature/nullness
T-Gro Feb 1, 2024
1d86093
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Feb 1, 2024
d1035f1
applying nullness
T-Gro Feb 5, 2024
2c29f52
Merge branch 'revert-15309-revert-15265-feature/nullness-enabled' of …
T-Gro Feb 6, 2024
5811d88
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Feb 6, 2024
cd662eb
Merge pull request #16648 from dotnet/merges/main-to-feature/nullness
T-Gro Feb 6, 2024
2a43e53
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Feb 6, 2024
bca1c53
Nullness :: Format string %s should allow nullable string (#16656)
T-Gro Feb 6, 2024
836e2c9
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Feb 7, 2024
a35c0e2
Merge pull request #16660 from dotnet/merges/main-to-feature/nullness
T-Gro Feb 7, 2024
17f0ced
Nullness:: Unchecked.nonNull for FSharp.Core (#16654)
T-Gro Feb 7, 2024
a0cb6b4
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Feb 7, 2024
d4dd6a8
Merge branch 'main' into feature/nullness
T-Gro Feb 8, 2024
15b9962
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Feb 8, 2024
552ea0a
Merge branch 'main' into feature/nullness
T-Gro Feb 8, 2024
050c8a0
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Feb 8, 2024
fc5c6c4
Merge pull request #16679 from dotnet/merges/main-to-feature/nullness
KevinRansom Feb 9, 2024
c5ecfb4
Merge branch 'main' into feature/nullness
T-Gro Feb 9, 2024
53f5e8c
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Feb 9, 2024
3775088
Merge pull request #16685 from dotnet/merges/main-to-feature/nullness
KevinRansom Feb 10, 2024
17a5ca9
Nullness :: Pattern matching with null should mark input for subseque…
T-Gro Feb 12, 2024
9bc3f81
Merge branch 'main' into feature/nullness
T-Gro Feb 12, 2024
ec2d4a8
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Feb 13, 2024
b6b737f
Merge pull request #16694 from dotnet/merges/main-to-feature/nullness
T-Gro Feb 13, 2024
3754c86
Merge pull request #16705 from dotnet/merges/main-to-feature/nullness
KevinRansom Feb 14, 2024
bfd8520
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
KevinRansom Feb 16, 2024
ab8a943
Merge pull request #16722 from dotnet/merges/main-to-feature/nullness
T-Gro Feb 16, 2024
d487006
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Feb 17, 2024
0e3f43f
Merge pull request #16727 from dotnet/merges/main-to-feature/nullness
T-Gro Feb 17, 2024
49e0d7c
Merge pull request #16728 from dotnet/merges/main-to-feature/nullness
KevinRansom Feb 20, 2024
97d9437
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
KevinRansom Feb 23, 2024
6827b1c
Feature nullness - support overrides of nullness annotation in the im…
T-Gro Mar 4, 2024
552c843
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Mar 4, 2024
ba69485
Improve type inference w.r.t. nullness in printing (#16681)
T-Gro Mar 4, 2024
9ae3768
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
vzarytovskii Mar 4, 2024
e8f2b97
Update tests/AheadOfTime/Trimming/check.ps1
T-Gro Mar 4, 2024
1f2b43b
Merge pull request #16752 from dotnet/merges/main-to-feature/nullness
T-Gro Mar 4, 2024
5eb9fea
Merge branch 'main' into feature/nullness
T-Gro Mar 4, 2024
055c772
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Mar 5, 2024
654c27f
Merge pull request #16808 from dotnet/merges/main-to-feature/nullness
T-Gro Mar 5, 2024
806c58e
Merge branch 'main' into feature/nullness
T-Gro Mar 6, 2024
743996a
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Mar 11, 2024
171b69e
Merge branch 'main' into feature/nullness
T-Gro Mar 11, 2024
04b93e1
Fix merge errors
T-Gro Mar 11, 2024
b5b14b6
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Mar 11, 2024
cbaffad
Merge pull request #16840 from dotnet/merges/main-to-feature/nullness
T-Gro Mar 11, 2024
2071594
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Mar 13, 2024
3c5605c
il tests reflecting visibility change
T-Gro Mar 18, 2024
cb696d5
Merge pull request #16866 from dotnet/merges/main-to-feature/nullness
T-Gro Mar 18, 2024
14efaa4
Merge branch 'main' into feature/nullness
T-Gro Mar 18, 2024
72b7494
Nullness feature :: New warning for functions insisting on a (WithNul…
T-Gro Mar 19, 2024
74d1da2
Merge branch 'main' into feature/nullness
T-Gro Mar 19, 2024
ccc35ba
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Mar 21, 2024
8ff2ed1
Merge pull request #16915 from dotnet/merges/main-to-feature/nullness
T-Gro Mar 21, 2024
5d89ba3
Merge pull request #16930 from dotnet/merges/main-to-feature/nullness
KevinRansom Mar 22, 2024
b84d754
Merge pull request #16939 from dotnet/merges/main-to-feature/nullness
T-Gro Mar 25, 2024
7f502b7
Merge pull request #16949 from dotnet/merges/main-to-feature/nullness
T-Gro Mar 26, 2024
65c7b8b
Merge branch 'main' into feature/nullness
T-Gro Mar 26, 2024
55cd42f
Feature nullness - propper guards against ` | null ` on unsupported t…
T-Gro Mar 28, 2024
b34e568
Merge pull request #16960 from dotnet/merges/main-to-feature/nullness
T-Gro Apr 2, 2024
8801707
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Apr 2, 2024
0be7fb4
fantomas
T-Gro Apr 3, 2024
9e4a413
Null-safe activity module
T-Gro Apr 3, 2024
a638f34
assemblyresolvehandler - reflection APIs
T-Gro Apr 3, 2024
e022636
Decorating generic not null type parameters
T-Gro Apr 3, 2024
28eb39c
Conditionally adding net8.0 tfm to get better null annotations
T-Gro Apr 3, 2024
9cf47f4
asyncmemoize,cancellable
T-Gro Apr 3, 2024
faba56d
Merge pull request #16980 from dotnet/merges/main-to-feature/nullness
KevinRansom Apr 4, 2024
a2fb9dd
Compiler location
T-Gro Apr 5, 2024
0d7068c
Option.ofString
T-Gro Apr 5, 2024
a6be10c
Merge pull request #16989 from dotnet/merges/main-to-feature/nullness
T-Gro Apr 5, 2024
a871929
getting rid of explicit type annotations
T-Gro Apr 5, 2024
7090129
(!!) introduced, applied for `typeof<..>.FullName`
T-Gro Apr 5, 2024
25dd379
.ToString() can return null, `string` function handles this
T-Gro Apr 5, 2024
bb6ae59
e.InnerException safe handling
T-Gro Apr 5, 2024
3a1a352
compiler imports - !! on file system ops that are `NotNullIfNotNull`
T-Gro Apr 5, 2024
b8feeac
Merge pull request #16996 from dotnet/merges/main-to-feature/nullness
KevinRansom Apr 6, 2024
920cae8
compilerlocation
T-Gro Apr 8, 2024
d522550
some more
T-Gro Apr 8, 2024
4b9ff3d
nullArgCheck -> (!!) to match existing assumption
T-Gro Apr 8, 2024
dc8b9fd
dependency provider
T-Gro Apr 8, 2024
597e9d6
next batch
T-Gro Apr 8, 2024
3675157
next batch
T-Gro Apr 8, 2024
0e350af
Working around .ToString() overrides in F# side
T-Gro Apr 9, 2024
dc6dd0b
ilreflect
T-Gro Apr 9, 2024
9067ad6
Merge pull request #17007 from dotnet/merges/main-to-feature/nullness
T-Gro Apr 10, 2024
647d797
Merge pull request #17023 from dotnet/merges/main-to-feature/nullness
T-Gro Apr 11, 2024
387acf8
next batch, adding `defaultIfNull `
T-Gro Apr 11, 2024
bc8a27e
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Apr 12, 2024
4b955cd
nullSafeEquality added, bunch of files reworked
T-Gro Apr 12, 2024
58f8cac
Merge pull request #17037 from dotnet/merges/main-to-feature/nullness
T-Gro Apr 16, 2024
76d28e5
transparent compiler - apply !! to filepath ops
T-Gro Apr 16, 2024
a9f23ca
typedtree
T-Gro Apr 16, 2024
d3cf221
typeproviders,infos
T-Gro Apr 17, 2024
f25d792
infos,,ilwritepdb
T-Gro Apr 17, 2024
1f9d5e9
some more
T-Gro Apr 17, 2024
b5b3f0d
Merge pull request #17058 from dotnet/merges/main-to-feature/nullness
KevinRansom Apr 17, 2024
c1b53bc
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Apr 18, 2024
dc0eaea
next batch, compareBy added
T-Gro Apr 18, 2024
42c6afd
Merge pull request #17065 from dotnet/merges/main-to-feature/nullness
T-Gro Apr 18, 2024
d78f5aa
Feature nullness :: warn also for 'obj' type (since it can be infered…
T-Gro Apr 19, 2024
a2823f3
typedtreeops, IComparer and IEqualityComparer impls
T-Gro Apr 19, 2024
6f0875d
sformat
T-Gro Apr 19, 2024
a0a7d82
Merge branch 'main' into feature/nullness
T-Gro Apr 19, 2024
13e8af2
Nullness feature :: various bugfixes (#17080)
T-Gro Apr 26, 2024
3bcf33d
Merge pull request #17083 from dotnet/merges/main-to-feature/nullness
T-Gro Apr 26, 2024
71c6b58
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Apr 26, 2024
14d666e
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Apr 29, 2024
fed2bdb
Merge branch 'main' into merges/main-to-feature/nullness
T-Gro May 16, 2024
ebdeebc
updating IL tests
T-Gro May 16, 2024
f161691
One more try
T-Gro May 16, 2024
6cf326c
surface area
T-Gro May 17, 2024
e154438
Merge branch 'main' into merges/main-to-feature/nullness
T-Gro May 17, 2024
0b65db9
trimmed size
T-Gro May 17, 2024
176275f
Merge pull request #17097 from dotnet/merges/main-to-feature/nullness
T-Gro May 17, 2024
a6373c9
Merge branch 'merges/main-to-feature/nullness' of https://github.com/…
T-Gro May 20, 2024
817ee1e
trimmed size
T-Gro May 20, 2024
61f5777
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro May 20, 2024
03e294f
Merge pull request #17175 from dotnet/merges/main-to-feature/nullness
T-Gro May 20, 2024
7da45b5
fix issues for plain 'dotnet build Fsharp.Compiler.Service.sln`
T-Gro May 20, 2024
c28b21a
update FSharpCoreShippedPackageVersionValue
T-Gro May 20, 2024
3570b2f
Wkraround attributetargets issue by using 'obj'. This removes 3x box …
T-Gro May 20, 2024
13e50b4
Merge pull request #17185 from dotnet/feature-nullness-fix-plain-builds
T-Gro May 21, 2024
3d375d2
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro May 21, 2024
e2e698d
Feature nullness :: Bugfixes (#17102)
T-Gro May 21, 2024
165f664
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro May 21, 2024
3603443
Merge pull request #17192 from dotnet/merges/main-to-feature/nullness
T-Gro May 21, 2024
101ae03
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Jun 11, 2024
aa62eef
Automated command ran: fantomas
github-actions[bot] Jun 11, 2024
a72457e
Feature nullness :: Try infer without null even when function/method…
T-Gro Jun 11, 2024
d4ad891
Feature nullness :: apply nullness annotations to usages of 'obj' in …
T-Gro Jun 11, 2024
382a327
Merge pull request #17213 from dotnet/merges/main-to-feature/nullness
T-Gro Jun 11, 2024
f9b1ccc
Merge branch 'main' into feature/nullness
T-Gro Jun 12, 2024
d84326b
resolve build error from auto-merge
T-Gro Jun 12, 2024
64033b9
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Jun 17, 2024
d2d7bd3
Merge pull request #17304 from dotnet/merges/main-to-feature/nullness
T-Gro Jun 17, 2024
1b29d70
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jun 17, 2024
7bde93c
Merge branch 'main' into feature/nullness
T-Gro Jun 17, 2024
5ab472e
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jun 17, 2024
679f605
Merge pull request #17320 from dotnet/merges/main-to-feature/nullness
T-Gro Jun 18, 2024
4fbbf32
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jun 19, 2024
5488a35
Feature nullness :: Cleanups, Test reorg, fix incrementalbuild cache …
T-Gro Jun 19, 2024
091da12
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jun 19, 2024
23f9990
Got rid of errors, now only warnings remain - hopefully
T-Gro Jun 19, 2024
0bba083
Relaxing LKG definition of MaybeNull to make it work for List ( List …
T-Gro Jun 19, 2024
98458d0
applying to codebase
T-Gro Jun 22, 2024
da4cdd3
applying nullness
T-Gro Jun 24, 2024
c044f20
protobuild passing now
T-Gro Jun 24, 2024
e41ad14
Update fsc.fsproj
T-Gro Jun 24, 2024
a9e52a3
fantomas
T-Gro Jun 25, 2024
9abf120
fix build
T-Gro Jun 25, 2024
888995c
try skipping R2R
T-Gro Jun 25, 2024
0aa633f
Bootstraping for resource builds
T-Gro Jun 25, 2024
595412f
Fix plain build
T-Gro Jun 26, 2024
2cb5387
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Jun 26, 2024
107ee5c
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Jun 26, 2024
30b2a02
fix tests build
T-Gro Jun 26, 2024
dc92a0c
Merge pull request #17337 from dotnet/merges/main-to-feature/nullness
T-Gro Jun 26, 2024
1108c0d
fantomas
T-Gro Jun 26, 2024
0a8ee68
Moving changes off from Micosoft.FSharp.targets to local Directory bu…
T-Gro Jun 27, 2024
469899b
Merge branch 'merges/main-to-feature/nullness' of https://github.com/…
T-Gro Jul 1, 2024
24f923c
Merge branch 'feature/nullness' into merges/main-to-feature/nullness
T-Gro Jul 1, 2024
c8cfda2
fix build issues
T-Gro Jul 1, 2024
653507c
Merge branch 'merges/main-to-feature/nullness' of https://github.com/…
T-Gro Jul 1, 2024
fedc901
Merge pull request #17354 from dotnet/merges/main-to-feature/nullness
T-Gro Jul 3, 2024
7ec905d
Merge branch 'main' into feature/nullness
T-Gro Jul 3, 2024
64c7e18
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jul 3, 2024
1f2e0c4
resolve semantic merge error
T-Gro Jul 3, 2024
af3f704
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jul 3, 2024
ddd666d
merge
KevinRansom Jul 9, 2024
59938f4
Merge pull request #17395 from KevinRansom/nullness
T-Gro Jul 9, 2024
a7984af
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jul 9, 2024
49bec1c
Nullness subsumption when used for contravariant typars
T-Gro Jul 9, 2024
6a65374
Merge branch 'feature/nullness' into feature-nullness-variance
T-Gro Jul 9, 2024
30c3432
fix nullness plain build (#17404)
T-Gro Jul 11, 2024
0773645
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jul 11, 2024
5f6b7da
Merge branch 'feature/nullness' into feature-nullness-variance
T-Gro Jul 11, 2024
3752733
Merge branch 'main' into feature/nullness
vzarytovskii Jul 11, 2024
57026b8
Merge pull request #17398 from dotnet/feature-nullness-variance
T-Gro Jul 11, 2024
5dcad11
Merge branch 'feature/nullness' into revert-15309-revert-15265-featur…
T-Gro Jul 11, 2024
770f98e
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Jul 19, 2024
e6f93a7
fix build issues after merge conflicts
T-Gro Jul 19, 2024
3a1b9ab
Fix release notes
psfinaki Jul 23, 2024
ee10bb3
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Jul 26, 2024
3e108fe
Change TargetFrameworks conditioning
T-Gro Jul 26, 2024
a72a20f
Resolving some TODOs, address fsharp.build artifacts and their nullne…
T-Gro Jul 26, 2024
48239d1
resolve TODOs in inforeader
T-Gro Jul 26, 2024
509e515
Our Range must shadow the System.Range which exists for ns2.1 and above
T-Gro Jul 26, 2024
bc6a20d
fantomas
T-Gro Jul 26, 2024
9c2e5e8
fantomas, readmes
T-Gro Jul 26, 2024
67667ce
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Jul 26, 2024
1b90861
F.C.S surface tests must use ns2.0 to make sure assembly references a…
T-Gro Jul 26, 2024
0284740
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Jul 29, 2024
1c08cd0
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Jul 31, 2024
3aa57a2
Skip NetCurrent on OSX CI
T-Gro Jul 31, 2024
677ce2f
Skip NetCurrent Linux as well, I think machine provisioning makes it …
T-Gro Jul 31, 2024
8717723
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Aug 12, 2024
5020a50
Re-enable PublishReadyToRun for fsc
T-Gro Aug 13, 2024
0b5cf85
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Aug 13, 2024
1efd639
put fsc.fscproj back
T-Gro Aug 13, 2024
02d9d23
Merge branch 'main' into revert-15309-revert-15265-feature/nullness-e…
T-Gro Aug 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -128,3 +128,5 @@ tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstanda
*.vsp
/tests/AheadOfTime/Trimming/output.txt
*.svclog
micro.exe
positive.exe
10 changes: 8 additions & 2 deletions src/Compiler/AbstractIL/ilread.fs
Original file line number Diff line number Diff line change
@@ -931,8 +931,9 @@ let mkCacheInt32 lowMem _inbase _nm _sz =
(fun f x -> f x)
else
let mutable cache: ConcurrentDictionary<int32, _> MaybeNull = null // TODO NULLNESS: this explicit annotation should not be needed
let mutable count = 0
#if STATISTICS
let mutable count = 0

addReport (fun oc ->
if count <> 0 then
oc.WriteLine((_inbase + string count + " " + _nm + " cache hits"): string))
@@ -948,7 +949,9 @@ let mkCacheInt32 lowMem _inbase _nm _sz =

match cache.TryGetValue idx with
| true, res ->
#if STATISTICS
count <- count + 1
#endif
res
| _ ->
let res = f idx
@@ -960,8 +963,9 @@ let mkCacheGeneric lowMem _inbase _nm _sz =
(fun f x -> f x)
else
let mutable cache: ConcurrentDictionary<_, _> MaybeNull = null // TODO NULLNESS: this explicit annotation should not be needed
let mutable count = 0
#if STATISTICS
let mutable count = 0

addReport (fun oc ->
if !count <> 0 then
oc.WriteLine((_inbase + string !count + " " + _nm + " cache hits"): string))
@@ -977,7 +981,9 @@ let mkCacheGeneric lowMem _inbase _nm _sz =

match cache.TryGetValue idx with
| true, v ->
#if STATISTICS
count <- count + 1
#endif
v
| _ ->
let res = f idx
5 changes: 4 additions & 1 deletion src/Compiler/Checking/CheckExpressions.fs
Original file line number Diff line number Diff line change
@@ -1040,6 +1040,7 @@ let TcAddNullnessToType (warn: bool) (cenv: cenv) (env: TcEnv) nullness innerTyC

if not g.compilingFSharpCore || not (isTyparTy g innerTyC) then
AddCxTypeDefnNotSupportsNull env.DisplayEnv cenv.css m NoTrace innerTyC
AddCxTypeIsReferenceType env.DisplayEnv cenv.css m NoTrace innerTyC

if not g.compilingFSharpCore && isTyparTy g innerTyC then
// A typar might be later infered into a type not supporting `| null|, like tuple or anon.
@@ -5314,6 +5315,7 @@ and TcExprFlex (cenv: cenv) flex compat (desiredTy: TType) (env: TcEnv) tpenv (s

if flex then
let argTy = NewInferenceType g
(destTyparTy g argTy).SetSupportsNullFlex(true)
if compat then
(destTyparTy g argTy).SetIsCompatFlex(true)

@@ -9601,7 +9603,8 @@ and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mExprAndItem objDetai
| None, false -> error (Error (FSComp.SR.tcEventIsNotStatic nm, mItem))
| _ -> ()

let delTy = einfo.GetDelegateType(cenv.amap, mItem)
// The F# wrappers around events are null safe (impl is in FSharp.Core). Therefore, from an F# perspective, the type of the delegate can be considered Not Null.
let delTy = einfo.GetDelegateType(cenv.amap, mItem) |> replaceNullnessOfTy KnownWithoutNull
let (SigOfFunctionForDelegate(delInvokeMeth, delArgTys, _, _)) = GetSigOfFunctionForDelegate cenv.infoReader delTy mItem ad
let objArgs = Option.toList (Option.map fst objDetails)
MethInfoChecks g cenv.amap true None objArgs env.eAccessRights mItem delInvokeMeth
47 changes: 41 additions & 6 deletions src/Compiler/Checking/ConstraintSolver.fs
Original file line number Diff line number Diff line change
@@ -308,6 +308,9 @@ type ConstraintSolverEnv =
// Is this speculative, with a trace allowing undo, and trial method overload resolution
IsSpeculativeForMethodOverloading: bool

// Can this ignore the 'must support null' constraint, e.g. in a mutable assignment scenario
IsSupportsNullFlex: bool

/// Indicates that when unifying ty1 = ty2, only type variables in ty1 may be solved. Constraints
/// can't be added to type variables in ty2
MatchingOnly: bool
@@ -344,6 +347,7 @@ let MakeConstraintSolverEnv contextInfo css m denv =
EquivEnv = TypeEquivEnv.Empty
DisplayEnv = denv
IsSpeculativeForMethodOverloading = false
IsSupportsNullFlex = false
ExtraRigidTypars = emptyFreeTypars
}

@@ -953,6 +957,13 @@ let rec SolveTyparEqualsTypePart1 (csenv: ConstraintSolverEnv) m2 (trace: Option
// Record the solution before we solve the constraints, since
// We may need to make use of the equation when solving the constraints.
// Record a entry in the undo trace if one is provided

//let ty1AllowsNull = r.Constraints |> List.exists (function | TyparConstraint.SupportsNull _ -> true | _ -> false )
//let tyAllowsNull() = TypeNullIsExtraValueNew csenv.g m2 ty
//if ty1AllowsNull && not (tyAllowsNull()) then
// trace.Exec (fun () -> r.typar_solution <- Some (ty |> replaceNullnessOfTy csenv.g.knownWithNull)) (fun () -> r.typar_solution <- None)
//else
// trace.Exec (fun () -> r.typar_solution <- Some ty) (fun () -> r.typar_solution <- None)
trace.Exec (fun () -> r.typar_solution <- Some ty) (fun () -> r.typar_solution <- None)
}

@@ -1218,6 +1229,12 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr
let sty1 = stripTyEqnsA csenv.g canShortcut ty1
let sty2 = stripTyEqnsA csenv.g canShortcut ty2

let csenv =
match ty1 with
| TType.TType_var(r,_) when r.typar_flags.IsSupportsNullFlex ->
{ csenv with IsSupportsNullFlex = true}
| _ -> csenv

match sty1, sty2 with
// type vars inside forall-types may be alpha-equivalent
| TType_var (tp1, nullness1), TType_var (tp2, nullness2) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some tpTy1 when typeEquiv g tpTy1 ty2 -> true | _ -> false) ->
@@ -1273,6 +1290,15 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr
// Unifying 'T1? and 'T2?
| ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull ->
SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2)
| ValueSome NullnessInfo.WithoutNull, ValueSome NullnessInfo.WithoutNull when
csenv.IsSupportsNullFlex &&
isAppTy g sty2 &&
tp1.Constraints |> List.exists (function TyparConstraint.SupportsNull _ -> true | _ -> false) ->
let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false)
trackErrors {
do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty2
do! SolveTypeEqualsType csenv ndeep m2 trace cxsln ty1 (TType_var(tpNew, g.knownWithNull))
}
// Unifying 'T1 % and 'T2 %
//| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull ->
// SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2)
@@ -2354,6 +2380,10 @@ and EnforceConstraintConsistency (csenv: ConstraintSolverEnv) ndeep m2 trace ret
| TyparConstraint.IsNonNullableStruct _, TyparConstraint.IsReferenceType _
| TyparConstraint.IsReferenceType _, TyparConstraint.IsNonNullableStruct _ ->
return! ErrorD (Error(FSComp.SR.csStructConstraintInconsistent(), m))

| TyparConstraint.SupportsNull _, TyparConstraint.NotSupportsNull _
| TyparConstraint.NotSupportsNull _, TyparConstraint.SupportsNull _ ->
return! ErrorD (Error(FSComp.SR.csNullNotNullConstraintInconsistent(), m))

| TyparConstraint.IsUnmanaged _, TyparConstraint.IsReferenceType _
| TyparConstraint.IsReferenceType _, TyparConstraint.IsUnmanaged _ ->
@@ -2534,16 +2564,18 @@ and SolveTypeUseSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 trace ty =
return! ErrorD (ConstraintSolverError(FSComp.SR.csNullableTypeDoesNotHaveNull(NicePrint.minimalStringOfType denv ty), m, m2))
else
match tryDestTyparTy g ty with
| ValueSome tp ->
| ValueSome tp ->
let nullness = nullnessOfTy g ty
match nullness.TryEvaluate() with
// NULLNESS TODO: This rule means turning on checkNullness changes type inference results for the cases
// mentioned in the comment above. THat's OK but needs to be documented in the RFC.
| ValueNone when not g.checkNullness ->
return! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.SupportsNull m)
| ValueSome NullnessInfo.WithoutNull ->
return! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.SupportsNull m)
| ValueSome NullnessInfo.WithoutNull ->
return! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.SupportsNull m)
| _ ->
if tp.Constraints |> List.exists (function | TyparConstraint.IsReferenceType _ -> true | _ -> false) |> not then
do! AddConstraint csenv ndeep m2 trace tp (TyparConstraint.IsReferenceType m)
return! SolveNullnessSupportsNull csenv ndeep m2 trace ty nullness
| _ ->
let nullness = nullnessOfTy g ty
@@ -2580,9 +2612,10 @@ and SolveNullnessSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 (trace: Opti
match n1 with
| NullnessInfo.AmbivalentToNull -> ()
| NullnessInfo.WithNull -> ()
| NullnessInfo.WithoutNull ->
| NullnessInfo.WithoutNull ->
if g.checkNullness then
return! WarnD(ConstraintSolverNullnessWarningWithType(denv, ty, n1, m, m2))
// TODO nullness: Shouldn't this be an error? We have a 'must support null' situation which is not being met.
return! WarnD(ConstraintSolverNullnessWarningWithType(denv, ty, n1, m, m2))
}

and SolveTypeUseNotSupportsNull (csenv: ConstraintSolverEnv) ndeep m2 trace ty =
@@ -2635,7 +2668,9 @@ and SolveTypeCanCarryNullness (csenv: ConstraintSolverEnv) ty nullness =
let m = csenv.m
let strippedTy = stripTyEqnsA g true ty
match tryAddNullnessToTy nullness strippedTy with
| Some _ -> ()
| Some _ ->
if isTyparTy g strippedTy && not (isReferenceTyparTy g strippedTy) then
return! AddConstraint csenv 0 m NoTrace (destTyparTy g strippedTy) (TyparConstraint.IsReferenceType m)
| None ->
let tyString = NicePrint.minimalStringOfType csenv.DisplayEnv strippedTy
return! ErrorD(Error(FSComp.SR.tcTypeDoesNotHaveAnyNull(tyString), m))
12 changes: 9 additions & 3 deletions src/Compiler/CodeGen/IlxGen.fs
Original file line number Diff line number Diff line change
@@ -5648,17 +5648,23 @@ and GenGenericParam cenv eenv (tp: Typar) =
| TyparConstraint.IsNonNullableStruct _ -> true
| _ -> false)

let notNullReferenceTypeConstraint =
let nullnessOfTypar =
if g.langFeatureNullness && g.checkNullness then
let hasNotSupportsNull =
tp.Constraints
|> List.exists (function
| TyparConstraint.NotSupportsNull _ -> true
| _ -> false)

let hasSupportsNull () =
tp.Constraints
|> List.exists (function
| TyparConstraint.SupportsNull _ -> true
| _ -> false)

if hasNotSupportsNull || notNullableValueTypeConstraint then
NullnessInfo.WithoutNull
elif hasNotSupportsNull || refTypeConstraint then
elif refTypeConstraint || hasSupportsNull () then
NullnessInfo.WithNull
else
NullnessInfo.AmbivalentToNull
@@ -5711,7 +5717,7 @@ and GenGenericParam cenv eenv (tp: Typar) =
yield! GenAttrs cenv eenv tp.Attribs
if emitUnmanagedInIlOutput then
yield (GetIsUnmanagedAttribute g)
match notNullReferenceTypeConstraint with
match nullnessOfTypar with
| Some nullInfo -> yield GetNullableAttribute g [ nullInfo ]
| _ -> ()
]
2 changes: 1 addition & 1 deletion src/Compiler/CodeGen/IlxGenSupport.fs
Original file line number Diff line number Diff line change
@@ -446,8 +446,8 @@ let rec GetNullnessFromTType (g: TcGlobals) ty =
]
| TType_forall _
| TType_ucase _
| TType_var _
| TType_measure _ -> []
| TType_var(nullness = nullness) -> [ nullness.Evaluate() ]

let GenNullnessIfNecessary (g: TcGlobals) ty =
if g.langFeatureNullness && g.checkNullness then
36 changes: 27 additions & 9 deletions src/Compiler/TypedTree/TypedTree.fs
Original file line number Diff line number Diff line change
@@ -300,7 +300,7 @@ type TyparRigidity =
[<Struct>]
type TyparFlags(flags: int32) =

new (kind: TyparKind, rigidity: TyparRigidity, isFromError: bool, isCompGen: bool, staticReq: TyparStaticReq, dynamicReq: TyparDynamicReq, equalityDependsOn: bool, comparisonDependsOn: bool) =
new (kind: TyparKind, rigidity: TyparRigidity, isFromError: bool, isCompGen: bool, staticReq: TyparStaticReq, dynamicReq: TyparDynamicReq, equalityDependsOn: bool, comparisonDependsOn: bool, supportsNullFlex: bool) =
TyparFlags((if isFromError then 0b00000000000000010 else 0) |||
(if isCompGen then 0b00000000000000100 else 0) |||
(match staticReq with
@@ -321,7 +321,11 @@ type TyparFlags(flags: int32) =
| TyparDynamicReq.No -> 0b00000000000000000
| TyparDynamicReq.Yes -> 0b00000010000000000) |||
(if equalityDependsOn then
0b00000100000000000 else 0))
0b00000100000000000 else 0) |||
// 0b00001000100000000 is being checked by x.Kind, but never set in this version of the code
// 0b00010000000000000 is taken by compat flex
(if supportsNullFlex then
0b00100000000000000 else 0))

/// Indicates if the type inference variable was generated after an error when type checking expressions or patterns
member x.IsFromError = (flags &&& 0b00000000000000010) <> 0x0
@@ -380,8 +384,20 @@ type TyparFlags(flags: int32) =
else
TyparFlags(flags &&& ~~~0b00010000000000000)

/// Indicates that whether this type parameter is flexible for 'supports null' constraint, e.g. in the case of assignment to a mutable value
member x.IsSupportsNullFlex =
(flags &&& 0b00100000000000000) <> 0x0

member x.WithSupportsNullFlex b =
if b then
TyparFlags(flags ||| 0b00100000000000000)
else
TyparFlags(flags &&& ~~~0b00100000000000000)



member x.WithStaticReq staticReq =
TyparFlags(x.Kind, x.Rigidity, x.IsFromError, x.IsCompilerGenerated, staticReq, x.DynamicReq, x.EqualityConditionalOn, x.ComparisonConditionalOn)
TyparFlags(x.Kind, x.Rigidity, x.IsFromError, x.IsCompilerGenerated, staticReq, x.DynamicReq, x.EqualityConditionalOn, x.ComparisonConditionalOn, x.IsSupportsNullFlex)

/// Get the flags as included in the F# binary metadata. We pickle this as int64 to allow for future expansion
member x.PickledBits = flags
@@ -2321,6 +2337,8 @@ type Typar =
/// Set whether this type parameter is a compat-flex type parameter (i.e. where "expr :> tp" only emits an optional warning)
member x.SetIsCompatFlex b = x.typar_flags <- x.typar_flags.WithCompatFlex b

member x.SetSupportsNullFlex b = x.typar_flags <- x.typar_flags.WithSupportsNullFlex b

/// Indicates whether a type variable can be instantiated by types or units-of-measure.
member x.Kind = x.typar_flags.Kind

@@ -2425,12 +2443,12 @@ type Typar =
/// Sets the rigidity of a type variable
member x.SetRigidity b =
let flags = x.typar_flags
x.typar_flags <- TyparFlags(flags.Kind, b, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn)
x.typar_flags <- TyparFlags(flags.Kind, b, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex)

/// Sets whether a type variable is compiler generated
member x.SetCompilerGenerated b =
let flags = x.typar_flags
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, b, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn)
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, b, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex)

/// Sets whether a type variable has a static requirement
member x.SetStaticReq b =
@@ -2439,17 +2457,17 @@ type Typar =
/// Sets whether a type variable is required at runtime
member x.SetDynamicReq b =
let flags = x.typar_flags
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, b, flags.EqualityConditionalOn, flags.ComparisonConditionalOn)
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, b, flags.EqualityConditionalOn, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex)

/// Sets whether the equality constraint of a type definition depends on this type variable
member x.SetEqualityDependsOn b =
let flags = x.typar_flags
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, b, flags.ComparisonConditionalOn)
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, b, flags.ComparisonConditionalOn, flags.IsSupportsNullFlex)

/// Sets whether the comparison constraint of a type definition depends on this type variable
member x.SetComparisonDependsOn b =
let flags = x.typar_flags
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, b)
x.typar_flags <- TyparFlags(flags.Kind, flags.Rigidity, flags.IsFromError, flags.IsCompilerGenerated, flags.StaticReq, flags.DynamicReq, flags.EqualityConditionalOn, b, flags.IsSupportsNullFlex)

[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
member x.DebugText = x.ToString()
@@ -6118,7 +6136,7 @@ type Construct() =
Typar.New
{ typar_id = id
typar_stamp = newStamp()
typar_flags= TyparFlags(kind, rigid, isFromError, isCompGen, staticReq, dynamicReq, eqDep, compDep)
typar_flags= TyparFlags(kind, rigid, isFromError, isCompGen, staticReq, dynamicReq, eqDep, compDep, false)
typar_solution = None
typar_astype = Unchecked.defaultof<_>
typar_opt_data =
Loading
Loading