Source file test/fixedbugs/issue48898.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 main() {
    10  	defer func() {
    11  		println(recover().(int))
    12  	}()
    13  	func() {
    14  		func() (_ [2]int) { type _ int; return }()
    15  		func() {
    16  			defer func() {
    17  				defer func() {
    18  					recover()
    19  				}()
    20  				defer panic(3)
    21  				panic(2)
    22  			}()
    23  			defer func() {
    24  				recover()
    25  			}()
    26  			panic(1)
    27  		}()
    28  		defer func() {}()
    29  	}()
    30  
    31  	var x = 123
    32  	func() {
    33  		// in the original issue, this defer was not executed (which is incorrect)
    34  		defer print(x)
    35  		func() {
    36  			defer func() {}()
    37  			panic(4)
    38  		}()
    39  	}()
    40  }
    41  

View as plain text