misc(pkg/analyzer): update to latest pkg:matcher API

Change-Id: I42a5c41394226f6ddc9c0608c6d688ae683ffdea
Reviewed-on: https://dart-review.googlesource.com/62680
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Kevin Moore 2018-06-27 19:29:20 +00:00 committed by commit-bot@chromium.org
parent d2bde00d9d
commit cb4a19b5fc
40 changed files with 564 additions and 571 deletions

4
DEPS
View file

@ -97,7 +97,7 @@ vars = {
"linter_tag": "0.1.55",
"logging_tag": "0.11.3+1",
"markdown_tag": "2.0.0",
"matcher_tag": "0.12.1+4",
"matcher_tag": "0.12.3",
"mime_tag": "0.9.6",
"mockito_tag": "d39ac507483b9891165e422ec98d9fb480037c8b",
"mustache4dart_tag" : "v2.1.2",
@ -131,7 +131,7 @@ vars = {
"test_process_tag": "1.0.1",
"term_glyph_tag": "1.0.0",
"test_reflective_loader_tag": "0.1.4",
"test_tag": "0.12.38",
"test_tag": "1.0.0",
"tuple_tag": "v1.0.1",
"typed_data_tag": "1.1.3",
"usage_tag": "3.3.0",

View file

@ -41,7 +41,7 @@ class CancelableCompleterTests {
.then((_) {
fail('Expected error completion');
}, onError: (error) {
expect(error, new isInstanceOf<FutureCanceledError>());
expect(error, new TypeMatcher<FutureCanceledError>());
// And make sure nothing else happens.
})
.then((_) => pumpEventQueue())
@ -57,7 +57,7 @@ class CancelableCompleterTests {
fail('Expected error completion');
}, onError: (error) {
expect(callbackInvoked, isFalse);
expect(error, new isInstanceOf<FutureCanceledError>());
expect(error, new TypeMatcher<FutureCanceledError>());
callbackInvoked = true;
});
expect(cancelCount, 0);
@ -106,7 +106,7 @@ class CancelableCompleterTests {
fail('Expected error completion');
}, onError: (error) {
expect(callbackInvoked, isFalse);
expect(error, new isInstanceOf<FutureCanceledError>());
expect(error, new TypeMatcher<FutureCanceledError>());
callbackInvoked = true;
});
// The callback should be deferred to a microtask.
@ -134,7 +134,7 @@ class CancelableCompleterTests {
.then((_) {
fail('Expected error completion');
}, onError: (error) {
expect(error, new isInstanceOf<FutureCanceledError>());
expect(error, new TypeMatcher<FutureCanceledError>());
// And make sure nothing else happens.
})
.then((_) => pumpEventQueue())
@ -235,7 +235,7 @@ class CancelableCompleterTests {
.then((_) {
fail('Expected error completion');
}, onError: (error) {
expect(error, new isInstanceOf<FutureCanceledError>());
expect(error, new TypeMatcher<FutureCanceledError>());
// And make sure nothing else happens.
})
.then((_) => pumpEventQueue())

View file

@ -871,7 +871,7 @@ class C {
FunctionElement initializerElement = fieldElement.initializer;
expect(initializerElement, isNotNull);
expect(initializerElement.hasImplicitReturnType, isTrue);
expect(initializer.element, new isInstanceOf<FunctionElement>());
expect(initializer.element, new TypeMatcher<FunctionElement>());
LocalVariableElement variableElement = variable.element;
expect(variableElement.hasImplicitType, isTrue);
expect(variableElement.isConst, isFalse);
@ -946,7 +946,7 @@ class C {
List<TopLevelVariableElement> variables = holder.topLevelVariables;
expect(variables, hasLength(1));
TopLevelVariableElement variable = variables[0];
expect(variable, new isInstanceOf<ConstTopLevelVariableElementImpl>());
expect(variable, new TypeMatcher<ConstTopLevelVariableElementImpl>());
expect(variable.initializer, isNotNull);
expect(variable.initializer.type, isNotNull);
expect(variable.initializer.hasImplicitReturnType, isTrue);
@ -1308,7 +1308,7 @@ abstract class _ApiElementBuilderTestMixin {
void test_metadata_visitExportDirective() {
buildElementsForText('@a export "foo.dart";');
expect(compilationUnit.directives[0], new isInstanceOf<ExportDirective>());
expect(compilationUnit.directives[0], new TypeMatcher<ExportDirective>());
ExportDirective exportDirective = compilationUnit.directives[0];
checkAnnotation(exportDirective.metadata);
}
@ -1354,14 +1354,14 @@ abstract class _ApiElementBuilderTestMixin {
void test_metadata_visitImportDirective() {
buildElementsForText('@a import "foo.dart";');
expect(compilationUnit.directives[0], new isInstanceOf<ImportDirective>());
expect(compilationUnit.directives[0], new TypeMatcher<ImportDirective>());
ImportDirective importDirective = compilationUnit.directives[0];
checkAnnotation(importDirective.metadata);
}
void test_metadata_visitLibraryDirective() {
buildElementsForText('@a library L;');
expect(compilationUnit.directives[0], new isInstanceOf<LibraryDirective>());
expect(compilationUnit.directives[0], new TypeMatcher<LibraryDirective>());
LibraryDirective libraryDirective = compilationUnit.directives[0];
checkAnnotation(libraryDirective.metadata);
}
@ -1390,7 +1390,7 @@ abstract class _ApiElementBuilderTestMixin {
void test_metadata_visitPartDirective() {
buildElementsForText('@a part "foo.dart";');
expect(compilationUnit.directives[0], new isInstanceOf<PartDirective>());
expect(compilationUnit.directives[0], new TypeMatcher<PartDirective>());
PartDirective partDirective = compilationUnit.directives[0];
checkAnnotation(partDirective.metadata);
}
@ -1399,7 +1399,7 @@ abstract class _ApiElementBuilderTestMixin {
// We don't build ElementAnnotation objects for `part of` directives, since
// analyzer ignores them in favor of annotations on the library directive.
buildElementsForText('@a part of L;');
expect(compilationUnit.directives[0], new isInstanceOf<PartOfDirective>());
expect(compilationUnit.directives[0], new TypeMatcher<PartOfDirective>());
PartOfDirective partOfDirective = compilationUnit.directives[0];
expect(partOfDirective.metadata, hasLength(1));
expect(partOfDirective.metadata[0].elementAnnotation, isNull);
@ -2586,10 +2586,10 @@ abstract class _BaseTest extends ParserTestCase {
*/
void checkAnnotation(NodeList<Annotation> metadata) {
expect(metadata, hasLength(1));
expect(metadata[0], new isInstanceOf<AnnotationImpl>());
expect(metadata[0], new TypeMatcher<AnnotationImpl>());
AnnotationImpl annotation = metadata[0];
expect(annotation.elementAnnotation,
new isInstanceOf<ElementAnnotationImpl>());
new TypeMatcher<ElementAnnotationImpl>());
ElementAnnotationImpl elementAnnotation = annotation.elementAnnotation;
expect(elementAnnotation.element, isNull); // Not yet resolved
expect(elementAnnotation.compilationUnit, isNotNull);
@ -2602,7 +2602,7 @@ abstract class _BaseTest extends ParserTestCase {
*/
void checkMetadata(Element element) {
expect(element.metadata, hasLength(1));
expect(element.metadata[0], new isInstanceOf<ElementAnnotationImpl>());
expect(element.metadata[0], new TypeMatcher<ElementAnnotationImpl>());
ElementAnnotationImpl elementAnnotation = element.metadata[0];
expect(elementAnnotation.element, isNull); // Not yet resolved
expect(elementAnnotation.compilationUnit, isNotNull);

View file

@ -28,9 +28,9 @@ main() {
});
}
var _isFile = new isInstanceOf<File>();
var _isFileSystemException = new isInstanceOf<FileSystemException>();
var _isFolder = new isInstanceOf<Folder>();
final _isFile = new TypeMatcher<File>();
final _isFileSystemException = new TypeMatcher<FileSystemException>();
final _isFolder = new TypeMatcher<Folder>();
@reflectiveTest
class FileSystemExceptionTest {
@ -158,7 +158,7 @@ class FileTest {
provider.newFile(path, 'content');
File file = provider.getResource(path);
Resource parent = file.parent;
expect(parent, new isInstanceOf<Folder>());
expect(parent, _isFolder);
expect(parent.path, equals(provider.convertPath('/foo/bar')));
}
@ -473,10 +473,10 @@ class FolderTest {
void test_parent() {
Resource parent1 = folder.parent;
expect(parent1, new isInstanceOf<Folder>());
expect(parent1, _isFolder);
expect(parent1.path, equals(provider.convertPath('/foo')));
Resource parent2 = parent1.parent;
expect(parent2, new isInstanceOf<Folder>());
expect(parent2, _isFolder);
expect(parent2.path, equals(provider.convertPath('/')));
expect(parent2.parent, isNull);
}
@ -682,7 +682,7 @@ class MemoryResourceProviderTest {
expect(() {
provider.deleteFile(path);
}, throwsArgumentError);
expect(provider.getResource(path), new isInstanceOf<Folder>());
expect(provider.getResource(path), _isFolder);
}
void test_deleteFile_notExistent() {
@ -699,7 +699,7 @@ class MemoryResourceProviderTest {
String path = provider.convertPath('/my/file');
provider.newFile(path, 'contents');
Resource file = provider.getResource(path);
expect(file, new isInstanceOf<File>());
expect(file, _isFile);
expect(file.exists, isTrue);
provider.deleteFile(path);
expect(file.exists, isFalse);
@ -746,7 +746,7 @@ class MemoryResourceProviderTest {
expect(() {
provider.modifyFile(path, 'contents');
}, throwsArgumentError);
expect(provider.getResource(path), new isInstanceOf<Folder>());
expect(provider.getResource(path), _isFolder);
}
void test_modifyFile_notExistent() {
@ -763,7 +763,7 @@ class MemoryResourceProviderTest {
String path = provider.convertPath('/my/file');
provider.newFile(path, 'contents 1');
Resource file = provider.getResource(path);
expect(file, new isInstanceOf<File>());
expect(file, _isFile);
Source source = (file as File).createSource();
expect(source.contents.data, equals('contents 1'));
provider.modifyFile(path, 'contents 2');

View file

@ -20,9 +20,9 @@ main() {
});
}
var _isFile = new isInstanceOf<File>();
var _isFileSystemException = new isInstanceOf<FileSystemException>();
var _isFolder = new isInstanceOf<Folder>();
final _isFile = new TypeMatcher<File>();
final _isFileSystemException = new TypeMatcher<FileSystemException>();
final _isFolder = new TypeMatcher<Folder>();
@reflectiveTest
class FileTest extends OverlayTestSupport {
@ -462,7 +462,7 @@ class FolderTest extends OverlayTestSupport {
test_delete_notExisting() {
Folder folder = _folder(exists: false);
expect(folder.exists, isFalse);
expect(() => folder.delete(), throwsA(new isInstanceOf<ArgumentError>()));
expect(() => folder.delete(), throwsA(new TypeMatcher<ArgumentError>()));
}
test_exists_false() {

View file

@ -26,9 +26,9 @@ main() {
}
}
var _isFile = new isInstanceOf<File>();
var _isFileSystemException = new isInstanceOf<FileSystemException>();
var _isFolder = new isInstanceOf<Folder>();
final _isFile = new TypeMatcher<File>();
final _isFileSystemException = new TypeMatcher<FileSystemException>();
final _isFolder = new TypeMatcher<Folder>();
String join(String part1, [String part2, String part3]) =>
pathos.join(part1, part2, part3);
@ -137,7 +137,7 @@ class FileTest extends _BaseTest {
void test_parent() {
Resource parent = file.parent;
expect(parent, new isInstanceOf<Folder>());
expect(parent, _isFolder);
expect(parent.path, equals(tempPath));
}
@ -457,7 +457,7 @@ class FolderTest extends _BaseTest {
void test_parent() {
Resource parent = folder.parent;
expect(parent, new isInstanceOf<Folder>());
expect(parent, _isFolder);
expect(parent.path, equals(tempPath));
// Since the OS is in control of where tempPath is, we don't know how
@ -469,7 +469,7 @@ class FolderTest extends _BaseTest {
if (grandParent == null) {
break;
}
expect(grandParent, new isInstanceOf<Folder>());
expect(grandParent, _isFolder);
expect(grandParent.path.length, lessThan(parent.path.length));
parent = grandParent;
}

View file

@ -600,7 +600,7 @@ var v = (() {
CompilationUnit unit2 = _cloneResolveUnit(unit);
SimpleIdentifier getterName = _findSimpleIdentifier(unit2, code, 'zzz =>');
// Local getters are not allowed, so a FunctionElement is created.
expect(getterName.staticElement, new isInstanceOf<FunctionElement>());
expect(getterName.staticElement, new TypeMatcher<FunctionElement>());
}
test_invalid_functionDeclaration_setter_inFunction() async {
@ -616,7 +616,7 @@ var v = (() {
CompilationUnit unit2 = _cloneResolveUnit(unit);
SimpleIdentifier setterName = _findSimpleIdentifier(unit2, code, 'zzz(x)');
// Local getters are not allowed, so a FunctionElement is created.
expect(setterName.staticElement, new isInstanceOf<FunctionElement>());
expect(setterName.staticElement, new TypeMatcher<FunctionElement>());
}
test_visitExportDirective_notExistingSource() async {

View file

@ -38,9 +38,9 @@ main() {
});
}
const _isClassElement = const isInstanceOf<ClassElement>();
const _isClassElement = const TypeMatcher<ClassElement>();
const _isConstructorElement = const isInstanceOf<ConstructorElement>();
const _isConstructorElement = const TypeMatcher<ConstructorElement>();
/// Wrapper around the test package's `fail` function.
///
@ -64,10 +64,10 @@ class A {
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<ClassElement>());
expect(name1.staticElement, new TypeMatcher<ClassElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'A');
expect(name2, isNotNull);
expect(name2.staticElement, new isInstanceOf<ConstructorElement>());
expect(name2.staticElement, new TypeMatcher<ConstructorElement>());
expect(
resolutionMap.staticElementForIdentifier(name2).displayName, 'named');
expect(name3, isNull);
@ -94,13 +94,13 @@ class A {
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<PrefixElement>());
expect(name1.staticElement, new TypeMatcher<PrefixElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
expect(name2, isNotNull);
expect(name2.staticElement, new isInstanceOf<ClassElement>());
expect(name2.staticElement, new TypeMatcher<ClassElement>());
expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'A');
expect(name3, isNotNull);
expect(name3.staticElement, new isInstanceOf<ConstructorElement>());
expect(name3.staticElement, new TypeMatcher<ConstructorElement>());
expect(
resolutionMap.staticElementForIdentifier(name3).displayName, 'named');
if (annotationElement is ConstructorElement) {
@ -126,13 +126,13 @@ class A {
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<PrefixElement>());
expect(name1.staticElement, new TypeMatcher<PrefixElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
expect(name2, isNotNull);
expect(name2.staticElement, new isInstanceOf<ClassElement>());
expect(name2.staticElement, new TypeMatcher<ClassElement>());
expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'A');
expect(name3, isNotNull);
expect(name3.staticElement, new isInstanceOf<PropertyAccessorElement>());
expect(name3.staticElement, new TypeMatcher<PropertyAccessorElement>());
expect(resolutionMap.staticElementForIdentifier(name3).displayName, 'V');
if (annotationElement is PropertyAccessorElement) {
expect(annotationElement, same(name3.staticElement));
@ -156,10 +156,10 @@ class A {
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<PrefixElement>());
expect(name1.staticElement, new TypeMatcher<PrefixElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
expect(name2, isNotNull);
expect(name2.staticElement, new isInstanceOf<ClassElement>());
expect(name2.staticElement, new TypeMatcher<ClassElement>());
expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'A');
expect(name3, isNull);
if (annotationElement is ConstructorElement) {
@ -184,10 +184,10 @@ class A {
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<ClassElement>());
expect(name1.staticElement, new TypeMatcher<ClassElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'A');
expect(name2, isNotNull);
expect(name2.staticElement, new isInstanceOf<PropertyAccessorElement>());
expect(name2.staticElement, new TypeMatcher<PropertyAccessorElement>());
expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'V');
expect(name3, isNull);
if (annotationElement is PropertyAccessorElement) {
@ -212,7 +212,7 @@ class A {
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<ClassElement>());
expect(name1.staticElement, new TypeMatcher<ClassElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'A');
expect(name2, isNull);
expect(name3, isNull);
@ -236,14 +236,14 @@ const V = 0;
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<PropertyAccessorElement>());
expect(name1.staticElement, new TypeMatcher<PropertyAccessorElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'V');
expect(name2, isNull);
expect(name3, isNull);
if (annotationElement is PropertyAccessorElement) {
expect(annotationElement, same(name1.staticElement));
expect(annotationElement.enclosingElement,
new isInstanceOf<CompilationUnitElement>());
new TypeMatcher<CompilationUnitElement>());
expect(annotationElement.displayName, 'V');
} else {
fail('Expected "annotationElement" is PropertyAccessorElement, '
@ -261,16 +261,16 @@ const V = 0;
SimpleIdentifier name3,
Element annotationElement) {
expect(name1, isNotNull);
expect(name1.staticElement, new isInstanceOf<PrefixElement>());
expect(name1.staticElement, new TypeMatcher<PrefixElement>());
expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
expect(name2, isNotNull);
expect(name2.staticElement, new isInstanceOf<PropertyAccessorElement>());
expect(name2.staticElement, new TypeMatcher<PropertyAccessorElement>());
expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'V');
expect(name3, isNull);
if (annotationElement is PropertyAccessorElement) {
expect(annotationElement, same(name2.staticElement));
expect(annotationElement.enclosingElement,
new isInstanceOf<CompilationUnitElement>());
new TypeMatcher<CompilationUnitElement>());
expect(annotationElement.displayName, 'V');
} else {
fail('Expected "annotationElement" is PropertyAccessorElement, '
@ -1623,7 +1623,7 @@ main() {
MethodInvocation invocation = statement.expression;
SimpleIdentifier prefix = invocation.target;
expect(prefix.staticElement, new isInstanceOf<PrefixElement>());
expect(prefix.staticElement, new TypeMatcher<PrefixElement>());
expect(invocation.methodName.name, 'max');
}

View file

@ -1003,7 +1003,7 @@ abstract class A {
{
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, "p]");
expect(ref.staticElement, new isInstanceOf<ParameterElement>());
expect(ref.staticElement, new TypeMatcher<ParameterElement>());
}
}
@ -1056,7 +1056,7 @@ foo(int p) {
CompilationUnit unit = analysisResult.unit;
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, 'p]');
expect(ref.staticElement, new isInstanceOf<ParameterElement>());
expect(ref.staticElement, new TypeMatcher<ParameterElement>());
}
test_commentReference_beforeFunction_expressionBody() async {
@ -1070,7 +1070,7 @@ foo(int p) => null;''';
CompilationUnit unit = analysisResult.unit;
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, 'p]');
expect(ref.staticElement, new isInstanceOf<ParameterElement>());
expect(ref.staticElement, new TypeMatcher<ParameterElement>());
}
test_commentReference_beforeFunctionTypeAlias() async {
@ -1085,7 +1085,7 @@ typedef Foo(int p);
CompilationUnit unit = analysisResult.unit;
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, 'p]');
expect(ref.staticElement, new isInstanceOf<ParameterElement>());
expect(ref.staticElement, new TypeMatcher<ParameterElement>());
}
test_commentReference_beforeGenericTypeAlias() async {
@ -1105,9 +1105,9 @@ typedef Foo<T> = Function<S>(int p);
.staticElement;
}
expect(getElement('T]'), new isInstanceOf<TypeParameterElement>());
expect(getElement('S]'), new isInstanceOf<TypeParameterElement>());
expect(getElement('p]'), new isInstanceOf<ParameterElement>());
expect(getElement('T]'), new TypeMatcher<TypeParameterElement>());
expect(getElement('S]'), new TypeMatcher<TypeParameterElement>());
expect(getElement('p]'), new TypeMatcher<ParameterElement>());
}
test_commentReference_beforeGetter() async {
@ -1148,7 +1148,7 @@ abstract class A {
assertIsParameter(String search) {
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, search);
expect(ref.staticElement, new isInstanceOf<ParameterElement>());
expect(ref.staticElement, new TypeMatcher<ParameterElement>());
}
assertIsParameter('p1');
@ -1172,7 +1172,7 @@ class A {
CompilationUnit unit = analysisResult.unit;
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, 'foo]');
expect(ref.staticElement, new isInstanceOf<MethodElement>());
expect(ref.staticElement, new TypeMatcher<MethodElement>());
}
test_commentReference_setter() async {
@ -1195,12 +1195,12 @@ class B extends A {
{
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, "x] in A");
expect(ref.staticElement, new isInstanceOf<PropertyAccessorElement>());
expect(ref.staticElement, new TypeMatcher<PropertyAccessorElement>());
}
{
SimpleIdentifier ref =
EngineTestCase.findSimpleIdentifier(unit, code, 'x] in B');
expect(ref.staticElement, new isInstanceOf<PropertyAccessorElement>());
expect(ref.staticElement, new TypeMatcher<PropertyAccessorElement>());
}
}

View file

@ -68,7 +68,7 @@ class DependencyFinderTest extends ResolverTestCase {
DependencyFinder finder = new DependencyFinder(resourceProvider);
expect(() => finder.transitiveDependenciesFor(packageMap, packagePath),
throwsA(new isInstanceOf<AnalysisException>()));
throwsA(new TypeMatcher<AnalysisException>()));
}
void test_transitiveDependenciesFor_noDependencies() {

View file

@ -1060,7 +1060,7 @@ class A native 'something' {
ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION,
]);
}
expect(member, new isInstanceOf<ClassDeclaration>());
expect(member, new TypeMatcher<ClassDeclaration>());
ClassDeclaration declaration = member;
expect(declaration.nativeClause, isNotNull);
expect(declaration.nativeClause.nativeKeyword, isNotNull);

File diff suppressed because it is too large Load diff

View file

@ -654,7 +654,7 @@ class A {
ConstructorDeclaration constructor = classA.members[2];
ParameterElement paramElement =
constructor.parameters.parameters[0].element;
expect(paramElement, new isInstanceOf<FieldFormalParameterElement>());
expect(paramElement, new TypeMatcher<FieldFormalParameterElement>());
expect((paramElement as FieldFormalParameterElement).field,
field.fields.variables[0].element);
ConstructorFieldInitializer initializer = constructor.initializers[0];

View file

@ -133,7 +133,7 @@ unittest:${_u('/home/somebody/.pub/cache/unittest-0.9.9/lib/')}
expect(
() => resolvePackageUri(
config: 'foo:<:&%>', uri: 'package:foo/bar.dart'),
throwsA(new isInstanceOf<FormatException>()));
throwsA(new TypeMatcher<FormatException>()));
});
test('Valid URI that cannot be further resolved', () {
String uri = resolvePackageUri(

View file

@ -92,7 +92,7 @@ main() {
""";
await resolveTestUnit(code);
// "foo" should be resolved to the "Foo" type
expectIdentifierType("foo();", new isInstanceOf<FunctionType>());
expectIdentifierType("foo();", new TypeMatcher<FunctionType>());
}
test_MethodInvocation_nameType_parameter_FunctionTypeAlias() async {
@ -104,7 +104,7 @@ main(Foo foo) {
""";
await resolveTestUnit(code);
// "foo" should be resolved to the "Foo" type
expectIdentifierType("foo();", new isInstanceOf<FunctionType>());
expectIdentifierType("foo();", new TypeMatcher<FunctionType>());
}
test_MethodInvocation_nameType_parameter_propagatedType() async {

View file

@ -1236,7 +1236,7 @@ library l;''');
}
// next tokens
if (original is CommentToken) {
expect(clone, new isInstanceOf<CommentToken>());
expect(clone, new TypeMatcher<CommentToken>());
skipOriginalComment = original;
skipCloneComment = clone;
original = (original as CommentToken).parent;

View file

@ -82,7 +82,7 @@ strong-mode: true
var optionsProvider = new AnalysisOptionsProvider();
expect(() => optionsProvider.getOptionsFromString(src),
throwsA(new isInstanceOf<OptionsFormatException>()));
throwsA(new TypeMatcher<OptionsFormatException>()));
});
test('test_bad_yaml (2)', () {

View file

@ -61,7 +61,7 @@ class PubPackageMapProviderTest {
expect(result, hasLength(1));
expect(result.keys, contains(packageName));
expect(result[packageName], hasLength(1));
expect(result[packageName][0], new isInstanceOf<Folder>());
expect(result[packageName][0], new TypeMatcher<Folder>());
expect(result[packageName][0].path, equals(folderPath));
}
@ -91,7 +91,7 @@ class PubPackageMapProviderTest {
expect(result, hasLength(1));
expect(result.keys, contains(packageName));
expect(result[packageName], hasLength(1));
expect(result[packageName][0], new isInstanceOf<Folder>());
expect(result[packageName][0], new TypeMatcher<Folder>());
expect(result[packageName][0].path, equals(folderPath));
}
@ -110,7 +110,7 @@ class PubPackageMapProviderTest {
expect(result.keys, contains(packageName));
expect(result[packageName], hasLength(2));
for (int i = 0; i < 2; i++) {
expect(result[packageName][i], new isInstanceOf<Folder>());
expect(result[packageName][i], new TypeMatcher<Folder>());
expect(result[packageName][i].path, isIn([folderPath1, folderPath2]));
}
}

View file

@ -103,7 +103,7 @@ class AbstractContextTest {
* Compute the given [result] for the given [target].
*/
void computeResult(AnalysisTarget target, ResultDescriptor result,
{isInstanceOf matcher: null}) {
{Matcher matcher: null}) {
oldOutputs = outputs;
task = analysisDriver.computeResult(target, result);
if (matcher == null) {

View file

@ -880,7 +880,7 @@ main() {}''');
future.then((CompilationUnit unit) {
fail('Future should have completed with error');
}, onError: (error) {
expect(error, new isInstanceOf<AnalysisNotScheduledError>());
expect(error, new TypeMatcher<AnalysisNotScheduledError>());
completed = true;
});
return pumpEventQueue().then((_) {
@ -900,7 +900,7 @@ main() {}''');
future.then((CompilationUnit unit) {
fail('Future should have been canceled');
}, onError: (error) {
expect(error, new isInstanceOf<FutureCanceledError>());
expect(error, new TypeMatcher<FutureCanceledError>());
completed = true;
});
expect(completed, isFalse);
@ -925,7 +925,7 @@ main() {}''');
future.then((CompilationUnit unit) {
fail('Future should have completed with error');
}, onError: (error) {
expect(error, new isInstanceOf<AnalysisNotScheduledError>());
expect(error, new TypeMatcher<AnalysisNotScheduledError>());
completed = true;
});
expect(completed, isFalse);

View file

@ -23,7 +23,7 @@ main() {
});
}
Matcher isUndefinedType = new isInstanceOf<UndefinedTypeImpl>();
final isUndefinedType = new TypeMatcher<UndefinedTypeImpl>();
/**
* Integration tests for resolution.

View file

@ -1739,7 +1739,7 @@ class C {}
ClassDeclaration c = result.unit.declarations[1] as ClassDeclaration;
Annotation a = c.metadata[0];
expect(a.name.name, 'fff');
expect(a.name.staticElement, new isInstanceOf<FunctionElement>());
expect(a.name.staticElement, new TypeMatcher<FunctionElement>());
}
test_getResult_invalidUri() async {

View file

@ -30,7 +30,7 @@ class ExpressionImplTest extends ParserTestCase {
expect(index >= 0, isTrue);
NodeLocator visitor = new NodeLocator(index);
AstNodeImpl node = visitor.searchWithin(testUnit);
expect(node, new isInstanceOf<ExpressionImpl>());
expect(node, new TypeMatcher<ExpressionImpl>());
expect((node as ExpressionImpl).inConstantContext,
isInContext ? isTrue : isFalse);
}

View file

@ -21,7 +21,7 @@ main() {
const int LONG_MAX_VALUE = 0x7fffffffffffffff;
final Matcher throwsEvaluationException =
throwsA(new isInstanceOf<EvaluationException>());
throwsA(new TypeMatcher<EvaluationException>());
@reflectiveTest
class DartObjectImplTest extends EngineTestCase {

View file

@ -1264,7 +1264,7 @@ class FunctionTypeImplTest extends EngineTestCase {
v.function.returnType = u.type;
// We don't care whether the types compare equal or not. We just need the
// computation to terminate.
expect(s.type == u.type, new isInstanceOf<bool>());
expect(s.type == u.type, new TypeMatcher<bool>());
}
void test_getElement() {
@ -1413,7 +1413,7 @@ class FunctionTypeImplTest extends EngineTestCase {
t.function.returnType = s.type;
// We don't care what the hash code is. We just need its computation to
// terminate.
expect(t.type.hashCode, new isInstanceOf<int>());
expect(t.type.hashCode, new TypeMatcher<int>());
}
void test_isAssignableTo_normalAndPositionalArgs() {

View file

@ -260,7 +260,7 @@ class FunctionTypeTest {
var fReturnArgReturn = (fReturnArg as FunctionType).returnType;
expect(fReturnArgReturn.element, same(listType.element));
expect((fReturnArgReturn as InterfaceType).typeArguments[0],
new isInstanceOf<CircularFunctionTypeImpl>());
new TypeMatcher<CircularFunctionTypeImpl>());
basicChecks(f.function.type,
element: same(f.function), displayName: isNotNull, returnType: fReturn);
if (bug_33302_fixed) {
@ -282,7 +282,7 @@ class FunctionTypeTest {
var gReturnArgReturn = (gReturnArg as FunctionType).returnType;
expect(gReturnArgReturn.element, same(listType.element));
expect((gReturnArgReturn as InterfaceType).typeArguments[0],
new isInstanceOf<CircularFunctionTypeImpl>());
new TypeMatcher<CircularFunctionTypeImpl>());
basicChecks(g.function.type,
element: same(g.function), displayName: isNotNull, returnType: gReturn);
if (bug_33302_fixed) {
@ -310,7 +310,7 @@ class FunctionTypeTest {
var fParamType = f.type.normalParameterTypes[0];
expect(fParamType.element, same(g.function));
expect((fParamType as FunctionType).normalParameterTypes[0],
new isInstanceOf<CircularFunctionTypeImpl>());
new TypeMatcher<CircularFunctionTypeImpl>());
basicChecks(f.function.type,
element: same(f.function),
displayName: isNotNull,
@ -334,7 +334,7 @@ class FunctionTypeTest {
var gParamType = g.type.normalParameterTypes[0];
expect(gParamType.element, same(f.function));
expect((gParamType as FunctionType).normalParameterTypes[0],
new isInstanceOf<CircularFunctionTypeImpl>());
new TypeMatcher<CircularFunctionTypeImpl>());
basicChecks(g.function.type,
element: same(g.function),
displayName: isNotNull,
@ -361,7 +361,7 @@ class FunctionTypeTest {
var fReturn = f.type.returnType;
expect(fReturn.element, same(g.function));
expect((fReturn as FunctionType).returnType,
new isInstanceOf<CircularFunctionTypeImpl>());
new TypeMatcher<CircularFunctionTypeImpl>());
basicChecks(f.function.type,
element: same(f.function), displayName: isNotNull, returnType: fReturn);
if (bug_33302_fixed) {
@ -374,7 +374,7 @@ class FunctionTypeTest {
var gReturn = g.type.returnType;
expect(gReturn.element, same(f.function));
expect((gReturn as FunctionType).returnType,
new isInstanceOf<CircularFunctionTypeImpl>());
new TypeMatcher<CircularFunctionTypeImpl>());
basicChecks(g.function.type,
element: same(g.function), displayName: isNotNull, returnType: gReturn);
if (bug_33302_fixed) {
@ -444,7 +444,7 @@ class FunctionTypeTest {
// dynamic Function<T>()
var t = new MockTypeParameterElement('T');
FunctionType f = new FunctionTypeImpl.synthetic(dynamicType, [t], []);
expect(() => f.instantiate([]), throwsA(new isInstanceOf<ArgumentError>()));
expect(() => f.instantiate([]), throwsA(new TypeMatcher<ArgumentError>()));
}
test_synthetic_instantiate_no_type_formals() {
@ -543,7 +543,7 @@ class FunctionTypeTest {
var t = new MockTypeParameterElement('T');
FunctionType f = new FunctionTypeImpl.synthetic(dynamicType, [], []);
expect(() => f.substitute2([], [t.type]),
throwsA(new isInstanceOf<ArgumentError>()));
throwsA(new TypeMatcher<ArgumentError>()));
}
test_synthetic_substitute_share_returnType_and_parameters() {
@ -630,7 +630,7 @@ class FunctionTypeTest {
var t = new MockTypeParameterElement('T');
var e = new MockFunctionTypedElement(typeParameters: [t]);
FunctionType f = new FunctionTypeImpl(e);
expect(() => f.instantiate([]), throwsA(new isInstanceOf<ArgumentError>()));
expect(() => f.instantiate([]), throwsA(new TypeMatcher<ArgumentError>()));
}
test_unnamedConstructor_instantiate_noop() {
@ -817,7 +817,7 @@ class FunctionTypeTest {
var e = new MockFunctionTypedElement(enclosingElement: c);
FunctionType f = new FunctionTypeImpl(e);
expect(() => f.substitute2([], [t.type]),
throwsA(new isInstanceOf<ArgumentError>()));
throwsA(new TypeMatcher<ArgumentError>()));
}
test_unnamedConstructor_substitute_bound_recursive() {

View file

@ -627,7 +627,7 @@ class C {
ClassDeclaration cls = unit.declarations[0];
MethodDeclaration method = cls.members[0];
FormalParameter parameter = method.parameters.parameters[0];
expect(parameter, new isInstanceOf<DefaultFormalParameter>());
expect(parameter, new TypeMatcher<DefaultFormalParameter>());
}
test_class_method_patch_success_implicitReturnType() {

View file

@ -27,7 +27,7 @@ class LinkerUnitTest extends SummaryLinkerTest {
@override
bool get allowMissingFiles => false;
Matcher get isUndefined => new isInstanceOf<UndefinedElementForLink>();
Matcher get isUndefined => const TypeMatcher<UndefinedElementForLink>();
LibraryElementInBuildUnit get testLibrary => _testLibrary ??=
linker.getLibrary(linkerInputs.testDartUri) as LibraryElementInBuildUnit;

View file

@ -21,8 +21,8 @@ main() {
}
/// A matcher for ConflictingSummaryException.
const Matcher isConflictingSummaryException =
const _ConflictingSummaryException();
const isConflictingSummaryException =
const TypeMatcher<ConflictingSummaryException>();
UnlinkedPublicNamespace _namespaceWithParts(List<String> parts) {
_UnlinkedPublicNamespaceMock namespace = new _UnlinkedPublicNamespaceMock();
@ -289,11 +289,6 @@ class SummaryDataStoreTest {
}
}
class _ConflictingSummaryException extends TypeMatcher {
const _ConflictingSummaryException() : super("ConflictingSummaryException");
bool matches(item, Map matchState) => item is ConflictingSummaryException;
}
class _InternalAnalysisContextMock implements InternalAnalysisContext {
@override
SourceFactory sourceFactory;

View file

@ -207,7 +207,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
? resynthesized.actualElement
: resynthesized;
if (original is Member) {
expect(resynthesizedNonHandle, new isInstanceOf<Member>(), reason: desc);
expect(resynthesizedNonHandle, new TypeMatcher<Member>(), reason: desc);
if (resynthesizedNonHandle is Member) {
List<DartType> resynthesizedTypeArguments =
resynthesizedNonHandle.definingType.typeArguments;
@ -223,7 +223,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
}
} else {
expect(
resynthesizedNonHandle, isNot(new isInstanceOf<ConstructorMember>()),
resynthesizedNonHandle, isNot(new TypeMatcher<ConstructorMember>()),
reason: desc);
}
}
@ -477,7 +477,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
} else if (o is ThisExpression && r is ThisExpression) {
// Nothing to compare.
} else if (o is NullLiteral) {
expect(r, new isInstanceOf<NullLiteral>(), reason: desc);
expect(r, new TypeMatcher<NullLiteral>(), reason: desc);
} else if (o is BooleanLiteral && r is BooleanLiteral) {
expect(r.value, o.value, reason: desc);
} else if (o is IntegerLiteral && r is IntegerLiteral) {
@ -764,9 +764,9 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
// Validate members.
if (oImpl is Member) {
expect(rImpl, new isInstanceOf<Member>(), reason: desc);
expect(rImpl, new TypeMatcher<Member>(), reason: desc);
} else {
expect(rImpl, isNot(new isInstanceOf<Member>()), reason: desc);
expect(rImpl, isNot(new TypeMatcher<Member>()), reason: desc);
}
}
@ -1091,7 +1091,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
reason: desc);
if (original.element.enclosingElement == null &&
original.element is FunctionElement) {
expect(resynthesized.element, new isInstanceOf<FunctionElement>());
expect(resynthesized.element, new TypeMatcher<FunctionElement>());
expect(resynthesized.element.enclosingElement, isNull, reason: desc);
compareFunctionElements(
resynthesized.element, original.element, '$desc.element',
@ -1197,7 +1197,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
Element actualElement = element.actualElement;
// A handle should never point to a member, because if it did, then
// "is Member" checks on the handle would produce the wrong result.
expect(actualElement, isNot(new isInstanceOf<Member>()), reason: desc);
expect(actualElement, isNot(new TypeMatcher<Member>()), reason: desc);
return getActualElement(actualElement, desc);
} else if (element is Member) {
return getActualElement(element.baseElement, desc);

View file

@ -241,7 +241,7 @@ abstract class SummaryTest {
* a file reachable via the given [absoluteUri].
*/
void checkDependency(int dependency, String absoluteUri) {
expect(dependency, new isInstanceOf<int>());
expect(dependency, new TypeMatcher<int>());
expect(linked.dependencies[dependency].uri, absoluteUri);
}
@ -293,7 +293,7 @@ abstract class SummaryTest {
void checkExportName(LinkedExportName exportName, String absoluteUri,
String expectedName, ReferenceKind expectedKind,
{int expectedTargetUnit: 0}) {
expect(exportName, new isInstanceOf<LinkedExportName>());
expect(exportName, new TypeMatcher<LinkedExportName>());
// Exported names must come from other libraries.
expect(exportName.dependency, isNot(0));
checkDependency(exportName.dependency, absoluteUri);
@ -455,7 +455,7 @@ abstract class SummaryTest {
* having the given [deBruijnIndex].
*/
void checkParamTypeRef(EntityRef typeRef, int deBruijnIndex) {
expect(typeRef, new isInstanceOf<EntityRef>());
expect(typeRef, new TypeMatcher<EntityRef>());
expect(typeRef.reference, 0);
expect(typeRef.typeArguments, isEmpty);
expect(typeRef.paramReference, deBruijnIndex);
@ -555,7 +555,7 @@ abstract class SummaryTest {
int numTypeParameters: 0,
bool unresolvedHasName: false}) {
linkedSourceUnit ??= definingUnit;
expect(typeRef, new isInstanceOf<EntityRef>());
expect(typeRef, new TypeMatcher<EntityRef>());
expect(typeRef.paramReference, 0);
int index = typeRef.reference;
expect(typeRef.typeArguments, hasLength(numTypeArguments));
@ -2652,7 +2652,7 @@ const int v = p.a.length;
0 // Size of the list
], referenceValidators: [
(EntityRef reference) {
expect(reference, new isInstanceOf<EntityRef>());
expect(reference, new TypeMatcher<EntityRef>());
expect(reference.entityKind, EntityRefKind.genericFunctionType);
expect(reference.syntheticParams, hasLength(1));
{
@ -2678,24 +2678,24 @@ const int v = p.a.length;
0 // Size of the list
], referenceValidators: [
(EntityRef reference) {
expect(reference, new isInstanceOf<EntityRef>());
expect(reference, new TypeMatcher<EntityRef>());
expect(reference.entityKind, EntityRefKind.genericFunctionType);
expect(reference.syntheticParams, hasLength(1));
{
final param = reference.syntheticParams[0];
expect(param.type, new isInstanceOf<EntityRef>());
expect(param.type, new TypeMatcher<EntityRef>());
expect(param.type.entityKind, EntityRefKind.genericFunctionType);
expect(param.type.syntheticParams, hasLength(2));
{
final subparam = param.type.syntheticParams[0];
expect(subparam.name, ''); // no name for generic type parameters
expect(subparam.type, new isInstanceOf<EntityRef>());
expect(subparam.type, new TypeMatcher<EntityRef>());
expect(subparam.type.paramReference, 2);
}
{
final subparam = param.type.syntheticParams[1];
expect(subparam.name, ''); // no name for generic type parameters
expect(subparam.type, new isInstanceOf<EntityRef>());
expect(subparam.type, new TypeMatcher<EntityRef>());
expect(subparam.type.paramReference, 1);
}
}

View file

@ -77,70 +77,70 @@ main() {
});
}
isInstanceOf isBuildCompilationUnitElementTask =
new isInstanceOf<BuildCompilationUnitElementTask>();
isInstanceOf isBuildDirectiveElementsTask =
new isInstanceOf<BuildDirectiveElementsTask>();
isInstanceOf isBuildEnumMemberElementsTask =
new isInstanceOf<BuildEnumMemberElementsTask>();
isInstanceOf isBuildExportNamespaceTask =
new isInstanceOf<BuildExportNamespaceTask>();
isInstanceOf isBuildLibraryElementTask =
new isInstanceOf<BuildLibraryElementTask>();
isInstanceOf isBuildPublicNamespaceTask =
new isInstanceOf<BuildPublicNamespaceTask>();
isInstanceOf isBuildSourceExportClosureTask =
new isInstanceOf<BuildSourceExportClosureTask>();
isInstanceOf isBuildTypeProviderTask =
new isInstanceOf<BuildTypeProviderTask>();
isInstanceOf isComputeConstantDependenciesTask =
new isInstanceOf<ComputeConstantDependenciesTask>();
isInstanceOf isComputeConstantValueTask =
new isInstanceOf<ComputeConstantValueTask>();
isInstanceOf isComputeInferableStaticVariableDependenciesTask =
new isInstanceOf<ComputeInferableStaticVariableDependenciesTask>();
isInstanceOf isContainingLibrariesTask =
new isInstanceOf<ContainingLibrariesTask>();
isInstanceOf isDartErrorsTask = new isInstanceOf<DartErrorsTask>();
isInstanceOf isEvaluateUnitConstantsTask =
new isInstanceOf<EvaluateUnitConstantsTask>();
isInstanceOf isGatherUsedImportedElementsTask =
new isInstanceOf<GatherUsedImportedElementsTask>();
isInstanceOf isGatherUsedLocalElementsTask =
new isInstanceOf<GatherUsedLocalElementsTask>();
isInstanceOf isGenerateHintsTask = new isInstanceOf<GenerateHintsTask>();
isInstanceOf isGenerateLintsTask = new isInstanceOf<GenerateLintsTask>();
isInstanceOf isInferInstanceMembersInUnitTask =
new isInstanceOf<InferInstanceMembersInUnitTask>();
isInstanceOf isInferStaticVariableTypesInUnitTask =
new isInstanceOf<InferStaticVariableTypesInUnitTask>();
isInstanceOf isInferStaticVariableTypeTask =
new isInstanceOf<InferStaticVariableTypeTask>();
isInstanceOf isLibraryErrorsReadyTask =
new isInstanceOf<LibraryErrorsReadyTask>();
isInstanceOf isLibraryUnitErrorsTask =
new isInstanceOf<LibraryUnitErrorsTask>();
isInstanceOf isParseDartTask = new isInstanceOf<ParseDartTask>();
isInstanceOf isPartiallyResolveUnitReferencesTask =
new isInstanceOf<PartiallyResolveUnitReferencesTask>();
isInstanceOf isResolveDirectiveElementsTask =
new isInstanceOf<ResolveDirectiveElementsTask>();
isInstanceOf isResolveLibraryReferencesTask =
new isInstanceOf<ResolveLibraryReferencesTask>();
isInstanceOf isResolveLibraryTask = new isInstanceOf<ResolveLibraryTask>();
isInstanceOf isResolveLibraryTypeNamesTask =
new isInstanceOf<ResolveLibraryTypeNamesTask>();
isInstanceOf isResolveTopLevelUnitTypeBoundsTask =
new isInstanceOf<ResolveTopLevelUnitTypeBoundsTask>();
isInstanceOf isResolveUnitTask = new isInstanceOf<ResolveUnitTask>();
isInstanceOf isResolveUnitTypeNamesTask =
new isInstanceOf<ResolveUnitTypeNamesTask>();
isInstanceOf isResolveVariableReferencesTask =
new isInstanceOf<ResolveVariableReferencesTask>();
isInstanceOf isScanDartTask = new isInstanceOf<ScanDartTask>();
isInstanceOf isStrongModeVerifyUnitTask =
new isInstanceOf<StrongModeVerifyUnitTask>();
isInstanceOf isVerifyUnitTask = new isInstanceOf<VerifyUnitTask>();
final isBuildCompilationUnitElementTask =
new TypeMatcher<BuildCompilationUnitElementTask>();
final isBuildDirectiveElementsTask =
new TypeMatcher<BuildDirectiveElementsTask>();
final isBuildEnumMemberElementsTask =
new TypeMatcher<BuildEnumMemberElementsTask>();
final isBuildExportNamespaceTask =
new TypeMatcher<BuildExportNamespaceTask>();
final isBuildLibraryElementTask =
new TypeMatcher<BuildLibraryElementTask>();
final isBuildPublicNamespaceTask =
new TypeMatcher<BuildPublicNamespaceTask>();
final isBuildSourceExportClosureTask =
new TypeMatcher<BuildSourceExportClosureTask>();
final isBuildTypeProviderTask =
new TypeMatcher<BuildTypeProviderTask>();
final isComputeConstantDependenciesTask =
new TypeMatcher<ComputeConstantDependenciesTask>();
final isComputeConstantValueTask =
new TypeMatcher<ComputeConstantValueTask>();
final isComputeInferableStaticVariableDependenciesTask =
new TypeMatcher<ComputeInferableStaticVariableDependenciesTask>();
final isContainingLibrariesTask =
new TypeMatcher<ContainingLibrariesTask>();
final isDartErrorsTask = new TypeMatcher<DartErrorsTask>();
final isEvaluateUnitConstantsTask =
new TypeMatcher<EvaluateUnitConstantsTask>();
final isGatherUsedImportedElementsTask =
new TypeMatcher<GatherUsedImportedElementsTask>();
final isGatherUsedLocalElementsTask =
new TypeMatcher<GatherUsedLocalElementsTask>();
final isGenerateHintsTask = new TypeMatcher<GenerateHintsTask>();
final isGenerateLintsTask = new TypeMatcher<GenerateLintsTask>();
final isInferInstanceMembersInUnitTask =
new TypeMatcher<InferInstanceMembersInUnitTask>();
final isInferStaticVariableTypesInUnitTask =
new TypeMatcher<InferStaticVariableTypesInUnitTask>();
final isInferStaticVariableTypeTask =
new TypeMatcher<InferStaticVariableTypeTask>();
final isLibraryErrorsReadyTask =
new TypeMatcher<LibraryErrorsReadyTask>();
final isLibraryUnitErrorsTask =
new TypeMatcher<LibraryUnitErrorsTask>();
final isParseDartTask = new TypeMatcher<ParseDartTask>();
final isPartiallyResolveUnitReferencesTask =
new TypeMatcher<PartiallyResolveUnitReferencesTask>();
final isResolveDirectiveElementsTask =
new TypeMatcher<ResolveDirectiveElementsTask>();
final isResolveLibraryReferencesTask =
new TypeMatcher<ResolveLibraryReferencesTask>();
final isResolveLibraryTask = new TypeMatcher<ResolveLibraryTask>();
final isResolveLibraryTypeNamesTask =
new TypeMatcher<ResolveLibraryTypeNamesTask>();
final isResolveTopLevelUnitTypeBoundsTask =
new TypeMatcher<ResolveTopLevelUnitTypeBoundsTask>();
final isResolveUnitTask = new TypeMatcher<ResolveUnitTask>();
final isResolveUnitTypeNamesTask =
new TypeMatcher<ResolveUnitTypeNamesTask>();
final isResolveVariableReferencesTask =
new TypeMatcher<ResolveVariableReferencesTask>();
final isScanDartTask = new TypeMatcher<ScanDartTask>();
final isStrongModeVerifyUnitTask =
new TypeMatcher<StrongModeVerifyUnitTask>();
final isVerifyUnitTask = new TypeMatcher<VerifyUnitTask>();
final LintCode _testLintCode = new LintCode('test lint', 'test lint code');
@ -248,7 +248,7 @@ class BuildDirectiveElementsTaskTest extends _AbstractDartTaskTest {
*/
void checkMetadata(Element element, CompilationUnitElement compilationUnit) {
expect(element.metadata, hasLength(1));
expect(element.metadata[0], new isInstanceOf<ElementAnnotationImpl>());
expect(element.metadata[0], new TypeMatcher<ElementAnnotationImpl>());
ElementAnnotationImpl elementAnnotation = element.metadata[0];
expect(elementAnnotation.element, isNull); // Not yet resolved
expect(elementAnnotation.compilationUnit, isNotNull);
@ -565,7 +565,7 @@ part 'part.dart';''',
.getCacheEntry(new LibrarySpecificUnit(sourceA, sourcePart))
.getValue(RESOLVED_UNIT1);
// Validate metadata
expect(part.directives[0], new isInstanceOf<PartOfDirective>());
expect(part.directives[0], new TypeMatcher<PartOfDirective>());
expect(part.directives[0].element, same(libraryA));
expect(
resolutionMap.elementDeclaredByDirective(part.directives[0]).metadata,
@ -3830,7 +3830,7 @@ typedef F<T extends String>();
String expectedBoundTypeString, String expectedBoundElementName) {
TypeAnnotation bound = typeParameter.bound;
// TODO(brianwilkerson) Extend this to support function types as bounds.
expect(bound, new isInstanceOf<TypeName>());
expect(bound, new TypeMatcher<TypeName>());
TypeName boundNode = bound;
Identifier boundName = boundNode.name;
expect(boundNode.type.toString(), expectedBoundTypeString);
@ -4910,7 +4910,7 @@ class _AbstractDartTaskTest extends AbstractContextTest {
List<dynamic> computeLibraryResults(
List<Source> sources, ResultDescriptor result,
{isInstanceOf matcher: null}) {
{Matcher matcher: null}) {
dynamic compute(Source source) {
computeResult(new LibrarySpecificUnit(source, source), result,
matcher: matcher);
@ -4922,7 +4922,7 @@ class _AbstractDartTaskTest extends AbstractContextTest {
List<Map<ResultDescriptor, dynamic>> computeLibraryResultsMap(
List<Source> sources, ResultDescriptor result,
{isInstanceOf matcher: null}) {
{Matcher matcher: null}) {
Map<ResultDescriptor, dynamic> compute(Source source) {
computeResult(source, result, matcher: matcher);
return outputs;

View file

@ -304,7 +304,7 @@ class AnalysisDriverTest extends AbstractDriverTest {
expect(analysisDriver.performAnalysisTask(), true);
CaughtException exception = context.getCacheEntry(target).exception;
expect(exception, isNotNull);
expect(exception.exception, new isInstanceOf<InfiniteTaskLoopException>());
expect(exception.exception, new TypeMatcher<InfiniteTaskLoopException>());
}
test_performAnalysisTask_inputsFirst() {

View file

@ -22,9 +22,9 @@ main() {
});
}
isInstanceOf isDartScriptsTask = new isInstanceOf<DartScriptsTask>();
isInstanceOf isHtmlErrorsTask = new isInstanceOf<HtmlErrorsTask>();
isInstanceOf isParseHtmlTask = new isInstanceOf<ParseHtmlTask>();
final isDartScriptsTask = new TypeMatcher<DartScriptsTask>();
final isHtmlErrorsTask = new TypeMatcher<HtmlErrorsTask>();
final isParseHtmlTask = new TypeMatcher<ParseHtmlTask>();
@reflectiveTest
class DartScriptsTaskTest extends AbstractContextTest {

View file

@ -114,7 +114,7 @@ class ConstantTaskInputTest extends EngineTestCase {
test_createBuilder() {
ConstantTaskInput<int> input = new ConstantTaskInput<int>(5);
expect(input.createBuilder(), new isInstanceOf<ConstantTaskInputBuilder>());
expect(input.createBuilder(), new TypeMatcher<ConstantTaskInputBuilder>());
}
}
@ -134,22 +134,21 @@ class ListTaskInputImplTest extends EngineTestCase {
test_createBuilder() {
var input = new ListTaskInputImpl<AnalysisTarget>(target, result1);
expect(input.createBuilder(), new isInstanceOf<SimpleTaskInputBuilder>());
expect(input.createBuilder(), new TypeMatcher<SimpleTaskInputBuilder>());
}
test_toList() {
var input = new ListTaskInputImpl<AnalysisTarget>(target, result1);
ListTaskInput<String> input2 =
input.toList((target) => new SimpleTaskInput<String>(target, null));
expect(input2,
new isInstanceOf<ListToListTaskInput<AnalysisTarget, String>>());
expect(
input2, new TypeMatcher<ListToListTaskInput<AnalysisTarget, String>>());
}
test_toListOf() {
var input = new ListTaskInputImpl<AnalysisTarget>(target, result1);
ListTaskInput<int> input2 = input.toListOf(result2);
expect(
input2, new isInstanceOf<ListToListTaskInput<AnalysisTarget, int>>());
expect(input2, new TypeMatcher<ListToListTaskInput<AnalysisTarget, int>>());
}
test_toMap() {
@ -157,13 +156,13 @@ class ListTaskInputImplTest extends EngineTestCase {
MapTaskInput<AnalysisTarget, String> input2 =
input.toMap((target) => new SimpleTaskInput<String>(target, null));
expect(
input2, new isInstanceOf<ListToMapTaskInput<AnalysisTarget, String>>());
input2, new TypeMatcher<ListToMapTaskInput<AnalysisTarget, String>>());
}
test_toMapOf() {
var input = new ListTaskInputImpl<AnalysisTarget>(target, result1);
MapTaskInput<AnalysisTarget, int> input2 = input.toMapOf(result2);
expect(input2, new isInstanceOf<ListToMapTaskInput<AnalysisTarget, int>>());
expect(input2, new TypeMatcher<ListToMapTaskInput<AnalysisTarget, int>>());
}
}
@ -277,7 +276,7 @@ class ListToListTaskInputBuilderTest extends EngineTestCase {
builder.currentValue = value3;
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<List>());
expect(inputValue, new TypeMatcher<List>());
List list = inputValue;
expect(list.length, 2);
expect(list[0], value2);
@ -297,7 +296,7 @@ class ListToListTaskInputBuilderTest extends EngineTestCase {
builder.currentValue = value3;
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<List>());
expect(inputValue, new TypeMatcher<List>());
List list = inputValue;
expect(list, orderedEquals([value3]));
}
@ -308,7 +307,7 @@ class ListToListTaskInputBuilderTest extends EngineTestCase {
builder.currentValueNotAvailable();
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<List>());
expect(inputValue, new TypeMatcher<List>());
List list = inputValue;
expect(list, isEmpty);
}
@ -472,7 +471,7 @@ class ListToMapTaskInputBuilderTest extends EngineTestCase {
builder.currentValue = value3;
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<Map>());
expect(inputValue, new TypeMatcher<Map>());
expect(inputValue.length, 2);
expect(inputValue, containsPair(target2, value2));
expect(inputValue, containsPair(target3, value3));
@ -491,7 +490,7 @@ class ListToMapTaskInputBuilderTest extends EngineTestCase {
builder.currentValue = value3;
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<Map>());
expect(inputValue, new TypeMatcher<Map>());
expect(inputValue, hasLength(1));
expect(inputValue, containsPair(target3, value3));
}
@ -502,7 +501,7 @@ class ListToMapTaskInputBuilderTest extends EngineTestCase {
builder.currentValueNotAvailable();
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<Map>());
expect(inputValue, new TypeMatcher<Map>());
expect(inputValue, isEmpty);
}
@ -700,8 +699,8 @@ class ObjectToListTaskInputTest extends EngineTestCase {
SimpleTaskInput baseInput = new SimpleTaskInput(target, result);
var mapper = (Object x) => [x];
ObjectToListTaskInput input = new ObjectToListTaskInput(baseInput, mapper);
expect(input.createBuilder(),
new isInstanceOf<ObjectToListTaskInputBuilder>());
expect(
input.createBuilder(), new TypeMatcher<ObjectToListTaskInputBuilder>());
}
}
@ -843,7 +842,7 @@ class SimpleTaskInputTest extends EngineTestCase {
test_createBuilder() {
SimpleTaskInput input = new SimpleTaskInput(target, result);
expect(input.createBuilder(), new isInstanceOf<SimpleTaskInputBuilder>());
expect(input.createBuilder(), new TypeMatcher<SimpleTaskInputBuilder>());
}
}
@ -1013,7 +1012,7 @@ class TopLevelTaskInputBuilderTest extends EngineTestCase {
builder.currentValue = value2;
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<Map>());
expect(inputValue, new TypeMatcher<Map>());
Map inputs = inputValue;
expect(inputs.length, 2);
expect(inputs, containsPair(key1, value1));
@ -1041,7 +1040,7 @@ class TopLevelTaskInputBuilderTest extends EngineTestCase {
builder.currentValue = value2;
builder.moveNext(); // Advance to the end
var inputValue = builder.inputValue;
expect(inputValue, new isInstanceOf<Map>());
expect(inputValue, new TypeMatcher<Map>());
Map inputs = inputValue;
expect(inputs, hasLength(1));
expect(inputs, containsPair(key2, value2));

View file

@ -63,7 +63,7 @@ class TaskManagerTest extends EngineTestCase {
TaskManager manager = new TaskManager();
AnalysisTarget target = new TestSource();
expect(() => manager.findTask(target, result1),
throwsA(new isInstanceOf<AnalysisException>()));
throwsA(new TypeMatcher<AnalysisException>()));
}
test_findTask_multiple() {
@ -90,7 +90,7 @@ class TaskManagerTest extends EngineTestCase {
manager.addTaskDescriptor(descriptor);
AnalysisTarget target = new TestSource();
expect(() => manager.findTask(target, result2),
throwsA(new isInstanceOf<AnalysisException>()));
throwsA(new TypeMatcher<AnalysisException>()));
}
test_removeGeneralResult_absent() {

View file

@ -28,14 +28,14 @@ class AnalysisTaskTest extends EngineTestCase {
AnalysisTask task = new TestAnalysisTask(null, target);
task.inputs = {'a': 'b'};
expect(() => task.getRequiredInput('c'),
throwsA(new isInstanceOf<AnalysisException>()));
throwsA(new TypeMatcher<AnalysisException>()));
}
test_getRequiredInput_noInputs() {
AnalysisTarget target = new TestSource();
AnalysisTask task = new TestAnalysisTask(null, target);
expect(() => task.getRequiredInput('x'),
throwsA(new isInstanceOf<AnalysisException>()));
throwsA(new TypeMatcher<AnalysisException>()));
}
test_getRequiredInput_valid() {

View file

@ -36,8 +36,8 @@ main() {
});
}
isInstanceOf isGenerateOptionsErrorsTask =
new isInstanceOf<GenerateOptionsErrorsTask>();
final isGenerateOptionsErrorsTask =
new TypeMatcher<GenerateOptionsErrorsTask>();
@reflectiveTest
class ContextConfigurationTest extends AbstractContextTest {

View file

@ -18,7 +18,7 @@ main() {
});
}
isInstanceOf isParseYamlTask = new isInstanceOf<ParseYamlTask>();
final isParseYamlTask = new TypeMatcher<ParseYamlTask>();
@reflectiveTest
class ParseYamlTaskTest extends AbstractContextTest {
@ -34,7 +34,7 @@ rules:
YamlDocument document = outputs[YAML_DOCUMENT];
expect(document, isNotNull);
var value = document.contents.value;
expect(value, new isInstanceOf<Map>());
expect(value, new TypeMatcher<Map>());
expect(value['rules']['style_guide']['camel_case_types'], isFalse);
expect(outputs[YAML_ERRORS], hasLength(0));
LineInfo lineInfo = outputs[LINE_INFO];

View file

@ -104,7 +104,7 @@ bool containsKey(Map<dynamic, YamlNode> map, dynamic key) =>
void expectEquals(YamlNode actual, YamlNode expected) {
if (expected is YamlScalar) {
expect(actual, new isInstanceOf<YamlScalar>());
expect(actual, new TypeMatcher<YamlScalar>());
expect(expected.value, actual.value);
} else if (expected is YamlList) {
if (actual is YamlList) {