blob: ec93a2d101ff0ed42efc8248fa4917ff5c0dd30a [file] [log] [blame]
Russ Cox0b477ef2012-02-16 23:48:57 -05001// errorcheck
Russ Cox862179b2011-10-18 14:55:50 -04002
3// Copyright 2011 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Russ Cox862179b2011-10-18 14:55:50 -04007// Test that error messages say what the source file says
Rob Pike7585aa62012-01-17 14:21:50 -08008// (uint8 vs byte, int32 vs. rune).
Rob Pikefc0dc042012-02-19 13:19:43 +11009// Does not compile.
10
11package main
Russ Cox862179b2011-10-18 14:55:50 -040012
Russ Cox8658b362011-10-26 15:27:47 -070013import (
14 "fmt"
Rob Pikef9489be2011-11-08 15:43:02 -080015 "unicode/utf8"
Russ Cox8658b362011-10-26 15:27:47 -070016)
17
Rob Pikef9489be2011-11-08 15:43:02 -080018func f(byte) {}
Russ Cox862179b2011-10-18 14:55:50 -040019func g(uint8) {}
20
21func main() {
Russ Cox8658b362011-10-26 15:27:47 -070022 var x float64
Rob Pikef9489be2011-11-08 15:43:02 -080023 f(x) // ERROR "byte"
24 g(x) // ERROR "uint8"
Russ Cox8658b362011-10-26 15:27:47 -070025
26 // Test across imports.
27
28 var ff fmt.Formatter
29 var fs fmt.State
Rob Pikef9489be2011-11-08 15:43:02 -080030 ff.Format(fs, x) // ERROR "rune"
Russ Cox8658b362011-10-26 15:27:47 -070031
Rob Pikef9489be2011-11-08 15:43:02 -080032 utf8.RuneStart(x) // ERROR "byte"
Russ Cox862179b2011-10-18 14:55:50 -040033}