Skip to content

Commit 02c3526

Browse files
committed
Add test for canonicalization edge case
1 parent e92c880 commit 02c3526

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

test/model_test.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,17 @@ void main() {
13891389
});
13901390

13911391
group('Class edge cases', () {
1392+
test('Inherit from private class across private library to public library',
1393+
() {
1394+
Class GadgetExtender = packageGraph.localPublicLibraries
1395+
.firstWhere((l) => l.name == 'gadget_extender')
1396+
.allClasses
1397+
.firstWhere((c) => c.name == 'GadgetExtender');
1398+
Field gadgetGetter =
1399+
GadgetExtender.allFields.firstWhere((f) => f.name == 'gadgetGetter');
1400+
expect(gadgetGetter.isCanonical, isTrue);
1401+
});
1402+
13921403
test(
13931404
'ExecutableElements from private classes and from public interfaces (#1561)',
13941405
() {

test/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import 'package:path/path.dart' as path;
1717
/// The number of public libraries in testing/test_package, minus 2 for
1818
/// the excluded libraries listed in the initializers for _testPackageGraphMemo
1919
/// and minus 1 for the <nodoc> tag in the 'excluded' library.
20-
const int kTestPackagePublicLibraries = 15;
20+
const int kTestPackagePublicLibraries = 16;
2121

2222
final RegExp quotables = RegExp(r'[ "\r\n\$]');
2323
final RegExp observatoryPortRegexp =
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'src/gadget.dart';
6+
7+
class GadgetExtender extends Gadget {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
class _GadgetBase {
6+
int get gadgetGetter => 5;
7+
}
8+
9+
10+
class Gadget extends _GadgetBase {}

0 commit comments

Comments
 (0)