mirror of
https://github.com/golang/go
synced 2024-11-22 08:54:39 -07:00
[dev.typeparams] cmd/compile/internal/types2: adjusted qualified identifier error message for compiler
Also: Triaged/adjusted some more test/fixedbugs tests. Change-Id: I050847b6dfccc7f301f8100bfdbe84e0487e33fc Reviewed-on: https://go-review.googlesource.com/c/go/+/276512 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
6812eae2e2
commit
43c7b214db
@ -490,7 +490,11 @@ func (check *Checker) selector(x *operand, e *syntax.SelectorExpr) {
|
||||
exp = pkg.scope.Lookup(sel)
|
||||
if exp == nil {
|
||||
if !pkg.fake {
|
||||
check.errorf(e.Sel, "%s not declared by package %s", sel, pkg.name)
|
||||
if check.conf.CompilerErrorMessages {
|
||||
check.errorf(e.Sel, "undefined: %s.%s", pkg.name, sel)
|
||||
} else {
|
||||
check.errorf(e.Sel, "%s not declared by package %s", sel, pkg.name)
|
||||
}
|
||||
}
|
||||
goto Error
|
||||
}
|
||||
|
@ -18,14 +18,14 @@ func main() {
|
||||
|
||||
// Any implementation must be able to handle these constants at
|
||||
// compile time (even though they cannot be assigned to a float64).
|
||||
var _ = 1e646456992 // ERROR "1e\+646456992 overflows float64"
|
||||
var _ = 1e64645699 // ERROR "1e\+64645699 overflows float64"
|
||||
var _ = 1e6464569 // ERROR "1e\+6464569 overflows float64"
|
||||
var _ = 1e646456 // ERROR "1e\+646456 overflows float64"
|
||||
var _ = 1e64645 // ERROR "1e\+64645 overflows float64"
|
||||
var _ = 1e6464 // ERROR "1e\+6464 overflows float64"
|
||||
var _ = 1e646 // ERROR "1e\+646 overflows float64"
|
||||
var _ = 1e309 // ERROR "1e\+309 overflows float64"
|
||||
var _ = 1e646456992 // ERROR "1e\+?646456992 .*overflows float64"
|
||||
var _ = 1e64645699 // ERROR "1e\+?64645699 .*overflows float64"
|
||||
var _ = 1e6464569 // ERROR "1e\+?6464569 .*overflows float64"
|
||||
var _ = 1e646456 // ERROR "1e\+?646456 .*overflows float64"
|
||||
var _ = 1e64645 // ERROR "1e\+?64645 .*overflows float64"
|
||||
var _ = 1e6464 // ERROR "1e\+?6464 .*overflows float64"
|
||||
var _ = 1e646 // ERROR "1e\+?646 .*overflows float64"
|
||||
var _ = 1e309 // ERROR "1e\+?309 .*overflows float64"
|
||||
|
||||
var _ = 1e308
|
||||
}
|
||||
|
@ -13,28 +13,28 @@ const x complex64 = 0
|
||||
const y complex128 = 0
|
||||
|
||||
var _ = x / 1e-20
|
||||
var _ = x / 1e-50 // ERROR "complex division by zero"
|
||||
var _ = x / 1e-1000 // ERROR "complex division by zero"
|
||||
var _ = x / 1e-50 // ERROR "(complex )?division by zero"
|
||||
var _ = x / 1e-1000 // ERROR "(complex )?division by zero"
|
||||
var _ = x / 1e-20i
|
||||
var _ = x / 1e-50i // ERROR "complex division by zero"
|
||||
var _ = x / 1e-1000i // ERROR "complex division by zero"
|
||||
var _ = x / 1e-50i // ERROR "(complex )?division by zero"
|
||||
var _ = x / 1e-1000i // ERROR "(complex )?division by zero"
|
||||
|
||||
var _ = x / 1e-45 // smallest positive float32
|
||||
|
||||
var _ = x / (1e-20 + 1e-20i)
|
||||
var _ = x / (1e-50 + 1e-20i)
|
||||
var _ = x / (1e-20 + 1e-50i)
|
||||
var _ = x / (1e-50 + 1e-50i) // ERROR "complex division by zero"
|
||||
var _ = x / (1e-1000 + 1e-1000i) // ERROR "complex division by zero"
|
||||
var _ = x / (1e-50 + 1e-50i) // ERROR "(complex )?division by zero"
|
||||
var _ = x / (1e-1000 + 1e-1000i) // ERROR "(complex )?division by zero"
|
||||
|
||||
var _ = y / 1e-50
|
||||
var _ = y / 1e-1000 // ERROR "complex division by zero"
|
||||
var _ = y / 1e-1000 // ERROR "(complex )?division by zero"
|
||||
var _ = y / 1e-50i
|
||||
var _ = y / 1e-1000i // ERROR "complex division by zero"
|
||||
var _ = y / 1e-1000i // ERROR "(complex )?division by zero"
|
||||
|
||||
var _ = y / 5e-324 // smallest positive float64
|
||||
|
||||
var _ = y / (1e-50 + 1e-50)
|
||||
var _ = y / (1e-1000 + 1e-50i)
|
||||
var _ = y / (1e-50 + 1e-1000i)
|
||||
var _ = y / (1e-1000 + 1e-1000i) // ERROR "complex division by zero"
|
||||
var _ = y / (1e-1000 + 1e-1000i) // ERROR "(complex )?division by zero"
|
||||
|
@ -12,6 +12,6 @@ func f()
|
||||
|
||||
func s(x interface{}) {
|
||||
switch x {
|
||||
case f: // ERROR "invalid case f \(type func\(\)\) in switch \(incomparable type\)"
|
||||
case f: // ERROR "invalid case f \(type func\(\)\) in switch \(incomparable type\)|cannot compare"
|
||||
}
|
||||
}
|
||||
|
@ -11,15 +11,15 @@ package main
|
||||
var t struct{}
|
||||
|
||||
func main() {
|
||||
_ = []int{-1: 0} // ERROR "index must be non\-negative integer constant"
|
||||
_ = [10]int{-1: 0} // ERROR "index must be non\-negative integer constant"
|
||||
_ = [...]int{-1: 0} // ERROR "index must be non\-negative integer constant"
|
||||
_ = []int{-1: 0} // ERROR "index must be non\-negative integer constant|must not be negative"
|
||||
_ = [10]int{-1: 0} // ERROR "index must be non\-negative integer constant|must not be negative"
|
||||
_ = [...]int{-1: 0} // ERROR "index must be non\-negative integer constant|must not be negative"
|
||||
|
||||
_ = []int{100: 0}
|
||||
_ = [10]int{100: 0} // ERROR "array index 100 out of bounds"
|
||||
_ = [...]int{100: 0}
|
||||
|
||||
_ = []int{t} // ERROR "cannot use .* as type int in slice literal"
|
||||
_ = [10]int{t} // ERROR "cannot use .* as type int in array literal"
|
||||
_ = [...]int{t} // ERROR "cannot use .* as type int in array literal"
|
||||
_ = []int{t} // ERROR "cannot use .* as (type )?int( in slice literal)?"
|
||||
_ = [10]int{t} // ERROR "cannot use .* as (type )?int( in array literal)?"
|
||||
_ = [...]int{t} // ERROR "cannot use .* as (type )?int( in array literal)?"
|
||||
}
|
||||
|
@ -9,17 +9,17 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
const _ int64 = 1e646456992 // ERROR "integer too large"
|
||||
const _ int32 = 1e64645699 // ERROR "integer too large"
|
||||
const _ int16 = 1e6464569 // ERROR "integer too large"
|
||||
const _ int8 = 1e646456 // ERROR "integer too large"
|
||||
const _ int = 1e64645 // ERROR "integer too large"
|
||||
const _ int64 = 1e646456992 // ERROR "integer too large|truncated to .*"
|
||||
const _ int32 = 1e64645699 // ERROR "integer too large|truncated to .*"
|
||||
const _ int16 = 1e6464569 // ERROR "integer too large|truncated to .*"
|
||||
const _ int8 = 1e646456 // ERROR "integer too large|truncated to .*"
|
||||
const _ int = 1e64645 // ERROR "integer too large|truncated to .*"
|
||||
|
||||
const _ uint64 = 1e646456992 // ERROR "integer too large"
|
||||
const _ uint32 = 1e64645699 // ERROR "integer too large"
|
||||
const _ uint16 = 1e6464569 // ERROR "integer too large"
|
||||
const _ uint8 = 1e646456 // ERROR "integer too large"
|
||||
const _ uint = 1e64645 // ERROR "integer too large"
|
||||
const _ uint64 = 1e646456992 // ERROR "integer too large|truncated to .*"
|
||||
const _ uint32 = 1e64645699 // ERROR "integer too large|truncated to .*"
|
||||
const _ uint16 = 1e6464569 // ERROR "integer too large|truncated to .*"
|
||||
const _ uint8 = 1e646456 // ERROR "integer too large|truncated to .*"
|
||||
const _ uint = 1e64645 // ERROR "integer too large|truncated to .*"
|
||||
|
||||
const _ rune = 1e64645 // ERROR "integer too large"
|
||||
const _ rune = 1e64645 // ERROR "integer too large|truncated to .*"
|
||||
}
|
||||
|
@ -18,21 +18,21 @@ func bug() {
|
||||
var m M
|
||||
var f F
|
||||
|
||||
_ = s == S(nil) // ERROR "compare.*to nil"
|
||||
_ = S(nil) == s // ERROR "compare.*to nil"
|
||||
_ = s == S(nil) // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
_ = S(nil) == s // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
switch s {
|
||||
case S(nil): // ERROR "compare.*to nil"
|
||||
case S(nil): // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
}
|
||||
|
||||
_ = m == M(nil) // ERROR "compare.*to nil"
|
||||
_ = M(nil) == m // ERROR "compare.*to nil"
|
||||
_ = m == M(nil) // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
_ = M(nil) == m // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
switch m {
|
||||
case M(nil): // ERROR "compare.*to nil"
|
||||
case M(nil): // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
}
|
||||
|
||||
_ = f == F(nil) // ERROR "compare.*to nil"
|
||||
_ = F(nil) == f // ERROR "compare.*to nil"
|
||||
_ = f == F(nil) // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
_ = F(nil) == f // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
switch f {
|
||||
case F(nil): // ERROR "compare.*to nil"
|
||||
case F(nil): // ERROR "compare.*to nil|operator \=\= not defined for ."
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ package p
|
||||
var (
|
||||
_ [10]int
|
||||
_ [10.0]int
|
||||
_ [float64(10)]int // ERROR "invalid array bound"
|
||||
_ [float64(10)]int // ERROR "invalid array bound|must be integer"
|
||||
_ [10 + 0i]int
|
||||
_ [complex(10, 0)]int
|
||||
_ [complex128(complex(10, 0))]int // ERROR "invalid array bound"
|
||||
_ [complex128(complex(10, 0))]int // ERROR "invalid array bound|must be integer"
|
||||
_ ['a']int
|
||||
_ [rune(65)]int
|
||||
)
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
package main
|
||||
|
||||
import "math" // ERROR "imported and not used"
|
||||
import "math" // ERROR "imported and not used|imported but not used"
|
||||
|
||||
func main() {
|
||||
math:
|
||||
|
@ -10,80 +10,80 @@
|
||||
package p
|
||||
|
||||
// failure case in issue
|
||||
const _ int64 = 1e-10000 // ERROR "1e\-10000 truncated"
|
||||
const _ int64 = 1e-10000 // ERROR "1e\-10000 truncated|.* truncated to int64"
|
||||
|
||||
const (
|
||||
_ int64 = 1e10000000 // ERROR "integer too large"
|
||||
_ int64 = 1e1000000 // ERROR "integer too large"
|
||||
_ int64 = 1e100000 // ERROR "integer too large"
|
||||
_ int64 = 1e10000 // ERROR "integer too large"
|
||||
_ int64 = 1e1000 // ERROR "integer too large"
|
||||
_ int64 = 1e100 // ERROR "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
|
||||
_ int64 = 1e10000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1e1000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1e100000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1e10000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1e1000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1e100 // ERROR "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64"
|
||||
_ int64 = 1e10
|
||||
_ int64 = 1e1
|
||||
_ int64 = 1e0
|
||||
_ int64 = 1e-1 // ERROR "0\.1 truncated"
|
||||
_ int64 = 1e-10 // ERROR "1e\-10 truncated"
|
||||
_ int64 = 1e-100 // ERROR "1e\-100 truncated"
|
||||
_ int64 = 1e-1000 // ERROR "1e\-1000 truncated"
|
||||
_ int64 = 1e-10000 // ERROR "1e\-10000 truncated"
|
||||
_ int64 = 1e-100000 // ERROR "1e\-100000 truncated"
|
||||
_ int64 = 1e-1000000 // ERROR "1e\-1000000 truncated"
|
||||
_ int64 = 1e-1 // ERROR "0\.1 truncated|.* truncated to int64"
|
||||
_ int64 = 1e-10 // ERROR "1e\-10 truncated|.* truncated to int64"
|
||||
_ int64 = 1e-100 // ERROR "1e\-100 truncated|.* truncated to int64"
|
||||
_ int64 = 1e-1000 // ERROR "1e\-1000 truncated|.* truncated to int64"
|
||||
_ int64 = 1e-10000 // ERROR "1e\-10000 truncated|.* truncated to int64"
|
||||
_ int64 = 1e-100000 // ERROR "1e\-100000 truncated|.* truncated to int64"
|
||||
_ int64 = 1e-1000000 // ERROR "1e\-1000000 truncated|.* truncated to int64"
|
||||
)
|
||||
|
||||
const (
|
||||
_ int64 = -1e10000000 // ERROR "integer too large"
|
||||
_ int64 = -1e1000000 // ERROR "integer too large"
|
||||
_ int64 = -1e100000 // ERROR "integer too large"
|
||||
_ int64 = -1e10000 // ERROR "integer too large"
|
||||
_ int64 = -1e1000 // ERROR "integer too large"
|
||||
_ int64 = -1e100 // ERROR "\-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
|
||||
_ int64 = -1e10000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1e1000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1e100000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1e10000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1e1000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1e100 // ERROR "\-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64"
|
||||
_ int64 = -1e10
|
||||
_ int64 = -1e1
|
||||
_ int64 = -1e0
|
||||
_ int64 = -1e-1 // ERROR "\-0\.1 truncated"
|
||||
_ int64 = -1e-10 // ERROR "\-1e\-10 truncated"
|
||||
_ int64 = -1e-100 // ERROR "\-1e\-100 truncated"
|
||||
_ int64 = -1e-1000 // ERROR "\-1e\-1000 truncated"
|
||||
_ int64 = -1e-10000 // ERROR "\-1e\-10000 truncated"
|
||||
_ int64 = -1e-100000 // ERROR "\-1e\-100000 truncated"
|
||||
_ int64 = -1e-1000000 // ERROR "\-1e\-1000000 truncated"
|
||||
_ int64 = -1e-1 // ERROR "\-0\.1 truncated|.* truncated to int64"
|
||||
_ int64 = -1e-10 // ERROR "\-1e\-10 truncated|.* truncated to int64"
|
||||
_ int64 = -1e-100 // ERROR "\-1e\-100 truncated|.* truncated to int64"
|
||||
_ int64 = -1e-1000 // ERROR "\-1e\-1000 truncated|.* truncated to int64"
|
||||
_ int64 = -1e-10000 // ERROR "\-1e\-10000 truncated|.* truncated to int64"
|
||||
_ int64 = -1e-100000 // ERROR "\-1e\-100000 truncated|.* truncated to int64"
|
||||
_ int64 = -1e-1000000 // ERROR "\-1e\-1000000 truncated|.* truncated to int64"
|
||||
)
|
||||
|
||||
const (
|
||||
_ int64 = 1.23456789e10000000 // ERROR "integer too large"
|
||||
_ int64 = 1.23456789e1000000 // ERROR "integer too large"
|
||||
_ int64 = 1.23456789e100000 // ERROR "integer too large"
|
||||
_ int64 = 1.23456789e10000 // ERROR "integer too large"
|
||||
_ int64 = 1.23456789e1000 // ERROR "integer too large"
|
||||
_ int64 = 1.23456789e100 // ERROR "12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
|
||||
_ int64 = 1.23456789e10000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1.23456789e1000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1.23456789e100000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1.23456789e10000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1.23456789e1000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = 1.23456789e100 // ERROR "12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64"
|
||||
_ int64 = 1.23456789e10
|
||||
_ int64 = 1.23456789e1 // ERROR "12\.3457 truncated"
|
||||
_ int64 = 1.23456789e0 // ERROR "1\.23457 truncated"
|
||||
_ int64 = 1.23456789e-1 // ERROR "0\.123457 truncated"
|
||||
_ int64 = 1.23456789e-10 // ERROR "1\.23457e\-10 truncated"
|
||||
_ int64 = 1.23456789e-100 // ERROR "1\.23457e\-100 truncated"
|
||||
_ int64 = 1.23456789e-1000 // ERROR "1\.23457e\-1000 truncated"
|
||||
_ int64 = 1.23456789e-10000 // ERROR "1\.23457e\-10000 truncated"
|
||||
_ int64 = 1.23456789e-100000 // ERROR "1\.23457e\-100000 truncated"
|
||||
_ int64 = 1.23456789e-1000000 // ERROR "1\.23457e\-1000000 truncated"
|
||||
_ int64 = 1.23456789e1 // ERROR "12\.3457 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e0 // ERROR "1\.23457 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e-1 // ERROR "0\.123457 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e-10 // ERROR "1\.23457e\-10 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e-100 // ERROR "1\.23457e\-100 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e-1000 // ERROR "1\.23457e\-1000 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e-10000 // ERROR "1\.23457e\-10000 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e-100000 // ERROR "1\.23457e\-100000 truncated|.* truncated to int64"
|
||||
_ int64 = 1.23456789e-1000000 // ERROR "1\.23457e\-1000000 truncated|.* truncated to int64"
|
||||
)
|
||||
|
||||
const (
|
||||
_ int64 = -1.23456789e10000000 // ERROR "integer too large"
|
||||
_ int64 = -1.23456789e1000000 // ERROR "integer too large"
|
||||
_ int64 = -1.23456789e100000 // ERROR "integer too large"
|
||||
_ int64 = -1.23456789e10000 // ERROR "integer too large"
|
||||
_ int64 = -1.23456789e1000 // ERROR "integer too large"
|
||||
_ int64 = -1.23456789e100 // ERROR "\-12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
|
||||
_ int64 = -1.23456789e10000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1.23456789e1000000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1.23456789e100000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1.23456789e10000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1.23456789e1000 // ERROR "integer too large|truncated to int64"
|
||||
_ int64 = -1.23456789e100 // ERROR "\-12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64"
|
||||
_ int64 = -1.23456789e10
|
||||
_ int64 = -1.23456789e1 // ERROR "\-12\.3457 truncated"
|
||||
_ int64 = -1.23456789e0 // ERROR "\-1\.23457 truncated"
|
||||
_ int64 = -1.23456789e-1 // ERROR "\-0\.123457 truncated"
|
||||
_ int64 = -1.23456789e-10 // ERROR "\-1\.23457e\-10 truncated"
|
||||
_ int64 = -1.23456789e-100 // ERROR "\-1\.23457e\-100 truncated"
|
||||
_ int64 = -1.23456789e-1000 // ERROR "\-1\.23457e\-1000 truncated"
|
||||
_ int64 = -1.23456789e-10000 // ERROR "\-1\.23457e\-10000 truncated"
|
||||
_ int64 = -1.23456789e-100000 // ERROR "\-1\.23457e\-100000 truncated"
|
||||
_ int64 = -1.23456789e-1000000 // ERROR "\-1\.23457e\-1000000 truncated"
|
||||
_ int64 = -1.23456789e1 // ERROR "\-12\.3457 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e0 // ERROR "\-1\.23457 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e-1 // ERROR "\-0\.123457 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e-10 // ERROR "\-1\.23457e\-10 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e-100 // ERROR "\-1\.23457e\-100 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e-1000 // ERROR "\-1\.23457e\-1000 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e-10000 // ERROR "\-1\.23457e\-10000 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e-100000 // ERROR "\-1\.23457e\-100000 truncated|.* truncated to int64"
|
||||
_ int64 = -1.23456789e-1000000 // ERROR "\-1\.23457e\-1000000 truncated|.* truncated to int64"
|
||||
)
|
||||
|
@ -14,6 +14,8 @@ package main
|
||||
type T struct{}
|
||||
|
||||
func main() {
|
||||
t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1} // ERROR "unknown field 'X' in struct literal of type T"
|
||||
var s string = 1 // ERROR "cannot use 1"
|
||||
t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1} // ERROR "unknown field 'X' in struct literal of type T|unknown field X"
|
||||
_ = t
|
||||
var s string = 1 // ERROR "cannot use 1|cannot convert"
|
||||
_ = s
|
||||
}
|
||||
|
@ -30,4 +30,4 @@ type C struct {
|
||||
var _ = C.F // ERROR "ambiguous selector"
|
||||
var _ = C.G // ERROR "ambiguous selector"
|
||||
var _ = C.H // ERROR "ambiguous selector"
|
||||
var _ = C.I // ERROR "no method I"
|
||||
var _ = C.I // ERROR "no method I|C.I undefined"
|
||||
|
@ -10,5 +10,5 @@ package main
|
||||
|
||||
import "unsafe"
|
||||
|
||||
type s struct { unsafe.Pointer } // ERROR "embedded type cannot be a pointer"
|
||||
type s struct { unsafe.Pointer } // ERROR "embedded type cannot be a pointer|embedded field type cannot be unsafe.Pointer"
|
||||
type s1 struct { p unsafe.Pointer }
|
||||
|
@ -8,10 +8,10 @@ package main
|
||||
|
||||
func main() {
|
||||
type name string
|
||||
_ = []byte("abc", "def", 12) // ERROR "too many arguments to conversion to \[\]byte: \(\[\]byte\)\(.abc., .def., 12\)"
|
||||
_ = string("a", "b", nil) // ERROR "too many arguments to conversion to string: string\(.a., .b., nil\)"
|
||||
_ = []byte() // ERROR "missing argument to conversion to \[\]byte: \(\[\]byte\)\(\)"
|
||||
_ = string() // ERROR "missing argument to conversion to string: string\(\)"
|
||||
_ = name("a", 1, 3.3) // ERROR "too many arguments to conversion to name: name\(.a., 1, 3.3\)"
|
||||
_ = map[string]string(nil, nil) // ERROR "too many arguments to conversion to map\[string\]string: \(map\[string\]string\)\(nil, nil\)"
|
||||
_ = []byte("abc", "def", 12) // ERROR "too many arguments (to conversion to \[\]byte: \(\[\]byte\)\(.abc., .def., 12\))?"
|
||||
_ = string("a", "b", nil) // ERROR "too many arguments (to conversion to string: string\(.a., .b., nil\))?"
|
||||
_ = []byte() // ERROR "missing argument (to conversion to \[\]byte: \(\[\]byte\)\(\))?"
|
||||
_ = string() // ERROR "missing argument (to conversion to string: string\(\))?"
|
||||
_ = name("a", 1, 3.3) // ERROR "too many arguments (to conversion to name: name\(.a., 1, 3.3\))?"
|
||||
_ = map[string]string(nil, nil) // ERROR "too many arguments (to conversion to map\[string\]string: \(map\[string\]string\)\(nil, nil\))?"
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ package p
|
||||
|
||||
func f(e interface{}) {
|
||||
switch e.(type) {
|
||||
case nil, nil: // ERROR "multiple nil cases in type switch"
|
||||
case nil, nil: // ERROR "multiple nil cases in type switch|duplicate case nil in type switch"
|
||||
}
|
||||
|
||||
switch e.(type) {
|
||||
case nil:
|
||||
case nil: // ERROR "multiple nil cases in type switch"
|
||||
case nil: // ERROR "multiple nil cases in type switch|duplicate case nil in type switch"
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@
|
||||
package p
|
||||
|
||||
var a []int = []int{1: 1}
|
||||
var b []int = []int{-1: 1} // ERROR "must be non-negative integer constant"
|
||||
var b []int = []int{-1: 1} // ERROR "must be non-negative integer constant|must not be negative"
|
||||
|
||||
var c []int = []int{2.0: 2}
|
||||
var d []int = []int{-2.0: 2} // ERROR "must be non-negative integer constant"
|
||||
var d []int = []int{-2.0: 2} // ERROR "must be non-negative integer constant|must not be negative"
|
||||
|
||||
var e []int = []int{3 + 0i: 3}
|
||||
var f []int = []int{3i: 3} // ERROR "truncated to integer"
|
||||
var f []int = []int{3i: 3} // ERROR "truncated to integer|truncated to int"
|
||||
|
||||
var g []int = []int{"a": 4} // ERROR "must be non-negative integer constant"
|
||||
var g []int = []int{"a": 4} // ERROR "must be non-negative integer constant|cannot convert"
|
||||
|
@ -12,19 +12,19 @@ var sink []byte
|
||||
|
||||
func main() {
|
||||
sink = make([]byte, 1.0)
|
||||
sink = make([]byte, float32(1.0)) // ERROR "non-integer.*len"
|
||||
sink = make([]byte, float64(1.0)) // ERROR "non-integer.*len"
|
||||
sink = make([]byte, float32(1.0)) // ERROR "non-integer.*len|must be integer"
|
||||
sink = make([]byte, float64(1.0)) // ERROR "non-integer.*len|must be integer"
|
||||
|
||||
sink = make([]byte, 0, 1.0)
|
||||
sink = make([]byte, 0, float32(1.0)) // ERROR "non-integer.*cap"
|
||||
sink = make([]byte, 0, float64(1.0)) // ERROR "non-integer.*cap"
|
||||
sink = make([]byte, 0, float32(1.0)) // ERROR "non-integer.*cap|must be integer"
|
||||
sink = make([]byte, 0, float64(1.0)) // ERROR "non-integer.*cap|must be integer"
|
||||
|
||||
sink = make([]byte, 1+0i)
|
||||
sink = make([]byte, complex64(1+0i)) // ERROR "non-integer.*len"
|
||||
sink = make([]byte, complex128(1+0i)) // ERROR "non-integer.*len"
|
||||
sink = make([]byte, complex64(1+0i)) // ERROR "non-integer.*len|must be integer"
|
||||
sink = make([]byte, complex128(1+0i)) // ERROR "non-integer.*len|must be integer"
|
||||
|
||||
sink = make([]byte, 0, 1+0i)
|
||||
sink = make([]byte, 0, complex64(1+0i)) // ERROR "non-integer.*cap"
|
||||
sink = make([]byte, 0, complex128(1+0i)) // ERROR "non-integer.*cap"
|
||||
sink = make([]byte, 0, complex64(1+0i)) // ERROR "non-integer.*cap|must be integer"
|
||||
sink = make([]byte, 0, complex128(1+0i)) // ERROR "non-integer.*cap|must be integer"
|
||||
|
||||
}
|
||||
|
@ -9,5 +9,5 @@
|
||||
package p
|
||||
|
||||
func f() uintptr {
|
||||
return nil // ERROR "cannot use nil as type uintptr in return argument"
|
||||
return nil // ERROR "cannot use nil as type uintptr in return argument|cannot convert nil"
|
||||
}
|
||||
|
@ -17,5 +17,6 @@ func bar() (T, string, T) { // ERROR "undefined"
|
||||
func main() {
|
||||
var x, y, z int
|
||||
x, y = foo()
|
||||
x, y, z = bar() // ERROR "cannot (use type|assign) string"
|
||||
x, y, z = bar() // ERROR "cannot (use type|assign) string|incompatible type"
|
||||
_, _, _ = x, y, z
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ package main
|
||||
|
||||
var (
|
||||
x int = a
|
||||
a int = b // ERROR "a refers to\n.*b refers to\n.*c refers to\n.*a|initialization cycle"
|
||||
a int = b // ERROR "a refers to\n.*b refers to\n.*c refers to\n.*a|initialization loop"
|
||||
b int = c
|
||||
c int = a
|
||||
)
|
||||
|
33
test/run.go
33
test/run.go
@ -1981,30 +1981,14 @@ var excluded = map[string]bool{
|
||||
"fixedbugs/bug462.go": true,
|
||||
"fixedbugs/bug463.go": true,
|
||||
"fixedbugs/bug487.go": true,
|
||||
"fixedbugs/issue11326.go": true,
|
||||
"fixedbugs/issue11362.go": true,
|
||||
"fixedbugs/issue11590.go": true,
|
||||
"fixedbugs/issue11610.go": true,
|
||||
"fixedbugs/issue11614.go": true,
|
||||
"fixedbugs/issue11674.go": true,
|
||||
"fixedbugs/issue11737.go": true,
|
||||
"fixedbugs/issue13365.go": true,
|
||||
"fixedbugs/issue13415.go": true,
|
||||
"fixedbugs/issue13471.go": true,
|
||||
"fixedbugs/issue13480.go": true,
|
||||
"fixedbugs/issue13485.go": true,
|
||||
"fixedbugs/issue13539.go": true,
|
||||
"fixedbugs/issue13559.go": true,
|
||||
"fixedbugs/issue14136.go": true,
|
||||
"fixedbugs/issue14321.go": true,
|
||||
"fixedbugs/issue14520.go": true,
|
||||
"fixedbugs/issue14540.go": true,
|
||||
"fixedbugs/issue14729.go": true,
|
||||
"fixedbugs/issue15055.go": true,
|
||||
"fixedbugs/issue15898.go": true,
|
||||
"fixedbugs/issue16428.go": true,
|
||||
"fixedbugs/issue16439.go": true,
|
||||
"fixedbugs/issue16949.go": true,
|
||||
"fixedbugs/issue11614.go": true, // types2 reports an extra error
|
||||
"fixedbugs/issue13415.go": true, // declared but not used conflict
|
||||
"fixedbugs/issue14520.go": true, // missing import path error by types2
|
||||
"fixedbugs/issue14540.go": true, // types2 is missing a fallthrough error
|
||||
"fixedbugs/issue16428.go": true, // types2 reports two instead of one error
|
||||
"fixedbugs/issue17038.go": true,
|
||||
"fixedbugs/issue17588.go": true,
|
||||
"fixedbugs/issue17631.go": true,
|
||||
@ -2084,11 +2068,8 @@ var excluded = map[string]bool{
|
||||
"fixedbugs/issue4517d.go": true,
|
||||
"fixedbugs/issue4847.go": true,
|
||||
"fixedbugs/issue4909a.go": true,
|
||||
"fixedbugs/issue5609.go": true,
|
||||
"fixedbugs/issue6402.go": true,
|
||||
"fixedbugs/issue6403.go": true,
|
||||
"fixedbugs/issue6500.go": true,
|
||||
"fixedbugs/issue6572.go": true,
|
||||
"fixedbugs/issue5609.go": true, // types2 needs a better error message
|
||||
"fixedbugs/issue6500.go": true, // compiler -G is not reporting an error (but types2 does)
|
||||
"fixedbugs/issue6889.go": true, // types2 can handle this without constant overflow
|
||||
"fixedbugs/issue7525.go": true, // init cycle error on different line - ok otherwise
|
||||
"fixedbugs/issue7525b.go": true, // init cycle error on different line - ok otherwise
|
||||
|
@ -17,5 +17,5 @@ package main
|
||||
import "runtime"
|
||||
|
||||
func main() {
|
||||
runtime.printbool(true) // ERROR "unexported|not declared"
|
||||
runtime.printbool(true) // ERROR "unexported|undefined"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user