diff --git a/accepted/future-releases/set-literals/feature-specification.md b/accepted/future-releases/set-literals/feature-specification.md index b9b24bca1e..e8162061a1 100644 --- a/accepted/future-releases/set-literals/feature-specification.md +++ b/accepted/future-releases/set-literals/feature-specification.md @@ -1,5 +1,6 @@ # Set Literals Design Document Author: lrn@google.com +Version: 1.1 Solution for [Set Literals Problem](http://github.com/dart-lang/language/issues/36). Based on feature proposal [Issue 37](http://github.com/dart-lang/language/issues/37) @@ -84,12 +85,14 @@ if *s* has a `typeArguments` with two type arguments, *s* is a *map literal*. (*Three or more type arguments is a compile time error, so the remaining possible case is having no type arguments*). If *s* is an `emptySetOrMapLiteral` with no `typeArguments` and static context type *C*, then -if `Set` is assignable to *C* and `Map` is not assignable to *C*, then *s* is a *set literal*, -otherwise *s* is a *map literal*. +if `LinkedHashSet` is assignable to *C* and `LinkedHashMap` is not assignable to *C*, +then *s* is a *set literal*, otherwise *s* is a *map literal*. -(*So if *C* is, for example, `Iterable` or `Set` or `FutureOr>` or a type variable with any of -those as bound, then *s* is a set literal. If *C* is `Object` or `dynamic` or `Null` or `String`, then *s* is a map literal, -*and* potentially a compile-time error due to static typing*). +(*So if *C* is, for example, `Iterable`, `Set`, `LinkedHashSet` or `FutureOr>`, +then *s* is a set literal. If *C* is `Object` or `dynamic` or `Null` or `String`, then *s* is a map literal, +*and* potentially a compile-time error due to static typing*. If *C* is some subclass of `Set` other than `LinkedHashSet`, then the literal is a map literal, but it is also a guaranteed type error even if the literal +is a set. If *C* is a subtype of `LinkedHashSet` *and* a subtype of `LinkedHashMap`, then *s* is again +a map literal, and a guaranteed run-time type error). ### Map literals @@ -357,3 +360,7 @@ var s6 = {...{1: 1}, ...?d}; // Map // var s7 = {...?d}; // Compile-time error, ambiguous // var s8 = {...{1}, ...{1: 1}}; // Compile-time error, incompatible ``` + +##Revisions +1.0: Initial version plus type fixes. +1.1: Changed type rules for selecting set literals over map literals.