[cfe] Warn about non-nullable operands in null-aware operations

Closes #40094.

Bug: http://dartbug.com/40094
Change-Id: I3af5258bf0845257915eb090889fde0fdcb96bf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134339
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Dmitry Stefantsov
2020-02-06 11:06:41 +00:00
committed by commit-bot@chromium.org
parent a6ba130b73
commit 11790fe024
29 changed files with 1724 additions and 192 deletions
@@ -2047,6 +2047,42 @@ Message _withArgumentsMixinInferenceNoMatchingClass(
arguments: {'name': name, 'name2': name2, 'type': _type});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
String name, DartType _type, bool isNonNullableByDefault)>
templateNonNullableInNullAware = const Template<
Message Function(
String name, DartType _type, bool isNonNullableByDefault)>(
messageTemplate:
r"""Operand of null-aware operation '#name' has type '#type' which excludes null.""",
withArguments: _withArgumentsNonNullableInNullAware);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<
Message Function(
String name, DartType _type, bool isNonNullableByDefault)>
codeNonNullableInNullAware = const Code<
Message Function(
String name, DartType _type, bool isNonNullableByDefault)>(
"NonNullableInNullAware", templateNonNullableInNullAware,
severity: Severity.warning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsNonNullableInNullAware(
String name, DartType _type, bool isNonNullableByDefault) {
if (name.isEmpty) throw 'No name provided';
name = demangleMixinApplicationName(name);
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
List<Object> typeParts = labeler.labelType(_type);
String type = typeParts.join();
return new Message(codeNonNullableInNullAware,
message:
"""Operand of null-aware operation '${name}' has type '${type}' which excludes null.""" +
labeler.originMessages,
arguments: {'name': name, 'type': _type});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
templateNullableExpressionCallError = const Template<
@@ -352,6 +352,10 @@ class InferenceVisitor
ExpressionInferenceResult result = inferrer.inferExpression(
node.variable.initializer, typeContext, true,
isVoidAllowed: false);
if (node.isNullAware) {
reportNonNullableInNullAwareWarningIfNeeded(
result.inferredType, "?..", node.fileOffset);
}
node.variable.initializer = result.expression..parent = node.variable;
node.variable.type = result.inferredType;
@@ -1087,6 +1091,8 @@ class InferenceVisitor
ExpressionInferenceResult lhsResult = inferrer.inferExpression(
node.left, inferrer.computeNullable(typeContext), true,
isVoidAllowed: false);
reportNonNullableInNullAwareWarningIfNeeded(
lhsResult.inferredType, "??", node.left.fileOffset);
Member equalsMember = inferrer
.findInterfaceMember(
@@ -1280,6 +1286,10 @@ class InferenceVisitor
<DartType>[inferredTypeArgument]),
inferenceNeeded || typeChecksNeeded,
isVoidAllowed: true);
if (element.isNullAware) {
reportNonNullableInNullAwareWarningIfNeeded(
spreadResult.inferredType, "...?", element.expression.fileOffset);
}
element.expression = spreadResult.expression..parent = element;
DartType spreadType = spreadResult.inferredType;
inferredSpreadTypes[element.expression] = spreadType;
@@ -1689,6 +1699,10 @@ class InferenceVisitor
ExpressionInferenceResult spreadResult = inferrer.inferExpression(
entry.expression, spreadContext, inferenceNeeded || typeChecksNeeded,
isVoidAllowed: true);
if (entry.isNullAware) {
reportNonNullableInNullAwareWarningIfNeeded(
spreadResult.inferredType, "...?", entry.expression.fileOffset);
}
entry.expression = spreadResult.expression..parent = entry;
DartType spreadType = spreadResult.inferredType;
inferredSpreadTypes[entry.expression] = spreadType;
@@ -2376,8 +2390,8 @@ class InferenceVisitor
ExpressionInferenceResult operandResult = inferrer.inferExpression(
node.operand, inferrer.computeNullable(typeContext), true);
node.operand = operandResult.expression..parent = node;
// TODO(johnniwinther): Check that the inferred type is potentially
// nullable.
reportNonNullableInNullAwareWarningIfNeeded(
operandResult.inferredType, "!", node.operand.fileOffset);
inferrer.flowAnalysis.nonNullAssert_end(node.operand);
DartType nonNullableResultType =
inferrer.computeNonNullable(operandResult.inferredType);
@@ -2388,6 +2402,8 @@ class InferenceVisitor
NullAwareMethodInvocation node, DartType typeContext) {
Link<NullAwareGuard> nullAwareGuards =
inferrer.inferSyntheticVariableNullAware(node.variable);
reportNonNullableInNullAwareWarningIfNeeded(
node.variable.type, "?.", node.variable.fileOffset);
NullAwareGuard nullAwareGuard =
inferrer.createNullAwareGuard(node.variable);
ExpressionInferenceResult invocationResult = inferrer.inferExpression(
@@ -2403,6 +2419,8 @@ class InferenceVisitor
NullAwarePropertyGet node, DartType typeContext) {
Link<NullAwareGuard> nullAwareGuards =
inferrer.inferSyntheticVariableNullAware(node.variable);
reportNonNullableInNullAwareWarningIfNeeded(
node.variable.type, "?.", node.variable.fileOffset);
NullAwareGuard nullAwareGuard =
inferrer.createNullAwareGuard(node.variable);
ExpressionInferenceResult readResult =
@@ -2417,6 +2435,8 @@ class InferenceVisitor
NullAwarePropertySet node, DartType typeContext) {
Link<NullAwareGuard> nullAwareGuards =
inferrer.inferSyntheticVariableNullAware(node.variable);
reportNonNullableInNullAwareWarningIfNeeded(
node.variable.type, "?.", node.variable.fileOffset);
NullAwareGuard nullAwareGuard =
inferrer.createNullAwareGuard(node.variable);
ExpressionInferenceResult writeResult =
@@ -2430,6 +2450,8 @@ class InferenceVisitor
ExpressionInferenceResult visitNullAwareExtension(
NullAwareExtension node, DartType typeContext) {
inferrer.inferSyntheticVariable(node.variable);
reportNonNullableInNullAwareWarningIfNeeded(
node.variable.type, "?.", node.variable.fileOffset);
NullAwareGuard nullAwareGuard =
inferrer.createNullAwareGuard(node.variable);
ExpressionInferenceResult expressionResult =
@@ -2572,6 +2594,8 @@ class InferenceVisitor
ExpressionInferenceResult readResult = inferrer.inferExpression(
node.read, const UnknownType(), true,
isVoidAllowed: true);
reportNonNullableInNullAwareWarningIfNeeded(
readResult.inferredType, "??=", node.read.fileOffset);
Expression read = readResult.expression;
DartType readType = readResult.inferredType;
@@ -2633,6 +2657,8 @@ class InferenceVisitor
IfNullSet node, DartType typeContext) {
ExpressionInferenceResult readResult =
inferrer.inferExpression(node.read, const UnknownType(), true);
reportNonNullableInNullAwareWarningIfNeeded(
readResult.inferredType, "??=", node.read.fileOffset);
Link<NullAwareGuard> nullAwareGuards;
Expression read;
DartType readType;
@@ -2995,6 +3021,8 @@ class InferenceVisitor
ExpressionInferenceResult readResult = _computeIndexGet(node.readOffset,
readReceiver, receiverType, readTarget, readIndex, checkKind);
reportNonNullableInNullAwareWarningIfNeeded(
readResult.inferredType, "??=", node.readOffset);
Expression read = readResult.expression;
DartType readType = readResult.inferredType;
inferrer.flowAnalysis.ifNullExpression_rightBegin(read);
@@ -3114,6 +3142,8 @@ class InferenceVisitor
: const ObjectAccessTarget.missing();
DartType readType = inferrer.getReturnType(readTarget, inferrer.thisType);
reportNonNullableInNullAwareWarningIfNeeded(
readType, "??=", node.readOffset);
DartType readIndexType =
inferrer.getIndexKeyType(readTarget, inferrer.thisType);
@@ -3314,6 +3344,8 @@ class InferenceVisitor
readTarget,
readIndex,
MethodContravarianceCheckKind.none);
reportNonNullableInNullAwareWarningIfNeeded(
readResult.inferredType, "??=", node.readOffset);
Expression read = readResult.expression;
DartType readType = readResult.inferredType;
inferrer.flowAnalysis.ifNullExpression_rightBegin(read);
@@ -4157,6 +4189,8 @@ class InferenceVisitor
ExpressionInferenceResult receiverResult = inferrer.inferExpression(
node.receiver, const UnknownType(), true,
isVoidAllowed: true);
reportNonNullableInNullAwareWarningIfNeeded(
receiverResult.inferredType, "?.", node.receiver.fileOffset);
Expression receiver;
DartType receiverType;
@@ -4666,6 +4700,8 @@ class InferenceVisitor
ExpressionInferenceResult receiverResult = inferrer.inferExpression(
node.receiver, const UnknownType(), true,
isVoidAllowed: false);
reportNonNullableInNullAwareWarningIfNeeded(
receiverResult.inferredType, "?.", node.receiver.fileOffset);
Link<NullAwareGuard> nullAwareGuards;
Expression receiver;
@@ -5659,6 +5695,20 @@ class InferenceVisitor
return new ExpressionInferenceResult(
result.inferredType, result.expression);
}
void reportNonNullableInNullAwareWarningIfNeeded(
DartType operandType, String operationName, int offset) {
if (inferrer.isNonNullableByDefault && inferrer.performNnbdChecks) {
if (operandType != InvalidType && !operandType.isPotentiallyNullable) {
inferrer.library.addProblem(
templateNonNullableInNullAware.withArguments(
operationName, operandType, inferrer.isNonNullableByDefault),
offset,
noLength,
inferrer.library.fileUri);
}
}
}
}
class ForInResult {
+2
View File
@@ -465,6 +465,8 @@ NonConstConstructor/example: Fail
NonConstFactory/example: Fail
NonInstanceTypeVariableUse/example: Fail
NonNullAwareSpreadIsNull/analyzerCode: Fail # There's no analyzer code for that error yet.
NonNullableInNullAware/analyzerCode: Fail
NonNullableInNullAware/example: Fail
NonNullableOptOut/analyzerCode: Fail
NonNullableOptOut/example: Fail
NonPartOfDirectiveInPart/part_wrapped_script1: Fail
+4
View File
@@ -3906,3 +3906,7 @@ DefaultListConstructorWarning:
template: "Using the default List constructor."
tip: "Try using List.filled instead."
severity: WARNING
NonNullableInNullAware:
template: "Operand of null-aware operation '#name' has type '#type' which excludes null."
severity: WARNING
@@ -1028,6 +1028,7 @@ exceptions
exclamation
exclude
excluded
excludes
excluding
exclusive
executable
@@ -1,4 +1,16 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:14: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:24: Warning: Operand of null-aware operation '!' has type 'C' which excludes null.
// - 'C' is from 'pkg/front_end/testcases/nnbd/issue_39286_2.dart'.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,16 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:14: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:24: Warning: Operand of null-aware operation '!' has type 'C' which excludes null.
// - 'C' is from 'pkg/front_end/testcases/nnbd/issue_39286_2.dart'.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,16 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:14: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:24: Warning: Operand of null-aware operation '!' has type 'C' which excludes null.
// - 'C' is from 'pkg/front_end/testcases/nnbd/issue_39286_2.dart'.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,16 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:14: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
// pkg/front_end/testcases/nnbd/issue_39286_2.dart:15:24: Warning: Operand of null-aware operation '!' has type 'C' which excludes null.
// - 'C' is from 'pkg/front_end/testcases/nnbd/issue_39286_2.dart'.
// x..f()!.g()['Hi!']!..h()!.y = 2;
// ^
//
import self as self;
import "dart:core" as core;
+10 -3
View File
@@ -9,23 +9,30 @@ class Class {
void operator []=(int key, int value) {}
Class get nonNullableClass => this;
Class call() => this;
NullableIndexClass get nonNullableNullableIndexClass => NullableIndexClass();
}
class NullableIndexClass {
int? operator [](int key) => key;
void operator []=(int key, int value) {}
}
main() {}
errors(Class? nullableClass, Class nonNullableClass, int? nullableInt,
int nonNullableInt) {
int nonNullableInt, NullableIndexClass? nullableNullableIndexClass) {
-nullableInt; // error
nullableInt + 2; // error
nullableClass[nonNullableInt]; // error
nullableClass[nonNullableInt] = nonNullableInt; // error
nullableClass[nonNullableInt] += nonNullableInt; // error
nullableClass[nonNullableInt] ??= nonNullableInt; // error
nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
nullableClass?.nonNullableClass[nonNullableInt]; // ok
nullableClass?.nonNullableClass[nonNullableInt] = nonNullableInt; // ok
nullableClass?.nonNullableClass[nonNullableInt] += nonNullableInt; // ok
nullableClass?.nonNullableClass[nonNullableInt] ??= nonNullableInt; // ok
nullableClass?.nonNullableNullableIndexClass[nonNullableInt] ??=
nonNullableInt; // ok
nullableClass.nonNullableField; // error
nullableClass.nonNullableField = 2; // error
@@ -15,8 +15,18 @@ class Class extends core::Object {
;
method call() → self::Class
;
get nonNullableNullableIndexClass() → self::NullableIndexClass
;
}
class NullableIndexClass extends core::Object {
synthetic constructor •() → self::NullableIndexClass
;
operator [](core::int key) → core::int?
;
operator []=(core::int key, core::int value) → void
;
}
static method main() → dynamic
;
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt) → dynamic
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt, self::NullableIndexClass? nullableNullableIndexClass) → dynamic
;
@@ -2,82 +2,96 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_access.dart:18:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:24:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
// -nullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:19:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:25:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// nullableInt + 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:20:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:26:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt]; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:21:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:27:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] = nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]' cannot be called on 'NullableIndexClass?' because it is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]=' cannot be called on 'NullableIndexClass?' because it is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:30:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:37:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:31:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:38:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField = 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:32:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:39:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField += 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:41:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:48:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// nonNullableClass.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:42:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:49:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// nullableClass?.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:54:35: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// nullableClass?.nonNullableClass.nonNullableField ??= 0; // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?. instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?.call instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:59:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass(); // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:60:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass.nonNullableClass(); // ok
// ^
//
import self as self;
import "dart:core" as core;
@@ -94,56 +108,66 @@ class Class extends core::Object {
return this;
method call() → self::Class
return this;
get nonNullableNullableIndexClass() → self::NullableIndexClass
return new self::NullableIndexClass::•();
}
class NullableIndexClass extends core::Object {
synthetic constructor •() → self::NullableIndexClass
: super core::Object::•()
;
operator [](core::int key) → core::int?
return key;
operator []=(core::int key, core::int value) → void {}
}
static method main() → dynamic {}
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt) → dynamic {
let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:18:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt, self::NullableIndexClass? nullableNullableIndexClass) → dynamic {
let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:24:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
-nullableInt; // error
^" in nullableInt.{core::int::unary-}();
let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:19:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:25:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
nullableInt + 2; // error
^" in nullableInt.{core::num::+}(2);
let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:20:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:26:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt]; // error
^" in nullableClass.{self::Class::[]}(nonNullableInt);
let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:21:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:27:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] = nonNullableInt; // error
^" in nullableClass.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t5 = nullableClass in let final core::int #t6 = nonNullableInt in let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
let final self::Class? #t5 = nullableClass in let final core::int #t6 = nonNullableInt in let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] += nonNullableInt; // error
^" in #t5.{self::Class::[]=}(#t6, (let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
^" in #t5.{self::Class::[]=}(#t6, (let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] += nonNullableInt; // error
^" in #t5.{self::Class::[]}(#t6)).{core::num::+}(nonNullableInt));
let final self::Class? #t9 = nullableClass in let final core::int #t10 = nonNullableInt in (let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::Class::[]}(#t10)).{core::num::==}(null) ?{core::int} let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::Class::[]=}(#t10, nonNullableInt) : null;
let final self::NullableIndexClass? #t9 = nullableNullableIndexClass in let final core::int #t10 = nonNullableInt in (let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]' cannot be called on 'NullableIndexClass?' because it is potentially null.
- 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::NullableIndexClass::[]}(#t10)).{core::num::==}(null) ?{core::int} let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]=' cannot be called on 'NullableIndexClass?' because it is potentially null.
- 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::NullableIndexClass::[]=}(#t10, nonNullableInt) : null;
let final self::Class? #t13 = nullableClass in #t13.{core::Object::==}(null) ?{core::int?} null : #t13{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]}(nonNullableInt);
let final self::Class? #t14 = nullableClass in #t14.{core::Object::==}(null) ?{core::int?} null : #t14{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t15 = nullableClass in #t15.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t16 = #t15{self::Class}.{self::Class::nonNullableClass} in let final core::int #t17 = nonNullableInt in #t16.{self::Class::[]=}(#t17, #t16.{self::Class::[]}(#t17).{core::num::+}(nonNullableInt));
let final self::Class? #t18 = nullableClass in #t18.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t19 = #t18{self::Class}.{self::Class::nonNullableClass} in let final core::int #t20 = nonNullableInt in #t19.{self::Class::[]}(#t20).{core::num::==}(null) ?{core::int} #t19.{self::Class::[]=}(#t20, nonNullableInt) : null;
let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:30:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
let final self::Class? #t18 = nullableClass in #t18.{core::Object::==}(null) ?{core::int?} null : let final self::NullableIndexClass #t19 = #t18{self::Class}.{self::Class::nonNullableNullableIndexClass} in let final core::int #t20 = nonNullableInt in #t19.{self::NullableIndexClass::[]}(#t20).{core::num::==}(null) ?{core::int} #t19.{self::NullableIndexClass::[]=}(#t20, nonNullableInt) : null;
let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:37:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField; // error
^^^^^^^^^^^^^^^^" in nullableClass.{self::Class::nonNullableField};
let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:31:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:38:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField = 2; // error
^^^^^^^^^^^^^^^^" in nullableClass.{self::Class::nonNullableField} = 2;
let final self::Class? #t23 = nullableClass in let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:32:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
let final self::Class? #t23 = nullableClass in let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:39:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField += 2; // error
^^^^^^^^^^^^^^^^" in #t23.{self::Class::nonNullableField} = (let final<BottomType> #t25 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:32:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
^^^^^^^^^^^^^^^^" in #t23.{self::Class::nonNullableField} = (let final<BottomType> #t25 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:39:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField += 2; // error
@@ -153,21 +177,21 @@ Try accessing using ?. instead.
let final self::Class? #t28 = nullableClass in #t28.{core::Object::==}(null) ?{core::int?} null : #t28.{self::Class::nonNullableField} = #t28.{self::Class::nonNullableField}.{core::num::+}(2);
let final self::Class? #t29 = nullableClass in #t29.{core::Object::==}(null) ?{core::int?} null : #t29{self::Class}.{self::Class::nonNullableClass}.{self::Class::nonNullableField};
let final self::Class? #t30 = nullableClass in #t30.{core::Object::==}(null) ?{core::int?} null : #t30{self::Class}.{self::Class::nonNullableClass}.{self::Class::nonNullableField} = 2;
let final self::Class #t31 = nonNullableClass in #t31.{self::Class::nullableField} = let final<BottomType> #t32 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:41:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
let final self::Class #t31 = nonNullableClass in #t31.{self::Class::nullableField} = let final<BottomType> #t32 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:48:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
nonNullableClass.nullableField += 2; // error
^" in #t31.{self::Class::nullableField}.{core::num::+}(2);
let final self::Class? #t33 = nullableClass in #t33.{core::Object::==}(null) ?{core::int?} null : #t33.{self::Class::nullableField} = let final<BottomType> #t34 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:42:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
let final self::Class? #t33 = nullableClass in #t33.{core::Object::==}(null) ?{core::int?} null : #t33.{self::Class::nullableField} = let final<BottomType> #t34 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:49:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
nullableClass?.nullableField += 2; // error
^" in #t33.{self::Class::nullableField}.{core::num::+}(2);
let final self::Class? #t35 = nullableClass in #t35.{core::Object::==}(null) ?{core::int?} null : #t35.{self::Class::nonNullableField}.{core::num::==}(null) ?{core::int} #t35.{self::Class::nonNullableField} = 0 : null;
let final self::Class? #t36 = nullableClass in #t36.{core::Object::==}(null) ?{core::int?} null : #t36.{self::Class::nullableField}.{core::num::==}(null) ?{core::int} #t36.{self::Class::nullableField} = 0 : null;
let final self::Class? #t37 = nullableClass in #t37.{core::Object::==}(null) ?{core::int?} null : let final self::Class? #t38 = #t37{self::Class}.{self::Class::nonNullableClass} in #t38{self::Class}.{self::Class::nonNullableField}.{core::num::==}(null) ?{core::int} #t38{self::Class}.{self::Class::nonNullableField} = 0 : null;
let final self::Class? #t39 = nullableClass in #t39.{core::Object::==}(null) ?{core::int?} null : let final self::Class? #t40 = #t39{self::Class}.{self::Class::nonNullableClass} in #t40{self::Class}.{self::Class::nullableField}.{core::num::==}(null) ?{core::int} #t40{self::Class}.{self::Class::nullableField} = 0 : null;
let final<BottomType> #t41 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
let final<BottomType> #t41 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try calling using ?.call instead.
nullableClass(); // error
^" in let final<BottomType> #t42 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
^" in let final<BottomType> #t42 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try calling using ?. instead.
nullableClass(); // error
@@ -2,82 +2,96 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_access.dart:18:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:24:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
// -nullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:19:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:25:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// nullableInt + 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:20:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:26:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt]; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:21:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:27:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] = nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]' cannot be called on 'NullableIndexClass?' because it is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]=' cannot be called on 'NullableIndexClass?' because it is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:30:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:37:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:31:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:38:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField = 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:32:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:39:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField += 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:41:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:48:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// nonNullableClass.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:42:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:49:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
// nullableClass?.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:54:35: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// nullableClass?.nonNullableClass.nonNullableField ??= 0; // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?. instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?.call instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:59:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass(); // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:60:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass.nonNullableClass(); // ok
// ^
//
import self as self;
import "dart:core" as core;
@@ -94,56 +108,66 @@ class Class extends core::Object {
return this;
method call() → self::Class
return this;
get nonNullableNullableIndexClass() → self::NullableIndexClass
return new self::NullableIndexClass::•();
}
class NullableIndexClass extends core::Object {
synthetic constructor •() → self::NullableIndexClass
: super core::Object::•()
;
operator [](core::int key) → core::int?
return key;
operator []=(core::int key, core::int value) → void {}
}
static method main() → dynamic {}
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt) → dynamic {
let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:18:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt, self::NullableIndexClass? nullableNullableIndexClass) → dynamic {
let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:24:3: Error: Operator 'unary-' cannot be called on 'int?' because it is potentially null.
-nullableInt; // error
^" in nullableInt.{core::int::unary-}();
let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:19:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:25:15: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
nullableInt + 2; // error
^" in nullableInt.{core::num::+}(2);
let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:20:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:26:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt]; // error
^" in nullableClass.{self::Class::[]}(nonNullableInt);
let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:21:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:27:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] = nonNullableInt; // error
^" in nullableClass.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t5 = nullableClass in let final core::int #t6 = nonNullableInt in let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
let final self::Class? #t5 = nullableClass in let final core::int #t6 = nonNullableInt in let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] += nonNullableInt; // error
^" in #t5.{self::Class::[]=}(#t6, (let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:22:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
^" in #t5.{self::Class::[]=}(#t6, (let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:28:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] += nonNullableInt; // error
^" in #t5.{self::Class::[]}(#t6)).{core::num::+}(nonNullableInt));
let final self::Class? #t9 = nullableClass in let final core::int #t10 = nonNullableInt in (let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::Class::[]}(#t10)).{core::num::==}(null) ?{core::int} let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:23:16: Error: Operator '[]=' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::Class::[]=}(#t10, nonNullableInt) : null;
let final self::NullableIndexClass? #t9 = nullableNullableIndexClass in let final core::int #t10 = nonNullableInt in (let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]' cannot be called on 'NullableIndexClass?' because it is potentially null.
- 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::NullableIndexClass::[]}(#t10)).{core::num::==}(null) ?{core::int} let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:29:29: Error: Operator '[]=' cannot be called on 'NullableIndexClass?' because it is potentially null.
- 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
^" in #t9.{self::NullableIndexClass::[]=}(#t10, nonNullableInt) : null;
let final self::Class? #t13 = nullableClass in #t13.{core::Object::==}(null) ?{core::int?} null : #t13{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]}(nonNullableInt);
let final self::Class? #t14 = nullableClass in #t14.{core::Object::==}(null) ?{core::int?} null : #t14{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t15 = nullableClass in #t15.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t16 = #t15{self::Class}.{self::Class::nonNullableClass} in let final core::int #t17 = nonNullableInt in #t16.{self::Class::[]=}(#t17, #t16.{self::Class::[]}(#t17).{core::num::+}(nonNullableInt));
let final self::Class? #t18 = nullableClass in #t18.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t19 = #t18{self::Class}.{self::Class::nonNullableClass} in let final core::int #t20 = nonNullableInt in #t19.{self::Class::[]}(#t20).{core::num::==}(null) ?{core::int} #t19.{self::Class::[]=}(#t20, nonNullableInt) : null;
let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:30:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
let final self::Class? #t18 = nullableClass in #t18.{core::Object::==}(null) ?{core::int?} null : let final self::NullableIndexClass #t19 = #t18{self::Class}.{self::Class::nonNullableNullableIndexClass} in let final core::int #t20 = nonNullableInt in #t19.{self::NullableIndexClass::[]}(#t20).{core::num::==}(null) ?{core::int} #t19.{self::NullableIndexClass::[]=}(#t20, nonNullableInt) : null;
let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:37:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField; // error
^^^^^^^^^^^^^^^^" in nullableClass.{self::Class::nonNullableField};
let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:31:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:38:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField = 2; // error
^^^^^^^^^^^^^^^^" in nullableClass.{self::Class::nonNullableField} = 2;
let final self::Class? #t23 = nullableClass in let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:32:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
let final self::Class? #t23 = nullableClass in let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:39:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField += 2; // error
^^^^^^^^^^^^^^^^" in #t23.{self::Class::nonNullableField} = (let final<BottomType> #t25 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:32:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
^^^^^^^^^^^^^^^^" in #t23.{self::Class::nonNullableField} = (let final<BottomType> #t25 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:39:17: Error: Property 'nonNullableField' cannot be accessed on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try accessing using ?. instead.
nullableClass.nonNullableField += 2; // error
@@ -153,21 +177,21 @@ Try accessing using ?. instead.
let final self::Class? #t28 = nullableClass in #t28.{core::Object::==}(null) ?{core::int?} null : #t28.{self::Class::nonNullableField} = #t28.{self::Class::nonNullableField}.{core::num::+}(2);
let final self::Class? #t29 = nullableClass in #t29.{core::Object::==}(null) ?{core::int?} null : #t29{self::Class}.{self::Class::nonNullableClass}.{self::Class::nonNullableField};
let final self::Class? #t30 = nullableClass in #t30.{core::Object::==}(null) ?{core::int?} null : #t30{self::Class}.{self::Class::nonNullableClass}.{self::Class::nonNullableField} = 2;
let final self::Class #t31 = nonNullableClass in #t31.{self::Class::nullableField} = let final<BottomType> #t32 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:41:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
let final self::Class #t31 = nonNullableClass in #t31.{self::Class::nullableField} = let final<BottomType> #t32 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:48:34: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
nonNullableClass.nullableField += 2; // error
^" in #t31.{self::Class::nullableField}.{core::num::+}(2);
let final self::Class? #t33 = nullableClass in #t33.{core::Object::==}(null) ?{core::int?} null : #t33.{self::Class::nullableField} = let final<BottomType> #t34 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:42:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
let final self::Class? #t33 = nullableClass in #t33.{core::Object::==}(null) ?{core::int?} null : #t33.{self::Class::nullableField} = let final<BottomType> #t34 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:49:32: Error: Operator '+' cannot be called on 'int?' because it is potentially null.
nullableClass?.nullableField += 2; // error
^" in #t33.{self::Class::nullableField}.{core::num::+}(2);
let final self::Class? #t35 = nullableClass in #t35.{core::Object::==}(null) ?{core::int?} null : #t35.{self::Class::nonNullableField}.{core::num::==}(null) ?{core::int} #t35.{self::Class::nonNullableField} = 0 : null;
let final self::Class? #t36 = nullableClass in #t36.{core::Object::==}(null) ?{core::int?} null : #t36.{self::Class::nullableField}.{core::num::==}(null) ?{core::int} #t36.{self::Class::nullableField} = 0 : null;
let final self::Class? #t37 = nullableClass in #t37.{core::Object::==}(null) ?{core::int?} null : let final self::Class? #t38 = #t37{self::Class}.{self::Class::nonNullableClass} in #t38{self::Class}.{self::Class::nonNullableField}.{core::num::==}(null) ?{core::int} #t38{self::Class}.{self::Class::nonNullableField} = 0 : null;
let final self::Class? #t39 = nullableClass in #t39.{core::Object::==}(null) ?{core::int?} null : let final self::Class? #t40 = #t39{self::Class}.{self::Class::nonNullableClass} in #t40{self::Class}.{self::Class::nullableField}.{core::num::==}(null) ?{core::int} #t40{self::Class}.{self::Class::nullableField} = 0 : null;
let final<BottomType> #t41 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
let final<BottomType> #t41 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Can't use an expression of type 'Class?' as a function because it's potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try calling using ?.call instead.
nullableClass(); // error
^" in let final<BottomType> #t42 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:50:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
^" in let final<BottomType> #t42 = invalid-expression "pkg/front_end/testcases/nnbd/null_access.dart:57:16: Error: Method 'call' cannot be called on 'Class?' because it is potentially null.
- 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
Try calling using ?. instead.
nullableClass(); // error
@@ -2,82 +2,96 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_access.dart:18:3: Warning: Operator 'unary-' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:24:3: Warning: Operator 'unary-' is called on 'int?' which is potentially null.
// -nullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:19:15: Warning: Operator '+' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:25:15: Warning: Operator '+' is called on 'int?' which is potentially null.
// nullableInt + 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:20:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:26:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt]; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:21:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:27:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] = nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Warning: Operator '[]' is called on 'NullableIndexClass?' which is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Warning: Operator '[]=' is called on 'NullableIndexClass?' which is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:30:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:37:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:31:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:38:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField = 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:32:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:39:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField += 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:41:34: Warning: Operator '+' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:48:34: Warning: Operator '+' is called on 'int?' which is potentially null.
// nonNullableClass.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:42:32: Warning: Operator '+' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:49:32: Warning: Operator '+' is called on 'int?' which is potentially null.
// nullableClass?.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Warning: Method 'call' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:54:35: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// nullableClass?.nonNullableClass.nonNullableField ??= 0; // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Warning: Method 'call' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?. instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Warning: Expression of type 'Class?' is used as a function, but it's potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Warning: Expression of type 'Class?' is used as a function, but it's potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?.call instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:59:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass(); // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:60:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass.nonNullableClass(); // ok
// ^
//
import self as self;
import "dart:core" as core;
@@ -94,19 +108,29 @@ class Class extends core::Object {
return this;
method call() → self::Class
return this;
get nonNullableNullableIndexClass() → self::NullableIndexClass
return new self::NullableIndexClass::•();
}
class NullableIndexClass extends core::Object {
synthetic constructor •() → self::NullableIndexClass
: super core::Object::•()
;
operator [](core::int key) → core::int?
return key;
operator []=(core::int key, core::int value) → void {}
}
static method main() → dynamic {}
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt) → dynamic {
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt, self::NullableIndexClass? nullableNullableIndexClass) → dynamic {
nullableInt.{core::int::unary-}();
nullableInt.{core::num::+}(2);
nullableClass.{self::Class::[]}(nonNullableInt);
nullableClass.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t1 = nullableClass in let final core::int #t2 = nonNullableInt in #t1.{self::Class::[]=}(#t2, #t1.{self::Class::[]}(#t2).{core::num::+}(nonNullableInt));
let final self::Class? #t3 = nullableClass in let final core::int #t4 = nonNullableInt in #t3.{self::Class::[]}(#t4).{core::num::==}(null) ?{core::int} #t3.{self::Class::[]=}(#t4, nonNullableInt) : null;
let final self::NullableIndexClass? #t3 = nullableNullableIndexClass in let final core::int #t4 = nonNullableInt in #t3.{self::NullableIndexClass::[]}(#t4).{core::num::==}(null) ?{core::int} #t3.{self::NullableIndexClass::[]=}(#t4, nonNullableInt) : null;
let final self::Class? #t5 = nullableClass in #t5.{core::Object::==}(null) ?{core::int?} null : #t5{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]}(nonNullableInt);
let final self::Class? #t6 = nullableClass in #t6.{core::Object::==}(null) ?{core::int?} null : #t6{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t7 = nullableClass in #t7.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t8 = #t7{self::Class}.{self::Class::nonNullableClass} in let final core::int #t9 = nonNullableInt in #t8.{self::Class::[]=}(#t9, #t8.{self::Class::[]}(#t9).{core::num::+}(nonNullableInt));
let final self::Class? #t10 = nullableClass in #t10.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t11 = #t10{self::Class}.{self::Class::nonNullableClass} in let final core::int #t12 = nonNullableInt in #t11.{self::Class::[]}(#t12).{core::num::==}(null) ?{core::int} #t11.{self::Class::[]=}(#t12, nonNullableInt) : null;
let final self::Class? #t10 = nullableClass in #t10.{core::Object::==}(null) ?{core::int?} null : let final self::NullableIndexClass #t11 = #t10{self::Class}.{self::Class::nonNullableNullableIndexClass} in let final core::int #t12 = nonNullableInt in #t11.{self::NullableIndexClass::[]}(#t12).{core::num::==}(null) ?{core::int} #t11.{self::NullableIndexClass::[]=}(#t12, nonNullableInt) : null;
nullableClass.{self::Class::nonNullableField};
nullableClass.{self::Class::nonNullableField} = 2;
let final self::Class? #t13 = nullableClass in #t13.{self::Class::nonNullableField} = #t13.{self::Class::nonNullableField}.{core::num::+}(2);
@@ -2,82 +2,96 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_access.dart:18:3: Warning: Operator 'unary-' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:24:3: Warning: Operator 'unary-' is called on 'int?' which is potentially null.
// -nullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:19:15: Warning: Operator '+' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:25:15: Warning: Operator '+' is called on 'int?' which is potentially null.
// nullableInt + 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:20:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:26:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt]; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:21:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:27:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] = nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:22:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:28:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] += nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Warning: Operator '[]' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Warning: Operator '[]' is called on 'NullableIndexClass?' which is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:23:16: Warning: Operator '[]=' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableClass[nonNullableInt] ??= nonNullableInt; // error
// ^
// pkg/front_end/testcases/nnbd/null_access.dart:29:29: Warning: Operator '[]=' is called on 'NullableIndexClass?' which is potentially null.
// - 'NullableIndexClass' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nullableNullableIndexClass[nonNullableInt] ??= nonNullableInt; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:30:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:37:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:31:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:38:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField = 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:32:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:39:17: Warning: Property 'nonNullableField' is accessed on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try accessing using ?. instead.
// nullableClass.nonNullableField += 2; // error
// ^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/null_access.dart:41:34: Warning: Operator '+' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:48:34: Warning: Operator '+' is called on 'int?' which is potentially null.
// nonNullableClass.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:42:32: Warning: Operator '+' is called on 'int?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:49:32: Warning: Operator '+' is called on 'int?' which is potentially null.
// nullableClass?.nullableField += 2; // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Warning: Method 'call' is called on 'Class?' which is potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:54:35: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// nullableClass?.nonNullableClass.nonNullableField ??= 0; // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Warning: Method 'call' is called on 'Class?' which is potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?. instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:50:16: Warning: Expression of type 'Class?' is used as a function, but it's potentially null.
// pkg/front_end/testcases/nnbd/null_access.dart:57:16: Warning: Expression of type 'Class?' is used as a function, but it's potentially null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// Try calling using ?.call instead.
// nullableClass(); // error
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:59:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass(); // ok
// ^
//
// pkg/front_end/testcases/nnbd/null_access.dart:60:3: Warning: Operand of null-aware operation '?.' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_access.dart'.
// nonNullableClass?.nonNullableClass.nonNullableClass(); // ok
// ^
//
import self as self;
import "dart:core" as core;
@@ -94,19 +108,29 @@ class Class extends core::Object {
return this;
method call() → self::Class
return this;
get nonNullableNullableIndexClass() → self::NullableIndexClass
return new self::NullableIndexClass::•();
}
class NullableIndexClass extends core::Object {
synthetic constructor •() → self::NullableIndexClass
: super core::Object::•()
;
operator [](core::int key) → core::int?
return key;
operator []=(core::int key, core::int value) → void {}
}
static method main() → dynamic {}
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt) → dynamic {
static method errors(self::Class? nullableClass, self::Class nonNullableClass, core::int? nullableInt, core::int nonNullableInt, self::NullableIndexClass? nullableNullableIndexClass) → dynamic {
nullableInt.{core::int::unary-}();
nullableInt.{core::num::+}(2);
nullableClass.{self::Class::[]}(nonNullableInt);
nullableClass.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t1 = nullableClass in let final core::int #t2 = nonNullableInt in #t1.{self::Class::[]=}(#t2, #t1.{self::Class::[]}(#t2).{core::num::+}(nonNullableInt));
let final self::Class? #t3 = nullableClass in let final core::int #t4 = nonNullableInt in #t3.{self::Class::[]}(#t4).{core::num::==}(null) ?{core::int} #t3.{self::Class::[]=}(#t4, nonNullableInt) : null;
let final self::NullableIndexClass? #t3 = nullableNullableIndexClass in let final core::int #t4 = nonNullableInt in #t3.{self::NullableIndexClass::[]}(#t4).{core::num::==}(null) ?{core::int} #t3.{self::NullableIndexClass::[]=}(#t4, nonNullableInt) : null;
let final self::Class? #t5 = nullableClass in #t5.{core::Object::==}(null) ?{core::int?} null : #t5{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]}(nonNullableInt);
let final self::Class? #t6 = nullableClass in #t6.{core::Object::==}(null) ?{core::int?} null : #t6{self::Class}.{self::Class::nonNullableClass}.{self::Class::[]=}(nonNullableInt, nonNullableInt);
let final self::Class? #t7 = nullableClass in #t7.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t8 = #t7{self::Class}.{self::Class::nonNullableClass} in let final core::int #t9 = nonNullableInt in #t8.{self::Class::[]=}(#t9, #t8.{self::Class::[]}(#t9).{core::num::+}(nonNullableInt));
let final self::Class? #t10 = nullableClass in #t10.{core::Object::==}(null) ?{core::int?} null : let final self::Class #t11 = #t10{self::Class}.{self::Class::nonNullableClass} in let final core::int #t12 = nonNullableInt in #t11.{self::Class::[]}(#t12).{core::num::==}(null) ?{core::int} #t11.{self::Class::[]=}(#t12, nonNullableInt) : null;
let final self::Class? #t10 = nullableClass in #t10.{core::Object::==}(null) ?{core::int?} null : let final self::NullableIndexClass #t11 = #t10{self::Class}.{self::Class::nonNullableNullableIndexClass} in let final core::int #t12 = nonNullableInt in #t11.{self::NullableIndexClass::[]}(#t12).{core::num::==}(null) ?{core::int} #t11.{self::NullableIndexClass::[]=}(#t12, nonNullableInt) : null;
nullableClass.{self::Class::nonNullableField};
nullableClass.{self::Class::nonNullableField} = 2;
let final self::Class? #t13 = nullableClass in #t13.{self::Class::nonNullableField} = #t13.{self::Class::nonNullableField}.{core::num::+}(2);
@@ -1,4 +1,90 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_check.dart:14:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:15:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field = 42;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:16:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:17:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:18:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:19:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method()!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:20:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:8: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:22:7: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:23:6: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// (c + c)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:10: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:17: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:18: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:5: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:12: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:22: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:20: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,90 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_check.dart:14:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:15:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field = 42;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:16:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:17:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:18:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:19:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method()!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:20:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:8: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:22:7: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:23:6: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// (c + c)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:10: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:17: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:18: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:5: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:12: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:22: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:20: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,90 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_check.dart:14:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:15:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field = 42;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:16:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:17:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:18:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:19:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method()!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:20:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:8: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:22:7: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:23:6: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// (c + c)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:10: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:17: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:18: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:5: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:12: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:22: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:20: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,90 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_check.dart:14:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:15:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field = 42;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:16:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:17:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:18:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.field!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:19:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c!.method()!.toString();
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:20:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:3: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:21:8: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c! + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:22:7: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// c + c!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:23:6: Warning: Operand of null-aware operation '!' has type 'Class' which excludes null.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/null_check.dart'.
// (c + c)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:10: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:17: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:26:18: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !o! ? !o! : !!o!!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:5: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:12: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:22: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
// pkg/front_end/testcases/nnbd/null_check.dart:27:20: Warning: Operand of null-aware operation '!' has type 'bool' which excludes null.
// !(o!) ? (!o)! : (!(!o)!)!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,47 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:33:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:34:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:46:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:47:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1 + c2[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:58:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:59:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1 + Extension(c2)[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:70:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:71:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:82:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:83:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1 + Extension(c2)?.[1]!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,47 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:33:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:34:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:46:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:47:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1 + c2[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:58:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:59:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1 + Extension(c2)[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:70:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:71:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:82:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:83:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1 + Extension(c2)?.[1]!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,47 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:33:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:34:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:46:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:47:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1 + c2[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:58:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:59:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1 + Extension(c2)[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:70:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:71:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:82:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:83:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1 + Extension(c2)?.[1]!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -1,4 +1,47 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:33:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:34:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:46:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:47:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c2?.[0] ??= 1 + c2[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:58:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:59:16: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c2)?.[0] ??= 1 + Extension(c2)[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:70:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:71:12: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// c1?.field?.[0] ??= 1 + c1[1];
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:82:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1;
// ^
//
// pkg/front_end/testcases/nnbd/null_shorting_index.dart:83:23: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// Extension(c1?.field)?.[0] ??= 1 + Extension(c2)?.[1]!;
// ^
//
import self as self;
import "dart:core" as core;
@@ -6,13 +6,44 @@
// non-nullable types being used in positions typically occupied by those of
// nullable types, that is, in various null-aware expressions.
warning(String s, List<String> l) {
s?.length;
s?..length;
s ?? "foo";
s ??= "foo";
[...?l];
s!;
extension E on String {
int get foo => 42;
void operator[]=(int index, int value) {}
int operator[](int index) => 42;
}
class A {
String operator[](int index) => "foo";
void operator[]=(int index, String value) {}
}
class B extends A {
void test() {
super[42] ??= "bar"; // Warning.
}
}
warning(String s, List<String> l, Map<String, int> m) {
s?.length; // Warning.
s?..length; // Warning.
s ?? "foo"; // Warning.
s ??= "foo"; // Warning.
[...?l]; // Warning.
var a = {...?l}; // Warning.
<String>{...?l}; // Warning.
var b = {...?m}; // Warning.
<String, int>{...?m}; // Warning.
s!; // Warning.
s?.substring(0, 0); // Warning.
l?.length = 42; // Warning.
l?.length += 42; // Warning.
l?.length ??= 42; // Warning.
s?.foo; // Warning.
E(s)[42] ??= 42; // Warning.
l[42] ??= "foo"; // Warning.
l.length ??= 42; // Warning.
l?..length = 42; // Warning.
l?..length ??= 42; // Warning.
}
main() {}
@@ -2,7 +2,32 @@ library;
import self as self;
import "dart:core" as core;
static method warning(core::String s, core::List<core::String> l) → dynamic
class A extends core::Object {
synthetic constructor •() → self::A
;
operator [](core::int index) → core::String
;
operator []=(core::int index, core::String value) → void
;
}
class B extends self::A {
synthetic constructor •() → self::B
;
method test() → void
;
}
extension E on core::String {
get foo = self::E|get#foo;
operator []= = self::E|[]=;
operator [] = self::E|[];
}
static method E|get#foo(final core::String #this) → core::int
;
static method E|[]=(final core::String #this, core::int index, core::int value) → void
;
static method E|[](final core::String #this, core::int index) → core::int
;
static method warning(core::String s, core::List<core::String> l, core::Map<core::String, core::int> m) → dynamic
;
static method main() → dynamic
;
@@ -1,19 +1,187 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:22:10: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// super[42] ??= "bar"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:27:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:28:3: Warning: Operand of null-aware operation '?..' has type 'String' which excludes null.
// s?..length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:29:3: Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
// s ?? "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:30:3: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// s ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:31:8: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// [...?l]; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:32:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// var a = {...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:33:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// <String>{...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:34:16: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// var b = {...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:35:21: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// <String, int>{...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:36:3: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// s!; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:37:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.substring(0, 0); // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:38:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:39:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length += 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:40:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:41:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.foo; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:42:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// E(s)[42] ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:43:4: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// l[42] ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:44:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:45:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l?..length ??= 42; // Warning.
// ^
//
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method warning(core::String s, core::List<core::String> l) → dynamic {
let final core::String #t1 = s in #t1.{core::String::==}(null) ?{core::int?} null : #t1.{core::String::length};
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::String} null : let final void #t3 = #t2.{core::String::length} in #t2;
let final core::String #t4 = s in #t4.{core::String::==}(null) ?{core::String} "foo" : #t4;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
operator [](core::int index) → core::String
return "foo";
operator []=(core::int index, core::String value) → void {}
}
class B extends self::A {
synthetic constructor •() → self::B
: super self::A::•()
;
method test() → void {
let final core::int #t1 = 42 in super.{self::A::[]}(#t1).{core::String::==}(null) ?{core::String} super.{self::A::[]=}(#t1, "bar") : null;
}
}
extension E on core::String {
get foo = self::E|get#foo;
operator []= = self::E|[]=;
operator [] = self::E|[];
}
static method E|get#foo(final core::String #this) → core::int
return 42;
static method E|[]=(final core::String #this, core::int index, core::int value) → void {}
static method E|[](final core::String #this, core::int index) → core::int
return 42;
static method warning(core::String s, core::List<core::String> l, core::Map<core::String, core::int> m) → dynamic {
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::int?} null : #t2.{core::String::length};
let final core::String #t3 = s in #t3.{core::String::==}(null) ?{core::String} null : let final void #t4 = #t3.{core::String::length} in #t3;
let final core::String #t5 = s in #t5.{core::String::==}(null) ?{core::String} "foo" : #t5;
s.{core::String::==}(null) ?{core::String} s = "foo" : null;
block {
final core::List<core::String> #t5 = <core::String>[];
final core::Iterable<core::String>? #t6 = l;
if(!#t6.{core::Object::==}(null))
for (final core::String #t7 in #t6{core::Iterable<core::String>})
#t5.{core::List::add}(#t7);
} =>#t5;
final core::List<core::String> #t6 = <core::String>[];
final core::Iterable<core::String>? #t7 = l;
if(!#t7.{core::Object::==}(null))
for (final core::String #t8 in #t7{core::Iterable<core::String>})
#t6.{core::List::add}(#t8);
} =>#t6;
core::Set<core::String> a = block {
final core::Set<core::String> #t9 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t10 = l;
if(!#t10.{core::Object::==}(null))
for (final dynamic #t11 in #t10{core::Iterable<core::String>}) {
final core::String #t12 = #t11 as{TypeError,ForNonNullableByDefault} core::String;
#t9.{core::Set::add}(#t12);
}
} =>#t9;
block {
final core::Set<core::String> #t13 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t14 = l;
if(!#t14.{core::Object::==}(null))
for (final core::String #t15 in #t14{core::Iterable<core::String>})
#t13.{core::Set::add}(#t15);
} =>#t13;
core::Map<core::String, core::int> b = block {
final core::Map<core::String, core::int> #t16 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t17 = m;
if(!#t17.{core::Object::==}(null))
for (final core::MapEntry<core::String, core::int> #t18 in #t17{core::Map<core::String, core::int>}.{core::Map::entries})
#t16.{core::Map::[]=}(#t18.{core::MapEntry::key}, #t18.{core::MapEntry::value});
} =>#t16;
block {
final core::Map<core::String, core::int> #t19 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t20 = m;
if(!#t20.{core::Object::==}(null))
for (final core::MapEntry<core::String, core::int> #t21 in #t20{core::Map<core::String, core::int>}.{core::Map::entries})
#t19.{core::Map::[]=}(#t21.{core::MapEntry::key}, #t21.{core::MapEntry::value});
} =>#t19;
s!;
let final core::String #t22 = s in #t22.{core::String::==}(null) ?{core::String?} null : #t22.{core::String::substring}(0, 0);
let final core::List<core::String> #t23 = l in #t23.{core::List::==}(null) ?{core::int?} null : #t23.{core::List::length} = 42;
let final core::List<core::String> #t24 = l in #t24.{core::List::==}(null) ?{core::int?} null : #t24.{core::List::length} = #t24.{core::List::length}.{core::num::+}(42);
let final core::List<core::String> #t25 = l in #t25.{core::List::==}(null) ?{core::int?} null : #t25.{core::List::length}.{core::num::==}(null) ?{core::int} #t25.{core::List::length} = 42 : null;
let final core::String #t26 = s in #t26.{core::String::==}(null) ?{core::int?} null : self::E|get#foo(#t26);
let final core::String #t27 = s in let final core::int #t28 = 42 in self::E|[](#t27, #t28).{core::num::==}(null) ?{core::int} self::E|[]=(#t27, #t28, 42) : null;
let final core::List<core::String> #t29 = l in let final core::int #t30 = 42 in #t29.{core::List::[]}(#t30).{core::String::==}(null) ?{core::String} #t29.{core::List::[]=}(#t30, "foo") : null;
let final core::List<core::String> #t31 = l in #t31.{core::List::length}.{core::num::==}(null) ?{core::int} #t31.{core::List::length} = 42 : null;
let final core::List<core::String> #t32 = l in #t32.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t33 = #t32.{core::List::length} = 42 in #t32;
let final core::List<core::String> #t34 = l in #t34.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t35 = let final core::List<core::String> #t36 = #t34 in #t36.{core::List::length}.{core::num::==}(null) ?{core::int} #t36.{core::List::length} = 42 : null in #t34;
}
static method main() → dynamic {}
@@ -1,24 +1,209 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:22:10: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// super[42] ??= "bar"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:27:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:28:3: Warning: Operand of null-aware operation '?..' has type 'String' which excludes null.
// s?..length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:29:3: Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
// s ?? "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:30:3: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// s ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:31:8: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// [...?l]; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:32:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// var a = {...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:33:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// <String>{...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:34:16: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// var b = {...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:35:21: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// <String, int>{...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:36:3: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// s!; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:37:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.substring(0, 0); // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:38:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:39:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length += 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:40:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:41:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.foo; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:42:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// E(s)[42] ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:43:4: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// l[42] ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:44:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:45:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l?..length ??= 42; // Warning.
// ^
//
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
import "dart:collection" as col;
static method warning(core::String s, core::List<core::String> l) → dynamic {
let final core::String #t1 = s in #t1.{core::String::==}(null) ?{core::int?} null : #t1.{core::String::length};
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::String} null : let final void #t3 = #t2.{core::String::length} in #t2;
let final core::String #t4 = s in #t4.{core::String::==}(null) ?{core::String} "foo" : #t4;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
operator [](core::int index) → core::String
return "foo";
operator []=(core::int index, core::String value) → void {}
}
class B extends self::A {
synthetic constructor •() → self::B
: super self::A::•()
;
method test() → void {
let final core::int #t1 = 42 in super.{self::A::[]}(#t1).{core::String::==}(null) ?{core::String} super.{self::A::[]=}(#t1, "bar") : null;
}
}
extension E on core::String {
get foo = self::E|get#foo;
operator []= = self::E|[]=;
operator [] = self::E|[];
}
static method E|get#foo(final core::String #this) → core::int
return 42;
static method E|[]=(final core::String #this, core::int index, core::int value) → void {}
static method E|[](final core::String #this, core::int index) → core::int
return 42;
static method warning(core::String s, core::List<core::String> l, core::Map<core::String, core::int> m) → dynamic {
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::int?} null : #t2.{core::String::length};
let final core::String #t3 = s in #t3.{core::String::==}(null) ?{core::String} null : let final void #t4 = #t3.{core::String::length} in #t3;
let final core::String #t5 = s in #t5.{core::String::==}(null) ?{core::String} "foo" : #t5;
s.{core::String::==}(null) ?{core::String} s = "foo" : null;
block {
final core::List<core::String> #t5 = <core::String>[];
final core::Iterable<core::String>? #t6 = l;
if(!#t6.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t6{core::Iterable<core::String>}).{core::Iterable::iterator};
final core::List<core::String> #t6 = <core::String>[];
final core::Iterable<core::String>? #t7 = l;
if(!#t7.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t7{core::Iterable<core::String>}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::String #t7 = :sync-for-iterator.{core::Iterator::current};
#t5.{core::List::add}(#t7);
final core::String #t8 = :sync-for-iterator.{core::Iterator::current};
#t6.{core::List::add}(#t8);
}
}
} =>#t5;
} =>#t6;
core::Set<core::String> a = block {
final core::Set<core::String> #t9 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t10 = l;
if(!#t10.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t10{core::Iterable<core::String>}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final dynamic #t11 = :sync-for-iterator.{core::Iterator::current};
{
final core::String #t12 = #t11 as{TypeError,ForNonNullableByDefault} core::String;
#t9.{core::Set::add}(#t12);
}
}
}
} =>#t9;
block {
final core::Set<core::String> #t13 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t14 = l;
if(!#t14.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t14{core::Iterable<core::String>}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::String #t15 = :sync-for-iterator.{core::Iterator::current};
#t13.{core::Set::add}(#t15);
}
}
} =>#t13;
core::Map<core::String, core::int> b = block {
final core::Map<core::String, core::int> #t16 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t17 = m;
if(!#t17.{core::Object::==}(null)) {
core::Iterator<core::MapEntry<core::String*, core::int*>*>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::MapEntry<core::String*, core::int*>*>*>(#t17{core::Map<core::String, core::int>}.{core::Map::entries}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::MapEntry<core::String, core::int> #t18 = :sync-for-iterator.{core::Iterator::current};
#t16.{core::Map::[]=}(#t18.{core::MapEntry::key}, #t18.{core::MapEntry::value});
}
}
} =>#t16;
block {
final core::Map<core::String, core::int> #t19 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t20 = m;
if(!#t20.{core::Object::==}(null)) {
core::Iterator<core::MapEntry<core::String*, core::int*>*>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::MapEntry<core::String*, core::int*>*>*>(#t20{core::Map<core::String, core::int>}.{core::Map::entries}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::MapEntry<core::String, core::int> #t21 = :sync-for-iterator.{core::Iterator::current};
#t19.{core::Map::[]=}(#t21.{core::MapEntry::key}, #t21.{core::MapEntry::value});
}
}
} =>#t19;
s!;
let final core::String #t22 = s in #t22.{core::String::==}(null) ?{core::String?} null : #t22.{core::String::substring}(0, 0);
let final core::List<core::String> #t23 = l in #t23.{core::List::==}(null) ?{core::int?} null : #t23.{core::List::length} = 42;
let final core::List<core::String> #t24 = l in #t24.{core::List::==}(null) ?{core::int?} null : #t24.{core::List::length} = #t24.{core::List::length}.{core::num::+}(42);
let final core::List<core::String> #t25 = l in #t25.{core::List::==}(null) ?{core::int?} null : #t25.{core::List::length}.{core::num::==}(null) ?{core::int} #t25.{core::List::length} = 42 : null;
let final core::String #t26 = s in #t26.{core::String::==}(null) ?{core::int?} null : self::E|get#foo(#t26);
let final core::String #t27 = s in let final core::int #t28 = 42 in self::E|[](#t27, #t28).{core::num::==}(null) ?{core::int} self::E|[]=(#t27, #t28, 42) : null;
let final core::List<core::String> #t29 = l in let final core::int #t30 = 42 in #t29.{core::List::[]}(#t30).{core::String::==}(null) ?{core::String} #t29.{core::List::[]=}(#t30, "foo") : null;
let final core::List<core::String> #t31 = l in #t31.{core::List::length}.{core::num::==}(null) ?{core::int} #t31.{core::List::length} = 42 : null;
let final core::List<core::String> #t32 = l in #t32.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t33 = #t32.{core::List::length} = 42 in #t32;
let final core::List<core::String> #t34 = l in #t34.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t35 = let final core::List<core::String> #t36 = #t34 in #t36.{core::List::length}.{core::num::==}(null) ?{core::int} #t36.{core::List::length} = 42 : null in #t34;
}
static method main() → dynamic {}
@@ -1,19 +1,187 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:22:10: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// super[42] ??= "bar"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:27:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:28:3: Warning: Operand of null-aware operation '?..' has type 'String' which excludes null.
// s?..length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:29:3: Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
// s ?? "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:30:3: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// s ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:31:8: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// [...?l]; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:32:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// var a = {...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:33:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// <String>{...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:34:16: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// var b = {...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:35:21: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// <String, int>{...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:36:3: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// s!; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:37:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.substring(0, 0); // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:38:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:39:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length += 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:40:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:41:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.foo; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:42:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// E(s)[42] ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:43:4: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// l[42] ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:44:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:45:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l?..length ??= 42; // Warning.
// ^
//
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method warning(core::String s, core::List<core::String> l) → dynamic {
let final core::String #t1 = s in #t1.{core::String::==}(null) ?{core::int?} null : #t1.{core::String::length};
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::String} null : let final void #t3 = #t2.{core::String::length} in #t2;
let final core::String #t4 = s in #t4.{core::String::==}(null) ?{core::String} "foo" : #t4;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
operator [](core::int index) → core::String
return "foo";
operator []=(core::int index, core::String value) → void {}
}
class B extends self::A {
synthetic constructor •() → self::B
: super self::A::•()
;
method test() → void {
let final core::int #t1 = 42 in super.{self::A::[]}(#t1).{core::String::==}(null) ?{core::String} super.{self::A::[]=}(#t1, "bar") : null;
}
}
extension E on core::String {
get foo = self::E|get#foo;
operator []= = self::E|[]=;
operator [] = self::E|[];
}
static method E|get#foo(final core::String #this) → core::int
return 42;
static method E|[]=(final core::String #this, core::int index, core::int value) → void {}
static method E|[](final core::String #this, core::int index) → core::int
return 42;
static method warning(core::String s, core::List<core::String> l, core::Map<core::String, core::int> m) → dynamic {
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::int?} null : #t2.{core::String::length};
let final core::String #t3 = s in #t3.{core::String::==}(null) ?{core::String} null : let final void #t4 = #t3.{core::String::length} in #t3;
let final core::String #t5 = s in #t5.{core::String::==}(null) ?{core::String} "foo" : #t5;
s.{core::String::==}(null) ?{core::String} s = "foo" : null;
block {
final core::List<core::String> #t5 = <core::String>[];
final core::Iterable<core::String>? #t6 = l;
if(!#t6.{core::Object::==}(null))
for (final core::String #t7 in #t6{core::Iterable<core::String>})
#t5.{core::List::add}(#t7);
} =>#t5;
final core::List<core::String> #t6 = <core::String>[];
final core::Iterable<core::String>? #t7 = l;
if(!#t7.{core::Object::==}(null))
for (final core::String #t8 in #t7{core::Iterable<core::String>})
#t6.{core::List::add}(#t8);
} =>#t6;
core::Set<core::String> a = block {
final core::Set<core::String> #t9 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t10 = l;
if(!#t10.{core::Object::==}(null))
for (final dynamic #t11 in #t10{core::Iterable<core::String>}) {
final core::String #t12 = #t11 as{TypeError,ForNonNullableByDefault} core::String;
#t9.{core::Set::add}(#t12);
}
} =>#t9;
block {
final core::Set<core::String> #t13 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t14 = l;
if(!#t14.{core::Object::==}(null))
for (final core::String #t15 in #t14{core::Iterable<core::String>})
#t13.{core::Set::add}(#t15);
} =>#t13;
core::Map<core::String, core::int> b = block {
final core::Map<core::String, core::int> #t16 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t17 = m;
if(!#t17.{core::Object::==}(null))
for (final core::MapEntry<core::String, core::int> #t18 in #t17{core::Map<core::String, core::int>}.{core::Map::entries})
#t16.{core::Map::[]=}(#t18.{core::MapEntry::key}, #t18.{core::MapEntry::value});
} =>#t16;
block {
final core::Map<core::String, core::int> #t19 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t20 = m;
if(!#t20.{core::Object::==}(null))
for (final core::MapEntry<core::String, core::int> #t21 in #t20{core::Map<core::String, core::int>}.{core::Map::entries})
#t19.{core::Map::[]=}(#t21.{core::MapEntry::key}, #t21.{core::MapEntry::value});
} =>#t19;
s!;
let final core::String #t22 = s in #t22.{core::String::==}(null) ?{core::String?} null : #t22.{core::String::substring}(0, 0);
let final core::List<core::String> #t23 = l in #t23.{core::List::==}(null) ?{core::int?} null : #t23.{core::List::length} = 42;
let final core::List<core::String> #t24 = l in #t24.{core::List::==}(null) ?{core::int?} null : #t24.{core::List::length} = #t24.{core::List::length}.{core::num::+}(42);
let final core::List<core::String> #t25 = l in #t25.{core::List::==}(null) ?{core::int?} null : #t25.{core::List::length}.{core::num::==}(null) ?{core::int} #t25.{core::List::length} = 42 : null;
let final core::String #t26 = s in #t26.{core::String::==}(null) ?{core::int?} null : self::E|get#foo(#t26);
let final core::String #t27 = s in let final core::int #t28 = 42 in self::E|[](#t27, #t28).{core::num::==}(null) ?{core::int} self::E|[]=(#t27, #t28, 42) : null;
let final core::List<core::String> #t29 = l in let final core::int #t30 = 42 in #t29.{core::List::[]}(#t30).{core::String::==}(null) ?{core::String} #t29.{core::List::[]=}(#t30, "foo") : null;
let final core::List<core::String> #t31 = l in #t31.{core::List::length}.{core::num::==}(null) ?{core::int} #t31.{core::List::length} = 42 : null;
let final core::List<core::String> #t32 = l in #t32.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t33 = #t32.{core::List::length} = 42 in #t32;
let final core::List<core::String> #t34 = l in #t34.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t35 = let final core::List<core::String> #t36 = #t34 in #t36.{core::List::length}.{core::num::==}(null) ?{core::int} #t36.{core::List::length} = 42 : null in #t34;
}
static method main() → dynamic {}
@@ -1,24 +1,209 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:22:10: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// super[42] ??= "bar"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:27:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:28:3: Warning: Operand of null-aware operation '?..' has type 'String' which excludes null.
// s?..length; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:29:3: Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
// s ?? "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:30:3: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// s ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:31:8: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// [...?l]; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:32:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// var a = {...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:33:16: Warning: Operand of null-aware operation '...?' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// <String>{...?l}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:34:16: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// var b = {...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:35:21: Warning: Operand of null-aware operation '...?' has type 'Map<String, int>' which excludes null.
// - 'Map' is from 'dart:core'.
// <String, int>{...?m}; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:36:3: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
// s!; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:37:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.substring(0, 0); // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:38:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:39:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length += 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:40:3: Warning: Operand of null-aware operation '?.' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:41:3: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.
// s?.foo; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:42:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// E(s)[42] ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:43:4: Warning: Operand of null-aware operation '??=' has type 'String' which excludes null.
// l[42] ??= "foo"; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:44:5: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l.length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:45:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length = 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:3: Warning: Operand of null-aware operation '?..' has type 'List<String>' which excludes null.
// - 'List' is from 'dart:core'.
// l?..length ??= 42; // Warning.
// ^
//
// pkg/front_end/testcases/nnbd/strictly_non_nullable_warnings.dart:46:7: Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.
// l?..length ??= 42; // Warning.
// ^
//
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
import "dart:collection" as col;
static method warning(core::String s, core::List<core::String> l) → dynamic {
let final core::String #t1 = s in #t1.{core::String::==}(null) ?{core::int?} null : #t1.{core::String::length};
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::String} null : let final void #t3 = #t2.{core::String::length} in #t2;
let final core::String #t4 = s in #t4.{core::String::==}(null) ?{core::String} "foo" : #t4;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
operator [](core::int index) → core::String
return "foo";
operator []=(core::int index, core::String value) → void {}
}
class B extends self::A {
synthetic constructor •() → self::B
: super self::A::•()
;
method test() → void {
let final core::int #t1 = 42 in super.{self::A::[]}(#t1).{core::String::==}(null) ?{core::String} super.{self::A::[]=}(#t1, "bar") : null;
}
}
extension E on core::String {
get foo = self::E|get#foo;
operator []= = self::E|[]=;
operator [] = self::E|[];
}
static method E|get#foo(final core::String #this) → core::int
return 42;
static method E|[]=(final core::String #this, core::int index, core::int value) → void {}
static method E|[](final core::String #this, core::int index) → core::int
return 42;
static method warning(core::String s, core::List<core::String> l, core::Map<core::String, core::int> m) → dynamic {
let final core::String #t2 = s in #t2.{core::String::==}(null) ?{core::int?} null : #t2.{core::String::length};
let final core::String #t3 = s in #t3.{core::String::==}(null) ?{core::String} null : let final void #t4 = #t3.{core::String::length} in #t3;
let final core::String #t5 = s in #t5.{core::String::==}(null) ?{core::String} "foo" : #t5;
s.{core::String::==}(null) ?{core::String} s = "foo" : null;
block {
final core::List<core::String> #t5 = <core::String>[];
final core::Iterable<core::String>? #t6 = l;
if(!#t6.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t6{core::Iterable<core::String>}).{core::Iterable::iterator};
final core::List<core::String> #t6 = <core::String>[];
final core::Iterable<core::String>? #t7 = l;
if(!#t7.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t7{core::Iterable<core::String>}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::String #t7 = :sync-for-iterator.{core::Iterator::current};
#t5.{core::List::add}(#t7);
final core::String #t8 = :sync-for-iterator.{core::Iterator::current};
#t6.{core::List::add}(#t8);
}
}
} =>#t5;
} =>#t6;
core::Set<core::String> a = block {
final core::Set<core::String> #t9 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t10 = l;
if(!#t10.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t10{core::Iterable<core::String>}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final dynamic #t11 = :sync-for-iterator.{core::Iterator::current};
{
final core::String #t12 = #t11 as{TypeError,ForNonNullableByDefault} core::String;
#t9.{core::Set::add}(#t12);
}
}
}
} =>#t9;
block {
final core::Set<core::String> #t13 = col::LinkedHashSet::•<core::String>();
final core::Iterable<core::String>? #t14 = l;
if(!#t14.{core::Object::==}(null)) {
core::Iterator<core::String>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::String>*>(#t14{core::Iterable<core::String>}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::String #t15 = :sync-for-iterator.{core::Iterator::current};
#t13.{core::Set::add}(#t15);
}
}
} =>#t13;
core::Map<core::String, core::int> b = block {
final core::Map<core::String, core::int> #t16 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t17 = m;
if(!#t17.{core::Object::==}(null)) {
core::Iterator<core::MapEntry<core::String*, core::int*>*>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::MapEntry<core::String*, core::int*>*>*>(#t17{core::Map<core::String, core::int>}.{core::Map::entries}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::MapEntry<core::String, core::int> #t18 = :sync-for-iterator.{core::Iterator::current};
#t16.{core::Map::[]=}(#t18.{core::MapEntry::key}, #t18.{core::MapEntry::value});
}
}
} =>#t16;
block {
final core::Map<core::String, core::int> #t19 = <core::String, core::int>{};
final core::Map<core::String, core::int>? #t20 = m;
if(!#t20.{core::Object::==}(null)) {
core::Iterator<core::MapEntry<core::String*, core::int*>*>* :sync-for-iterator = _in::unsafeCast<core::Iterable<core::MapEntry<core::String*, core::int*>*>*>(#t20{core::Map<core::String, core::int>}.{core::Map::entries}).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
final core::MapEntry<core::String, core::int> #t21 = :sync-for-iterator.{core::Iterator::current};
#t19.{core::Map::[]=}(#t21.{core::MapEntry::key}, #t21.{core::MapEntry::value});
}
}
} =>#t19;
s!;
let final core::String #t22 = s in #t22.{core::String::==}(null) ?{core::String?} null : #t22.{core::String::substring}(0, 0);
let final core::List<core::String> #t23 = l in #t23.{core::List::==}(null) ?{core::int?} null : #t23.{core::List::length} = 42;
let final core::List<core::String> #t24 = l in #t24.{core::List::==}(null) ?{core::int?} null : #t24.{core::List::length} = #t24.{core::List::length}.{core::num::+}(42);
let final core::List<core::String> #t25 = l in #t25.{core::List::==}(null) ?{core::int?} null : #t25.{core::List::length}.{core::num::==}(null) ?{core::int} #t25.{core::List::length} = 42 : null;
let final core::String #t26 = s in #t26.{core::String::==}(null) ?{core::int?} null : self::E|get#foo(#t26);
let final core::String #t27 = s in let final core::int #t28 = 42 in self::E|[](#t27, #t28).{core::num::==}(null) ?{core::int} self::E|[]=(#t27, #t28, 42) : null;
let final core::List<core::String> #t29 = l in let final core::int #t30 = 42 in #t29.{core::List::[]}(#t30).{core::String::==}(null) ?{core::String} #t29.{core::List::[]=}(#t30, "foo") : null;
let final core::List<core::String> #t31 = l in #t31.{core::List::length}.{core::num::==}(null) ?{core::int} #t31.{core::List::length} = 42 : null;
let final core::List<core::String> #t32 = l in #t32.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t33 = #t32.{core::List::length} = 42 in #t32;
let final core::List<core::String> #t34 = l in #t34.{core::List::==}(null) ?{core::List<core::String>} null : let final void #t35 = let final core::List<core::String> #t36 = #t34 in #t36.{core::List::length}.{core::num::==}(null) ?{core::int} #t36.{core::List::length} = 42 : null in #t34;
}
static method main() → dynamic {}