reject_unknown_field.mx raw

   1  // expected: has no field or method
   2  //
   3  // A selector that is neither a field nor a method on a struct must be an
   4  // error. stage4 used to drop the failed lookup and let the emitter dereference
   5  // nothing, which turned a typo into invalid wasm (the relay-proxy worker was
   6  // rejected by the browser's validator with "popping value from empty stack").
   7  package main
   8  
   9  type inner struct {
  10  	a int32
  11  }
  12  
  13  type outer struct {
  14  	in inner
  15  }
  16  
  17  func main() {
  18  	o := outer{}
  19  	o.in.b = 5
  20  	println(o.in.a)
  21  }
  22