mirror of https://github.com/tinygo-org/tinygo.git
Browse Source
This fixes a type system loophole. The following program would incorrectly run in TinyGo, while it would trigger a panic in Go: package main import "reflect" func main() { v := reflect.ValueOf(struct { x int }{}) x := v.Field(0).Interface() println("x:", x.(int)) } Playground link: https://play.golang.org/p/nvvA18XFqFC The panic in Go is the following: panic: reflect.Value.Interface: cannot return value obtained from unexported field or method I've shortened it in TinyGo to save a little bit of space.pull/1743/head
Ayke van Laethem
4 years ago
committed by
Ron Evans
2 changed files with 25 additions and 2 deletions
Loading…
Reference in new issue