aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/interface.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-03-19 13:59:37 +0100
committerRon Evans <[email protected]>2020-03-20 22:22:24 +0100
commit9222bda9c665daf64e16ac0e724946582ffc6860 (patch)
treeed56c005ccb1c534d48cc385467c2e2cfe9c8ee5 /testdata/interface.go
parent213a6240a17870dea2603e7fd01ff163468e50c9 (diff)
downloadtinygo-9222bda9c665daf64e16ac0e724946582ffc6860.tar.gz
tinygo-9222bda9c665daf64e16ac0e724946582ffc6860.zip
interp: add support for constant type asserts
Non-constant type asserts are not yet implemented, but should be relatively easy to add at a later time. They should result in a clear error message for now.
Diffstat (limited to 'testdata/interface.go')
-rw-r--r--testdata/interface.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/testdata/interface.go b/testdata/interface.go
index c23af4fd1..fac4dfc81 100644
--- a/testdata/interface.go
+++ b/testdata/interface.go
@@ -137,6 +137,12 @@ func printItf(val interface{}) {
}
}
+var (
+ // Test for type assert support in the interp package.
+ globalThing interface{} = Foo(3)
+ _ = globalThing.(Foo)
+)
+
func nestedSwitch(verb rune, arg interface{}) bool {
switch verb {
case 'v', 's':