Start splitting out the tests for hint codes

Change-Id: I2d221aa024b6db9426d7adf6b38c17da0be599d9
Reviewed-on: https://dart-review.googlesource.com/c/88541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index 40e7b67..0a7da26 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -7,7 +7,7 @@
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/task/options.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -284,7 +284,7 @@
                      part 'part1.dart';
                      @sealed class Foo {}
                      ''');
-    Source source2 = addNamedSource('/pkg1/lib/part1.dart', r'''
+    addNamedSource('/pkg1/lib/part1.dart', r'''
                      part of 'lib1.dart';
                      class Bar1 extends Foo {}
                      class Bar2 implements Foo {}
@@ -307,7 +307,7 @@
                      import 'package:meta/meta.dart';
                      @sealed class Foo {}
                      ''');
-    Source source2 = addNamedSource('/pkg1/lib/src/lib2.dart', r'''
+    addNamedSource('/pkg1/lib/src/lib2.dart', r'''
                      class Bar1 extends Foo {}
                      class Bar2 implements Foo {}
                      class Bar4 = Bar1 with Foo;
@@ -329,7 +329,7 @@
                      import 'package:meta/meta.dart';
                      @sealed class Foo {}
                      ''');
-    Source source2 = addNamedSource('/pkg1/test/test.dart', r'''
+    addNamedSource('/pkg1/test/test.dart', r'''
                      class Bar1 extends Foo {}
                      class Bar2 implements Foo {}
                      class Bar4 = Bar1 with Foo;
@@ -372,149 +372,6 @@
     ]);
   }
 
-  test_argumentTypeNotAssignable_functionType() async {
-    Source source = addSource(r'''
-m() {
-  var a = new A();
-  a.n(() => 0);
-}
-class A {
-  n(void f(int i)) {}
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
-    verify([source]);
-  }
-
-  test_argumentTypeNotAssignable_type() async {
-    Source source = addSource(r'''
-m() {
-  var i = '';
-  n(i);
-}
-n(int i) {}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_after_cascade() async {
-    Source source = addSource(r'''
-m(x) {
-  x..a?.b.c;
-}
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_before_cascade() async {
-    Source source = addSource(r'''
-m(x) {
-  x?.a..m();
-}
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_cascade_parenthesis() async {
-    Source source = addSource(r'''
-m(x) {
-  (x?.a)..m();
-}
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_false_methodInvocation() async {
-    Source source = addSource(r'''
-m(x) {
-  x?.a()?.b();
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_false_null() async {
-    Source source = addSource(r'''
-m(x) {
-  x?.a.hashCode;
-  x?.a.runtimeType;
-  x?.a.toString();
-  x?.b().hashCode;
-  x?.b().runtimeType;
-  x?.b().toString();
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_false_propertyAccess() async {
-    Source source = addSource(r'''
-m(x) {
-  x?.a?.b;
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_methodInvocation() async {
-    Source source = addSource(r'''
-m(x) {
-  x?.a.b();
-}
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_parenthesized() async {
-    Source source = addSource(r'''
-m(x) {
-  (x?.a).b;
-}
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_propertyAccess() async {
-    Source source = addSource(r'''
-m(x) {
-  x?.a.b;
-}
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
-    verify([source]);
-  }
-
-  test_canBeNullAfterNullAware_several() async {
-    Source source = addSource(r'''
-m(x) {
-  x?.a
-    ..m()
-    ..m();
-}
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
-    verify([source]);
-  }
-
   test_deadCode_deadBlock_conditionalElse() async {
     Source source = addSource(r'''
 f() {
@@ -1051,233 +908,6 @@
     verify([source]);
   }
 
-  test_deprecatedAnnotationUse_assignment() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  A operator+(A a) { return a; }
-}
-f(A a) {
-  A b;
-  a += b;
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_call() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  call() {}
-  m() {
-    A a = new A();
-    a();
-  }
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_deprecated() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  m() {}
-  n() {m();}
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_Deprecated() async {
-    Source source = addSource(r'''
-class A {
-  @Deprecated('0.9')
-  m() {}
-  n() {m();}
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_export() async {
-    Source source = addSource("export 'deprecated_library.dart';");
-    addNamedSource("/deprecated_library.dart", r'''
-@deprecated
-library deprecated_library;
-class A {}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_field() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  int x = 1;
-}
-f(A a) {
-  return a.x;
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_getter() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  get m => 1;
-}
-f(A a) {
-  return a.m;
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_import() async {
-    Source source = addSource(r'''
-import 'deprecated_library.dart';
-f(A a) {}''');
-    addNamedSource("/deprecated_library.dart", r'''
-@deprecated
-library deprecated_library;
-class A {}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_indexExpression() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  operator[](int i) {}
-}
-f(A a) {
-  return a[1];
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_instanceCreation() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  A(int i) {}
-}
-f() {
-  A a = new A(1);
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_instanceCreation_namedConstructor() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  A.named(int i) {}
-}
-f() {
-  A a = new A.named(1);
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_named() async {
-    Source source = addSource(r'''
-class A {
-  m({@deprecated int x}) {}
-  n() {m(x: 1);}
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_operator() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  operator+(A a) {}
-}
-f(A a) {
-  A b;
-  return a + b;
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_positional() async {
-    Source source = addSource(r'''
-class A {
-  m([@deprecated int x]) {}
-  n() {m(1);}
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_setter() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  set s(v) {}
-}
-f(A a) {
-  return a.s = 1;
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_superConstructor() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  A() {}
-}
-class B extends A {
-  B() : super() {}
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_superConstructor_namedConstructor() async {
-    Source source = addSource(r'''
-class A {
-  @deprecated
-  A.named() {}
-}
-class B extends A {
-  B() : super.named() {}
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
-    verify([source]);
-  }
-
   test_deprecatedFunction_class() async {
     Source source = addSource(r'''
 class Function {}
@@ -1331,49 +961,6 @@
     verify([source]);
   }
 
-  test_divisionOptimization_double() async {
-    Source source = addSource(r'''
-f(double x, double y) {
-  var v = (x / y).toInt();
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
-    verify([source]);
-  }
-
-  test_divisionOptimization_int() async {
-    Source source = addSource(r'''
-f(int x, int y) {
-  var v = (x / y).toInt();
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
-    verify([source]);
-  }
-
-  test_divisionOptimization_propagatedType() async {
-    // Tests the propagated type information of the '/' method
-    Source source = addSource(r'''
-f(x, y) {
-  x = 1;
-  y = 1;
-  var v = (x / y).toInt();
-}''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_divisionOptimization_wrappedBinaryExpression() async {
-    Source source = addSource(r'''
-f(int x, int y) {
-  var v = (((x / y))).toInt();
-}''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
-    verify([source]);
-  }
-
   test_duplicateImport() async {
     Source source = addSource(r'''
 library L;
@@ -1749,66 +1336,6 @@
     verify([source]);
   }
 
-  test_invalidRequiredParam_on_named_parameter_with_default() async {
-    Source source = addNamedSource('/lib1.dart', r'''
-import 'package:meta/meta.dart';
-
-m({@required a = 1}) => null;
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]);
-    verify([source]);
-  }
-
-  test_invalidRequiredParam_on_positional_parameter() async {
-    Source source = addNamedSource('/lib1.dart', r'''
-import 'package:meta/meta.dart';
-
-m([@required a]) => null;
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]);
-    verify([source]);
-  }
-
-  test_invalidRequiredParam_on_positional_parameter_with_default() async {
-    Source source = addNamedSource('/lib1.dart', r'''
-import 'package:meta/meta.dart';
-
-m([@required a = 1]) => null;
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]);
-    verify([source]);
-  }
-
-  test_invalidRequiredParam_on_required_parameter() async {
-    Source source = addNamedSource('/lib1.dart', r'''
-import 'package:meta/meta.dart';
-
-m(@required a) => null;
-''');
-    await computeAnalysisResult(source);
-    assertErrors(source, [HintCode.INVALID_REQUIRED_PARAM]);
-    verify([source]);
-  }
-
-  test_invalidRequiredParam_valid() async {
-    Source source = addNamedSource('/lib1.dart', r'''
-import 'package:meta/meta.dart';
-
-m1() => null;
-m2(a) => null;
-m3([a]) => null;
-m4({a}) => null;
-m5({@required a}) => null;
-m6({a, @required b}) => null;
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
   test_invalidSealedAnnotation_onClass() async {
     Source source = addNamedSource('/lib1.dart', r'''
 import 'package:meta/meta.dart';
diff --git a/pkg/analyzer/test/generated/non_hint_code_test.dart b/pkg/analyzer/test/generated/non_hint_code_test.dart
index c6a3028..f1af9c5 100644
--- a/pkg/analyzer/test/generated/non_hint_code_test.dart
+++ b/pkg/analyzer/test/generated/non_hint_code_test.dart
@@ -273,224 +273,6 @@
     verify([source]);
   }
 
-  test_deprecatedAnnotationUse_namedParameter_inDefiningFunction() async {
-    Source source = addSource(r'''
-f({@deprecated int x}) => x;
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_namedParameter_inDefiningLocalFunction() async {
-    Source source = addSource(r'''
-class C {
-  m() {
-    f({@deprecated int x}) {
-      return x;
-    }
-    return f();
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_namedParameter_inDefiningMethod() async {
-    Source source = addSource(r'''
-class C {
-  m({@deprecated int x}) {
-    return x;
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedAnnotationUse_namedParameter_inNestedLocalFunction() async {
-    Source source = addSource(r'''
-class C {
-  m({@deprecated int x}) {
-    f() {
-      return x;
-    }
-    return f();
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedClass() async {
-    Source source = addSource(r'''
-@deprecated
-f() {}
-
-@deprecated
-class C {
-  m() {
-    f();
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedField() async {
-    Source source = addSource(r'''
-@deprecated
-class C {}
-
-class X {
-  @deprecated
-  C f;
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedFunction() async {
-    Source source = addSource(r'''
-@deprecated
-f() {}
-
-@deprecated
-g() {
-  f();
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedLibrary() async {
-    Source source = addSource(r'''
-@deprecated
-library lib;
-
-@deprecated
-f() {}
-
-class C {
-  m() {
-    f();
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedMethod() async {
-    Source source = addSource(r'''
-@deprecated
-f() {}
-
-class C {
-  @deprecated
-  m() {
-    f();
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedMethod_inDeprecatedClass() async {
-    Source source = addSource(r'''
-@deprecated
-f() {}
-
-@deprecated
-class C {
-  @deprecated
-  m() {
-    f();
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedMixin() async {
-    Source source = addSource(r'''
-@deprecated
-f() {}
-
-@deprecated
-mixin M {
-  m() {
-    f();
-  }
-}
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_deprecatedMemberUse_inDeprecatedTopLevelVariable() async {
-    Source source = addSource(r'''
-@deprecated
-class C {}
-
-@deprecated
-C v;
-''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_divisionOptimization() async {
-    Source source = addSource(r'''
-f(int x, int y) {
-  var v = x / y.toInt();
-}''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_divisionOptimization_supressIfDivisionNotDefinedInCore() async {
-    Source source = addSource(r'''
-f(x, y) {
-  var v = (x / y).toInt();
-}''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  test_divisionOptimization_supressIfDivisionOverridden() async {
-    Source source = addSource(r'''
-class A {
-  num operator /(x) { return x; }
-}
-f(A x, A y) {
-  var v = (x / y).toInt();
-}''');
-    await computeAnalysisResult(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
   test_duplicateImport_as() async {
     Source source = addSource(r'''
 library L;
diff --git a/pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart b/pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart
new file mode 100644
index 0000000..bd6d96e
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../generated/resolver_test_case.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(ArgumentTypeNotAssignableTest);
+    defineReflectiveTests(ArgumentTypeNotAssignableTest_Driver);
+  });
+}
+
+@reflectiveTest
+class ArgumentTypeNotAssignableTest extends ResolverTestCase {
+  test_functionType() async {
+    assertErrorsInCode(r'''
+m() {
+  var a = new A();
+  a.n(() => 0);
+}
+class A {
+  n(void f(int i)) {}
+}
+''', [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
+  }
+
+  test_interfaceType() async {
+    assertErrorsInCode(r'''
+m() {
+  var i = '';
+  n(i);
+}
+n(int i) {}
+''', [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
+  }
+}
+
+@reflectiveTest
+class ArgumentTypeNotAssignableTest_Driver
+    extends ArgumentTypeNotAssignableTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/src/diagnostics/can_be_null_after_null_aware_test.dart b/pkg/analyzer/test/src/diagnostics/can_be_null_after_null_aware_test.dart
new file mode 100644
index 0000000..61f3441
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/can_be_null_after_null_aware_test.dart
@@ -0,0 +1,111 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../generated/resolver_test_case.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(CanBeNullAfterNullAwareTest);
+    defineReflectiveTests(CanBeNullAfterNullAwareTest_Driver);
+  });
+}
+
+@reflectiveTest
+class CanBeNullAfterNullAwareTest extends ResolverTestCase {
+  test_afterCascade() async {
+    assertErrorsInCode(r'''
+m(x) {
+  x..a?.b.c;
+}
+''', [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+  }
+
+  test_beforeCascade() async {
+    assertErrorsInCode(r'''
+m(x) {
+  x?.a..m();
+}
+''', [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+  }
+
+  test_cascadeWithParenthesis() async {
+    assertErrorsInCode(r'''
+m(x) {
+  (x?.a)..m();
+}
+''', [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+  }
+
+  test_definedForNull() async {
+    assertNoErrorsInCode(r'''
+m(x) {
+  x?.a.hashCode;
+  x?.a.runtimeType;
+  x?.a.toString();
+  x?.b().hashCode;
+  x?.b().runtimeType;
+  x?.b().toString();
+}
+''');
+  }
+
+  test_guarded_methodInvocation() async {
+    assertNoErrorsInCode(r'''
+m(x) {
+  x?.a()?.b();
+}
+''');
+  }
+
+  test_guarded_propertyAccess() async {
+    assertNoErrorsInCode(r'''
+m(x) {
+  x?.a?.b;
+}
+''');
+  }
+
+  test_methodInvocation() async {
+    assertErrorsInCode(r'''
+m(x) {
+  x?.a.b();
+}
+''', [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+  }
+
+  test_multipleInvocations() async {
+    assertErrorsInCode(r'''
+m(x) {
+  x?.a
+    ..m()
+    ..m();
+}
+''', [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+  }
+
+  test_parenthesized() async {
+    assertErrorsInCode(r'''
+m(x) {
+  (x?.a).b;
+}
+''', [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+  }
+
+  test_propertyAccess() async {
+    assertErrorsInCode(r'''
+m(x) {
+  x?.a.b;
+}
+''', [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+  }
+}
+
+@reflectiveTest
+class CanBeNullAfterNullAwareTest_Driver extends CanBeNullAfterNullAwareTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart b/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
new file mode 100644
index 0000000..7519905
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
@@ -0,0 +1,369 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../generated/resolver_test_case.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(DeprecatedMemberUseTest);
+    defineReflectiveTests(DeprecatedMemberUseTest_Driver);
+  });
+}
+
+@reflectiveTest
+class DeprecatedMemberUseTest extends ResolverTestCase {
+  test__methodInvocation_contructor() async {
+    assertErrorsInCode(r'''
+class A {
+  @Deprecated('0.9')
+  m() {}
+  n() {m();}
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_call() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  call() {}
+  m() {
+    A a = new A();
+    a();
+  }
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_compoundAssignment() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  A operator+(A a) { return a; }
+}
+f(A a) {
+  A b;
+  a += b;
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_export() async {
+    addNamedSource("/deprecated_library.dart", r'''
+@deprecated
+library deprecated_library;
+class A {}
+''');
+    assertErrorsInCode('''
+export 'deprecated_library.dart';
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_field() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  int x = 1;
+}
+f(A a) {
+  return a.x;
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_getter() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  get m => 1;
+}
+f(A a) {
+  return a.m;
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_import() async {
+    addNamedSource("/deprecated_library.dart", r'''
+@deprecated
+library deprecated_library;
+class A {}
+''');
+    assertErrorsInCode(r'''
+import 'deprecated_library.dart';
+f(A a) {}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_inDeprecatedClass() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+f() {}
+
+@deprecated
+class C {
+  m() {
+    f();
+  }
+}
+''');
+  }
+
+  test_inDeprecatedField() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+class C {}
+
+class X {
+  @deprecated
+  C f;
+}
+''');
+  }
+
+  test_inDeprecatedFunction() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+f() {}
+
+@deprecated
+g() {
+  f();
+}
+''');
+  }
+
+  test_inDeprecatedLibrary() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+library lib;
+
+@deprecated
+f() {}
+
+class C {
+  m() {
+    f();
+  }
+}
+''');
+  }
+
+  test_inDeprecatedMethod() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+f() {}
+
+class C {
+  @deprecated
+  m() {
+    f();
+  }
+}
+''');
+  }
+
+  test_inDeprecatedMethod_inDeprecatedClass() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+f() {}
+
+@deprecated
+class C {
+  @deprecated
+  m() {
+    f();
+  }
+}
+''');
+  }
+
+  test_inDeprecatedMixin() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+f() {}
+
+@deprecated
+mixin M {
+  m() {
+    f();
+  }
+}
+''');
+  }
+
+  test_inDeprecatedTopLevelVariable() async {
+    assertNoErrorsInCode(r'''
+@deprecated
+class C {}
+
+@deprecated
+C v;
+''');
+  }
+
+  test_indexExpression() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  operator[](int i) {}
+}
+f(A a) {
+  return a[1];
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_instanceCreation_defaultConstructor() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  A(int i) {}
+}
+f() {
+  A a = new A(1);
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_instanceCreation_namedConstructor() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  A.named(int i) {}
+}
+f() {
+  A a = new A.named(1);
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_methodInvocation_constant() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  m() {}
+  n() {m();}
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_operator() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  operator+(A a) {}
+}
+f(A a) {
+  A b;
+  return a + b;
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_parameter_named() async {
+    assertErrorsInCode(r'''
+class A {
+  m({@deprecated int x}) {}
+  n() {m(x: 1);}
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_parameter_named_inDefiningFunction() async {
+    assertNoErrorsInCode(r'''
+f({@deprecated int x}) => x;
+''');
+  }
+
+  test_parameter_named_inDefiningLocalFunction() async {
+    assertNoErrorsInCode(r'''
+class C {
+  m() {
+    f({@deprecated int x}) {
+      return x;
+    }
+    return f();
+  }
+}
+''');
+  }
+
+  test_parameter_named_inDefiningMethod() async {
+    assertNoErrorsInCode(r'''
+class C {
+  m({@deprecated int x}) {
+    return x;
+  }
+}
+''');
+  }
+
+  test_parameter_named_inNestedLocalFunction() async {
+    assertNoErrorsInCode(r'''
+class C {
+  m({@deprecated int x}) {
+    f() {
+      return x;
+    }
+    return f();
+  }
+}
+''');
+  }
+
+  test_parameter_positional() async {
+    assertErrorsInCode(r'''
+class A {
+  m([@deprecated int x]) {}
+  n() {m(1);}
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_setter() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  set s(v) {}
+}
+f(A a) {
+  return a.s = 1;
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_superConstructor_defaultConstructor() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  A() {}
+}
+class B extends A {
+  B() : super() {}
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+
+  test_superConstructor_namedConstructor() async {
+    assertErrorsInCode(r'''
+class A {
+  @deprecated
+  A.named() {}
+}
+class B extends A {
+  B() : super.named() {}
+}
+''', [HintCode.DEPRECATED_MEMBER_USE]);
+  }
+}
+
+@reflectiveTest
+class DeprecatedMemberUseTest_Driver extends DeprecatedMemberUseTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/src/diagnostics/division_optimization_test.dart b/pkg/analyzer/test/src/diagnostics/division_optimization_test.dart
new file mode 100644
index 0000000..539cdf1
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/division_optimization_test.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../generated/resolver_test_case.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(DivisionOptimizationTest);
+    defineReflectiveTests(DivisionOptimizationTest_Driver);
+  });
+}
+
+@reflectiveTest
+class DivisionOptimizationTest extends ResolverTestCase {
+  test_divisionOptimization() async {
+    assertNoErrorsInCode(r'''
+f(int x, int y) {
+  var v = x / y.toInt();
+}
+''');
+  }
+
+  test_double() async {
+    assertErrorsInCode(r'''
+f(double x, double y) {
+  var v = (x / y).toInt();
+}
+''', [HintCode.DIVISION_OPTIMIZATION]);
+  }
+
+  test_dynamic() async {
+    assertNoErrorsInCode(r'''
+f(x, y) {
+  var v = (x / y).toInt();
+}
+''');
+  }
+
+  test_int() async {
+    assertErrorsInCode(r'''
+f(int x, int y) {
+  var v = (x / y).toInt();
+}
+''', [HintCode.DIVISION_OPTIMIZATION]);
+  }
+
+  test_nonNumeric() async {
+    assertNoErrorsInCode(r'''
+class A {
+  num operator /(x) { return x; }
+}
+f(A x, A y) {
+  var v = (x / y).toInt();
+}
+''');
+  }
+
+  test_wrappedInParentheses() async {
+    assertErrorsInCode(r'''
+f(int x, int y) {
+  var v = (((x / y))).toInt();
+}
+''', [HintCode.DIVISION_OPTIMIZATION]);
+  }
+}
+
+@reflectiveTest
+class DivisionOptimizationTest_Driver extends DivisionOptimizationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_required_param_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_required_param_test.dart
new file mode 100644
index 0000000..70c22e5
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/invalid_required_param_test.dart
@@ -0,0 +1,77 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../generated/hint_code_test.dart' show metaLibraryStub;
+import '../../generated/resolver_test_case.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(InvalidRequiredParamTest);
+    defineReflectiveTests(InvalidRequiredParamTest_Driver);
+  });
+}
+
+@reflectiveTest
+class InvalidRequiredParamTest extends ResolverTestCase {
+  @override
+  void reset() {
+    super.resetWith(packages: [
+      ['meta', metaLibraryStub]
+    ]);
+  }
+
+  test_namedParameter_withDefault() async {
+    assertErrorsInCode(r'''
+import 'package:meta/meta.dart';
+
+m({@required a = 1}) => null;
+''', [HintCode.INVALID_REQUIRED_PARAM]);
+  }
+
+  test_positionalParameter_withDefault() async {
+    assertErrorsInCode(r'''
+import 'package:meta/meta.dart';
+
+m([@required a = 1]) => null;
+''', [HintCode.INVALID_REQUIRED_PARAM]);
+  }
+
+  test_ppositionalParameter_noDefault() async {
+    assertErrorsInCode(r'''
+import 'package:meta/meta.dart';
+
+m([@required a]) => null;
+''', [HintCode.INVALID_REQUIRED_PARAM]);
+  }
+
+  test_requiredParameter() async {
+    assertErrorsInCode(r'''
+import 'package:meta/meta.dart';
+
+m(@required a) => null;
+''', [HintCode.INVALID_REQUIRED_PARAM]);
+  }
+
+  test_valid() async {
+    assertNoErrorsInCode(r'''
+import 'package:meta/meta.dart';
+
+m1() => null;
+m2(a) => null;
+m3([a]) => null;
+m4({a}) => null;
+m5({@required a}) => null;
+m6({a, @required b}) => null;
+''');
+  }
+}
+
+@reflectiveTest
+class InvalidRequiredParamTest_Driver extends InvalidRequiredParamTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
new file mode 100644
index 0000000..a0b3585
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'argument_type_not_assignable_test.dart' as argument_type_not_assignable;
+import 'can_be_null_after_null_aware_test.dart' as can_be_null_after_null_aware;
+import 'deprecated_member_use_test.dart' as deprecated_member_use;
+import 'division_optimization_test.dart' as division_optimization;
+import 'invalid_required_param_test.dart' as invalid_required_param;
+
+main() {
+  defineReflectiveSuite(() {
+    argument_type_not_assignable.main();
+    can_be_null_after_null_aware.main();
+    deprecated_member_use.main();
+    division_optimization.main();
+    invalid_required_param.main();
+  }, name: 'diagnostics');
+}
diff --git a/pkg/analyzer/test/src/test_all.dart b/pkg/analyzer/test/src/test_all.dart
index 20bdbbb..011e198 100644
--- a/pkg/analyzer/test/src/test_all.dart
+++ b/pkg/analyzer/test/src/test_all.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
@@ -7,6 +7,7 @@
 import 'command_line/test_all.dart' as command_line;
 import 'context/test_all.dart' as context;
 import 'dart/test_all.dart' as dart;
+import 'diagnostics/test_all.dart' as diagnostics;
 import 'fasta/test_all.dart' as fasta;
 import 'lint/test_all.dart' as lint;
 import 'options/test_all.dart' as options;
@@ -22,6 +23,7 @@
     command_line.main();
     context.main();
     dart.main();
+    diagnostics.main();
     fasta.main();
     lint.main();
     options.main();