1// errorcheck 2 3// Copyright 2021 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 7package p 8 9var s string 10var b bool 11var i int 12var iface interface{} 13 14var ( 15 _ = "" + b // ERROR "invalid operation.*mismatched types.*untyped string and bool" 16 _ = "" + i // ERROR "invalid operation.*mismatched types.*untyped string and int" 17 _ = "" + nil // ERROR "invalid operation.*mismatched types.*untyped string and nil|(untyped nil)" 18) 19 20var ( 21 _ = s + false // ERROR "invalid operation.*mismatched types.*string and untyped bool" 22 _ = s + 1 // ERROR "invalid operation.*mismatched types.*string and untyped int" 23 _ = s + nil // ERROR "invalid operation.*mismatched types.*string and nil|(untyped nil)" 24) 25 26var ( 27 _ = "" + false // ERROR "invalid operation.*mismatched types.*untyped string and untyped bool" 28 _ = "" + 1 // ERROR "invalid operation.*mismatched types.*untyped string and untyped int" 29) 30 31var ( 32 _ = b + 1 // ERROR "invalid operation.*mismatched types.*bool and untyped int" 33 _ = i + false // ERROR "invalid operation.*mismatched types.*int and untyped bool" 34 _ = iface + 1 // ERROR "invalid operation.*mismatched types.*interface *{} and int" 35 _ = iface + 1.0 // ERROR "invalid operation.*mismatched types.*interface *{} and float64" 36 _ = iface + false // ERROR "invalid operation.*mismatched types.*interface *{} and bool" 37) 38