-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: arithmetic virus isn't applied to expressions involing string li…
…terals anymore (#18) arithmetic virus isn't applied to strings anymore Note that this is only a partial fix (#17), as it only works if the binary expression involves a string literal. Two string variables will still cause an unwanted mutation.
- Loading branch information
Marcel Schramm
authored
Aug 17, 2023
1 parent
957d080
commit 1255479
Showing
3 changed files
with
72 additions
and
1 deletion.
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
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
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,37 @@ | ||
//!go:build testdata | ||
|
||
package source | ||
|
||
func hello0() string { | ||
x := "hello" | ||
return "/" + x | ||
} | ||
|
||
func hello1() string { | ||
x := "hello" | ||
return x + "/" | ||
} | ||
|
||
func hello3() string { | ||
x := "hello" | ||
y := []byte("/") | ||
return x + string(y) | ||
} | ||
|
||
// FIXME This still fails | ||
// func hello2() string { | ||
// x := "hello" | ||
// y := "/" | ||
// return x + y | ||
// } | ||
|
||
// FIXME This still fails | ||
// func toString(b []byte) string { | ||
// return string(x) | ||
// } | ||
|
||
// func hello4() string { | ||
// x := "hello" | ||
// y := []byte{"/"} | ||
// return hello + toString(y) | ||
// } |