modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/ken/litfun.go (about)

     1  // run
     2  
     3  // Copyright 2009 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  // Test simple function literals.
     8  
     9  package main
    10  
    11  func
    12  main() {
    13  	x := func(a int)int {
    14  		x := func(a int)int {
    15  			x := func(a int)int {
    16  				return a+5;
    17  			};
    18  			return x(a)+7;
    19  		};
    20  		return x(a)+11;
    21  	};
    22  	if x(3) != 3+5+7+11 { panic(x(3)); }
    23  }