diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2014-11-27 00:06:42 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2014-11-27 00:06:42 +0000 |
commit | ad9841e8ac74bfcb1814b728a143408e87dd00a7 (patch) | |
tree | a36b962fece0b5b9676f26c1af90b43388069284 /llgo/test/execution/nil.go | |
parent | 5468e86469f716eb40b1b39dfd9fd92e4f35df9e (diff) | |
download | bcm5719-llvm-ad9841e8ac74bfcb1814b728a143408e87dd00a7.tar.gz bcm5719-llvm-ad9841e8ac74bfcb1814b728a143408e87dd00a7.zip |
Initial commit of llgo.
llvm-svn: 222857
Diffstat (limited to 'llgo/test/execution/nil.go')
-rw-r--r-- | llgo/test/execution/nil.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/llgo/test/execution/nil.go b/llgo/test/execution/nil.go new file mode 100644 index 00000000000..0aa94e7c0d4 --- /dev/null +++ b/llgo/test/execution/nil.go @@ -0,0 +1,32 @@ +// RUN: llgo -o %t %s +// RUN: %t 2>&1 | FileCheck %s + +// CHECK: 0x0 +// CHECK-NEXT: x is nil +// CHECK-NEXT: y is nil +// CHECK-NEXT: z is nil + +package main + +func main() { + var x *int = nil + println(x) + + if x == nil { + println("x is nil") + } + + var y interface{} + var z interface{} = y + if y == nil { + println("y is nil") + } else { + println("y is not nil") + } + + if z == nil { + println("z is nil") + } else { + println("z is not nil") + } +} |