<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 It is an error if a top level variable, static variable, or
 * instance field with potentially non-nullable type has no initializer
 * expression and is not initialized in a constructor via an initializing formal
 * or an initializer list entry, unless the variable or field is marked with the
 * 'late' modifier.
 *
 * @description Check that it is no compile-time error if an instance field
 * with potentially non-nullable type has no initializer expression but
 * initialized in a constructor via an initializing formal or an initializer
 * list entry. Test FutureOr
 * @author <EMAIL>
 */
// SharedOptions=--enable-experiment=non-nullable
// Requirements=nnbd-strong
import "dart:async";
import "legacy_lib.dart";

typedef void Foo();
class A {}
void foo() {}
Never never() {}

class C1<T extends Object> {
  FutureOr<T> t1;
  FutureOr<Never> n1;
  FutureOr<Function> f1;
  FutureOr<Foo> f2;
  FutureOr<A> a1;
  FutureOr<M> m1;
  FutureOr<FutureOr<A>> a2;

  C1(FutureOr<T> t, FutureOr<Never> n, FutureOr<Function> f1, FutureOr<Foo> f2, FutureOr<A> a1, FutureOr<M> m1, FutureOr<FutureOr<A>> a2)
      : this.t1 = t, this.n1 = n, this.f1 = f1, this.f2 = f2, this.a1 = a1, this.m1 = m1, this.a2 = a2 {}
}

class C2<T extends Object> {
  FutureOr<T> t1;
  FutureOr<Never> n1;
  FutureOr<Function> f1;
  FutureOr<Foo> f2;
  FutureOr<A> a1;
  FutureOr<M> m1;
  FutureOr<FutureOr<A>> a2;
  C2(this.t1, this.n1, this.f1, this.f2, this.a1, this.m1, this.a2);
}

main() {
  new C1<String>("s", never(), foo, foo, A(), M(), A());
  new C2<String>("s", never(), foo, foo, A(), M(), A());
}<commit_msg>Fixes #528. Process Never in a special way<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 It is an error if a top level variable, static variable, or
 * instance field with potentially non-nullable type has no initializer
 * expression and is not initialized in a constructor via an initializing formal
 * or an initializer list entry, unless the variable or field is marked with the
 * 'late' modifier.
 *
 * @description Check that it is no compile-time error if an instance field
 * with potentially non-nullable type has no initializer expression but
 * initialized in a constructor via an initializing formal or an initializer
 * list entry. Test FutureOr
 * @author <EMAIL>
 */
// SharedOptions=--enable-experiment=non-nullable
// Requirements=nnbd-strong
import "dart:async";
import "legacy_lib.dart";

typedef void Foo();
class A {}
void foo() {}
dynamic getX() => null;

class C1<T extends Object> {
  FutureOr<T> t1;
  FutureOr<Function> f1;
  FutureOr<Foo> f2;
  FutureOr<A> a1;
  FutureOr<M> m1;
  FutureOr<FutureOr<A>> a2;

  C1(FutureOr<T> t, FutureOr<Function> f1, FutureOr<Foo> f2, FutureOr<A> a1, FutureOr<M> m1, FutureOr<FutureOr<A>> a2)
      : this.t1 = t, this.f1 = f1, this.f2 = f2, this.a1 = a1, this.m1 = m1, this.a2 = a2 {}
}

class C2<T extends Object> {
  FutureOr<T> t1;
  FutureOr<Function> f1;
  FutureOr<Foo> f2;
  FutureOr<A> a1;
  FutureOr<M> m1;
  FutureOr<FutureOr<A>> a2;
  C2(this.t1, this.f1, this.f2, this.a1, this.m1, this.a2);
}

class C3 {
  FutureOr<Never> n1;

  C3(FutureOr<Never> n) : n1 = n {}
}

class C4 {
  FutureOr<Never> n1;

  C4(this.n1);
}


main() {
  new C1<String>("s", foo, foo, A(), M(), A());
  new C2<String>("s", foo, foo, A(), M(), A());
  var x = getX();
  if (x is Never) {
    new C3(x);
    new C4(x);
  }
}
{'fraction_non_alphanumeric': 0.1327941560135664, 'fraction_numerical': 0.027393686407513697, 'mean_word_length': 3.877862595419847, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 62, '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': '3130865', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1379, 'n_words': 477}