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.
This commit is contained in:
Ayke van Laethem
2020-03-19 13:59:37 +01:00
committed by Ron Evans
parent 213a6240a1
commit 9222bda9c6
5 changed files with 59 additions and 0 deletions
+6
View File
@@ -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':