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: }
  class B implements I<int>, J<String> {
    set s(double d) {}
  }''');
      await computeAnalysisResult(source);
      assertErrors(source, [
        CompileTimeErrorCode.INVALID_OVERRIDE,
        CompileTimeErrorCode.INVALID_OVERRIDE
      ]);
      verify([source]);
    }
  
    test_mismatchedAccessorTypes_topLevel() async {
      Source source = addSource(r'''
  int get g { return 0; }
  set g(String v) {}''');
      await computeAnalysisResult(source);
      assertErrors(
          source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]);
      verify([source]);
    }
  
    test_missingEnumConstantInSwitch() async {
      Source source = addSource(r'''
  enum E { ONE, TWO, THREE, FOUR }
  bool odd(E e) {
    switch (e) {
  
negative.code: }
  main() {
    B.a.x = 0;
  }''', [
        error(StaticWarningCode.ASSIGNMENT_TO_FINAL_NO_SETTER, 71, 1),
      ]);
    }
  
    test_assignmentToFunction() async {
      await assertErrorsInCode('''
  f() {}
  main() {
    f = null;
  }''', [
        error(StaticWarningCode.ASSIGNMENT_TO_FUNCTION, 18, 1),
      ]);
    }
  
    test_assignmentToMethod() async {
      await assertErrorsInCode('''
  class A {
    m() {}
  }
  f(A a) {
    a.m = () {};
  }''', [
        error(StaticWarningCode.ASSIGNMENT_TO_METHOD, 32, 3),
      ]);
    }
  
    test_assignmentToTypedef() async {
      await assertErrorsInCode('''
  typedef void F();
  main() {
    F = null;
  }
  ''', [
        error(StaticWarningCode.ASSIGNMENT_TO_TYPE, 29, 1),
      ]);
    }
  
    test_assignmentToTypeParameter() async {
      await assertErrorsInCode('''
  class C<T> {
    f() {
      T = null;
    }
  }
  ''', [
        error(StaticWarningCode.ASSIGNMENT_TO_TYPE, 25, 1),
      ]);
    }
  
    test_caseBlockNotTerminated() async {
      await assertErrorsInCode('''
  f(int p) {
    switch (p) {
      case 0:
  