Source file test/fixedbugs/issue70156.go

     1  // run
     2  
     3  // Copyright 2024 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  import (
    10  	"reflect"
    11  )
    12  
    13  func main() {
    14  	pi := new(interface{})
    15  	v := reflect.ValueOf(pi).Elem()
    16  	if v.Kind() != reflect.Interface {
    17  		panic(0)
    18  	}
    19  	if (v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface) && v.IsNil() {
    20  		return
    21  	}
    22  	panic(1)
    23  }
    24  

View as plain text