1 // expected: undefined: Undefined
2 //
3 // A STRUCT FIELD type, in a type declaration. This was a silent miscompile:
4 //
5 // type S struct { n Undefined }
6 // s := S{}
7 // println("n=[" | s.n.String() | "]") // built rc=0, printed NOTHING
8 //
9 // A struct type resolves even when a field type does not, so the declaration
10 // was accepted, the field was typed nil, and every use of it compiled away
11 // without a word. The signature rule cannot see this - it walks parameter and
12 // result types - so the declaration is checked directly.
13 package main
14 15 type S struct {
16 n Undefined
17 }
18 19 func main() {
20 s := S{}
21 println("n=[" | s.n.String() | "]")
22 }
23