Source file src/cmd/compile/internal/test/testdata/reproducible/issue82043.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package p
     6  
     7  type Regexp struct{ n int }
     8  
     9  //go:noinline
    10  func (re *Regexp) find(dstCap []int) []int { return append(dstCap, 0, re.n) }
    11  
    12  func (re *Regexp) Find(b []byte) []byte {
    13  	var dstCap [2]int
    14  	a := re.find(dstCap[:0])
    15  	if a == nil {
    16  		return nil
    17  	}
    18  	return b[a[0]:a[1]:a[1]]
    19  }
    20  
    21  // The backing array of this literal is a noalg [2]int, sharing a descriptor
    22  // with the [2]int above.
    23  func (re *Regexp) allIndex(m []int) func(yield func([]int) bool) {
    24  	return func(yield func([]int) bool) {
    25  		yield([]int{m[0], m[1]})
    26  	}
    27  }
    28  

View as plain text