Files
sdk/tests/language/abstract/getter_error_test.dart
Robert Nystrom 1d684cdfb0 Reformat tests/language/abstract.
Change-Id: I18bbc65a798e79fb5e69a9a4134c10a9f6cdbb3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399860
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-12-11 23:31:53 -08:00

28 lines
785 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.
import "package:expect/expect.dart";
// Test to ensure that an abstract getter is not mistaken for a field.
class Foo {
// ^
// [cfe] The non-abstract class 'Foo' is missing implementations for these members:
// Intentionally abstract:
get i;
// [error column 3, length 6]
// [analyzer] COMPILE_TIME_ERROR.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER
}
checkIt(f) {
Expect.throwsNoSuchMethodError(() => f.i = 'hi');
Expect.throwsNoSuchMethodError(() => print(f.i));
Expect.throwsNoSuchMethodError(() => print(f.i()));
}
main() {
checkIt(new Foo());
}