Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3910)

Issue 5339045: code review 5339045: gc: Allow any type in switch on interface value. Static... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 4 months ago by lvd
Modified:
13 years, 4 months ago
Reviewers:
CC:
rsc, dsymonds, golang-dev
Visibility:
Public.

Description

gc: Better typechecks and errors in switches. Allow any type in switch on interface value. Statically check typeswitch early. Fixes issue 2423. Fixes issue 2424.

Patch Set 1 #

Patch Set 2 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 8 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Total comments: 3

Patch Set 9 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r 27d7673713db https://go.googlecode.com/hg/ #

Patch Set 11 : diff -r 41fb9e7d3027 https://go.googlecode.com/hg/ #

Patch Set 12 : diff -r 890d78282ea9 https://go.googlecode.com/hg/ #

Patch Set 13 : diff -r 890d78282ea9 https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 14 : diff -r 41171c6b511f https://go.googlecode.com/hg/ #

Patch Set 15 : diff -r 9b9fd209f03e https://go.googlecode.com/hg/ #

Patch Set 16 : diff -r 9b9fd209f03e https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -28 lines) Patch
M src/cmd/gc/swt.c View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +19 lines, -5 lines 0 comments Download
R test/fixedbugs/bug270.go View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -21 lines 0 comments Download
M test/fixedbugs/bug340.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
A test/fixedbugs/bug375.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +19 lines, -0 lines 0 comments Download
A test/switch3.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +38 lines, -0 lines 0 comments Download
A test/typeswitch3.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +20 lines, -0 lines 0 comments Download

Messages

Total messages: 20
lvd
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 4 months ago (2011-11-07 07:36:17 UTC) #1
dsymonds
Isn't this a language change? I understood (value) switches to be glorified if chains with ...
13 years, 4 months ago (2011-11-07 08:18:22 UTC) #2
lvd
Hello rsc@golang.org, dsymonds@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 4 months ago (2011-11-07 08:21:04 UTC) #3
lvd
On 2011/11/07 08:18:22, dsymonds wrote: > Isn't this a language change? I understood (value) switches ...
13 years, 4 months ago (2011-11-07 08:22:40 UTC) #4
lvd
(hm don't know why code. doesn't send my reply) On Mon, Nov 7, 2011 at ...
13 years, 4 months ago (2011-11-07 08:31:16 UTC) #5
lvd
On Mon, Nov 7, 2011 at 09:31, Luuk van Dijk <lvd@google.com> wrote: > (hm don't ...
13 years, 4 months ago (2011-11-07 08:34:30 UTC) #6
dsymonds
On Mon, Nov 7, 2011 at 7:31 PM, Luuk van Dijk <lvd@google.com> wrote: > On ...
13 years, 4 months ago (2011-11-07 11:09:10 UTC) #7
lvd
http://codereview.appspot.com/5339045/diff/1002/src/cmd/gc/swt.c File src/cmd/gc/swt.c (right): http://codereview.appspot.com/5339045/diff/1002/src/cmd/gc/swt.c#newcode863 src/cmd/gc/swt.c:863: ; btw i just realized I could do an ...
13 years, 4 months ago (2011-11-07 14:45:00 UTC) #8
rsc
http://codereview.appspot.com/5339045/diff/1002/src/cmd/gc/swt.c File src/cmd/gc/swt.c (right): http://codereview.appspot.com/5339045/diff/1002/src/cmd/gc/swt.c#newcode863 src/cmd/gc/swt.c:863: ; I think this new code is only necessary ...
13 years, 4 months ago (2011-11-07 17:36:58 UTC) #9
lvd
On Mon, Nov 7, 2011 at 18:36, <rsc@golang.org> wrote: > > http://codereview.appspot.com/**5339045/diff/1002/src/cmd/gc/**swt.c<http://codereview.appspot.com/5339045/diff/1002/src/cmd/gc/swt.c> > File src/cmd/gc/swt.c ...
13 years, 4 months ago (2011-11-07 19:00:44 UTC) #10
rsc
http://codereview.appspot.com/5339045/diff/17002/test/fixedbugs/bug270.go File test/fixedbugs/bug270.go (right): http://codereview.appspot.com/5339045/diff/17002/test/fixedbugs/bug270.go#newcode19 test/fixedbugs/bug270.go:19: default: I think you can remove this test. It ...
13 years, 4 months ago (2011-11-07 19:06:06 UTC) #11
lvd
On Mon, Nov 7, 2011 at 20:06, <rsc@golang.org> wrote: > > http://codereview.appspot.com/**5339045/diff/17002/test/** > fixedbugs/bug270.go<http://codereview.appspot.com/5339045/diff/17002/test/fixedbugs/bug270.go> > ...
13 years, 4 months ago (2011-11-07 19:10:25 UTC) #12
rsc
http://codereview.appspot.com/5339045/diff/17002/src/cmd/gc/swt.c File src/cmd/gc/swt.c (right): http://codereview.appspot.com/5339045/diff/17002/src/cmd/gc/swt.c#newcode864 src/cmd/gc/swt.c:864: else if(ll->n->type != T && assignop(ll->n->type, t, &why) == ...
13 years, 4 months ago (2011-11-07 19:14:36 UTC) #13
lvd
On Mon, Nov 7, 2011 at 20:14, <rsc@golang.org> wrote: > > http://codereview.appspot.com/**5339045/diff/17002/src/cmd/gc/**swt.c<http://codereview.appspot.com/5339045/diff/17002/src/cmd/gc/swt.c> > File src/cmd/gc/swt.c ...
13 years, 4 months ago (2011-11-07 20:21:53 UTC) #14
lvd
On Mon, Nov 7, 2011 at 21:21, Luuk van Dijk <lvd@google.com> wrote: > > > ...
13 years, 4 months ago (2011-11-07 20:40:53 UTC) #15
lvd
On Mon, Nov 7, 2011 at 21:40, Luuk van Dijk <lvd@google.com> wrote: > > > ...
13 years, 4 months ago (2011-11-07 21:41:06 UTC) #16
lvd
all tests pass. will leave the checkimplements for another CL, where i can add more ...
13 years, 4 months ago (2011-11-07 21:51:59 UTC) #17
rsc
LGTM http://codereview.appspot.com/5339045/diff/9/test/fixedbugs/bug375.go File test/fixedbugs/bug375.go (right): http://codereview.appspot.com/5339045/diff/9/test/fixedbugs/bug375.go#newcode12 test/fixedbugs/bug375.go:12: var x interface{} = "hello" please gofmt. looks ...
13 years, 4 months ago (2011-11-09 04:37:35 UTC) #18
lvd
http://codereview.appspot.com/5339045/diff/9/test/fixedbugs/bug375.go File test/fixedbugs/bug375.go (right): http://codereview.appspot.com/5339045/diff/9/test/fixedbugs/bug375.go#newcode12 test/fixedbugs/bug375.go:12: var x interface{} = "hello" On 2011/11/09 04:37:35, rsc ...
13 years, 4 months ago (2011-11-09 09:44:24 UTC) #19
lvd
13 years, 4 months ago (2011-11-09 09:58:59 UTC) #20
*** Submitted as http://code.google.com/p/go/source/detail?r=e19afb349d0e ***

gc: Better typechecks and errors in switches.

Allow any type in switch on interface value.
Statically check typeswitch early.

Fixes issue 2423.
Fixes issue 2424.

R=rsc, dsymonds
CC=golang-dev
http://codereview.appspot.com/5339045
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b