21cc667dca
This adds support for having a final field and an external constructor without error, assuming that the external constructor initializes the final field. This supports the inline class with external members use case. Change-Id: I33b78275e967636ed0697d17f7921e9eee30401b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279095 Reviewed-by: Srujan Gaddam <srujzs@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
44 lines
675 B
Dart
44 lines
675 B
Dart
// Copyright (c) 2023, 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.
|
|
|
|
abstract class A {}
|
|
|
|
class B {
|
|
final A a;
|
|
|
|
external B(A a); // Ok
|
|
}
|
|
|
|
class C {
|
|
final A a1;
|
|
final A a2;
|
|
|
|
external C(); // Ok
|
|
C.named(this.a1, this.as2); // Ok
|
|
}
|
|
|
|
class D {
|
|
final A a1;
|
|
final A a2;
|
|
|
|
external D(); // Ok
|
|
D.named(this.a1); // Error
|
|
}
|
|
|
|
class E {
|
|
final A a1;
|
|
final A a2;
|
|
|
|
E(this.a2); // Error
|
|
external E.named(); // Ok
|
|
}
|
|
|
|
class F {
|
|
final A a1;
|
|
final A a2;
|
|
|
|
F(this.a1, this.as2); // Ok
|
|
external F.named(); // Ok
|
|
}
|