summaryrefslogtreecommitdiff
path: root/test/cmp6.go
Commit message (Collapse)AuthorAgeFilesLines
* cmd/gc: do not consider length zero arrays as comparable.R?my Oudompheng2014-01-311-1/+12
| | | | | | | | | | | | Array values are comparable if values of the array element type are comparable. Fixes issue 6526. LGTM=khr R=rsc, bradfitz, khr CC=golang-codereviews https://codereview.appspot.com/58580043
* cmd/gc: fix computation of equality class of types.R?my Oudompheng2013-07-021-1/+1
| | | | | | | | | | | | | | 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 issue 5698. R=rsc, golang-dev, daniel.morsing, bradfitz, gri, r CC=golang-dev https://codereview.appspot.com/10271046
* test: [a-c]: add introductory comments to testsRob Pike2012-02-191-0/+3
| | | | | | | | | | | | 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 http://codereview.appspot.com/5656100
* cmd/gc: fix comparison of struct with _ fieldRuss Cox2012-02-171-0/+5
| | | | | | | | Fixes issue 2989. R=ken2 CC=golang-dev http://codereview.appspot.com/5674091
* test: use testlib (first 100)Russ Cox2012-02-161-1/+1
| | | | | | | | | | | 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 http://codereview.appspot.com/5656082
* gc: implement == on structs and arraysRuss Cox2011-12-121-1/+11
| | | | | | | | | | | | | | | | | | | | | | 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 http://codereview.appspot.com/5451105
* gc: remove func, map compareRuss Cox2011-11-131-10/+18
| | | | | | R=ken, ken CC=golang-dev http://codereview.appspot.com/5373079
* test: match gccgo error messages for cmp6.goIan Lance Taylor2011-03-251-5/+5
| | | | | | | | | | | | 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 http://codereview.appspot.com/4281071
* gc: clearer error for struct == structRuss Cox2011-01-211-0/+7
| | | | | | | | | | cmp6.go:48: invalid operation: t3 == t3 (operator == not defined on struct) Fixes issue 1438. R=ken2 CC=golang-dev http://codereview.appspot.com/4003045
* gc: implement new comparison ruleRuss Cox2010-09-131-0/+42
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 http://codereview.appspot.com/1462041 but never implemented. Fixes issue 1070. R=ken2 CC=golang-dev http://codereview.appspot.com/2116047