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

     1  // run
     2  
     3  // Copyright 2011 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  // issue 1900
     8  
     9  package main
    10  
    11  func getArgs(data map[string]interface{}, keys ...string) map[string]string {
    12         ret := map[string]string{}
    13         var ok bool
    14         for _, k := range keys {
    15                 ret[k], ok = data[k].(string)
    16                 if !ok {}
    17         }
    18         return ret
    19  }
    20  
    21  func main() {
    22  	x := getArgs(map[string]interface{}{"x":"y"}, "x")
    23  	if x["x"] != "y" {
    24  		println("BUG bug343", x)
    25  	}
    26  }
    27  	
    28  
    29  /*
    30  typecheck [1008592b0]
    31  .   INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
    32  bug343.go:15: internal compiler error: typecheck INDREG
    33  */