Debian Codegraph @

test/fixedbugs/issue44378.go

raw
1 // compile
2
3 // Copyright 2021 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 // This test case caused a panic in the compiler's DWARF gen code.
8
9 // Note to future maintainers of this code:
10 //
11 // ** Do NOT run gofmt when editing this file **
12 //
13 // In order for the buggy behavior to be triggered in the compiler,
14 // we need to have a the function of interest all on one gigantic line.
15
16 package a
17
18 type O interface{}
19 type IO int
20 type OS int
21
22 type A struct {
23 x int
24 }
25
26 // original versions of the two function
27 func (p *A) UO(o O) {
28 p.r(o, o)
29 }
30 func (p *A) r(o1, o2 O) {
31 switch x := o1.(type) {
32 case *IO:
33 p.x = int(*x)
34 case *OS:
35 p.x = int(*x + 2)
36 }
37 }
38
39 // see note above about the importance of all this code winding up on one line.
40 var myverylongname0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 int ; func (p *A) UO2(o O) { p.r2(o, o); }; func (p *A) r2(o1, o2 O) { switch x := o1.(type) { case *IO: p.x = int(*x); case *OS: p.x = int(*x + 2); } }