Source file test/fixedbugs/issue78599.go

     1  // compile
     2  
     3  // Copyright 2026 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  // Issue 78599: compiler ICE (DwarfFixupTable has orphaned fixup)
     8  // when wrapping iter.Seq2[K, ZeroSize] into iter.Seq[K].
     9  
    10  package p
    11  
    12  import "iter"
    13  
    14  func pairs() iter.Seq2[int, struct{}] {
    15  	return func(yield func(int, struct{}) bool) {
    16  		yield(1, struct{}{})
    17  	}
    18  }
    19  
    20  func keys() iter.Seq[int] {
    21  	return func(yield func(int) bool) {
    22  		for k := range pairs() {
    23  			if !yield(k) {
    24  				return
    25  			}
    26  		}
    27  	}
    28  }
    29  
    30  func use() {
    31  	for range keys() {
    32  	}
    33  }
    34  

View as plain text