mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:56:57 +00:00
de984e58cb
Implements static semantics for redirecting factories (c.f. §10.6.2 of the specification). This CL does not include inference of actual type arguments on redirectees, that is it does not handle the case where type arguments have been omitted on the redirectee as in this following example program: class A<T> { factory A() = B; } class B<T> implements A<T> { B(); } Closes https://github.com/dart-lang/sdk/issues/32988. Also resolves the second part of https://github.com/dart-lang/sdk/issues/30579. Can possibly also close https://github.com/dart-lang/sdk/issues/11578. Change-Id: I5f1fb60510ba6cdc917321239819c1f817b5b85d Reviewed-on: https://dart-review.googlesource.com/74580 Commit-Queue: Daniel Hillerström <hillerstrom@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
19 lines
606 B
Dart
19 lines
606 B
Dart
// Copyright (c) 2012, 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.
|
|
// Dart test to verify incompatible constructor types
|
|
|
|
abstract class Point {
|
|
factory Point(int x, int y) = PointImplementation; //# 01: ok
|
|
factory Point(x, y) = PointImplementation; //# 02: compile-time error
|
|
}
|
|
|
|
class PointImplementation implements Point {
|
|
PointImplementation(int x, int y) {}
|
|
}
|
|
|
|
main() {
|
|
new Point(1, 2); //# 01: continued
|
|
new Point(1, 2); //# 02: continued
|
|
}
|