2012-02-16 21:48:57 -07:00
|
|
|
// errorcheck
|
2011-10-18 12:55:50 -06:00
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
// Test that error messages say what the source file says
|
2012-01-17 15:21:50 -07:00
|
|
|
// (uint8 vs byte, int32 vs. rune).
|
2012-02-18 19:19:43 -07:00
|
|
|
// Does not compile.
|
|
|
|
|
|
|
|
package main
|
2011-10-18 12:55:50 -06:00
|
|
|
|
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-18 12:55:50 -06:00
|
|
|
}
|