mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 02:57:46 +00:00
compiler: allow slicing arrays of a named type
This commit is contained in:
committed by
Ayke van Laethem
parent
873c1c3b4d
commit
f44dff6f59
Vendored
+8
@@ -1,5 +1,7 @@
|
||||
package main
|
||||
|
||||
type MySlice [32]byte
|
||||
|
||||
func main() {
|
||||
l := 5
|
||||
foo := []int{1, 2, 4, 5}
|
||||
@@ -89,6 +91,12 @@ func main() {
|
||||
print(" ", n)
|
||||
}
|
||||
println()
|
||||
|
||||
// Verify the fix in https://github.com/aykevl/tinygo/pull/119
|
||||
var unnamed [32]byte
|
||||
var named MySlice
|
||||
assert(len(unnamed[:]) == 32)
|
||||
assert(len(named[:]) == 32)
|
||||
}
|
||||
|
||||
func printslice(name string, s []int) {
|
||||
|
||||
Reference in New Issue
Block a user