-
Notifications
You must be signed in to change notification settings - Fork 795
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
F# program doesn't continue linearly #367
Comments
I do not see anything resembling "jumps to a random point in the codebase" -- can you provide a complete, self-contained repro that illustrates this? Since let doUpdate n = { n with x = { y = "test" } } Compiles simply to public static A doUpdate(A n)
{
return new A(new B("test"));
} If your record type has multiple properties, then you indeed get a nullref, as expected. type C = { w : string; z : int }
let doUpdate n = { n with z = 42 }
doUpdate Unchecked.defaultof<C> // NullReferenceException Current behavior seems reasonable to me. I guess one could opine that copy and update should always throw if in the input is null, but it seems odd to check for null of an input that is never otherwise used. |
I tried reproducing it in the small, but wasn't able. I can let someone from your team have access if you want? |
You can email private info to [email protected] if needed |
Let's close this to celebrate F# 4.0 and write it down to a mono bug. =) This was one of the strangest bugs I've seen though :) |
When the record-update syntax is called with a null value as the record, the program jumps to a random location in the code-base.
Example:
This should probably throw a NullReferenceException?
I get the null from C# interop; but since I'm deserialising to a Record it 'should never be null' according to the static typing rules, but the C# lib (Newtonsoft) deserialises to null if it can't deserialise the record.
The text was updated successfully, but these errors were encountered: