Source file src/internal/types/testdata/fixedbugs/issue82933.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  func _[P ~int | ~complex64](x int, p P) {
     8  	for range real(x /* ERROR "expected complex type" */) { // must not crash
     9  	}
    10  	for range imag(p /* ERROR "expected complex type" */) { // must not crash
    11  	}
    12  	_ = append([]byte{}, complex(x /* ERROR "expected floating-point" */, x)...) // must not crash
    13  }
    14  
    15  // test case from issue
    16  
    17  func _(x int) {
    18  	for range complex(x /* ERROR "expected floating-point" */, x) {
    19  	}
    20  }
    21  

View as plain text