blob: 53f0ee85b049207ee303d6c493d43ece769cc053 [file] [log] [blame]
 // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. /// @assertion If a constant set literals is created which has the same type /// argument and contains the same values in the same order, as the value of a /// previously evaluated constant set literal, then the constant set literal /// expression instead evaluates to the previously created constant set. That is, /// constant set literals are canonicalized. /// /// @description Check that if a constant set literals is created which has the /// same type argument and contains the same values in the same order, as the /// value of a previously evaluated constant set literal, then the constant set /// literal expression instead evaluates to the previously created constant set /// @author sgrekhov@unipro.ru /// @issue 43281 import "../../Utils/expect.dart"; main() { Expect.isTrue(identical(const {}, const {})); Expect.isFalse(identical({}, {})); Expect.isFalse(identical(const {}, {})); Expect.isTrue(identical(const {1, 2, 3}, const {1, 2, 3})); Expect.isTrue(identical(const {1, 2, 3}, const {1, 2, 2 + 1,})); Expect.isTrue(identical(const {1, 2, 3}, const {1, 2, 3, })); Expect.isFalse(identical(const {1, 2, 3}, const {2, 3, 1})); const s1 = {'1', '2' + '1', "3 - 1", null, !true}; var s2 = const {'1', '21', "3 - 1", null, false}; Expect.isTrue(identical(s1, s2)); }