aboutsummaryrefslogtreecommitdiff
path: root/test/cmp6.go
AgeCommit message (Collapse)Author
2014-01-31cmd/gc: do not consider length zero arrays as comparable.Rémy Oudompheng
Array values are comparable if values of the array element type are comparable. Fixes #6526. LGTM=khr R=rsc, bradfitz, khr CC=golang-codereviews https://golang.org/cl/58580043
2013-07-02cmd/gc: fix computation of equality class of types.Rémy Oudompheng
A struct with a single field was considered as equivalent to the field type, which is incorrect is the field is blank. Fields with padding could make the compiler think some types are comparable when they are not. Fixes #5698. R=rsc, golang-dev, daniel.morsing, bradfitz, gri, r CC=golang-dev https://golang.org/cl/10271046
2012-02-19test: [a-c]: add introductory comments to testsRob Pike
Very few of the compiler regression tests include a comment saying waht they do. Many are obvious, some are anything but. I've started with a-c in the top directory. More will follow once we agree on the approach, correctness, and thoroughness here. zerodivide.go sneaked in too. R=rsc, r CC=golang-dev https://golang.org/cl/5656100
2012-02-17cmd/gc: fix comparison of struct with _ fieldRuss Cox
Fixes #2989. R=ken2 CC=golang-dev https://golang.org/cl/5674091
2012-02-16test: use testlib (first 100)Russ Cox
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5656082
2011-12-12gc: implement == on structs and arraysRuss Cox
To allow these types as map keys, we must fill in equal and hash functions in their algorithm tables. Structs or arrays that are "just memory", like [2]int, can and do continue to use the AMEM algorithm. Structs or arrays that contain special values like strings or interface values use generated functions for both equal and hash. The runtime helper func runtime.equal(t, x, y) bool handles the general equality case for x == y and calls out to the equal implementation in the algorithm table. For short values (<= 4 struct fields or array elements), the sequence of elementwise comparisons is inlined instead of calling runtime.equal. R=ken, mpimenov CC=golang-dev https://golang.org/cl/5451105
2011-11-13gc: remove func, map compareRuss Cox
R=ken, ken CC=golang-dev https://golang.org/cl/5373079
2011-03-25test: match gccgo error messages for cmp6.goIan Lance Taylor
cmp6.go:28:9: error: incompatible types in binary expression cmp6.go:29:9: error: incompatible types in binary expression cmp6.go:40:9: error: incompatible types in binary expression cmp6.go:41:9: error: incompatible types in binary expression cmp6.go:48:9: error: expected integer, floating, complex, string, pointer, boolean, interface, slice, map, channel, or function type R=rsc, r2 CC=golang-dev https://golang.org/cl/4281071
2011-01-21gc: clearer error for struct == structRuss Cox
cmp6.go:48: invalid operation: t3 == t3 (operator == not defined on struct) Fixes #1438. R=ken2 CC=golang-dev https://golang.org/cl/4003045
2010-09-13gc: implement new comparison ruleRuss Cox
The new comparison rule was added to the spec by changeset: 5605:33abb649cb63 user: Robert Griesemer <gri@golang.org> date: Thu Jun 03 16:55:50 2010 -0700 files: doc/go_spec.html description: go spec: Base comparison compatibility on assignment compatibility. Specifically: - Simplified definition of comparison compatibility and folded into section on comparison operators since it's only used there. This is a small language change/cleanup. As a consequence: - An interface value may now be compared against a non-interface value. - Channels with opposite directions cannot be compared directly anymore (per discussion with rsc). R=rsc, r, iant, ken2 CC=golang-dev https://golang.org/cl/1462041 but never implemented. Fixes #1070. R=ken2 CC=golang-dev https://golang.org/cl/2116047