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
16package a
17
18type O interface{}
19type IO int
20type OS int
21
22type A struct {
23	x int
24}
25
26// original versions of the two function
27func (p *A) UO(o O) {
28	p.r(o, o)
29}
30func (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.
40var 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); } }
41