dart-sdk/tests/language/redirecting/factory_bounds_test.dart
Robert Nystrom 0ea8347576 Remove references to dartfmt in various comments and docs.
Change-Id: I02112ce2920d71f84ce4808c13a62e1a1765d83f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215181
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-10-01 00:56:14 +00:00

51 lines
1.3 KiB
Dart

// 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.
// Bounds checking on redirecting factories.
class Foo<T> {}
class Baz<T> {}
class Foobar<T> implements Foo<T> {}
class Bar<
T // A comment to prevent dart format from joining the lines.
extends Foo<T> //# 00: ok
extends Baz<Foo<T>> //# 01: compile-time error
extends Foobar<T> //# 02: compile-time error
> {
Bar.named();
factory Bar() = Qux<T>;
}
class Qux<
T // A comment to prevent dart format from joining the lines.
extends Foo<T> //# 00: continued
extends Foo<T> //# 01: continued
extends Foo<T> //# 02: continued
> extends Bar<T> {
Qux() : super.named();
}
class A<T extends int> {
factory A() = B<
T // A comment to prevent dart format from joining the lines.
, int //# 03: compile-time error
, String //# 04: ok
>;
}
class B<T extends int
, S extends String //# 03: continued
, S extends String //# 04: continued
> implements A<T> {}
void main() {
new Bar<Never>();
new A<int>();
}