-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gnovm): fix issue with locally re-definition (#3014)
closes: #3013 <!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details> --------- Co-authored-by: Morgan Bazalgette <[email protected]>
- Loading branch information
1 parent
520195e
commit 287c22e
Showing
7 changed files
with
96 additions
and
6 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
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,15 @@ | ||
package main | ||
|
||
var ss = []int{1, 2, 3} | ||
|
||
func main() { | ||
for _, s := range ss { | ||
s := s | ||
println(s) | ||
} | ||
} | ||
|
||
// Output: | ||
// 1 | ||
// 2 | ||
// 3 |
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,25 @@ | ||
package main | ||
|
||
var testTable = []struct { | ||
name string | ||
}{ | ||
{ | ||
"one", | ||
}, | ||
{ | ||
"two", | ||
}, | ||
} | ||
|
||
func main() { | ||
|
||
for _, testCase := range testTable { | ||
testCase := testCase | ||
|
||
println(testCase.name) | ||
} | ||
} | ||
|
||
// Output: | ||
// one | ||
// two |
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,13 @@ | ||
package main | ||
|
||
func main() { | ||
for i := 0; i < 3; i++ { | ||
i := i | ||
println(i) | ||
} | ||
} | ||
|
||
// Output: | ||
// 0 | ||
// 1 | ||
// 2 |
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,15 @@ | ||
package main | ||
|
||
func main() { | ||
a := 1 | ||
b := 3 | ||
println(a, b) // prints 1 3 | ||
|
||
// Re-declaration of 'a' is allowed because 'c' is a new variable | ||
a, c := 2, 5 | ||
println(a, c) // prints 2 5 | ||
} | ||
|
||
// Output: | ||
// 1 3 | ||
// 2 5 |
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,18 @@ | ||
package main | ||
|
||
func main() { | ||
a := 1 | ||
println(a) // prints 1 | ||
|
||
if true { | ||
a := 2 // valid: new scope inside the if statement | ||
println(a) // prints 2 | ||
} | ||
|
||
println(a) // prints 1: outer variable is unchanged | ||
} | ||
|
||
// Output: | ||
// 1 | ||
// 2 | ||
// 1 |
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,9 @@ | ||
package main | ||
|
||
func main() { | ||
a, b := 1, 2 | ||
a, b := 3, 4 | ||
} | ||
|
||
// Error: | ||
// files/redefine6.gno:5:2: no new variables on left side of := |
287c22e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'Go Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.20
.BenchmarkBinary/EmptyStruct:encode
473.3
ns/op 96 B/op 2 allocs/op288.3
ns/op 96 B/op 2 allocs/op1.64
BenchmarkBinary/EmptyStruct:encode - ns/op
473.3
ns/op288.3
ns/op1.64
BenchmarkBinary/EmptyStruct:decode
273
ns/op 0 B/op 0 allocs/op133.4
ns/op 0 B/op 0 allocs/op2.05
BenchmarkBinary/EmptyStruct:decode - ns/op
273
ns/op133.4
ns/op2.05
BenchmarkBinary/ShortArraysStruct:decode
383.5
ns/op 0 B/op 0 allocs/op217.8
ns/op 0 B/op 0 allocs/op1.76
BenchmarkBinary/ShortArraysStruct:decode - ns/op
383.5
ns/op217.8
ns/op1.76
BenchmarkDetaching
123.8
ns/op 0 B/op 0 allocs/op75.57
ns/op 0 B/op 0 allocs/op1.64
BenchmarkDetaching - ns/op
123.8
ns/op75.57
ns/op1.64
BenchmarkRemoved
38.92
ns/op 0 B/op 0 allocs/op29.24
ns/op 0 B/op 0 allocs/op1.33
BenchmarkRemoved - ns/op
38.92
ns/op29.24
ns/op1.33
BenchmarkBcryptGenerateFromPassword/benchmark-security-param
63642928
ns/op 5130 B/op 9 allocs/op31930722
ns/op 5125 B/op 9 allocs/op1.99
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - ns/op
63642928
ns/op31930722
ns/op1.99
BenchmarkBcryptGenerateFromPassword/benchmark-security-param
127558017
ns/op 5139 B/op 9 allocs/op31930722
ns/op 5125 B/op 9 allocs/op3.99
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - ns/op
127558017
ns/op31930722
ns/op3.99
BenchmarkBcryptGenerateFromPassword/benchmark-security-param
254520635
ns/op 5158 B/op 9 allocs/op31930722
ns/op 5125 B/op 9 allocs/op7.97
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - ns/op
254520635
ns/op31930722
ns/op7.97
BenchmarkBcryptGenerateFromPassword/benchmark-security-param
508803084
ns/op 5196 B/op 10 allocs/op31930722
ns/op 5125 B/op 9 allocs/op15.93
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - ns/op
508803084
ns/op31930722
ns/op15.93
BenchmarkBcryptGenerateFromPassword/benchmark-security-param
1017383442
ns/op 5528 B/op 13 allocs/op31930722
ns/op 5125 B/op 9 allocs/op31.86
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - ns/op
1017383442
ns/op31930722
ns/op31.86
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - allocs/op
13
allocs/op9
allocs/op1.44
BenchmarkBcryptGenerateFromPassword/benchmark-security-param
2034221178
ns/op 5736 B/op 15 allocs/op31930722
ns/op 5125 B/op 9 allocs/op63.71
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - ns/op
2034221178
ns/op31930722
ns/op63.71
BenchmarkBcryptGenerateFromPassword/benchmark-security-param - allocs/op
15
allocs/op9
allocs/op1.67
BenchmarkSigning
84390
ns/op 1856 B/op 36 allocs/op25723
ns/op 64 B/op 1 allocs/op3.28
BenchmarkSigning - ns/op
84390
ns/op25723
ns/op3.28
BenchmarkSigning - B/op
1856
B/op64
B/op29
BenchmarkSigning - allocs/op
36
allocs/op1
allocs/op36
BenchmarkSigning
83467
ns/op 1856 B/op 36 allocs/op25723
ns/op 64 B/op 1 allocs/op3.24
BenchmarkSigning - ns/op
83467
ns/op25723
ns/op3.24
BenchmarkSigning - B/op
1856
B/op64
B/op29
BenchmarkSigning - allocs/op
36
allocs/op1
allocs/op36
BenchmarkVerification
160705
ns/op 864 B/op 19 allocs/op61353
ns/op 0 B/op 0 allocs/op2.62
BenchmarkVerification - ns/op
160705
ns/op61353
ns/op2.62
BenchmarkVerification - B/op
864
B/op0
B/op+∞
BenchmarkVerification - allocs/op
19
allocs/op0
allocs/op+∞
BenchmarkVerification
167233
ns/op 864 B/op 19 allocs/op61353
ns/op 0 B/op 0 allocs/op2.73
BenchmarkVerification - ns/op
167233
ns/op61353
ns/op2.73
BenchmarkVerification - B/op
864
B/op0
B/op+∞
BenchmarkVerification - allocs/op
19
allocs/op0
allocs/op+∞
BenchmarkRandomBytes/random
68.24
ns/op 16 B/op 1 allocs/op32.74
ns/op 4 B/op 1 allocs/op2.08
BenchmarkRandomBytes/random - ns/op
68.24
ns/op32.74
ns/op2.08
BenchmarkRandomBytes/random - B/op
16
B/op4
B/op4
BenchmarkRandomBytes/random
105.4
ns/op 32 B/op 1 allocs/op32.74
ns/op 4 B/op 1 allocs/op3.22
BenchmarkRandomBytes/random - ns/op
105.4
ns/op32.74
ns/op3.22
BenchmarkRandomBytes/random - B/op
32
B/op4
B/op8
BenchmarkRandomBytes/random
267.4
ns/op 112 B/op 1 allocs/op32.74
ns/op 4 B/op 1 allocs/op8.17
BenchmarkRandomBytes/random - ns/op
267.4
ns/op32.74
ns/op8.17
BenchmarkRandomBytes/random - B/op
112
B/op4
B/op28
BenchmarkRandomBytes/random
2309
ns/op 1024 B/op 1 allocs/op32.74
ns/op 4 B/op 1 allocs/op70.53
BenchmarkRandomBytes/random - ns/op
2309
ns/op32.74
ns/op70.53
BenchmarkRandomBytes/random - B/op
1024
B/op4
B/op256
BenchmarkSmall/boltdb-1000-100-16-40/update
1496479
ns/op 41722 B/op 397 allocs/op997600
ns/op 38116 B/op 376 allocs/op1.50
BenchmarkSmall/boltdb-1000-100-16-40/update - ns/op
1496479
ns/op997600
ns/op1.50
BenchmarkSmall/memdb-1000-100-16-40/block
16848704
ns/op 9323151 B/op 170137 allocs/op12672327
ns/op 6606654 B/op 117223 allocs/op1.33
BenchmarkSmall/memdb-1000-100-16-40/block - ns/op
16848704
ns/op12672327
ns/op1.33
BenchmarkSmall/memdb-1000-100-16-40/block - B/op
9323151
B/op6606654
B/op1.41
BenchmarkSmall/memdb-1000-100-16-40/block - allocs/op
170137
allocs/op117223
allocs/op1.45
BenchmarkMedium/boltdb-100000-100-16-40/update
7084988
ns/op 136336 B/op 1053 allocs/op5686583
ns/op 104166 B/op 879 allocs/op1.25
BenchmarkMedium/boltdb-100000-100-16-40/update - ns/op
7084988
ns/op5686583
ns/op1.25
BenchmarkMedium/boltdb-100000-100-16-40/update - B/op
136336
B/op104166
B/op1.31
BenchmarkMedium/memdb-100000-100-16-40/update
1254618
ns/op 379435 B/op 7517 allocs/op1021157
ns/op 256615 B/op 4954 allocs/op1.23
BenchmarkMedium/memdb-100000-100-16-40/update - ns/op
1254618
ns/op1021157
ns/op1.23
BenchmarkMedium/memdb-100000-100-16-40/update - B/op
379435
B/op256615
B/op1.48
BenchmarkMedium/memdb-100000-100-16-40/update - allocs/op
7517
allocs/op4954
allocs/op1.52
BenchmarkLevelDBBatchSizes/goleveldb-100000-400-16-40/update - B/op
48250
B/op38410
B/op1.26
BenchmarkLevelDBBatchSizes/goleveldb-100000-400-16-40/update - allocs/op
591
allocs/op445
allocs/op1.33
BenchmarkLevelDBBatchSizes/goleveldb-100000-2000-16-40/update - allocs/op
417
allocs/op338
allocs/op1.23
BenchmarkHash/ripemd160
2832
ns/op 25 B/op 1 allocs/op704.3
ns/op 25 B/op 1 allocs/op4.02
BenchmarkHash/ripemd160 - ns/op
2832
ns/op704.3
ns/op4.02
BenchmarkHash/sha2-256
522.3
ns/op 33 B/op 1 allocs/op169.7
ns/op 33 B/op 1 allocs/op3.08
BenchmarkHash/sha2-256 - ns/op
522.3
ns/op169.7
ns/op3.08
BenchmarkHash/sha3-256
1835
ns/op 33 B/op 1 allocs/op689.3
ns/op 33 B/op 1 allocs/op2.66
BenchmarkHash/sha3-256 - ns/op
1835
ns/op689.3
ns/op2.66
BenchmarkWriteSecretConnection
6542
ns/op 0 B/op 0 allocs/op4012
ns/op 0 B/op 0 allocs/op1.63
BenchmarkWriteSecretConnection - ns/op
6542
ns/op4012
ns/op1.63
BenchmarkReadSecretConnection
3143
ns/op 0 B/op 0 allocs/op2351
ns/op 0 B/op 0 allocs/op1.34
BenchmarkReadSecretConnection - ns/op
3143
ns/op2351
ns/op1.34
This comment was automatically generated by workflow using github-action-benchmark.
CC: @ajnavarro @thehowl @zivkovicmilos