You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: src/Compiler/FSComp.txt
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1526,6 +1526,12 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl
1526
1526
#3261 reserved for ConstraintSolverNullnessWarningWithTypes
1527
1527
#3261 reserved for ConstraintSolverNullnessWarningWithType
1528
1528
#3261 reserved for ConstraintSolverNullnessWarning
1529
+
3262,tcPassingWithoutNullToANullableExpectingFunc,"Value known to be without null passed to a function meant for nullables: %s"
1530
+
tcPassingWithoutNullToOptionOfObj,"You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."
1531
+
tcPassingWithoutNullToValueOptionOfObj,"You can create 'ValueSome value' directly instead of 'ofObj', or consider not using a voption for this value."
1532
+
tcPassingWithoutNullToNonNullAP,"You can remove this |Null|NonNull| pattern usage."
1533
+
tcPassingWithoutNullToNonNullQuickAP,"You can remove this |NonNullQuick| pattern usage."
1534
+
tcPassingWithoutNullTononNullFunction,"You can remove this `nonNull` assertion."
1529
1535
3268,csNullNotNullConstraintInconsistent,"The constraints 'null' and 'not null' are inconsistent"
1530
1536
3271,tcNullnessCheckingNotEnabled,"The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored."
1531
1537
csTypeHasNullAsTrueValue,"The type '%s' uses 'null' as a representation value but a non-null type is expected"
0 commit comments