Skip to content
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

Match the wording of the readme and report from wastedassign #25

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions testdata/src/a/a.go
Expand Up @@ -28,28 +28,28 @@ func noUseParams(params string) int {

func f(param int) int {
println(param)
useOutOfIf := 1212121 // want "wasted assignment"
useOutOfIf := 1212121 // want "reassigned, but reassigned without using the value"
ret := 0
if false {
useOutOfIf = 200 // want "reassigned, but never used afterwards"
return 0
} else if param == 100 {
useOutOfIf = 100 // want "wasted assignment"
useOutOfIf = 100 // want "reassigned, but reassigned without using the value"
useOutOfIf = 201
useOutOfIf = pa(useOutOfIf)
useOutOfIf += 200 // want "wasted assignment"
useOutOfIf += 200 // want "reassigned, but reassigned without using the value"
} else {
useOutOfIf = 100
useOutOfIf += 100
useOutOfIf = pa(useOutOfIf)
useOutOfIf += 200 // want "wasted assignment"
useOutOfIf += 200 // want "reassigned, but reassigned without using the value"
}

if false {
useOutOfIf = 200 // want "reassigned, but never used afterwards"
return 0
} else if param == 200 {
useOutOfIf = 100 // want "wasted assignment"
useOutOfIf = 100 // want "reassigned, but reassigned without using the value"
useOutOfIf = 201
useOutOfIf = pa(useOutOfIf)
useOutOfIf += 200
Expand Down Expand Up @@ -92,10 +92,10 @@ func r(param int) int {
} else if param == 100 {
ret = useOutOfIf
} else if param == 200 {
useOutOfIf = 100 // want "wasted assignment"
useOutOfIf = 100 // want "reassigned, but reassigned without using the value"
useOutOfIf = 100
useOutOfIf = pa(useOutOfIf)
useOutOfIf += 200 // want "wasted assignment"
useOutOfIf += 200 // want "reassigned, but reassigned without using the value"
}
useOutOfIf = 12
println(useOutOfIf)
Expand All @@ -109,7 +109,7 @@ func mugen() {
var i int
var hoge int
for {
hoge = 5 // want "wasted assignment"
hoge = 5 // want "reassigned, but reassigned without using the value"
// break
}

Expand Down
2 changes: 1 addition & 1 deletion wastedassign.go
Expand Up @@ -155,7 +155,7 @@ func (wr wastedReason) String() string {
case noUseUntilReturn:
return "reassigned, but never used afterwards"
case reassignedSoon:
return "wasted assignment"
return "reassigned, but reassigned without using the value"
case notWasted:
return ""
default:
Expand Down