Source file test/typeparam/issue47684b.go

     1  // run
     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  package main
     8  
     9  func f[G any]() interface{} {
    10  	return func() interface{} {
    11  		return func() interface{} {
    12  			var x G
    13  			return x
    14  		}()
    15  	}()
    16  }
    17  
    18  func main() {
    19  	x := f[int]()
    20  	if v, ok := x.(int); !ok || v != 0 {
    21  		panic("bad")
    22  	}
    23  }
    24  

View as plain text