reject_undefined_result_type.mx raw

   1  // expected: undefined: Undefined
   2  //
   3  // A BARE undefined RESULT type. Same leak as the parameter form pinned by
   4  // reject_undefined_param_type, and measured the same way: this built with rc=0
   5  // and then failed its own assertion at run time, because the result type came
   6  // back nil and the value it carried was nothing.
   7  //
   8  // The signature report covers parameters and results together at the one site
   9  // where neither can be a type parameter - a non-generic top-level function.
  10  package main
  11  
  12  func f() (r Undefined) {
  13  	return r
  14  }
  15  
  16  func main() {
  17  	v := f()
  18  	if v.String() != "x" {
  19  		panic("f")
  20  	}
  21  }
  22