aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/slice.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-10-20 17:22:51 +0200
committerAyke van Laethem <[email protected]>2018-10-20 17:22:51 +0200
commitda89464a63a7c181e928a68f4ac392bd841a00b2 (patch)
tree13d0fb3d9fd7086664e3cddc39d48ffd7bc45e71 /testdata/slice.go
parent3f054908465029d20d8b9d195ee4b2ea777256df (diff)
downloadtinygo-da89464a63a7c181e928a68f4ac392bd841a00b2.tar.gz
tinygo-da89464a63a7c181e928a68f4ac392bd841a00b2.zip
compiler: compare slice against nil
Diffstat (limited to 'testdata/slice.go')
-rw-r--r--testdata/slice.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/testdata/slice.go b/testdata/slice.go
index c5e4a3308..8fcbffff1 100644
--- a/testdata/slice.go
+++ b/testdata/slice.go
@@ -4,6 +4,7 @@ func main() {
l := 5
foo := []int{1, 2, 4, 5}
bar := make([]int, l-2, l)
+ println("foo is nil?", foo == nil, nil == foo)
printslice("foo", foo)
printslice("bar", bar)
printslice("foo[1:2]", foo[1:2])
@@ -15,6 +16,7 @@ func main() {
// append
var grow []int
+ println("slice is nil?", grow == nil, nil == grow)
printslice("grow", grow)
grow = append(grow, 42)
printslice("grow", grow)