<commit_before>/*
 * Copyright (c) 2019, 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 spread element in a list or set literal has static type
 * [Iterable<T>] for some [T], then the upwards inference element type is [T].
 * @description Checks that spread element upwards inference element type is [T]
 * in the set literal
 * @author <EMAIL>
 */
// SharedOptions=--enable-experiment=spread-collections

import "../../Utils/expect.dart";

class A {}
class B extends A {}
class C extends B {}

main() {
  List<A> a_list = <A>[new A()];
  List<B> b_list = <B>[new B()];
  List<C> c_list = <C>[new C()];
  List<int> int_list= <int>[1, 2, 3];
  List<String> str_list = <String>["string"];

  A a = new A();
  B b = new B();
  C c = new C();

  Expect.isTrue({...int_list} is Set<int>);
  Expect.isTrue({"test", "a", ...?string_list, "ooooo"} is Set<String>);

  Expect.isTrue({...a_list} is Set<A>);
  Expect.isTrue({a, ...?a_list} is Set<A>);
  Expect.isTrue({...b_list} is Set<A>);
  Expect.isTrue({a, ...?b_list} is Set<A>);
  Expect.isTrue({...c_list} is Set<A>);
  Expect.isTrue({a, ...?c_list} is Set<A>);
  Expect.isTrue({a, ...a_list, ...b_list, b} is Set<A>);
  Expect.isTrue({a, b, c, ...a_list, ...b_list, ...?c_list} is Set<A>);
  Expect.isTrue({a, ...a_list, ...b_list, b} is Set<A>);

  Expect.isFalse({...a_list} is Set<B>);
  Expect.isFalse({b, ...?a_list} is Set<B>);
  Expect.isTrue({...b_list} is Set<B>);
  Expect.isTrue({b, ...?b_list} is Set<B>);
  Expect.isTrue({...c_list} is Set<B>);
  Expect.isTrue({b, ...?c_list} is Set<B>);
  Expect.isFalse({c, ...a_list, ...b_list, b} is Set<B>);
  Expect.isFalse({b, c, ...a_list, ...b_list, ...?c_list} is Set<B>);<commit_msg>Issue #259 fixed.<commit_after>/*
 * Copyright (c) 2019, 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 spread element in a list or set literal has static type
 * [Iterable<T>] for some [T], then the upwards inference element type is [T].
 * @description Checks that spread element upwards inference element type is [T]
 * in the set literal
 * @author <EMAIL>
 */
// SharedOptions=--enable-experiment=spread-collections

import "../../Utils/expect.dart";

class A {}
class B extends A {}
class C extends B {}

main() {
  List<A> a_list = <A>[new A()];
  List<B> b_list = <B>[new B()];
  List<C> c_list = <C>[new C()];
  List<int> int_list= <int>[1, 2, 3];
  List<String> str_list = <String>["string"];

  A a = new A();
  B b = new B();
  C c = new C();

  Expect.isTrue({...int_list} is Set<int>);
  Expect.isTrue({"test", "a", ...?str_list, "ooooo"} is Set<String>);

  Expect.isTrue({...a_list} is Set<A>);
  Expect.isTrue({a, ...?a_list} is Set<A>);
  Expect.isTrue({...b_list} is Set<A>);
  Expect.isTrue({a, ...?b_list} is Set<A>);
  Expect.isTrue({...c_list} is Set<A>);
  Expect.isTrue({a, ...?c_list} is Set<A>);
  Expect.isTrue({a, ...a_list, ...b_list, b} is Set<A>);
  Expect.isTrue({a, b, c, ...a_list, ...b_list, ...?c_list} is Set<A>);
  Expect.isTrue({a, ...a_list, ...b_list, b} is Set<A>);

  Expect.isFalse({...a_list} is Set<B>);
  Expect.isFalse({b, ...?a_list} is Set<B>);
  Expect.isTrue({...b_list} is Set<B>);
  Expect.isTrue({b, ...?b_list} is Set<B>);
  Expect.isTrue({...c_list} is Set<B>);
  Expect.isTrue({b, ...?c_list} is Set<B>);
  Expect.isFalse({c, ...a_list, ...b_list, b} is Set<B>);
  Expect.isFalse({b, c, ...a_list, ...b_list, ...?c_list} is Set<B>);
{'fraction_non_alphanumeric': 0.218942849476791, 'fraction_numerical': 0.004561309364099812, 'mean_word_length': 3.3653395784543325, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4440204', 'n_tokens_mistral': 1507, 'n_tokens_neox': 1461, 'n_words': 421}