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

Issue 6869050: code review 6869050: spec: type assertions and type switches must be valid (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by gri
Modified:
11 years, 3 months ago
Reviewers:
CC:
rsc, iant, r, ken2, golang-dev
Visibility:
Public.

Description

spec: type assertions and type switches must be valid The spec didn't preclude invalid type assertions and type switches, i.e., cases where a concrete type doesn't implement the interface type in the assertion in the first place. Both, the gc and gccgo compiler exclude these cases. This is documenting the status quo. Also: - minor clean up of respective examples - added sentence about default case in select statements Fixes issue 4472.

Patch Set 1 #

Patch Set 2 : diff -r 1f3ebf9a7548 https://code.google.com/p/go #

Patch Set 3 : diff -r 1f3ebf9a7548 https://code.google.com/p/go #

Total comments: 4

Patch Set 4 : diff -r 1f3ebf9a7548 https://code.google.com/p/go #

Patch Set 5 : diff -r 08462805eb2c https://code.google.com/p/go #

Total comments: 4

Patch Set 6 : diff -r 08462805eb2c https://code.google.com/p/go #

Patch Set 7 : diff -r 644271a17661 https://code.google.com/p/go #

Total comments: 6

Patch Set 8 : diff -r 52c9c412f1f2 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -24 lines) Patch
M doc/go_spec.html View 1 2 3 4 5 6 7 8 chunks +51 lines, -24 lines 0 comments Download

Messages

Total messages: 8
gri
Hello rsc@golang.org, iant@golang.org, r@golang.org, ken@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to ...
11 years, 3 months ago (2012-12-03 18:31:25 UTC) #1
rsc
https://codereview.appspot.com/6869050/diff/5001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6869050/diff/5001/doc/go_spec.html#newcode2673 doc/go_spec.html:2673: Type <code>T</code> must <a href="#Method_sets">implement</a> the (interface) type of ...
11 years, 3 months ago (2012-12-03 19:32:31 UTC) #2
gri
PTAL - gri https://codereview.appspot.com/6869050/diff/5001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6869050/diff/5001/doc/go_spec.html#newcode2673 doc/go_spec.html:2673: Type <code>T</code> must <a href="#Method_sets">implement</a> the ...
11 years, 3 months ago (2012-12-03 22:06:23 UTC) #3
iant
LGTM https://codereview.appspot.com/6869050/diff/9001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6869050/diff/9001/doc/go_spec.html#newcode4180 doc/go_spec.html:4180: x.(type) This new example is a little tricky ...
11 years, 3 months ago (2012-12-03 22:32:33 UTC) #4
gri
PTAL https://codereview.appspot.com/6869050/diff/9001/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6869050/diff/9001/doc/go_spec.html#newcode4180 doc/go_spec.html:4180: x.(type) On 2012/12/03 22:32:34, iant wrote: > This ...
11 years, 3 months ago (2012-12-03 22:37:45 UTC) #5
rsc
LGTM https://codereview.appspot.com/6869050/diff/1004/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6869050/diff/1004/doc/go_spec.html#newcode2671 doc/go_spec.html:2671: In this case, <code>T</code> must <a href="#Method_sets">implement</a> the ...
11 years, 3 months ago (2012-12-06 03:37:03 UTC) #6
gri
FYI. https://codereview.appspot.com/6869050/diff/1004/doc/go_spec.html File doc/go_spec.html (right): https://codereview.appspot.com/6869050/diff/1004/doc/go_spec.html#newcode2671 doc/go_spec.html:2671: In this case, <code>T</code> must <a href="#Method_sets">implement</a> the ...
11 years, 3 months ago (2012-12-06 17:07:16 UTC) #7
gri
11 years, 3 months ago (2012-12-06 17:17:44 UTC) #8
*** Submitted as https://code.google.com/p/go/source/detail?r=1f28d9979753 ***

spec: type assertions and type switches must be valid

The spec didn't preclude invalid type assertions and
type switches, i.e., cases where a concrete type doesn't
implement the interface type in the assertion in the first
place. Both, the gc and gccgo compiler exclude these cases.
This is documenting the status quo.

Also:
- minor clean up of respective examples
- added sentence about default case in select statements

Fixes issue 4472.

R=rsc, iant, r, ken
CC=golang-dev
https://codereview.appspot.com/6869050
Sign in to reply to this message.

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