Conversation
Contributor
✅ No release notes required |
ce5d2f0 to
052d236
Compare
Fix #17539: UoM ToString on value types returns string instead of string|null Fix #18013: Pipe operator nullness warning location points to nullable argument Fix #18021: No false positive nullness warning for non-null AllowNullLiteral instances Fix #18334: Allow 'not null' constraint on type extensions Fix #19042: Multi-match tuple null elimination with restricting patterns Also adds regression tests for #17727 (Option.toObj inference) and #18034 (FSharpPlus monad CE with nullness).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Five nullness-related bug fixes and two regression tests for the F# compiler's nullable reference type checking.
Bug Fixes
UoM ToString returns
stringfor value types (fixes Nullness issue - ToString on an integer with UoM takes nullness information from ValueType #17539)int<kg>.ToString()now returnsstringinstead ofstring | nullisMeasureableValueTypehelper inTypedTreeOps.fsMethodCalls.fsto cover measureable value typesPipe operator nullness warning location (fixes Nullness issue - Error shows on incorrect symbol when using |> #18013)
bar |> foo "mr") now point at the nullable argument (bar) instead of the pipe operatorNullnessCheckOfCapturedArgcontext toConstraintSolver, propagated throughCheckExpressions.fsAllowNullLiteral false positive on non-null instances (fixes Nullness issue - No way to silence warning in e.g. ServiceCollection.AddSingleton if type allows null #18021)
MyClass()whereMyClasshas[<AllowNullLiteral>]no longer triggers a false nullness warningTypeNullIsExtraValueNewto check explicit nullness annotation first, only falling back toAllowNullLiteralwhen nullness is ambivalentnot nullconstraint on type extensions (fixes Nullness issue – Invalid type constraint resolution onILookup#18334)type ILookup<'Key, 'Value when 'Key : not null> with ...no longer errorstyparsAEquivWithAddedNotNullConstraintsAllowedfor extension checksCheckTyparsTuple null elimination over-inference (fixes Nullness issue - type check in multi-match expressions doesn't eliminate null #19042)
match x, y with | null, _ -> ... | s, 5 -> test sno longer over-infers non-null when non-wild patterns restrict non-nullable elementsRegression Tests (no code changes, tests only)
Option.toObjinference - ensures input is inferred asstring option, notstring | null optionDelayin monad CE - ensures no crash with or without nullnessChanged Files (13 total)
Source (10 files):
src/Compiler/Checking/CheckDeclarations.fssrc/Compiler/Checking/ConstraintSolver.fs+.fsisrc/Compiler/Checking/Expressions/CheckExpressions.fssrc/Compiler/Checking/MethodCalls.fssrc/Compiler/Driver/CompilerDiagnostics.fssrc/Compiler/Symbols/FSharpDiagnostic.fssrc/Compiler/TypedTree/TypedTreeOps.fs+.fsiTests (3 files):
tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs(704 lines added)Release notes:
docs/release-notes/.FSharp.Compiler.Service/10.0.300.md