mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:17:07 +00:00
Update resolveFile2() to accept File instead of String.
Change-Id: I5ded2930457ef963fa3e53895ae3b46ace2b75c5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333700 Reviewed-by: Samuel Rawlins <srawlins@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
dfdadb83b8
commit
c2ef69dff5
21 changed files with 84 additions and 93 deletions
|
@ -347,21 +347,18 @@ void main() {
|
|||
}
|
||||
|
||||
test_locate_PartOfDirective_withName() async {
|
||||
var libPath = convertPath('$testPackageLibPath/lib.dart');
|
||||
var partPath = convertPath('$testPackageLibPath/test.dart');
|
||||
|
||||
newFile(libPath, r'''
|
||||
final libFile = newFile('$testPackageLibPath/lib.dart', r'''
|
||||
library my.lib;
|
||||
part 'test.dart';
|
||||
''');
|
||||
|
||||
newFile(partPath, r'''
|
||||
final partFile = newFile('$testPackageLibPath/test.dart', r'''
|
||||
part of my.lib;
|
||||
''');
|
||||
|
||||
await resolveFile(libPath);
|
||||
await resolveFile(libFile.path);
|
||||
|
||||
await resolveFile2(partPath);
|
||||
await resolveFile2(partFile);
|
||||
var node = findNode.partOf('part of');
|
||||
var element = ElementLocator.locate(node);
|
||||
expect(element, isLibraryElement);
|
||||
|
|
|
@ -2443,7 +2443,7 @@ void func() {
|
|||
// No resolved files yet.
|
||||
_assertResolvedFiles([]);
|
||||
|
||||
await resolveFile2(testFile.path);
|
||||
await resolveFile2(testFile);
|
||||
var result1 = result;
|
||||
|
||||
// The file was resolved.
|
||||
|
@ -2453,7 +2453,7 @@ void func() {
|
|||
expect(fileResolver.cachedResults, contains(testFile.path));
|
||||
|
||||
// Ask again, no changes, not resolved.
|
||||
await resolveFile2(testFile.path);
|
||||
await resolveFile2(testFile);
|
||||
_assertResolvedFiles([]);
|
||||
|
||||
// The same result was returned.
|
||||
|
@ -2464,7 +2464,7 @@ void func() {
|
|||
fileResolver.changeFiles([a_path]);
|
||||
|
||||
// The was a change to a file, no matter which, resolve again.
|
||||
await resolveFile2(testFile.path);
|
||||
await resolveFile2(testFile);
|
||||
_assertResolvedFiles([testFile]);
|
||||
|
||||
// Get should get a new result.
|
||||
|
|
|
@ -30,7 +30,7 @@ import augment 'c.dart';
|
|||
library augment 'b.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
final node = findNode.augmentationImportDirective('c.dart');
|
||||
|
@ -62,7 +62,7 @@ import augment 'c.dart' /*2*/;
|
|||
library augment 'b.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.DUPLICATE_AUGMENTATION_IMPORT, 66, 8),
|
||||
]);
|
||||
|
@ -93,7 +93,7 @@ import augment 'c.dart';
|
|||
|
||||
newFile('$testPackageLibPath/c.dart', '');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION, 41, 8),
|
||||
]);
|
||||
|
@ -122,7 +122,7 @@ library augment 'a.dart';
|
|||
import augment ':net';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.INVALID_URI, 41, 6),
|
||||
]);
|
||||
|
@ -151,7 +151,7 @@ library augment 'a.dart';
|
|||
import augment '${'foo'}.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_WITH_INTERPOLATION, 41, 15),
|
||||
]);
|
||||
|
@ -190,7 +190,7 @@ library augment 'a.dart';
|
|||
import augment 'foo:bar';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 41, 9),
|
||||
]);
|
||||
|
|
|
@ -27,7 +27,7 @@ library augment 'a.dart';
|
|||
|
||||
newFile('$testPackageLibPath/c.dart', '');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
final node = findNode.libraryAugmentation('a.dart');
|
||||
|
|
|
@ -28,7 +28,7 @@ export 'c.dart';
|
|||
|
||||
newFile('$testPackageLibPath/c.dart', '');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
final node = findNode.export('c.dart');
|
||||
|
@ -54,7 +54,7 @@ library augment 'a.dart';
|
|||
export 'c.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 33, 8),
|
||||
]);
|
||||
|
@ -82,7 +82,7 @@ library augment 'a.dart';
|
|||
export ':net';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.INVALID_URI, 33, 6),
|
||||
]);
|
||||
|
@ -110,7 +110,7 @@ library augment 'a.dart';
|
|||
export '${'foo'}.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_WITH_INTERPOLATION, 33, 15),
|
||||
]);
|
||||
|
@ -148,7 +148,7 @@ library augment 'a.dart';
|
|||
export 'foo:bar';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 33, 9),
|
||||
]);
|
||||
|
@ -180,7 +180,7 @@ export 'c.dart';
|
|||
library augment 'b.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, 33, 8),
|
||||
]);
|
||||
|
@ -212,7 +212,7 @@ export 'c.dart';
|
|||
part of my.lib;
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, 33, 8),
|
||||
]);
|
||||
|
@ -244,7 +244,7 @@ export 'c.dart';
|
|||
part of 'b.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, 33, 8),
|
||||
]);
|
||||
|
|
|
@ -27,7 +27,7 @@ import 'c.dart';
|
|||
|
||||
newFile('$testPackageLibPath/c.dart', '');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(WarningCode.UNUSED_IMPORT, 33, 8),
|
||||
]);
|
||||
|
@ -55,7 +55,7 @@ library augment 'a.dart';
|
|||
import 'c.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 33, 8),
|
||||
]);
|
||||
|
@ -83,7 +83,7 @@ library augment 'a.dart';
|
|||
import ':net';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.INVALID_URI, 33, 6),
|
||||
]);
|
||||
|
@ -111,7 +111,7 @@ library augment 'a.dart';
|
|||
import '${'foo'}.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_WITH_INTERPOLATION, 33, 15),
|
||||
]);
|
||||
|
@ -149,7 +149,7 @@ library augment 'a.dart';
|
|||
import 'foo:bar';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 33, 9),
|
||||
]);
|
||||
|
@ -181,7 +181,7 @@ import 'c.dart';
|
|||
library augment 'b.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY, 33, 8),
|
||||
]);
|
||||
|
@ -213,7 +213,7 @@ import 'c.dart';
|
|||
part of my.lib;
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY, 33, 8),
|
||||
]);
|
||||
|
@ -245,7 +245,7 @@ import 'c.dart';
|
|||
part of 'b.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(b.path);
|
||||
await resolveFile2(b);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY, 33, 8),
|
||||
]);
|
||||
|
|
|
@ -216,7 +216,7 @@ const foo = 42;
|
|||
library augment 'test.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
_assertAtFoo42();
|
||||
|
@ -357,7 +357,7 @@ const foo = 42;
|
|||
part of 'test.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
_assertAtFoo42();
|
||||
|
|
|
@ -157,7 +157,7 @@ void foo() {}
|
|||
class A {}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
|
||||
final node = findNode.singleMethodInvocation;
|
||||
assertResolvedNodeText(node, r'''
|
||||
|
|
|
@ -451,11 +451,9 @@ mixin ResolutionTest implements ResourceProviderMixin {
|
|||
|
||||
Future<ResolvedUnitResult> resolveFile(String path);
|
||||
|
||||
/// Resolve the file with the [path] into [result].
|
||||
Future<void> resolveFile2(String path) async {
|
||||
path = convertPath(path);
|
||||
|
||||
result = await resolveFile(path);
|
||||
/// Resolve [file] into [result].
|
||||
Future<void> resolveFile2(File file) async {
|
||||
result = await resolveFile(file.path);
|
||||
|
||||
findNode = FindNode(result.content, result.unit);
|
||||
findElement = FindElement(result.unit);
|
||||
|
@ -463,8 +461,8 @@ mixin ResolutionTest implements ResourceProviderMixin {
|
|||
|
||||
/// Create a new file with the [path] and [content], resolve it into [result].
|
||||
Future<void> resolveFileCode(String path, String content) {
|
||||
newFile(path, content);
|
||||
return resolveFile2(path);
|
||||
final file = newFile(path, content);
|
||||
return resolveFile2(file);
|
||||
}
|
||||
|
||||
/// Put the [code] into the test file, and resolve it.
|
||||
|
@ -474,7 +472,7 @@ mixin ResolutionTest implements ResourceProviderMixin {
|
|||
}
|
||||
|
||||
Future<void> resolveTestFile() {
|
||||
return resolveFile2(testFile.path);
|
||||
return resolveFile2(testFile);
|
||||
}
|
||||
|
||||
/// Choose the type display string, depending on whether the [result] is
|
||||
|
|
|
@ -160,7 +160,7 @@ part 'a.dart';
|
|||
error(CompileTimeErrorCode.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE, 5, 8),
|
||||
]);
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
|
||||
final node = findNode.switchStatement('switch');
|
||||
assertResolvedNodeText(node, r'''
|
||||
|
|
|
@ -31,7 +31,7 @@ import augment 'a.dart';
|
|||
class A {}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
|
||||
nodeTextConfiguration.withInterfaceTypeElements = true;
|
||||
|
||||
|
@ -61,7 +61,7 @@ import augment 'a.dart';
|
|||
mixin M {}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
nodeTextConfiguration.withInterfaceTypeElements = true;
|
||||
|
|
|
@ -172,7 +172,7 @@ class A {
|
|||
await resolveTestFile();
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ class A {
|
|||
await resolveTestFile();
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 55, 3,
|
||||
contextMessages: [message('/home/test/lib/test.dart', 43, 3)]),
|
||||
|
@ -1591,7 +1591,7 @@ mixin A {
|
|||
await resolveTestFile();
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
||||
|
@ -1615,7 +1615,7 @@ mixin A {
|
|||
await resolveTestFile();
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertErrorsInResult([
|
||||
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 55, 3,
|
||||
contextMessages: [message('/home/test/lib/test.dart', 43, 3)]),
|
||||
|
@ -2150,7 +2150,7 @@ class A {}
|
|||
await resolveTestFile();
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
||||
|
@ -2170,7 +2170,7 @@ mixin A {}
|
|||
await resolveTestFile();
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class A implements MapEntry<int, int> {
|
|||
}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await assertNoErrorsInCode(r'''
|
||||
|
|
|
@ -47,7 +47,7 @@ class A implements MapEntry<int, int> {
|
|||
}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await assertErrorsInCode(r'''
|
||||
|
|
|
@ -30,28 +30,28 @@ import 'dart:_internal';
|
|||
}
|
||||
|
||||
test_wasm_fromJs() async {
|
||||
var filePath = _inPackage('js');
|
||||
newFile(filePath, '''
|
||||
var filePath = _pathInPackage('js');
|
||||
final file = newFile(filePath, '''
|
||||
import 'dart:_wasm';
|
||||
''');
|
||||
await resolveFile2(filePath);
|
||||
await resolveFile2(file);
|
||||
assertErrorsInResolvedUnit(result, [
|
||||
error(WarningCode.UNUSED_IMPORT, 7, 12),
|
||||
]);
|
||||
}
|
||||
|
||||
test_wasm_fromUi() async {
|
||||
var filePath = _inPackage('ui');
|
||||
newFile(filePath, '''
|
||||
var filePath = _pathInPackage('ui');
|
||||
final file = newFile(filePath, '''
|
||||
import 'dart:_wasm';
|
||||
''');
|
||||
await resolveFile2(filePath);
|
||||
await resolveFile2(file);
|
||||
assertErrorsInResolvedUnit(result, [
|
||||
error(WarningCode.UNUSED_IMPORT, 7, 12),
|
||||
]);
|
||||
}
|
||||
|
||||
String _inPackage(String packageName) {
|
||||
String _pathInPackage(String packageName) {
|
||||
var packageRoot = '$workspaceRootPath/$packageName';
|
||||
var builder = PackageConfigFileBuilder();
|
||||
builder.add(
|
||||
|
@ -61,6 +61,6 @@ import 'dart:_wasm';
|
|||
);
|
||||
var path = '$packageRoot/.dart_tool/package_config.json';
|
||||
writePackageConfig(path, builder);
|
||||
return convertPath('$packageRoot/lib/$packageName.dart');
|
||||
return '$packageRoot/lib/$packageName.dart';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ import 'package:meta/meta.dart';
|
|||
@internal
|
||||
class A {}
|
||||
''');
|
||||
newFile('$fooPackageRootPath/lib/a.dart', '''
|
||||
final a = newFile('$fooPackageRootPath/lib/a.dart', '''
|
||||
import 'src/a.dart';
|
||||
|
||||
A a = A();
|
||||
''');
|
||||
await resolveFile2('$fooPackageRootPath/lib/a.dart');
|
||||
await resolveFile2(a);
|
||||
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ import 'package:meta/meta.dart';
|
|||
@internal
|
||||
extension type E(int i) {}
|
||||
''');
|
||||
newFile('$fooPackageRootPath/lib/a.dart', '''
|
||||
final a = newFile('$fooPackageRootPath/lib/a.dart', '''
|
||||
import 'src/a.dart';
|
||||
|
||||
E e = E(1);
|
||||
''');
|
||||
await resolveFile2('$fooPackageRootPath/lib/a.dart');
|
||||
await resolveFile2(a);
|
||||
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
|
|
@ -50,57 +50,57 @@ mixin Bar on Foo {}
|
|||
}
|
||||
|
||||
test_withinPackageLibDirectory_OK() async {
|
||||
newFile('$testPackageLibPath/lib1.dart', r'''
|
||||
final lib1 = newFile('$testPackageLibPath/lib1.dart', r'''
|
||||
import 'package:meta/meta.dart';
|
||||
@sealed class Foo {}
|
||||
''');
|
||||
|
||||
newFile('$testPackageLibPath/src/lib2.dart', r'''
|
||||
final lib2 = newFile('$testPackageLibPath/src/lib2.dart', r'''
|
||||
import '../lib1.dart';
|
||||
mixin Bar on Foo {}
|
||||
''');
|
||||
|
||||
await resolveFile2('$testPackageLibPath/lib1.dart');
|
||||
await resolveFile2(lib1);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2('$testPackageLibPath/src/lib2.dart');
|
||||
await resolveFile2(lib2);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
||||
test_withinPackageTestDirectory_OK() async {
|
||||
newFile('$testPackageLibPath/lib1.dart', r'''
|
||||
final lib1 = newFile('$testPackageLibPath/lib1.dart', r'''
|
||||
import 'package:meta/meta.dart';
|
||||
@sealed class Foo {}
|
||||
''');
|
||||
|
||||
newFile('$testPackageRootPath/test/lib2.dart', r'''
|
||||
final lib2 = newFile('$testPackageRootPath/test/lib2.dart', r'''
|
||||
import 'package:test/lib1.dart';
|
||||
mixin Bar on Foo {}
|
||||
''');
|
||||
|
||||
await resolveFile2('$testPackageLibPath/lib1.dart');
|
||||
await resolveFile2(lib1);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2('$testPackageRootPath/test/lib2.dart');
|
||||
await resolveFile2(lib2);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
|
||||
test_withinPart_OK() async {
|
||||
newFile('$testPackageLibPath/lib1.dart', r'''
|
||||
final lib1 = newFile('$testPackageLibPath/lib1.dart', r'''
|
||||
import 'package:meta/meta.dart';
|
||||
part 'part1.dart';
|
||||
@sealed class Foo {}
|
||||
''');
|
||||
|
||||
newFile('$testPackageLibPath/part1.dart', r'''
|
||||
final lib2 = newFile('$testPackageLibPath/part1.dart', r'''
|
||||
part of 'lib1.dart';
|
||||
mixin Bar on Foo {}
|
||||
''');
|
||||
|
||||
await resolveFile2('$testPackageLibPath/lib1.dart');
|
||||
await resolveFile2(lib1);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2('$testPackageLibPath/part1.dart');
|
||||
await resolveFile2(lib2);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,12 +42,11 @@ part 'part.g.dart';
|
|||
part of 'foo.dart';
|
||||
''');
|
||||
|
||||
var path = '$testPackageRootPath/example/foo.dart';
|
||||
newFile(path, '''
|
||||
final foo = newFile('$testPackageRootPath/example/foo.dart', '''
|
||||
part 'foo.g.dart';
|
||||
''');
|
||||
|
||||
await resolveFile2(path);
|
||||
await resolveFile2(foo);
|
||||
assertErrorsInResolvedUnit(result, const []);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ import 'dart:collection';
|
|||
abstract class A implements LinkedListEntry<Never> {}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await assertErrorsInCode(r'''
|
||||
|
@ -115,7 +115,7 @@ import 'dart:collection';
|
|||
abstract class A implements LinkedListEntry<Never> {}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await assertErrorsInCode(r'''
|
||||
|
|
|
@ -55,7 +55,7 @@ class A implements MapEntry<int, int> {
|
|||
}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await assertErrorsInCode(r'''
|
||||
|
@ -113,7 +113,7 @@ class A implements MapEntry<int, int> {
|
|||
}
|
||||
''');
|
||||
|
||||
await resolveFile2(a.path);
|
||||
await resolveFile2(a);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await assertErrorsInCode(r'''
|
||||
|
|
|
@ -193,17 +193,14 @@ mixin Bar5 implements Foo {}
|
|||
}
|
||||
|
||||
test_withinPart_language219() async {
|
||||
var libPath = '$testPackageLibPath/a.dart';
|
||||
var partPath = '$testPackageLibPath/b.dart';
|
||||
|
||||
newFile(libPath, r'''
|
||||
final lib = newFile('$testPackageLibPath/a.dart', r'''
|
||||
// @dart = 2.19
|
||||
import 'package:meta/meta.dart';
|
||||
part 'b.dart';
|
||||
@sealed class Foo {}
|
||||
''');
|
||||
|
||||
newFile(partPath, r'''
|
||||
final part = newFile('$testPackageLibPath/b.dart', r'''
|
||||
// @dart = 2.19
|
||||
part of 'a.dart';
|
||||
class Bar1 extends Foo {}
|
||||
|
@ -212,10 +209,10 @@ class Bar4 = Bar1 with Foo;
|
|||
mixin Bar5 implements Foo {}
|
||||
''');
|
||||
|
||||
await resolveFile2(libPath);
|
||||
await resolveFile2(lib);
|
||||
assertNoErrorsInResult();
|
||||
|
||||
await resolveFile2(partPath);
|
||||
await resolveFile2(part);
|
||||
assertNoErrorsInResult();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue