Source file test/fixedbugs/issue31782.go

     1  // run
     2  
     3  // Copyright 2019 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Check static composite literal reports wrong for struct
     8  // field.
     9  
    10  package main
    11  
    12  type one struct {
    13  	i interface{}
    14  }
    15  
    16  type two struct {
    17  	i interface{}
    18  	s []string
    19  }
    20  
    21  func main() {
    22  	o := one{i: two{i: 42}.i}
    23  	println(o.i.(int))
    24  }
    25  

View as plain text