mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:49:47 +00:00
d244eeb84c
The "@compile-error" comment is an old not-great way of defining static error tests. See: https://github.com/dart-lang/sdk/issues/45634 Change-Id: I3e10209e78e48893d2f2df7f8af7963d319efd9f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296405 Reviewed-by: Jake Macdonald <jakemac@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com>
22 lines
588 B
Dart
22 lines
588 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.
|
|
|
|
// It is a static compile time error if a method m1 overrides a method m2 and has a
|
|
// different number of required parameters.
|
|
|
|
class A {
|
|
foo() {}
|
|
}
|
|
|
|
class B extends A {
|
|
foo(a) {}
|
|
//^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
|
|
// [cfe] The method 'B.foo' has more required arguments than those of overridden method 'A.foo'.
|
|
}
|
|
|
|
main() {
|
|
new B().foo(42);
|
|
}
|