mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:47:13 +00:00
f20672e00a
Report an error when a factory constructor has type parameters. Report a better error than the old "couldn't find constructor" or "illegal method name" when the name of a constructor does not match the name of the enclosing class. Fixes https://github.com/dart-lang/sdk/issues/31196 Change-Id: Ie46a5b4cbe07ba05ce2936e1f8f9ca2cad0208f7 Reviewed-on: https://dart-review.googlesource.com/57620 Commit-Queue: Aske Simon Christensen <askesc@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com> Reviewed-by: Dan Rubel <danrubel@google.com>
32 lines
892 B
Dart
32 lines
892 B
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.
|
|
|
|
class Foo<T> {
|
|
Foo._();
|
|
|
|
factory Foo
|
|
<X> //# 01: compile-time error
|
|
<X extends T> //# 02: compile-time error
|
|
() => new Bar<T>();
|
|
|
|
factory Foo
|
|
<X> //# 03: compile-time error
|
|
<X extends T> //# 04: compile-time error
|
|
.far
|
|
<X> //# 05: compile-time error
|
|
<X extends T> //# 06: compile-time error
|
|
<X>.fip //# 07: compile-time error
|
|
<X extends T>.fip //# 08: compile-time error
|
|
() => new Bar<T>();
|
|
}
|
|
|
|
class Bar<T> extends Foo<T> {
|
|
Bar(): super._() {}
|
|
}
|
|
|
|
main() {
|
|
new Foo<String>();
|
|
new Foo<String>.far();
|
|
}
|