anchor.diff:    }
   
     test_exportDuplicatedLibraryNamed() async {
  -    Source source = addSource(r'''
  +    newFile("/test/lib/lib1.dart", content: "library lib;");
  +    newFile("/test/lib/lib2.dart", content: "library lib;");
  +    await assertErrorsInCode('''
   library test;
   export 'lib1.dart';
  -export 'lib2.dart';''');
  -    addNamedSource("/lib1.dart", "library lib;");
  -    addNamedSource("/lib2.dart", "library lib;");
  -    await computeAnalysisResult(source);
  -    assertErrors(source, [StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED]);
  -    verify([source]);
  +export 'lib2.dart';''', [
  +      error(StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED, 34, 19),
  +    ]);
     }
   
     test_extraPositionalArguments() async {
  -    Source source = addSource(r'''
  +    await assertErrorsInCode('''
   f() {}
   main() {
     f(0, 1, '2');
  -}''');
  -    await computeAnalysisResult(source);
  -    assertErrors(source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]);
  -    verify([source]);
  +}''', [
  +      error(StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS, 19, 11),
  +    ]);
     }
   
     test_extraPositionalArguments_functionExpression() async {
  -    Source source = addSource(r'''
  +    await assertErrorsInCode('''
   main() {
     (int x) {} (0, 1);
  -}''');
  -    await computeAnalysisResult(source);
  -    assertErrors(source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]);
  -    verify([source]);
  +}''', [
  +      error(StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS, 22, 6),
  +    ]);
     }
   
     test_extraPositionalArgumentsCouldBeNamed() async {
  -    Source source = addSource(r'''
  +    await assertErrorsInCode('''
   f({x, y}) {}
   main() {
     f(0, 1, '2');
  -}''');
  -    await computeAnalysisResult(source);
  -    assertErrors(
  -        source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED]);
  -    verify([source]);
  +}''', [
  +      error(
  +          StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 25, 11),
  +    ]);
     }
   
     test_extraPositionalArgumentsCouldBeNamed_functionExpression() async {
  -    Source source = addSource(r'''
  +    await assertErrorsInCode('''
   main() {
     (int x, {int y}) {} (0, 1);
  -}''');
  -    await computeAnalysisResult(source);
  -    assertErrors(
  -        source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED]);
  -    verify([source]);
  +}''', [
  +      error(StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 31, 6),
  +    ]);
     }
   
     test_fieldInitializedInInitializerAndDeclaration_final() async {
  -    Source source = addSource(r'''
  +    await assertErrorsInCode('''
   class A {
     final int x = 0;
     A() : x = 1 {}
  -}''');
  -    await computeAnalysisResult(source);
  -    assertErrors(source,
  -        [StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
  -    verify([source]);
  +}''', [
  +      error(StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION,
  +          37, 1),
  +    ]);
     }
   
     test_fieldInitializerNotAssignable() async {
  -    Source source = addSource(r'''
  +    await assertErrorsInCode('''
   class A {
     int x;
     A() : x = '';
  -}''');
  -    await computeAnalysisResult(source);
  -    assertErrors(source, [StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE]);
  -    verify([source]);
  +}''', [
  +      error(StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE, 31, 2),
  +    ]);
     }
   
     test_fieldInitializingFormalNotAssignable() async {
  -    Source source = addSource(r'''
  +    await assertErrorsInCode('''
   class A {
     int x;
     A(String this.x) {}
  -}''');
  -    await computeAnalysisResult(source);
  -    assertErrors(source, [
  -      StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE,
  -      StrongModeCode.INVALID_PARAMETER_DECLARATION
  -    ]);
  -    verify([source]);
  +}''', [
  +      error(StrongModeCode.INVALID_PARAMETER_DECLARATION, 23, 13),
  +      error(StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, 23, 13),
  +    ]);
     }
   
     /**
  
positive.code:     case E.THREE: return true;
    }
    return false;
  }''');
      await computeAnalysisResult(source);
      assertErrors(source, [
        StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
        StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH
      ]);
      verify([source]);
    }
  
    test_mixedReturnTypes_localFunction() async {
      Source source = addSource(r'''
  class C {
    m(int x) {
      return (int y) {
  
negative.code: class A {
    N m() { return null; }
  }
  class B<T extends N> {}''', [
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 48, 1),
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 53, 1),
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 59, 1),
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 63, 1),
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 72, 1),
        error(HintCode.UNUSED_LOCAL_VARIABLE, 74, 1),
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 106, 1),
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 149, 1),
      ]);
    }
  
    test_ambiguousImport_typeArgument_annotation() async {
      newFile("/test/lib/lib1.dart", content: '''
  library lib1;
  class N {}''');
      newFile("/test/lib/lib2.dart", content: '''
  library lib2;
  class N {}''');
      await assertErrorsInCode('''
  import 'lib1.dart';
  import 'lib2.dart';
  class A<T> {}
  A<N> f() { return null; }''', [
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 56, 1),
      ]);
    }
  
    test_ambiguousImport_typeArgument_instanceCreation() async {
      newFile("/test/lib/lib1.dart", content: '''
  library lib1;
  class N {}''');
      newFile("/test/lib/lib2.dart", content: '''
  library lib2;
  class N {}''');
      await assertErrorsInCode('''
  import 'lib1.dart';
  import 'lib2.dart';
  class A<T> {}
  f() {new A<N>();}''', [
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 65, 1),
      ]);
    }
  
    test_ambiguousImport_varRead() async {
      newFile("/test/lib/lib1.dart", content: '''
  library lib1;
  var v;''');
      newFile("/test/lib/lib2.dart", content: '''
  library lib2;
  var v;''');
      await assertErrorsInCode('''
  import 'lib1.dart';
  import 'lib2.dart';
  f() { g(v); }
  g(p) {}''', [
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 48, 1),
      ]);
    }
  
    test_ambiguousImport_varWrite() async {
      newFile("/test/lib/lib1.dart", content: '''
  library lib1;
  var v;''');
      newFile("/test/lib/lib2.dart", content: '''
  library lib2;
  var v;''');
      await assertErrorsInCode('''
  import 'lib1.dart';
  import 'lib2.dart';
  f() { v = 0; }''', [
        error(StaticWarningCode.AMBIGUOUS_IMPORT, 46, 1),
      ]);
    }
  
    test_argumentTypeNotAssignable_ambiguousClassName() async {
      // See dartbug.com/19624
      newFile("/test/lib/lib2.dart", content: '''
  class _A {}
  g(h(_A a)) {}''');
      await assertErrorsInCode('''
  import 'lib2.dart';
  class _A {}
  f() {
    g((_A a) {});
  }''', [
        error(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 42, 9),
      ]);
      // The name _A is private to the library it's defined in, so this is a type
      // mismatch. Furthermore, the error message should mention both _A and the
      // filenames so the user can figure out what's going on.
      String message = result.errors[0].message;
      expect(message.indexOf("_A") >= 0, isTrue);
    }
  
    test_argumentTypeNotAssignable_annotation_namedConstructor() async {
      await assertErrorsInCode('''
  class A {
    const A.fromInt(int p);
  }
  @A.fromInt('0')
  main() {
  }''', [
        error(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 49, 3),
      ]);
    }
  
    test_argumentTypeNotAssignable_annotation_unnamedConstructor() async {
      await assertErrorsInCode('''
  class A {
    const A(int p);
  }
  @A('0')
  main() {
  }''', [
        error(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 33, 3),
      ]);
    }
  
    test_argumentTypeNotAssignable_binary() async {
      await assertErrorsInCode('''
  class A {
    operator +(int p) {}
  }
  f(A a) {
    a + '0';
  }''', [
        error(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 50, 3),
      ]);
    }
  
    test_argumentTypeNotAssignable_call() async {
      await assertErrorsInCode('''
  typedef bool Predicate<T>(T object);
  
  Predicate<String> f() => null;
  
  void main() {
    f().call(3);
  }''', [
        error(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 95, 1),
      ]);
    }
  
    test_argumentTypeNotAssignable_cascadeSecond() async {
      await assertErrorsInCode('''
  // filler filler filler filler filler filler filler filler filler filler
  class A {
    B ma() { return new B(); }
  