-
Notifications
You must be signed in to change notification settings - Fork 789
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
Make nullness equivalent warning message clearer. #18172
base: main
Are you sure you want to change the base?
Make nullness equivalent warning message clearer. #18172
Conversation
|
Is this failing because of the lack of release notes or have I botched something else? Also - what causes the BSL files to get regenerated? I ended up doing it by hand. |
@isaacabraham looks like the only error apart from lack of release notes was this crash. If it passes locally it is most probably good. |
@isaacabraham setting the environment variable |
By running |
You can hijack the check of that variable: fsharp/tests/FSharp.Test.Utilities/Compiler.fs Line 1121 in 2c3bdcb
Or if you run the suite from command line, using Line 192 in 2c3bdcb
|
Any idea how to make this green? |
Just rerun the CI and hopefully the tests will not crash the CLR this time. To rerun you can close and reopen the PR or just add another commit with release notes. Sorry for the tests being a bit unstable in CI right now. I hope this will help when merged: #18169. |
@@ -678,8 +678,7 @@ type Exception with | |||
|
|||
let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2 | |||
|
|||
os.Append(ConstraintSolverNullnessWarningEquivWithTypesE().Format t1 t2) | |||
|> ignore | |||
os.Append(ConstraintSolverNullnessWarningEquivWithTypesE().Format t1) |> ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change is probably correct, but I would prefer to see at the throw site that indeed the "t1" type is always the non-nullable one and t2 is nullable.
This can be e.g. done by making the pattern match in SolveNullnessEquiv
total.
Also, the t2
field is therefore not needed anymore if I got it correctly, the same for minimalStringsOfTwoTypes
?
(= new textual message now displays only the first type and assumes the other ALWAYS is a nullable version of the first)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That assumption is correct, yes. I couldn't see where it wouldn't be the case - if the LHS is nullable and the right-hand side isn't, it's safe and the compiler will implicitly allow the change in type, right? i.e.
let x = ""
let y : string | null = x // this is fine, no warning is generated
For the release notes, what can I do to fix that - which file needs updating? |
Description
Fixes #18171. Warning now reads:
Checklist
NO_RELEASE_NOTES