Skip to content

Commit

Permalink
Merge branch 'master' into feat/vm-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton authored Feb 15, 2024
2 parents e6927ed + 6fb3317 commit 433e189
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gnovm/pkg/gnolang/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,11 +978,14 @@ func Preprocess(store Store, ctx BlockNode, n Node) Node {
arg0))
}
}

convertConst(store, last, arg0, ct)
constConverted = true
case SliceKind:
if ct.Elem().Kind() == Uint8Kind { // bypass []byte("xxx")
n.SetAttribute(ATTR_TYPEOF_VALUE, ct)
return n, TRANS_CONTINUE
}
}

// (const) untyped decimal -> float64.
// (const) untyped bigint -> int.
if !constConverted {
Expand Down
15 changes: 15 additions & 0 deletions gnovm/tests/files/byte_slice_issue1570.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

func main() {
for i := 0; i < 2; i++ {
l := []byte("lead")
if i == 0 {
l[0] = 'f'
}
println(string(l))
}
}

// Output:
// fead
// lead

0 comments on commit 433e189

Please sign in to comment.