438e0ebb35
TEST=language/constructor/external_constructor_test Fixes https://github.com/dart-lang/sdk/issues/49912 Fixes https://github.com/dart-lang/sdk/issues/28565 Change-Id: If01fd39c3195afe059da46bf26ab5bcf158933a3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258281 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
29 lines
641 B
Dart
29 lines
641 B
Dart
// Copyright (c) 2022, 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.
|
|
|
|
// Test for external constructors.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class A {
|
|
final int field;
|
|
|
|
const A(this.field);
|
|
external const A.foo(dynamic arg);
|
|
}
|
|
|
|
class B extends A {
|
|
const B(int abc) : super(abc);
|
|
B.foo(dynamic arg) : super.foo(arg);
|
|
}
|
|
|
|
void main() {
|
|
Expect.throws(() {
|
|
A.foo(42);
|
|
}, (e) => e is NoSuchMethodError);
|
|
Expect.throws(() {
|
|
B.foo(42);
|
|
}, (e) => e is NoSuchMethodError);
|
|
}
|