From 9222bda9c665daf64e16ac0e724946582ffc6860 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 19 Mar 2020 13:59:37 +0100 Subject: 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. --- testdata/interface.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'testdata/interface.go') 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': -- cgit v1.2.3