2011-10-18 12:55:50 -06:00
|
|
|
// errchk $G -e $D/$F.go
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
// Test that error messages say what the source file says
|
|
|
|
// (uint8 vs byte).
|
|
|
|
|
2011-10-26 16:27:47 -06:00
|
|
|
import (
|
|
|
|
"fmt"
|
2011-11-08 16:43:02 -07:00
|
|
|
"unicode/utf8"
|
2011-10-26 16:27:47 -06:00
|
|
|
)
|
|
|
|
|
2011-11-08 16:43:02 -07:00
|
|
|
func f(byte) {}
|
2011-10-18 12:55:50 -06:00
|
|
|
func g(uint8) {}
|
|
|
|
|
|
|
|
func main() {
|
2011-10-26 16:27:47 -06:00
|
|
|
var x float64
|
2011-11-08 16:43:02 -07:00
|
|
|
f(x) // ERROR "byte"
|
|
|
|
g(x) // ERROR "uint8"
|
2011-10-26 16:27:47 -06:00
|
|
|
|
|
|
|
// Test across imports.
|
|
|
|
|
|
|
|
var ff fmt.Formatter
|
|
|
|
var fs fmt.State
|
2011-11-08 16:43:02 -07:00
|
|
|
ff.Format(fs, x) // ERROR "rune"
|
2011-10-26 16:27:47 -06:00
|
|
|
|
2011-11-08 16:43:02 -07:00
|
|
|
utf8.RuneStart(x) // ERROR "byte"
|
2011-10-26 16:27:47 -06:00
|
|
|
|
|
|
|
var s utf8.String
|
2011-11-08 16:43:02 -07:00
|
|
|
s.At(x) // ERROR "int"
|
2011-10-18 12:55:50 -06:00
|
|
|
}
|