Source file test/fixedbugs/issue42568.go

     1  // compile
     2  
     3  // Copyright 2020 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  // Ensure that late expansion correctly handles an OpIData with type interface{}
     8  
     9  package p
    10  
    11  type S struct{}
    12  
    13  func (S) M() {}
    14  
    15  type I interface {
    16  	M()
    17  }
    18  
    19  func f(i I) {
    20  	o := i.(interface{})
    21  	if _, ok := i.(*S); ok {
    22  		o = nil
    23  	}
    24  	println(o)
    25  }
    26  

View as plain text