-
Notifications
You must be signed in to change notification settings - Fork 848
Bugfix :: Nullness :: Bug selection #19262
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
T-Gro
wants to merge
15
commits into
main
Choose a base branch
from
nullness-bugs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+1,526
−27
Conversation
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
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).
…date tests - Delete explicitNullnessOfTy helper (unsound) - Revert TypeNullIsExtraValueNew to main branch logic using stripTyparEqns, tryTcrefOfAppTy, TypeHasAllowNull, nullnessOfTy, GetTyparTyIfSupportsNull - Update 6 AllowNullLiteral tests (B1-B6) for new diagnostics - Remove GitHub issue URL comments from test code
…yOverallType Filter env.eContextInfo to only forward NullnessCheckOfCapturedArg context to the constraint solver, passing NoContext for all other cases. This prevents unintended side effects on non-nullness error formatting (e.g. duplicated parse errors and expanded type mismatch messages in neg83.vsbsl).
…I (IsFromConstructor, KnownWithoutNullFromCtor)
… issues - Remove Nullness.KnownFromConstructor (dead code: never constructed in production) - Remove all handling branches in ConstraintSolver.fs, TypedTree.fs, TypedTreeBasics.fs - Replace KnownFromConstructor-specific tests with equivalent Known WithoutNull tests - Remove redundant comments in TypedTreeOps.fs - Clean up blank line artifacts in .fsi files
…lined subset check
…aValueNew comments
…temThen The proto/bootstrap build (netstandard2.0 with NO_TYPEPROVIDERS defined) fails because 'let g = cenv.g' was moved outside the #if block but is only used inside #if !NO_TYPEPROVIDERS code paths within TcCtorItemThen, causing error FS1182 (unused value treated as error via --warnaserror).
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