2012-02-17 04:48:57 +00:00
|
|
|
// errorcheck
|
2011-10-18 18:55:50 +00: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 22:21:50 +00:00
|
|
|
// (uint8 vs byte, int32 vs. rune).
|
2012-02-19 02:19:43 +00:00
|
|
|
// Does not compile.
|
|
|
|
|
|
|
|
package main
|
2011-10-18 18:55:50 +00:00
|
|
|
|
2011-10-26 22:27:47 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
2011-11-08 23:43:02 +00:00
|
|
|
"unicode/utf8"
|
2011-10-26 22:27:47 +00:00
|
|
|
)
|
|
|
|
|
2011-11-08 23:43:02 +00:00
|
|
|
func f(byte) {}
|
2011-10-18 18:55:50 +00:00
|
|
|
func g(uint8) {}
|
|
|
|
|
|
|
|
func main() {
|
2011-10-26 22:27:47 +00:00
|
|
|
var x float64
|
2011-11-08 23:43:02 +00:00
|
|
|
f(x) // ERROR "byte"
|
|
|
|
g(x) // ERROR "uint8"
|
2011-10-26 22:27:47 +00:00
|
|
|
|
|
|
|
// Test across imports.
|
|
|
|
|
|
|
|
var ff fmt.Formatter
|
|
|
|
var fs fmt.State
|
2011-11-08 23:43:02 +00:00
|
|
|
ff.Format(fs, x) // ERROR "rune"
|
2011-10-26 22:27:47 +00:00
|
|
|
|
2011-11-08 23:43:02 +00:00
|
|
|
utf8.RuneStart(x) // ERROR "byte"
|
2011-10-18 18:55:50 +00:00
|
|
|
}
|