-
-
Notifications
You must be signed in to change notification settings - Fork 673
Investigate randomly failing non-null checks #1139
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
Labels
Comments
class Ref {
}
let result: Ref | null = null;
function test(input: bool): void {
if (input) {
return;
} else {
result = new Ref();
}
func(result);
}
function func(input: Ref): void {
trace("something", 1, <f64>changetype<usize>(input));
}
test(false); Not exactly minimal, and it probably could be better, but this seems to get the compiler error. |
This one seems different, being caused by |
Got it! class Ref {
}
function useRef(aRef: Ref): void {}
function otherExample(condition: bool): void {
let something: Ref | null;
if (condition) {
return;
} else {
something = new Ref();
}
useRef(something);
}
otherExample(true);
|
This one is interesting, but unlike the cases in the compiler can't be solved with a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
While working on #1129 I noticed that flows and/or assignments do sometimes not correctly pick up non-null state after assigning to a local from a function call in a conditional branch:
There are 8 code locations in the compiler currently with that
FIXME: WHY?
comment that all look similar, but I didn't yet manage to reproduce this in a smaller code sample. If someone else manages to, that would be super helpful :)The text was updated successfully, but these errors were encountered: