-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Undefined Value Graphs (UVGs) (#717)
- Loading branch information
Showing
12 changed files
with
1,191 additions
and
179 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import "stdlib/io.jou" | ||
|
||
@public | ||
def maybe_undefined(n: int) -> None: | ||
for i = 0; i < n; i++: | ||
message = "Hi" | ||
puts(message) # Warning: the value of 'message' may be undefined | ||
|
||
@public | ||
def surely_undefined_loop() -> None: | ||
while False: | ||
message = "Hi" # Warning: this code will never run | ||
puts(message) # Warning: the value of 'message' is undefined | ||
|
||
@public | ||
def surely_undefined_annotation() -> None: | ||
x: byte* | ||
puts(x) # Warning: the value of 'x' is undefined | ||
|
||
@public | ||
def surely_undefined_assignments() -> None: | ||
a: int | ||
b = &a | ||
c = b | ||
d = c | ||
e = *d # TODO: should emit warning, but this is too "advanced" for UVGs | ||
|
||
def main() -> int: | ||
return 0 |
File renamed without changes.
This file contains 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
Oops, something went wrong.