mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
compiler: fix crash on type assert on interfaces with no methods
This commit is contained in:
Vendored
+9
@@ -116,6 +116,9 @@ func main() {
|
||||
|
||||
// check that pointer-to-pointer type switches work
|
||||
ptrptrswitch()
|
||||
|
||||
// check that type asserts to interfaces with no methods work
|
||||
emptyintfcrash()
|
||||
}
|
||||
|
||||
func printItf(val interface{}) {
|
||||
@@ -334,3 +337,9 @@ func identify(itf any) {
|
||||
println("other type??")
|
||||
}
|
||||
}
|
||||
|
||||
func emptyintfcrash() {
|
||||
if x, ok := any(5).(any); ok {
|
||||
println("x is", x.(int))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user