go/test/fixedbugs/bug388.go
Robert Griesemer bb3b10214d cmd/compile: faster parameter parsing with no OKEY nodes
Step 2 of stream-lining parameter parsing

- do parameter validity checks in parser
- two passes instead of multiple (and theoretically quadratic) passes
  when checking parameters
- removes the need for OKEY and some ONONAME nodes in those passes

This removes allocation of ~123K OKEY (incl. some ONONAME) nodes
out of a total of ~10M allocated nodes when running make.bash, or
a reduction of the number of alloacted nodes by ~1.2%.

Change-Id: I4a8ec578d0ee2a7b99892ac6b92e56f8e0415f03
Reviewed-on: https://go-review.googlesource.com/20748
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
2016-03-16 18:54:31 +00:00

39 lines
996 B
Go

// errorcheck
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 2231
package main
import "runtime"
func foo(runtime.UintType, i int) { // ERROR "cannot declare name runtime.UintType|mixed named and unnamed|undefined identifier"
println(i, runtime.UintType) // GCCGO_ERROR "undefined identifier"
}
func bar(i int) {
runtime.UintType := i // ERROR "cannot declare name runtime.UintType|non-name on left side|undefined identifier"
println(runtime.UintType) // GCCGO_ERROR "invalid use of type|undefined identifier"
}
func baz() {
main.i := 1 // ERROR "non-name main.i|non-name on left side"
println(main.i) // GCCGO_ERROR "no fields or methods"
}
func qux() {
var main.i // ERROR "unexpected [.]|expected type"
println(main.i)
}
func corge() {
var foo.i int // ERROR "unexpected [.]|expected type"
println(foo.i)
}
func main() {
foo(42,43)
bar(1969)
}