]> Cypherpunks repositories - gostls13.git/commit
spec: extend type omission rules for composite literal element values
authorRobert Griesemer <gri@golang.org>
Fri, 9 Jan 2015 00:01:31 +0000 (16:01 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 20 Mar 2015 23:06:28 +0000 (23:06 +0000)
commit7727dee44565bed441c9fc09a2e2441ecd6b9fe7
tree387115de3ffdb40066dbfc8dd6686a9add0e683c
parenta22e9393e39a7a2036ed6f55b9e9b668b261a25c
spec: extend type omission rules for composite literal element values
      to map element keys

Composite literals containing element values that are themselves composite
literals may leave away the element's literal types if they are identical
to the enclosing composite literal's element type.

(http://golang.org/ref/spec#Composite_literals)

When we made this change, we forgot to apply the analogous rule to map
literal keys. This change generalizes that rule. Added more examples,
including one showing the recursive application of the elision rules.

This is a fully backward-compatible language change. It was discussed
some time back.

Fixes #8589.

To be submitted once all compilers accept the extension.

Change-Id: I4d45b64b5970f0d5501572945d5a097e64a9458b
Reviewed-on: https://go-review.googlesource.com/2591
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
doc/go_spec.html