Source file test/fixedbugs/issue59709.dir/dcache.go

     1  // Copyright 2023 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 dcache
     6  
     7  import (
     8  	"./aconfig"
     9  	"./bresource"
    10  	"./cmem"
    11  )
    12  
    13  type Module struct {
    14  	cfg  *aconfig.Config
    15  	err  error
    16  	last any
    17  }
    18  
    19  //go:noinline
    20  func TD() {
    21  }
    22  
    23  func (m *Module) Configure(x string) error {
    24  	if m.err != nil {
    25  		return m.err
    26  	}
    27  	res := cmem.NewResource(m.cfg)
    28  	m.last = res
    29  
    30  	return nil
    31  }
    32  
    33  func (m *Module) Blurb(x string, e error) bool {
    34  	res, ok := m.last.(*bresource.Resource[*int])
    35  	if !ok {
    36  		panic("bad")
    37  	}
    38  	return bresource.Should(res, e)
    39  }
    40  

View as plain text