Inline FeatureSetProvider.isNullSafetySdk, rename isNullSafetySdkAndLegacyLibrary.

Change-Id: I12397d77a1f77bc872f335550789322e4344d456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2021-08-09 13:31:38 +00:00 committed by commit-bot@chromium.org
parent 0f7f8e361c
commit 04c44e8e67
15 changed files with 113 additions and 121 deletions

View file

@ -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;

View file

@ -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',
);

View file

@ -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',
);

View file

@ -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 extends num>(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',
);

View file

@ -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',
);

View file

@ -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<double> a) {
writeType: 'double',
operatorElement: elementMatcher(
doublePlusElement,
isLegacy: isNullSafetySdkAndLegacyLibrary,
isLegacy: isLegacyLibrary,
),
type: 'double',
);

View file

@ -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');
}

View file

@ -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',
);

View file

@ -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 extends num>(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',
);

View file

@ -220,7 +220,7 @@ void f(A a) {
writeType: 'int',
operatorElement: elementMatcher(
numElement.getMethod('+'),
isLegacy: isNullSafetySdkAndLegacyLibrary,
isLegacy: isLegacyLibrary,
),
type: 'int',
);

View file

@ -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',
);

View file

@ -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;

View file

@ -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',
);

View file

@ -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.';
}

View file

@ -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',
);