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
func foo(x *int) {
x = nil
y := x
z := y
print(*z) // L30. Error reported here
}
NilAway prints the error message as
Potential nil panic detected. Observed nil flow from source to dereference point:
-> errormessage/errormessage.go:30:9: literal `nil` dereferenced
This can be confusing and difficult for the users to comprehend if the assignments have followed a complicated path. Instead, we would like NilAway to generate a more informative error message following the assignments.
The text was updated successfully, but these errors were encountered:
This PR refines the error message by incorporating information about the
assignments. Following is an example of an informative error message:
Code snippet:
```
func test(x *int) {
x = nil
y := x
z := y
print(*z)
}
```
Error message:
```
Potential nil panic detected. Observed nil flow from source to dereference point:
-> errormessage/errormessage.go:32:9: literal `nil` dereferenced via the assignment(s):
-> `nil` to `x` at errormessage/errormessage.go:29:2,
-> `x` to `y` at errormessage/errormessage.go:30:2,
-> `y` to `z` at errormessage/errormessage.go:31:2
```
[closes#83 ]
[depends on #86 ]
For code example below,
NilAway prints the error message as
This can be confusing and difficult for the users to comprehend if the assignments have followed a complicated path. Instead, we would like NilAway to generate a more informative error message following the assignments.
The text was updated successfully, but these errors were encountered: