diff --git a/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart b/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart index 6d38db223d0..9f3a4db3957 100644 --- a/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart +++ b/pkg/analyzer/lib/src/dart/analysis/feature_set_provider.dart @@ -12,10 +12,6 @@ import 'package:analyzer/src/util/uri.dart'; import 'package:pub_semver/pub_semver.dart'; class FeatureSetProvider { - /// This flag will be turned to `true` and inlined when we un-fork SDK, - /// so that the only SDK is the Null Safe SDK. - static const isNullSafetySdk = true; - final Version _sdkLanguageVersion; final AllowedExperiments _allowedExperiments; final ResourceProvider _resourceProvider; diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart index 9fe7223e5c7..367f7efdcf0 100644 --- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart +++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart @@ -2643,7 +2643,7 @@ const c = a.codeUnitAt(b); invocation.methodName, elementMatcher( stringElement.getMethod('codeUnitAt'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), ); @@ -8532,7 +8532,7 @@ main() { prefixed, element: elementMatcher( objectHashCode, - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -8546,7 +8546,7 @@ main() { identifier, element: elementMatcher( objectHashCode, - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart index 1581d510fe9..ce3713b1e92 100644 --- a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart @@ -103,7 +103,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -129,7 +129,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -155,7 +155,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -228,7 +228,7 @@ class B extends A { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -254,7 +254,7 @@ class A { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -733,7 +733,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -925,7 +925,7 @@ void f() { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -963,7 +963,7 @@ void f() { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -1072,7 +1072,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -1134,7 +1134,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -1176,7 +1176,7 @@ void f(C c) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -1271,7 +1271,7 @@ class B extends A { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -1306,7 +1306,7 @@ class A { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -1623,7 +1623,7 @@ void f() { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'num', // num + int = num ); @@ -2144,7 +2144,7 @@ class C { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -2184,7 +2184,7 @@ class C with M1, M2 { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -2281,7 +2281,7 @@ void f() { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -2349,7 +2349,7 @@ class A { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart index f3f1dea00ba..5be34e43544 100644 --- a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart @@ -123,7 +123,7 @@ f(int a, int b) { findNode.binary('a != b'), element: elementMatcher( numElement.getMethod('=='), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'bool', ); @@ -177,7 +177,7 @@ f(int a, int b) { findNode.binary('a == b'), element: elementMatcher( numElement.getMethod('=='), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'bool', ); @@ -287,7 +287,7 @@ f(int a, double b) { findNode.binary('a - b'), element: elementMatcher( numElement.getMethod('-'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -304,7 +304,7 @@ f(int a, int b) { findNode.binary('a - b'), element: elementMatcher( numElement.getMethod('-'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -334,7 +334,7 @@ f(int a, double b) { findNode.binary('a % b'), element: elementMatcher( numElement.getMethod('%'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -351,7 +351,7 @@ f(int a, int b) { findNode.binary('a % b'), element: elementMatcher( numElement.getMethod('%'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -405,7 +405,7 @@ f(double a, dynamic b) { findNode.binary('a + b'), element: elementMatcher( doubleElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -489,7 +489,7 @@ f(int a, double b) { findNode.binary('a + b'), element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -506,7 +506,7 @@ f(int a, dynamic b) { findNode.binary('a + b'), element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'num', ); @@ -523,7 +523,7 @@ f(int a, int b) { findNode.binary('a + b'), element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -540,7 +540,7 @@ f(int Function() a, int b) { findNode.binary('a() + b'), element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -577,7 +577,7 @@ f(int a, num b) { findNode.binary('a + b'), element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'num', ); @@ -741,7 +741,7 @@ f(T a) { findNode.binary('a + 0'), element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'num', ); @@ -758,7 +758,7 @@ f(int a, int b) { findNode.binary('a / b'), element: elementMatcher( numElement.getMethod('/'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -788,7 +788,7 @@ f(int a, double b) { findNode.binary('a * b'), element: elementMatcher( numElement.getMethod('*'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -805,7 +805,7 @@ f(int a, int b) { findNode.binary('a * b'), element: elementMatcher( numElement.getMethod('*'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart index 946f22306d5..3a737e2b7a4 100644 --- a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart @@ -630,7 +630,7 @@ void f(A a) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -664,7 +664,7 @@ void f(A a) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -699,7 +699,7 @@ void f(p.A a) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -740,7 +740,7 @@ void f(p.A a) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart index e10926e4ffb..20e87bf969d 100644 --- a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart @@ -187,7 +187,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numPlusElement, - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: typeToStringWithNullability ? 'double' : 'num', ); @@ -248,7 +248,7 @@ void f(A a) { writeType: 'double', operatorElement: elementMatcher( doublePlusElement, - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart index a76e41a9ddb..3b573d9048b 100644 --- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart @@ -77,7 +77,7 @@ f(double a, double b, double c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: typeToStringWithNullability ? 'double' : 'num'); } @@ -92,7 +92,7 @@ f(double a, double b, int c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -107,7 +107,7 @@ f(double a, int b, double c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -122,7 +122,7 @@ f(double a, int b, int c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -181,7 +181,7 @@ f(int a, double b, double c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -196,7 +196,7 @@ f(int a, double b, dynamic c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -211,7 +211,7 @@ f(int a, double b, int c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -226,7 +226,7 @@ f(int a, dynamic b, double c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -241,7 +241,7 @@ f(int a, dynamic b, int c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -256,7 +256,7 @@ f(int a, int b, double c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -271,7 +271,7 @@ f(int a, int b, dynamic c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -286,7 +286,7 @@ f(int a, int b, int c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: typeToStringWithNullability ? 'int' : 'num'); } @@ -305,7 +305,7 @@ f(int a, int b, int c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: typeToStringWithNullability ? 'int' : 'num'); } @@ -337,7 +337,7 @@ f(int a, int b, Never c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -356,7 +356,7 @@ f(int a, Never b, int c) { assertMethodInvocation( findNode.methodInvocation('clamp'), elementMatcher(numElement.getMethod('clamp'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num, num)', expectedType: 'num'); } @@ -2122,7 +2122,7 @@ void f(a) { findNode.methodInvocation('toString()'), element: elementMatcher( objectElement.getMethod('toString'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), typeArgumentTypes: [], invokeType: 'String Function()', @@ -2223,7 +2223,7 @@ f(int a, double b) { assertMethodInvocation( findNode.methodInvocation('remainder'), elementMatcher(numElement.getMethod('remainder'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num)', expectedType: typeToStringWithNullability ? 'double' : 'num'); } @@ -2238,7 +2238,7 @@ f(int a, int b) { assertMethodInvocation( findNode.methodInvocation('remainder'), elementMatcher(numElement.getMethod('remainder'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num)', expectedType: typeToStringWithNullability ? 'int' : 'num'); } @@ -2253,7 +2253,7 @@ f(int Function() a, int b) { assertMethodInvocation( findNode.methodInvocation('remainder'), elementMatcher(numElement.getMethod('remainder'), - isLegacy: isNullSafetySdkAndLegacyLibrary), + isLegacy: isLegacyLibrary), 'num Function(num)', expectedType: typeToStringWithNullability ? 'int' : 'num'); } diff --git a/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart index 2c5f4431487..3cfabd6eec6 100644 --- a/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/postfix_expression_test.dart @@ -319,7 +319,7 @@ void f(int x) { writeType: 'int', element: elementMatcher( numElement.getMethod('-'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -345,7 +345,7 @@ void f(A a) { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -373,7 +373,7 @@ class B extends A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -399,7 +399,7 @@ class A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -489,7 +489,7 @@ void f(A a) { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -518,7 +518,7 @@ void f() { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -546,7 +546,7 @@ void f() { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -577,7 +577,7 @@ class B extends A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -603,7 +603,7 @@ class A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -624,7 +624,7 @@ void f(double x) { writeType: 'double', element: elementMatcher( doubleElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -645,7 +645,7 @@ void f(int x) { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -666,7 +666,7 @@ void f(num x) { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'num', ); @@ -695,7 +695,7 @@ class B extends A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -725,7 +725,7 @@ void f() { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -757,7 +757,7 @@ class A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart index 1fa6d56f621..34082374d5c 100644 --- a/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/prefix_expression_test.dart @@ -234,7 +234,7 @@ void f(A a) { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -262,7 +262,7 @@ class B extends A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -288,7 +288,7 @@ class A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -309,7 +309,7 @@ void f(int x) { writeType: null, element: elementMatcher( intElement.getMethod('unary-'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -382,7 +382,7 @@ void f(A a) { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -411,7 +411,7 @@ void f() { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -439,7 +439,7 @@ void f() { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -470,7 +470,7 @@ class B extends A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -496,7 +496,7 @@ class A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -517,7 +517,7 @@ void f(double x) { writeType: 'double', element: elementMatcher( doubleElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'double', ); @@ -538,7 +538,7 @@ void f(int x) { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -559,7 +559,7 @@ void f(num x) { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'num', ); @@ -585,7 +585,7 @@ void f(T x) { writeType: 'T', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'num', ); @@ -614,7 +614,7 @@ class B extends A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -644,7 +644,7 @@ class A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -674,7 +674,7 @@ void f() { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -706,7 +706,7 @@ class A { writeType: 'num', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -735,7 +735,7 @@ class A { writeType: 'int', element: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -756,7 +756,7 @@ void f(int x) { writeType: null, element: elementMatcher( intElement.getMethod('~'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart index e1fcbccb624..dc81aabbd6b 100644 --- a/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/prefixed_identifier_test.dart @@ -220,7 +220,7 @@ void f(A a) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart index e3ef89b03fd..d57c5ea8223 100644 --- a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart @@ -223,7 +223,7 @@ void f(A a) { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -335,7 +335,7 @@ void f() { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -472,7 +472,7 @@ void f() { writeType: 'num', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -578,7 +578,7 @@ class B extends A { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart index 63a93dbb6c3..9cdf492b55a 100644 --- a/pkg/analyzer/test/src/dart/resolution/resolution.dart +++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart @@ -9,7 +9,6 @@ import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/dart/element/type_provider.dart'; import 'package:analyzer/error/error.dart'; -import 'package:analyzer/src/dart/analysis/feature_set_provider.dart'; import 'package:analyzer/src/dart/ast/ast.dart'; import 'package:analyzer/src/dart/ast/extensions.dart'; import 'package:analyzer/src/dart/element/element.dart'; @@ -57,11 +56,8 @@ mixin ResolutionTest implements ResourceProviderMixin { InterfaceType get intType => typeProvider.intType; - bool get isNullSafetySdkAndLegacyLibrary { - if (FeatureSetProvider.isNullSafetySdk) { - return !result.libraryElement.isNonNullableByDefault; - } - return false; + bool get isLegacyLibrary { + return !result.libraryElement.isNonNullableByDefault; } ClassElement get listElement => typeProvider.listElement; diff --git a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart index c64b59274cd..a120a6ffa85 100644 --- a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart +++ b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart @@ -571,7 +571,7 @@ void f() { findNode.binary('=='), element: elementMatcher( objectElement.getMethod('=='), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'bool', ); @@ -621,7 +621,7 @@ void f() { findNode.simple('toString'), element: elementMatcher( objectElement.getMethod('toString'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'String Function()', ); @@ -638,7 +638,7 @@ void f() { findNode.simple('hashCode'), element: elementMatcher( objectElement.getGetter('hashCode'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); diff --git a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart index ab0bbca832d..cfe890278ca 100644 --- a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart +++ b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart @@ -340,7 +340,7 @@ class A { @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/38162') test_method_async_block_callable_class() async { - if (isNullSafetySdkAndLegacyLibrary) { + if (isLegacyLibrary) { throw 'Make it fail for Null Safety as well, for now.'; } diff --git a/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart b/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart index 64accd64fa0..8eec4b23230 100644 --- a/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart +++ b/pkg/analyzer/test/src/diagnostics/use_of_nullable_value_test.dart @@ -505,7 +505,7 @@ m(B b) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -518,7 +518,7 @@ m(B b) { writeType: 'int?', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -561,7 +561,7 @@ m(B b) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int?', ); @@ -574,7 +574,7 @@ m(B b) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -608,7 +608,7 @@ m(int x, int? y) { writeType: 'int', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', ); @@ -621,7 +621,7 @@ m(int x, int? y) { writeType: 'int?', operatorElement: elementMatcher( numElement.getMethod('+'), - isLegacy: isNullSafetySdkAndLegacyLibrary, + isLegacy: isLegacyLibrary, ), type: 'int', );