...
Run Format

Source file test/fixedbugs/bug336.go

Documentation: test/fixedbugs

     1  // run
     2  
     3  // Copyright 2011 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  package main
     8  
     9  type T1 struct {
    10  	Next *T2
    11  }
    12  
    13  type T2 T1
    14  
    15  type T3 struct {
    16  	Next *T4
    17  }
    18  
    19  type T4 T5
    20  type T5 T6
    21  type T6 T7
    22  type T7 T8
    23  type T8 T9
    24  type T9 T3
    25  
    26  type T10 struct {
    27  	x struct {
    28  		y ***struct {
    29  			z *struct {
    30  				Next *T11
    31  			}
    32  		}
    33  	}
    34  }
    35  
    36  type T11 T10
    37  
    38  type T12 struct {
    39  	F1 *T15
    40  	F2 *T13
    41  	F3 *T16
    42  }
    43  
    44  type T13 T14
    45  type T14 T15
    46  type T15 T16
    47  type T16 T17
    48  type T17 T12
    49  
    50  // issue 1672
    51  type T18 *[10]T19
    52  type T19 T18
    53  
    54  func main() {
    55  	_ = &T1{&T2{}}
    56  	_ = &T2{&T2{}}
    57  	_ = &T3{&T4{}}
    58  	_ = &T4{&T4{}}
    59  	_ = &T5{&T4{}}
    60  	_ = &T6{&T4{}}
    61  	_ = &T7{&T4{}}
    62  	_ = &T8{&T4{}}
    63  	_ = &T9{&T4{}}
    64  	_ = &T12{&T15{}, &T13{}, &T16{}}
    65  
    66  	var (
    67  		tn    struct{ Next *T11 }
    68  		tz    struct{ z *struct{ Next *T11 } }
    69  		tpz   *struct{ z *struct{ Next *T11 } }
    70  		tppz  **struct{ z *struct{ Next *T11 } }
    71  		tpppz ***struct{ z *struct{ Next *T11 } }
    72  		ty    struct {
    73  			y ***struct{ z *struct{ Next *T11 } }
    74  		}
    75  	)
    76  	tn.Next = &T11{}
    77  	tz.z = &tn
    78  	tpz = &tz
    79  	tppz = &tpz
    80  	tpppz = &tppz
    81  	ty.y = tpppz
    82  	_ = &T10{ty}
    83  
    84  	t19s := &[10]T19{}
    85  	_ = T18(t19s)
    86  }
    87  

View as plain text