File tree 4 files changed +12
-1
lines changed 4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -6516,7 +6516,9 @@ class PackageBuilder {
6516
6516
}
6517
6517
}
6518
6518
var sourceKind = await driver.getSourceKind (filePath);
6519
- if (sourceKind == SourceKind .LIBRARY ) {
6519
+ // Allow dart source files with inappropriate suffixes (#1897). Those
6520
+ // do not show up as SourceKind.LIBRARY.
6521
+ if (sourceKind != SourceKind .PART ) {
6520
6522
// Loading libraryElements from part files works, but is painfully slow
6521
6523
// and creates many duplicates.
6522
6524
return await driver.currentSession.getResolvedLibrary (source.fullName);
Original file line number Diff line number Diff line change @@ -675,6 +675,10 @@ void main() {
675
675
expect (anonLib.isDeprecated, isFalse);
676
676
});
677
677
678
+ test ('can be reexported even if the file suffix is not .dart' , () {
679
+ expect (fakeLibrary.allClasses.map ((c) => c.name), contains ('MyClassFromADartFile' ));
680
+ });
681
+
678
682
test ('that is deprecated has a deprecated css class in linkedName' , () {
679
683
expect (isDeprecated.linkedName, contains ('class="deprecated"' ));
680
684
});
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ import 'example.dart';
58
58
import 'mylibpub.dart' as renamedLib;
59
59
import 'mylibpub.dart' as renamedLib2;
60
60
import 'two_exports.dart' show BaseClass;
61
+ export 'src/notadotdartfile' ;
61
62
62
63
// ignore: uri_does_not_exist
63
64
export 'package:test_package_imported/categoryExporting.dart'
Original file line number Diff line number Diff line change
1
+ /// Test importing with an invalid dart file extension. (#1897)
2
+ library test_package.notadotdartfile;
3
+
4
+ class MyClassFromADartFile {}
You can’t perform that action at this time.
0 commit comments