Use WithNullSafetyMixin instead of direct AnalysisOptionsImpl.

Change-Id: Ib950d298e3008e708398cb6e8d8d0b3e57114dac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2020-07-21 16:16:28 +00:00 committed by commit-bot@chromium.org
parent d9860c8b4f
commit 204d22467b
96 changed files with 284 additions and 1128 deletions

View file

@ -4,12 +4,11 @@
import 'dart:async';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../src/dart/resolution/driver_resolution.dart';
import '../src/dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -337,15 +336,8 @@ class C {
}
@reflectiveTest
class InvalidCodeWithNullSafetyTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class InvalidCodeWithNullSafetyTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_issue_40837() async {
await _assertCanBeAnalyzed('''
class A {

View file

@ -2,16 +2,15 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/null_safety_understanding_flag.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:meta/meta.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../resolution/driver_resolution.dart';
import '../resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -1043,15 +1042,8 @@ class B extends A {
}
@reflectiveTest
class InheritanceManager3WithNnbdTest extends _InheritanceManager3Base {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class InheritanceManager3WithNnbdTest extends _InheritanceManager3Base
with WithNullSafetyMixin {
test_getInheritedMap_topMerge_method() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.6

View file

@ -2,12 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -44,16 +42,8 @@ f(FutureOr<int> a) async {
}
@reflectiveTest
class AwaitExpressionResolutionWithNullSafetyTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class AwaitExpressionResolutionWithNullSafetyTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_futureOrQ() async {
await assertNoErrorsInCode(r'''
import 'dart:async';

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -232,17 +230,8 @@ f(int a, int b) {
}
@reflectiveTest
class BinaryExpressionResolutionWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
)
..implicitCasts = false;
@override
bool get typeToStringWithNullability => true;
class BinaryExpressionResolutionWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_ifNull_left_nullableContext() async {
await assertNoErrorsInCode(r'''
T f<T>(T t) => t;

View file

@ -2,19 +2,17 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -238,17 +236,8 @@ extension E on int {
}
@reflectiveTest
class ConstantResolutionWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
)
..implicitCasts = false;
@override
bool get typeToStringWithNullability => true;
class ConstantResolutionWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_context_eliminateTypeVariables() async {
await assertNoErrorsInCode(r'''
class A<T> {

View file

@ -2,16 +2,15 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/mock_sdk.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -316,15 +315,8 @@ f(p.C c) {
/// Tests that show that extension declarations and the members inside them are
/// resolved correctly.
@reflectiveTest
class ExtensionMethodsDeclarationWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class ExtensionMethodsDeclarationWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_this_type_interface() async {
await assertNoErrorsInCode('''
extension E on int {
@ -484,15 +476,7 @@ extension on M {}
@reflectiveTest
class ExtensionMethodsExtendedTypeWithNnbdTest
extends ExtensionMethodsExtendedTypeTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
}
extends ExtensionMethodsExtendedTypeTest with WithNullSafetyMixin {}
/// Tests that extension members can be correctly resolved when referenced
/// by code external to the extension declaration.
@ -1437,15 +1421,7 @@ extension E on Function {
@reflectiveTest
class ExtensionMethodsExternalReferenceWithNnbdTest
extends ExtensionMethodsExternalReferenceTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
extends ExtensionMethodsExternalReferenceTest with WithNullSafetyMixin {
test_instance_getter_fromInstance_Never() async {
await assertNoErrorsInCode('''
extension E on Never {
@ -2243,12 +2219,4 @@ extension E on C {
@reflectiveTest
class ExtensionMethodsInternalReferenceWithNnbdTest
extends ExtensionMethodsInternalReferenceTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
}
extends ExtensionMethodsInternalReferenceTest with WithNullSafetyMixin {}

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -51,12 +50,8 @@ main() {
}
@reflectiveTest
class ForEachElementWithNnbdTest extends ForEachElementTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
class ForEachElementWithNnbdTest extends ForEachElementTest
with WithNullSafetyMixin {
test_optIn_fromOptOut() async {
newFile('/test/lib/a.dart', content: r'''
class A implements Iterable<int> {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -53,17 +51,8 @@ main() {
}
@reflectiveTest
class FunctionExpressionInvocationWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
)
..implicitCasts = false;
@override
bool get typeToStringWithNullability => true;
class FunctionExpressionInvocationWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_call_infer_fromArguments() async {
await assertNoErrorsInCode(r'''
class A {

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -35,9 +34,4 @@ main(bool Function() b) {
}
@reflectiveTest
class IfElementWithNnbdTest extends IfElementTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
}
class IfElementWithNnbdTest extends IfElementTest with WithNullSafetyMixin {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -238,15 +237,8 @@ main(A<double> a) {
}
@reflectiveTest
class IndexExpressionWithNnbdTest extends IndexExpressionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class IndexExpressionWithNnbdTest extends IndexExpressionTest
with WithNullSafetyMixin {
test_read_cascade_nullShorting() async {
await assertNoErrorsInCode(r'''
class A {

View file

@ -2,13 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -916,15 +915,7 @@ class C implements A, B {
@reflectiveTest
class InstanceMemberInferenceClassWithNullSafetyTest
extends InstanceMemberInferenceClassTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
extends InstanceMemberInferenceClassTest with WithNullSafetyMixin {
test_field_multiple_gettersSetters_final_nonNullify() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.7

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -323,15 +322,7 @@ class B<T> extends A<T> {
@reflectiveTest
class InstanceMemberInferenceClassWithNullSafetyTest
extends InstanceMemberInferenceClassTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
extends InstanceMemberInferenceClassTest with WithNullSafetyMixin {
test_method_parameter_required_multiple_different_merge() async {
await resolveTestCode('''
class A {

View file

@ -2,18 +2,16 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/context/packages.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:analyzer/src/test_utilities/find_node.dart';
import 'package:analyzer/src/test_utilities/mock_sdk.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -24,16 +22,8 @@ main() {
}
@reflectiveTest
class NullSafetyExperimentGlobalTest extends _FeaturesTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class NullSafetyExperimentGlobalTest extends _FeaturesTest
with WithNullSafetyMixin {
test_jsonConfig_legacyContext_nonNullDependency() async {
_configureTestWithJsonConfig('''
{

View file

@ -2,11 +2,9 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:meta/meta.dart';
import 'package:test/test.dart';
@ -14,6 +12,7 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../summary/resolved_ast_printer.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -183,19 +182,12 @@ class B {}
}
@reflectiveTest
class MetadataResolutionWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
class MetadataResolutionWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
ImportFindElement get import_a {
return findElement.importFind('package:test/a.dart');
}
@override
bool get typeToStringWithNullability => true;
test_optIn_fromOptOut_class() async {
newFile('/test/lib/a.dart', content: r'''
class A {

View file

@ -2,16 +2,14 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -1721,16 +1719,8 @@ main() {
}
@reflectiveTest
class MethodInvocationResolutionWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class MethodInvocationResolutionWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_hasReceiver_deferredImportPrefix_loadLibrary_optIn_fromOptOut() async {
newFile('/test/lib/a.dart', content: r'''
class A {}

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -30,9 +29,5 @@ Never f() => throw 'foo';
}
@reflectiveTest
class ImportResolutionWithNnbdTest extends ImportResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
}
class ImportResolutionWithNnbdTest extends ImportResolutionTest
with WithNullSafetyMixin {}

View file

@ -2,16 +2,14 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -21,17 +19,7 @@ main() {
}
@reflectiveTest
class NonNullableTest extends DriverResolutionTest {
// TODO(danrubel): Implement a more fine grained way to specify non-nullable.
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class NonNullableTest extends DriverResolutionTest with WithNullSafetyMixin {
test_class_hierarchy() async {
await assertNoErrorsInCode('''
class A {}

View file

@ -2,14 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -84,16 +82,7 @@ f() {
@reflectiveTest
class PostfixExpressionResolutionWithNnbdTest
extends PostfixExpressionResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
extends PostfixExpressionResolutionTest with WithNullSafetyMixin {
test_inc_localVariable_depromote() async {
await assertNoErrorsInCode(r'''
class A {

View file

@ -2,14 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -175,17 +173,7 @@ f(int x) {
@reflectiveTest
class PrefixExpressionResolutionWithNnbdTest
extends PrefixExpressionResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
)
..implicitCasts = false;
@override
bool get typeToStringWithNullability => true;
extends PrefixExpressionResolutionTest with WithNullSafetyMixin {
test_plusPlus_depromote() async {
await assertNoErrorsInCode(r'''
class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -61,15 +60,7 @@ int Function() foo() {
@reflectiveTest
class PrefixedIdentifierResolutionWithNnbdTest
extends PrefixedIdentifierResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
extends PrefixedIdentifierResolutionTest with WithNullSafetyMixin {
test_deferredImportPrefix_loadLibrary_optIn_fromOptOut() async {
newFile('/test/lib/a.dart', content: r'''
class A {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -36,16 +35,8 @@ bar() {
}
@reflectiveTest
class PropertyAccessResolutionWithNnbdTest
extends PropertyAccessResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class PropertyAccessResolutionWithNnbdTest extends PropertyAccessResolutionTest
with WithNullSafetyMixin {
test_implicitCall_tearOff_nullable() async {
await assertErrorsInCode('''
class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -115,15 +114,7 @@ class A {
@reflectiveTest
class SimpleIdentifierResolutionWithNnbdTest
extends SimpleIdentifierResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
extends SimpleIdentifierResolutionTest with WithNullSafetyMixin {
test_functionReference() async {
await assertErrorsInCode('''
// @dart = 2.7

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,15 +16,8 @@ main() {
}
@reflectiveTest
class ForElementWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class ForElementWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_list_awaitForIn_dynamic_downward() async {
await resolveTestCode('''
void f() async {
@ -202,15 +194,8 @@ T a<T>() => throw '';
}
@reflectiveTest
class IfElementWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class IfElementWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_list_downward() async {
await resolveTestCode('''
void f() {
@ -246,15 +231,8 @@ T a<T>() => throw '';
}
@reflectiveTest
class SpreadElementWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class SpreadElementWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_list_downward() async {
await resolveTestCode('''
void f() {

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -29,15 +28,8 @@ void f(bool a, int b, int c) {
}
@reflectiveTest
class ConditionalExpressionWithNnbdTest extends ConditionalExpressionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class ConditionalExpressionWithNnbdTest extends ConditionalExpressionTest
with WithNullSafetyMixin {
@failingTest
test_downward() async {
await resolveTestCode('''

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -31,15 +30,7 @@ void f(Object a, Object b) {
}
@reflectiveTest
class EqualWithNnbdTest extends EqualTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
}
class EqualWithNnbdTest extends EqualTest with WithNullSafetyMixin {}
@reflectiveTest
class NotEqualTest extends DriverResolutionTest {
@ -55,12 +46,4 @@ void f(Object a, Object b) {
}
@reflectiveTest
class NotEqualWithNnbdTest extends NotEqualTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
}
class NotEqualWithNnbdTest extends NotEqualTest with WithNullSafetyMixin {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -461,15 +460,8 @@ var v = () sync* {
}
@reflectiveTest
class FunctionExpressionWithNnbdTest extends FunctionExpressionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class FunctionExpressionWithNnbdTest extends FunctionExpressionTest
with WithNullSafetyMixin {
test_contextFunctionType_nonNullify() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.7

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -319,15 +318,7 @@ var a = <num>[];
}
@reflectiveTest
class ListLiteralWithNnbdTest extends ListLiteralTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class ListLiteralWithNnbdTest extends ListLiteralTest with WithNullSafetyMixin {
test_context_spread_nullAware() async {
await assertNoErrorsInCode('''
T f<T>(T t) => t;

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -31,15 +30,7 @@ void f(bool a, bool b) {
}
@reflectiveTest
class LogicalAndWithNnbdTest extends LogicalAndTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class LogicalAndWithNnbdTest extends LogicalAndTest with WithNullSafetyMixin {
@failingTest
test_downward() async {
await resolveTestCode('''
@ -69,15 +60,7 @@ void f(bool a, bool b) {
}
@reflectiveTest
class LogicalOrWithNnbdTest extends LogicalOrTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class LogicalOrWithNnbdTest extends LogicalOrTest with WithNullSafetyMixin {
@failingTest
test_downward() async {
await resolveTestCode('''

View file

@ -2,14 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -366,16 +364,7 @@ var a = <num, String>{};
}
@reflectiveTest
class MapLiteralWithNnbdTest extends MapLiteralTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class MapLiteralWithNnbdTest extends MapLiteralTest with WithNullSafetyMixin {
test_context_noTypeArgs_noEntries_typeParameterNullable() async {
await resolveTestCode('''
class C<T extends Object?> {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -278,16 +276,7 @@ var a = <num>{};
}
@reflectiveTest
class SetLiteralWithNnbdTest extends SetLiteralTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class SetLiteralWithNnbdTest extends SetLiteralTest with WithNullSafetyMixin {
AstNode setOrMapLiteral(String search) => findNode.setOrMapLiteral(search);
test_context_noTypeArgs_noEntries() async {

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -19,15 +18,7 @@ main() {
}
@reflectiveTest
class AssertWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class AssertWithNnbdTest extends DriverResolutionTest with WithNullSafetyMixin {
test_downward() async {
await resolveTestCode('''
void f() {
@ -40,15 +31,7 @@ T a<T>() => throw '';
}
@reflectiveTest
class DoWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class DoWithNnbdTest extends DriverResolutionTest with WithNullSafetyMixin {
test_downward() async {
await resolveTestCode('''
void f() {
@ -61,15 +44,7 @@ T a<T>() => throw '';
}
@reflectiveTest
class ForWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class ForWithNnbdTest extends DriverResolutionTest with WithNullSafetyMixin {
test_awaitForIn_dynamic_downward() async {
await resolveTestCode('''
void f() async {
@ -125,15 +100,7 @@ T a<T>() => throw '';
}
@reflectiveTest
class IfWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class IfWithNnbdTest extends DriverResolutionTest with WithNullSafetyMixin {
test_downward() async {
await resolveTestCode('''
void f() {
@ -146,15 +113,7 @@ T a<T>() => throw '';
}
@reflectiveTest
class WhileWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class WhileWithNnbdTest extends DriverResolutionTest with WithNullSafetyMixin {
test_downward() async {
await resolveTestCode('''
void f() {

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -15,15 +14,7 @@ main() {
}
@reflectiveTest
class ThrowWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class ThrowWithNnbdTest extends DriverResolutionTest with WithNullSafetyMixin {
test_downward() async {
await resolveTestCode('''
void f() {

View file

@ -2,11 +2,10 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../driver_resolution.dart';
import '../with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -31,15 +30,7 @@ void f(Object a) {
}
@reflectiveTest
class IsNotWithNnbdTest extends IsNotTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
}
class IsNotWithNnbdTest extends IsNotTest with WithNullSafetyMixin {}
@reflectiveTest
class IsTest extends DriverResolutionTest {
@ -55,12 +46,4 @@ void f(Object a) {
}
@reflectiveTest
class IsWithNnbdTest extends IsTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
}
class IsWithNnbdTest extends IsTest with WithNullSafetyMixin {}

View file

@ -2,13 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
import 'with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -256,12 +255,8 @@ f(Never a) {}
}
@reflectiveTest
class TypeNameResolutionWithNnbdTest extends TypeNameResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
class TypeNameResolutionWithNnbdTest extends TypeNameResolutionTest
with WithNullSafetyMixin {
ImportFindElement get import_a {
return findElement.importFind('package:test/a.dart');
}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -57,13 +55,5 @@ abstract class A {
}
@reflectiveTest
class AbstractClassMemberTest_NNBD extends AbstractClassMemberTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
}
class AbstractClassMemberTest_NNBD extends AbstractClassMemberTest
with WithNullSafetyMixin {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -65,12 +64,7 @@ f(Map<int, int> map, Set<int> set) {
@reflectiveTest
class AmbiguousSetOrMapLiteralBothWithNnbdTest
extends AmbiguousSetOrMapLiteralBothTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
extends AmbiguousSetOrMapLiteralBothTest with WithNullSafetyMixin {
test_map_keyNonNullable_valueNullable() async {
await assertNoErrorsInCode('''
f(Map<int, int?> map) {
@ -138,9 +132,4 @@ var c = {...set, ...map};
@reflectiveTest
class AmbiguousSetOrMapLiteralEitherWithNnbdTest
extends AmbiguousSetOrMapLiteralEitherTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
}
extends AmbiguousSetOrMapLiteralEitherTest with WithNullSafetyMixin {}

View file

@ -2,14 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -425,13 +423,8 @@ g(C c) {
}
@reflectiveTest
class ArgumentTypeNotAssignableTest_NNBD extends ArgumentTypeNotAssignableTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class ArgumentTypeNotAssignableTest_NNBD extends ArgumentTypeNotAssignableTest
with WithNullSafetyMixin {
test_binary_eqEq_covariantParameterType() async {
await assertErrorsInCode(r'''
class A {

View file

@ -2,13 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -138,12 +137,8 @@ f() { x = 1; }''', [
}
@reflectiveTest
class AssignmentToFinalLocalWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class AssignmentToFinalLocalWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_localVariable_late() async {
await assertNoErrorsInCode('''
void f() {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -46,12 +45,8 @@ f() {
}
@reflectiveTest
class AssignmentToFinalWithNnbdTest extends AssignmentToFinalTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class AssignmentToFinalWithNnbdTest extends AssignmentToFinalTest
with WithNullSafetyMixin {
test_field_late() async {
await assertNoErrorsInCode('''
class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,15 +15,11 @@ main() {
}
@reflectiveTest
class AwaitInLateLocalVariableInitializerTest extends DriverResolutionTest {
class AwaitInLateLocalVariableInitializerTest extends DriverResolutionTest
with WithNullSafetyMixin {
static const _errorCode =
CompileTimeErrorCode.AWAIT_IN_LATE_LOCAL_VARIABLE_INITIALIZER;
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
test_closure_late_await() async {
await assertErrorsInCode('''
main() {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,12 +15,8 @@ main() {
}
@reflectiveTest
class BodyMayCompleteNormallyTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
class BodyMayCompleteNormallyTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_factoryConstructor_named_blockBody() async {
await assertErrorsInCode(r'''
class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -108,12 +107,7 @@ void f(e) {
@reflectiveTest
class CaseExpressionTypeImplementsEqualsWithNnbdTest
extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
extends DriverResolutionTest with WithNullSafetyMixin {
test_declares() async {
await assertNoErrorsInCode(r'''
abstract class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,12 +16,7 @@ main() {
@reflectiveTest
class CaseExpressionTypeIsNotSswitchExpressionSubtype
extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
extends DriverResolutionTest with WithNullSafetyMixin {
CompileTimeErrorCode get _errorCode {
return CompileTimeErrorCode
.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE;

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -74,12 +73,7 @@ class C extends A implements B {}
@reflectiveTest
class ConflictingGenericInterfacesWithNnbdTest
extends ConflictingGenericInterfacesTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
extends ConflictingGenericInterfacesTest with WithNullSafetyMixin {
test_class_extends_implements_never() async {
await assertNoErrorsInCode('''
class I<T> {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -58,9 +57,5 @@ const F;
}
@reflectiveTest
class ConstNotInitializedWithNnbdTest extends ConstNotInitializedTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
}
class ConstNotInitializedWithNnbdTest extends ConstNotInitializedTest
with WithNullSafetyMixin {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class DeadNullAwareExpressionTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class DeadNullAwareExpressionTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_assignCompound_legacy() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.5

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,12 +15,8 @@ main() {
}
@reflectiveTest
class DefaultListConstructorMismatch extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class DefaultListConstructorMismatch extends DriverResolutionTest
with WithNullSafetyMixin {
test_inferredType() async {
await assertErrorsInCode('''
List<int> v = List(5);

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,12 +15,8 @@ main() {
}
@reflectiveTest
class DefaultValueOnRequiredParameterTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class DefaultValueOnRequiredParameterTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_function_notRequired_default() async {
await assertNoErrorsInCode('''
void log({String message: 'no message'}) {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class DefinitelyUnassignedLateLocalVariableTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class DefinitelyUnassignedLateLocalVariableTest extends DriverResolutionTest
with WithNullSafetyMixin {
CompileTimeErrorCode get _errorCode {
return CompileTimeErrorCode.DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE;
}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,15 +15,8 @@ main() {
}
@reflectiveTest
class ExportLegacySymbolTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class ExportLegacySymbolTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_exportDartAsync() async {
await assertNoErrorsInCode(r'''
export 'dart:async';

View file

@ -2,16 +2,15 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
// defineReflectiveTests(ExtendsNonClassTest);
defineReflectiveTests(ExtendsNonClassTest);
defineReflectiveTests(ExtendsNonClassWithNnbdTest);
});
}
@ -20,12 +19,8 @@ main() {
class ExtendsNonClassTest extends DriverResolutionTest {}
@reflectiveTest
class ExtendsNonClassWithNnbdTest extends ExtendsNonClassTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class ExtendsNonClassWithNnbdTest extends ExtendsNonClassTest
with WithNullSafetyMixin {
test_Never() async {
await assertErrorsInCode('''
class A extends Never {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -64,12 +63,7 @@ void f(B b) {
@reflectiveTest
class ExtensionOverrideArgumentNotAssignableWithNNBDTest
extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
extends DriverResolutionTest with WithNullSafetyMixin {
test_override_onNonNullable() async {
await assertErrorsInCode(r'''
extension E on String {

View file

@ -2,13 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -85,12 +84,8 @@ mixin M {
}
@reflectiveTest
class FinalNotInitializedWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class FinalNotInitializedWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_field_noConstructor_initializer() async {
await assertNoErrorsInCode('''
class C {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -64,12 +63,8 @@ f(bool e) {
}
@reflectiveTest
class ForInOfInvalidTypeWithNnbdTest extends ForInOfInvalidTypeTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class ForInOfInvalidTypeWithNnbdTest extends ForInOfInvalidTypeTest
with WithNullSafetyMixin {
test_awaitForIn_never() async {
await assertErrorsInCode('''
f(Never e) async {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,15 +15,8 @@ main() {
}
@reflectiveTest
class GetterNotSubtypeSetterTypesTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class GetterNotSubtypeSetterTypesTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_class_instance() async {
await assertErrorsInCode('''
class C {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -57,12 +56,8 @@ class C = A with M implements B;
}
@reflectiveTest
class ImplementsNonClassWithNnbdTest extends ImplementsNonClassTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class ImplementsNonClassWithNnbdTest extends ImplementsNonClassTest
with WithNullSafetyMixin {
test_Never() async {
await assertErrorsInCode('''
class A implements Never {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -250,12 +249,7 @@ class A<T> {
@reflectiveTest
class ImplicitThisReferenceInInitializerWithNnbdTest
extends ImplicitThisReferenceInInitializerTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
extends ImplicitThisReferenceInInitializerTest with WithNullSafetyMixin {
test_class_field_late_invokeInstanceMethod() async {
await assertNoErrorsInCode(r'''
class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,12 +16,8 @@ main() {
}
@reflectiveTest
class InvalidAssignmentNnbdTest extends InvalidAssignmentTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
class InvalidAssignmentNnbdTest extends InvalidAssignmentTest
with WithNullSafetyMixin {
@override
test_ifNullAssignment() async {
await assertErrorsInCode('''

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -18,14 +16,8 @@ main() {
}
@reflectiveTest
class InvalidNullAwareOperatorAfterShortCircuitTest
extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class InvalidNullAwareOperatorAfterShortCircuitTest extends DriverResolutionTest
with WithNullSafetyMixin {
Future<void> test_getter_previousTarget() async {
await assertErrorsInCode('''
void f(String? s) {
@ -95,13 +87,8 @@ void f(String? s) {
}
@reflectiveTest
class InvalidNullAwareOperatorTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class InvalidNullAwareOperatorTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_getter_class() async {
await assertNoErrorsInCode('''
class C {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -301,17 +299,8 @@ class B extends A {
@reflectiveTest
class InvalidOverrideDifferentDefaultValuesNamedWithNnbdTest
extends InvalidOverrideDifferentDefaultValuesNamedTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
)
..implicitCasts = false;
@override
bool get typeToStringWithNullability => true;
extends InvalidOverrideDifferentDefaultValuesNamedTest
with WithNullSafetyMixin {
test_concrete_equal_optIn_extends_optOut() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.7

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -316,17 +314,8 @@ class B extends A {
@reflectiveTest
class InvalidOverrideDifferentDefaultValuesPositionalWithNnbdTest
extends InvalidOverrideDifferentDefaultValuesPositionalTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
)
..implicitCasts = false;
@override
bool get typeToStringWithNullability => true;
extends InvalidOverrideDifferentDefaultValuesPositionalTest
with WithNullSafetyMixin {
test_concrete_equal_optIn_extends_optOut() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.7

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -563,17 +561,8 @@ class B implements I<int>, J<String> {
}
@reflectiveTest
class InvalidOverrideWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
)
..implicitCasts = false;
@override
bool get typeToStringWithNullability => true;
class InvalidOverrideWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_method_parameter_functionTyped_optOut_extends_optIn() async {
newFile('/test/lib/a.dart', content: r'''
abstract class A {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -137,13 +135,8 @@ class A {
}
@reflectiveTest
class InvalidReferenceToThisTest_NNBD extends InvalidReferenceToThisTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class InvalidReferenceToThisTest_NNBD extends InvalidReferenceToThisTest
with WithNullSafetyMixin {
test_instanceVariableInitializer_inDeclaration_late() async {
await assertNoErrorsInCode(r'''
class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,15 +15,11 @@ main() {
}
@reflectiveTest
class LateFinalFieldWithConstConstructorTest extends DriverResolutionTest {
class LateFinalFieldWithConstConstructorTest extends DriverResolutionTest
with WithNullSafetyMixin {
static const _errorCode =
CompileTimeErrorCode.LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR;
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
test_class_hasConstConstructor_instance_hasInitializer() async {
await assertErrorsInCode('''
class A {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,15 +15,8 @@ main() {
}
@reflectiveTest
class LateFinalLocalAlreadyAssignedTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class LateFinalLocalAlreadyAssignedTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_assignmentExpression_compound() async {
await assertErrorsInCode('''
main() {

View file

@ -2,13 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,12 +16,8 @@ main() {
}
@reflectiveTest
class MissingDefaultValueForParameterTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class MissingDefaultValueForParameterTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_constructor_externalFactory_nonNullable_named_optional_noDefault() async {
await assertNoErrorsInCode('''
class C {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -84,12 +83,7 @@ void f(E e) {
@reflectiveTest
class MissingEnumConstantInSwitchWithNnbdTest
extends MissingEnumConstantInSwitchTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
extends MissingEnumConstantInSwitchTest with WithNullSafetyMixin {
test_nullable() async {
await assertErrorsInCode('''
enum E { one, two }

View file

@ -2,14 +2,13 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/package_mixin.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../generated/test_support.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -246,12 +245,8 @@ class C {
}
@reflectiveTest
class MissingRequiredParamWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class MissingRequiredParamWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_constructor_argumentGiven() async {
await assertNoErrorsInCode(r'''
class C {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -60,12 +59,8 @@ class C = A with B;
}
@reflectiveTest
class MixinOfNonClassWithNnbdTest extends MixinOfNonClassTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class MixinOfNonClassWithNnbdTest extends MixinOfNonClassTest
with WithNullSafetyMixin {
test_Never() async {
await assertErrorsInCode('''
class A with Never {}

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -21,12 +20,7 @@ class MixinSuperClassConstraintNonInterfaceTest extends DriverResolutionTest {}
@reflectiveTest
class MixinSuperClassConstraintNonInterfaceWithNnbdTest
extends MixinSuperClassConstraintNonInterfaceTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
extends MixinSuperClassConstraintNonInterfaceTest with WithNullSafetyMixin {
test_Never() async {
await assertErrorsInCode('''
mixin M on Never {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -86,13 +84,8 @@ f() {
}
@reflectiveTest
class NonBoolConditionTest_NNBD extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NonBoolConditionTest_NNBD extends DriverResolutionTest
with WithNullSafetyMixin {
test_if_null() async {
await assertErrorsInCode(r'''
m() {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -31,13 +29,8 @@ f() {
}
@reflectiveTest
class NonBoolNegationExpressionTest_NNBD extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NonBoolNegationExpressionTest_NNBD extends DriverResolutionTest
with WithNullSafetyMixin {
test_null() async {
await assertErrorsInCode(r'''
m() {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -61,13 +59,8 @@ bool f(bool left, double right) {
}
@reflectiveTest
class NonBoolOperandTest_NNBD extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NonBoolOperandTest_NNBD extends DriverResolutionTest
with WithNullSafetyMixin {
test_and_null() async {
await assertErrorsInCode(r'''
m() {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -68,9 +67,4 @@ void f(var e) {
@reflectiveTest
class NonConstantCaseExpressionWithNnbdTest
extends NonConstantCaseExpressionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
}
extends NonConstantCaseExpressionTest with WithNullSafetyMixin {}

View file

@ -3,17 +3,16 @@
// BSD-style license that can be found in the LICENSE file.
//import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -22,15 +21,7 @@ main() {
}
@reflectiveTest
class NonNullOptOutTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class NonNullOptOutTest extends DriverResolutionTest with WithNullSafetyMixin {
ImportFindElement get _import_a {
return findElement.importFind('package:test/a.dart');
}

View file

@ -2,14 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../generated/test_support.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -21,13 +19,7 @@ main() {
@reflectiveTest
class NotInitializedPotentiallyNonNullableLocalVariableTest
extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
extends DriverResolutionTest with WithNullSafetyMixin {
test_assignment_leftExpression() async {
await assertErrorsInCode(r'''
void f() {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class NotInitializedNonNullableInstanceFieldTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NotInitializedNonNullableInstanceFieldTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_class_factoryConstructor() async {
await assertNoErrorsInCode('''
class A {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class NotInitializedNonNullableVariableTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NotInitializedNonNullableVariableTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_staticField_futureOr_questionArgument_none() async {
await assertNoErrorsInCode('''
import 'dart:async';

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,15 +16,8 @@ main() {
}
@reflectiveTest
class NotIterableSpreadNullSafetyTest extends NotIterableSpreadTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class NotIterableSpreadNullSafetyTest extends NotIterableSpreadTest
with WithNullSafetyMixin {
test_iterable_typeParameter_bound_listQuestion() async {
await assertNoErrorsInCode('''
void f<T extends List<int>?>(T a) {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,15 +16,8 @@ main() {
}
@reflectiveTest
class NotMapSpreadNullSafetyTest extends NotMapSpreadTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
class NotMapSpreadNullSafetyTest extends NotMapSpreadTest
with WithNullSafetyMixin {
test_map_typeParameter_bound_mapQuestion() async {
await assertNoErrorsInCode('''
void f<T extends Map<int, String>?>(T a) {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class NullableTypeInExtendsClauseTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NullableTypeInExtendsClauseTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_class_nonNullable() async {
await assertNoErrorsInCode('''
class A {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class NullableTypeInImplementsClauseTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NullableTypeInImplementsClauseTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_class_nonNullable() async {
await assertNoErrorsInCode('''
class A {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class NullableTypeInOnClauseTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NullableTypeInOnClauseTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_nonNullable() async {
await assertNoErrorsInCode('''
class A {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class NullableTypeInWithClauseTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class NullableTypeInWithClauseTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_class_nonNullable() async {
await assertNoErrorsInCode('''
class A {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -18,16 +16,8 @@ main() {
}
@reflectiveTest
class InvalidUseOfNeverTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class InvalidUseOfNeverTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_binaryExpression_never_eqEq() async {
await assertErrorsInCode(r'''
void main(Never x) {

View file

@ -7,6 +7,7 @@ import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
import 'sdk_constraint_verifier_support.dart';
main() {
@ -32,12 +33,8 @@ Never foo;
}
@reflectiveTest
class SdkVersionNeverWithNnbdTest extends SdkConstraintVerifierTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures =
FeatureSet.forTesting(additionalFeatures: [Feature.non_nullable]);
class SdkVersionNeverWithNnbdTest extends SdkConstraintVerifierTest
with WithNullSafetyMixin {
test_experimentEnabled() async {
await verifyVersion('2.7.0', r'''
Never foo = (throw 42);

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -16,12 +15,8 @@ main() {
}
@reflectiveTest
class SwitchCaseCompletesNormallyTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
class SwitchCaseCompletesNormallyTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_break() async {
await assertNoErrorsInCode(r'''
void f(int a) {

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class ThrowOfInvalidTypeTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class ThrowOfInvalidTypeTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_dynamic() async {
await assertNoErrorsInCode('''
f(dynamic a) {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -403,12 +402,7 @@ class C extends Object with G<B>{}
@reflectiveTest
class TypeArgumentNotMatchingBoundsWithNnbdTest
extends TypeArgumentNotMatchingBoundsTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
extends TypeArgumentNotMatchingBoundsTest with WithNullSafetyMixin {
test_extends_optIn_fromOptOut_Null() async {
newFile('/test/lib/a.dart', content: r'''
class A<X extends int> {}

View file

@ -2,13 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -177,9 +176,5 @@ main(int p) {
}
@reflectiveTest
class UndefinedIdentifierWithNnbdTest extends UndefinedIdentifierTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
}
class UndefinedIdentifierWithNnbdTest extends UndefinedIdentifierTest
with WithNullSafetyMixin {}

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -17,13 +15,8 @@ main() {
}
@reflectiveTest
class UnnecessaryNonNullAssertionTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class UnnecessaryNonNullAssertionTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_legacy() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.5

View file

@ -2,13 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -18,13 +16,8 @@ main() {
}
@reflectiveTest
class UnnecessaryNullComparisonFalseTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class UnnecessaryNullComparisonFalseTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_equal_intLiteral() async {
await assertNoErrorsInCode('''
f(int a, int? b) {
@ -85,13 +78,8 @@ f(int? a) {
}
@reflectiveTest
class UnnecessaryNullComparisonTrueTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class UnnecessaryNullComparisonTrueTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_notEqual_intLiteral() async {
await assertNoErrorsInCode('''
f(int a, int? b) {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -51,12 +50,7 @@ void f<T>(T a) {
@reflectiveTest
class UnnecessaryTypeCheckFalseWithNnbdTest
extends UnnecessaryTypeCheckFalseTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
extends UnnecessaryTypeCheckFalseTest with WithNullSafetyMixin {
@override
test_type_not_object() async {
await assertNoErrorsInCode(r'''
@ -109,13 +103,8 @@ void f<T>(T a) {
}
@reflectiveTest
class UnnecessaryTypeCheckTrueWithNnbdTest
extends UnnecessaryTypeCheckTrueTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.3.0', additionalFeatures: [Feature.non_nullable]);
class UnnecessaryTypeCheckTrueWithNnbdTest extends UnnecessaryTypeCheckTrueTest
with WithNullSafetyMixin {
@override
test_type_is_object() async {
await assertNoErrorsInCode(r'''

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -1403,12 +1402,8 @@ int _a = 7;
}
@reflectiveTest
class UnusedElementWithNnbdTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.6.0', additionalFeatures: [Feature.non_nullable]);
class UnusedElementWithNnbdTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_optionalParameter_isUsed_overrideRequiredNamed() async {
await assertNoErrorsInCode(r'''
class A {

View file

@ -2,14 +2,12 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -20,13 +18,8 @@ main() {
}
@reflectiveTest
class InvalidUseOfNullValueTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
class InvalidUseOfNullValueTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_as() async {
await assertNoErrorsInCode(r'''
m() {
@ -132,16 +125,7 @@ m(bool cond) {
@reflectiveTest
class UncheckedUseOfNullableValueInsideExtensionTest
extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
extends DriverResolutionTest with WithNullSafetyMixin {
test_indexExpression_nonNullable() async {
await assertNoErrorsInCode(r'''
class A {
@ -346,16 +330,8 @@ extension E on A? {
}
@reflectiveTest
class UncheckedUseOfNullableValueTest extends DriverResolutionTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.fromEnableFlags(
[EnableString.non_nullable],
);
@override
bool get typeToStringWithNullability => true;
class UncheckedUseOfNullableValueTest extends DriverResolutionTest
with WithNullSafetyMixin {
test_and_nonNullable() async {
await assertNoErrorsInCode(r'''
m() {

View file

@ -2,12 +2,11 @@
// 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/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/driver_resolution.dart';
import '../dart/resolution/with_null_safety_mixin.dart';
main() {
defineReflectiveSuite(() {
@ -440,12 +439,5 @@ Iterable<String> g() => throw 0;
}
@reflectiveTest
class YieldOfInvalidTypeTest2 extends YieldOfInvalidTypeTest {
@override
AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
..contextFeatures = FeatureSet.forTesting(
sdkVersion: '2.7.0', additionalFeatures: [Feature.non_nullable]);
@override
bool get typeToStringWithNullability => true;
}
class YieldOfInvalidTypeTest2 extends YieldOfInvalidTypeTest
with WithNullSafetyMixin {}