Hi, Before reporting this bug I thought I would post here to confirm that it has not been covered already.
If a function argument hides a built-in function and there is an attempt to call the built-in function the compiler will crash with no indication of where it was in the compilation process, which makes it hard to find in a large codebase. Here is a simple repo of the issue package main var a = []byte{1,2,3} func bug(len int) bool { return len < len(a) } func main() { println(bug(5)) } Here the argument len hides the built-in function len, and in that same function a call is made to the function len. The expected result would be a compiler error *cannot call non-function len (type int)* The actual result is > *panic: runtime error: invalid memory address or nil pointer > dereference[signal 0xc0000005 code=0x0 addr=0x70 pc=0xb94675]* > > > > > > > > > > > > > > > > > > > > > *goroutine 1 [running]:cmd/compile/internal/gc.typecheck1(0xc000352580, > 0x2, 0xc00033fa40) > c:/go/src/cmd/compile/internal/gc/typecheck.go:1270 > +0x3ed5cmd/compile/internal/gc.typecheck(0xc000352580, 0x2, > 0xc00033fa40) c:/go/src/cmd/compile/internal/gc/typecheck.go:238 > +0x6b4cmd/compile/internal/gc.typecheck1(0xc000352600, 0x12, > 0xc000084998) c:/go/src/cmd/compile/internal/gc/typecheck.go:585 > +0x2ccecmd/compile/internal/gc.typecheck(0xc000352600, 0x12, > 0xc0000849d8) c:/go/src/cmd/compile/internal/gc/typecheck.go:238 > +0x6b4cmd/compile/internal/gc.typecheckslice(0xc0000885d0, 0x1, 0x1, > 0x12) c:/go/src/cmd/compile/internal/gc/typecheck.go:68 > +0x57cmd/compile/internal/gc.typecheck1(0xc000352680, 0x1, 0xcbf373) > c:/go/src/cmd/compile/internal/gc/typecheck.go:2065 > +0xadd4cmd/compile/internal/gc.typecheck(0xc000352680, 0x1, 0x3) > c:/go/src/cmd/compile/internal/gc/typecheck.go:238 > +0x6b4cmd/compile/internal/gc.typecheckslice(0xc0000885d8, 0x1, 0x1, > 0x1) c:/go/src/cmd/compile/internal/gc/typecheck.go:68 > +0x57cmd/compile/internal/gc.Main(0xcdea30) > c:/go/src/cmd/compile/internal/gc/main.go:518 +0x20d0main.main() > c:/go/src/cmd/compile/main.go:51 +0x9d* > Best Regards, Chris -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.