mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:49:43 +00:00
[cfe] Special case Null in assignability errors.
In error reporting on assignability where the expression has type `Null` we use a special messages that doesn't state that "'Null' is nullable". Cases where `Null` is part of the type or where the expression of type `Null` is derived from a collection are not special cased. Closes #43998 Closes #44093 Change-Id: Ic0c79e6362f2365eb3fe8222ccd2ef8fac4f188d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170433 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
parent
f27e0f96b4
commit
38d7c7661d
|
@ -241,6 +241,73 @@ Message _withArgumentsArgumentTypeNotAssignableNullability(
|
|||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
templateArgumentTypeNotAssignableNullabilityNull = const Template<
|
||||
Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""The value 'null' can't be assigned to the parameter type '#type' because '#type' is not nullable.""",
|
||||
withArguments: _withArgumentsArgumentTypeNotAssignableNullabilityNull);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
codeArgumentTypeNotAssignableNullabilityNull =
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
"ArgumentTypeNotAssignableNullabilityNull",
|
||||
templateArgumentTypeNotAssignableNullabilityNull,
|
||||
analyzerCodes: <String>["ARGUMENT_TYPE_NOT_ASSIGNABLE"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsArgumentTypeNotAssignableNullabilityNull(
|
||||
DartType _type, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
String type = typeParts.join();
|
||||
return new Message(codeArgumentTypeNotAssignableNullabilityNull,
|
||||
message:
|
||||
"""The value 'null' can't be assigned to the parameter type '${type}' because '${type}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
templateArgumentTypeNotAssignableNullabilityNullType = const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""The argument type '#type' can't be assigned to the parameter type '#type2' because '#type2' is not nullable.""",
|
||||
withArguments:
|
||||
_withArgumentsArgumentTypeNotAssignableNullabilityNullType);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
codeArgumentTypeNotAssignableNullabilityNullType = const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
"ArgumentTypeNotAssignableNullabilityNullType",
|
||||
templateArgumentTypeNotAssignableNullabilityNullType,
|
||||
analyzerCodes: <String>["ARGUMENT_TYPE_NOT_ASSIGNABLE"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsArgumentTypeNotAssignableNullabilityNullType(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeArgumentTypeNotAssignableNullabilityNullType,
|
||||
message:
|
||||
"""The argument type '${type}' can't be assigned to the parameter type '${type2}' because '${type2}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(DartType _type, DartType _type2, DartType _type3,
|
||||
|
@ -1977,6 +2044,72 @@ Message _withArgumentsInvalidAssignmentErrorNullability(
|
|||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
templateInvalidAssignmentErrorNullabilityNull = const Template<
|
||||
Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""The value 'null' can't be assigned to a variable of type '#type' because '#type' is not nullable.""",
|
||||
withArguments: _withArgumentsInvalidAssignmentErrorNullabilityNull);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
codeInvalidAssignmentErrorNullabilityNull =
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
"InvalidAssignmentErrorNullabilityNull",
|
||||
templateInvalidAssignmentErrorNullabilityNull,
|
||||
analyzerCodes: <String>["INVALID_ASSIGNMENT"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidAssignmentErrorNullabilityNull(
|
||||
DartType _type, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
String type = typeParts.join();
|
||||
return new Message(codeInvalidAssignmentErrorNullabilityNull,
|
||||
message:
|
||||
"""The value 'null' can't be assigned to a variable of type '${type}' because '${type}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
templateInvalidAssignmentErrorNullabilityNullType = const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""A value of type '#type' can't be assigned to a variable of type '#type2' because '#type2' is not nullable.""",
|
||||
withArguments: _withArgumentsInvalidAssignmentErrorNullabilityNullType);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
codeInvalidAssignmentErrorNullabilityNullType = const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
"InvalidAssignmentErrorNullabilityNullType",
|
||||
templateInvalidAssignmentErrorNullabilityNullType,
|
||||
analyzerCodes: <String>["INVALID_ASSIGNMENT"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidAssignmentErrorNullabilityNullType(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeInvalidAssignmentErrorNullabilityNullType,
|
||||
message:
|
||||
"""A value of type '${type}' can't be assigned to a variable of type '${type2}' because '${type2}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(DartType _type, DartType _type2, DartType _type3,
|
||||
|
@ -3167,6 +3300,72 @@ Message _withArgumentsInvalidReturnAsyncNullability(
|
|||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
templateInvalidReturnAsyncNullabilityNull = const Template<
|
||||
Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""The value 'null' can't be returned from an async function with return type '#type' because '#type' is not nullable.""",
|
||||
withArguments: _withArgumentsInvalidReturnAsyncNullabilityNull);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
codeInvalidReturnAsyncNullabilityNull =
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
"InvalidReturnAsyncNullabilityNull",
|
||||
templateInvalidReturnAsyncNullabilityNull,
|
||||
);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidReturnAsyncNullabilityNull(
|
||||
DartType _type, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
String type = typeParts.join();
|
||||
return new Message(codeInvalidReturnAsyncNullabilityNull,
|
||||
message:
|
||||
"""The value 'null' can't be returned from an async function with return type '${type}' because '${type}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
templateInvalidReturnAsyncNullabilityNullType = const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""A value of type '#type' can't be returned from an async function with return type '#type2' because '#type2' is not nullable.""",
|
||||
withArguments: _withArgumentsInvalidReturnAsyncNullabilityNullType);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
codeInvalidReturnAsyncNullabilityNullType = const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
"InvalidReturnAsyncNullabilityNullType",
|
||||
templateInvalidReturnAsyncNullabilityNullType,
|
||||
);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidReturnAsyncNullabilityNullType(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeInvalidReturnAsyncNullabilityNullType,
|
||||
message:
|
||||
"""A value of type '${type}' can't be returned from an async function with return type '${type2}' because '${type2}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(DartType _type, DartType _type2, DartType _type3,
|
||||
|
@ -3254,6 +3453,72 @@ Message _withArgumentsInvalidReturnNullability(
|
|||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
templateInvalidReturnNullabilityNull = const Template<
|
||||
Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""The value 'null' can't be returned from a function with return type '#type' because '#type' is not nullable.""",
|
||||
withArguments: _withArgumentsInvalidReturnNullabilityNull);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
codeInvalidReturnNullabilityNull =
|
||||
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||
"InvalidReturnNullabilityNull",
|
||||
templateInvalidReturnNullabilityNull,
|
||||
);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidReturnNullabilityNull(
|
||||
DartType _type, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
String type = typeParts.join();
|
||||
return new Message(codeInvalidReturnNullabilityNull,
|
||||
message:
|
||||
"""The value 'null' can't be returned from a function with return type '${type}' because '${type}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
templateInvalidReturnNullabilityNullType = const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
messageTemplate:
|
||||
r"""A value of type '#type' can't be returned from a function with return type '#type2' because '#type2' is not nullable.""",
|
||||
withArguments: _withArgumentsInvalidReturnNullabilityNullType);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
codeInvalidReturnNullabilityNullType = const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
"InvalidReturnNullabilityNullType",
|
||||
templateInvalidReturnNullabilityNullType,
|
||||
);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsInvalidReturnNullabilityNullType(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeInvalidReturnNullabilityNullType,
|
||||
message:
|
||||
"""A value of type '${type}' can't be returned from a function with return type '${type2}' because '${type2}' is not nullable.""" +
|
||||
labeler.originMessages,
|
||||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(DartType _type, DartType _type2, DartType _type3,
|
||||
|
|
|
@ -3742,7 +3742,11 @@ class InferenceVisitor
|
|||
errorTemplate: templateArgumentTypeNotAssignable,
|
||||
nullabilityErrorTemplate: templateArgumentTypeNotAssignableNullability,
|
||||
nullabilityPartErrorTemplate:
|
||||
templateArgumentTypeNotAssignablePartNullability);
|
||||
templateArgumentTypeNotAssignablePartNullability,
|
||||
nullabilityNullErrorTemplate:
|
||||
templateArgumentTypeNotAssignableNullabilityNull,
|
||||
nullabilityNullTypeErrorTemplate:
|
||||
templateArgumentTypeNotAssignableNullabilityNullType);
|
||||
|
||||
Expression equals = new MethodInvocation(
|
||||
left,
|
||||
|
|
|
@ -202,7 +202,11 @@ class _SyncClosureContext implements ClosureContext {
|
|||
errorTemplate: templateInvalidReturn,
|
||||
nullabilityErrorTemplate: templateInvalidReturnNullability,
|
||||
nullabilityPartErrorTemplate:
|
||||
templateInvalidReturnPartNullability);
|
||||
templateInvalidReturnPartNullability,
|
||||
nullabilityNullErrorTemplate:
|
||||
templateInvalidReturnNullabilityNull,
|
||||
nullabilityNullTypeErrorTemplate:
|
||||
templateInvalidReturnNullabilityNullType);
|
||||
statement.expression = expression..parent = statement;
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +562,11 @@ class _AsyncClosureContext implements ClosureContext {
|
|||
errorTemplate: templateInvalidReturnAsync,
|
||||
nullabilityErrorTemplate: templateInvalidReturnAsyncNullability,
|
||||
nullabilityPartErrorTemplate:
|
||||
templateInvalidReturnAsyncPartNullability)
|
||||
templateInvalidReturnAsyncPartNullability,
|
||||
nullabilityNullErrorTemplate:
|
||||
templateInvalidReturnAsyncNullabilityNull,
|
||||
nullabilityNullTypeErrorTemplate:
|
||||
templateInvalidReturnAsyncNullabilityNullType)
|
||||
..parent = statement;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -395,6 +395,9 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
Template<Message Function(DartType, DartType, bool)> errorTemplate,
|
||||
Template<Message Function(DartType, DartType, bool)>
|
||||
nullabilityErrorTemplate,
|
||||
Template<Message Function(DartType, bool)> nullabilityNullErrorTemplate,
|
||||
Template<Message Function(DartType, DartType, bool)>
|
||||
nullabilityNullTypeErrorTemplate,
|
||||
Template<Message Function(DartType, DartType, DartType, DartType, bool)>
|
||||
nullabilityPartErrorTemplate}) {
|
||||
return ensureAssignable(
|
||||
|
@ -403,6 +406,8 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
isVoidAllowed: isVoidAllowed,
|
||||
errorTemplate: errorTemplate,
|
||||
nullabilityErrorTemplate: nullabilityErrorTemplate,
|
||||
nullabilityNullErrorTemplate: nullabilityNullErrorTemplate,
|
||||
nullabilityNullTypeErrorTemplate: nullabilityNullTypeErrorTemplate,
|
||||
nullabilityPartErrorTemplate: nullabilityPartErrorTemplate);
|
||||
}
|
||||
|
||||
|
@ -433,6 +438,9 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
Template<Message Function(DartType, DartType, bool)> errorTemplate,
|
||||
Template<Message Function(DartType, DartType, bool)>
|
||||
nullabilityErrorTemplate,
|
||||
Template<Message Function(DartType, bool)> nullabilityNullErrorTemplate,
|
||||
Template<Message Function(DartType, DartType, bool)>
|
||||
nullabilityNullTypeErrorTemplate,
|
||||
Template<Message Function(DartType, DartType, DartType, DartType, bool)>
|
||||
nullabilityPartErrorTemplate}) {
|
||||
assert(contextType != null);
|
||||
|
@ -442,7 +450,19 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
assert((errorTemplate == null) == (nullabilityErrorTemplate == null) &&
|
||||
(nullabilityErrorTemplate == null) ==
|
||||
(nullabilityPartErrorTemplate == null));
|
||||
// [nullabilityNullErrorTemplate] and [nullabilityNullTypeErrorTemplate]
|
||||
// should be provided together.
|
||||
assert((nullabilityNullErrorTemplate == null) ==
|
||||
(nullabilityNullTypeErrorTemplate == null));
|
||||
errorTemplate ??= templateInvalidAssignmentError;
|
||||
if (nullabilityErrorTemplate == null) {
|
||||
// Use [templateInvalidAssignmentErrorNullabilityNull] only if no
|
||||
// specific [nullabilityErrorTemplate] template was passed.
|
||||
nullabilityNullErrorTemplate ??=
|
||||
templateInvalidAssignmentErrorNullabilityNull;
|
||||
}
|
||||
nullabilityNullTypeErrorTemplate ??= nullabilityErrorTemplate ??
|
||||
templateInvalidAssignmentErrorNullabilityNullType;
|
||||
nullabilityErrorTemplate ??= templateInvalidAssignmentErrorNullability;
|
||||
nullabilityPartErrorTemplate ??=
|
||||
templateInvalidAssignmentErrorPartNullability;
|
||||
|
@ -532,12 +552,34 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
case AssignabilityKind.unassignableNullability:
|
||||
if (expressionType == assignabilityResult.subtype &&
|
||||
contextType == assignabilityResult.supertype) {
|
||||
result = _wrapUnassignableExpression(
|
||||
expression,
|
||||
expressionType,
|
||||
contextType,
|
||||
nullabilityErrorTemplate.withArguments(expressionType,
|
||||
declaredContextType ?? contextType, isNonNullableByDefault));
|
||||
if (expression is NullLiteral &&
|
||||
nullabilityNullErrorTemplate != null) {
|
||||
result = _wrapUnassignableExpression(
|
||||
expression,
|
||||
expressionType,
|
||||
contextType,
|
||||
nullabilityNullErrorTemplate.withArguments(
|
||||
declaredContextType ?? contextType,
|
||||
isNonNullableByDefault));
|
||||
} else if (expressionType is NullType) {
|
||||
result = _wrapUnassignableExpression(
|
||||
expression,
|
||||
expressionType,
|
||||
contextType,
|
||||
nullabilityNullTypeErrorTemplate.withArguments(
|
||||
expressionType,
|
||||
declaredContextType ?? contextType,
|
||||
isNonNullableByDefault));
|
||||
} else {
|
||||
result = _wrapUnassignableExpression(
|
||||
expression,
|
||||
expressionType,
|
||||
contextType,
|
||||
nullabilityErrorTemplate.withArguments(
|
||||
expressionType,
|
||||
declaredContextType ?? contextType,
|
||||
isNonNullableByDefault));
|
||||
}
|
||||
} else {
|
||||
result = _wrapUnassignableExpression(
|
||||
expression,
|
||||
|
@ -2130,7 +2172,11 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
nullabilityErrorTemplate:
|
||||
templateArgumentTypeNotAssignableNullability,
|
||||
nullabilityPartErrorTemplate:
|
||||
templateArgumentTypeNotAssignablePartNullability);
|
||||
templateArgumentTypeNotAssignablePartNullability,
|
||||
nullabilityNullErrorTemplate:
|
||||
templateArgumentTypeNotAssignableNullabilityNull,
|
||||
nullabilityNullTypeErrorTemplate:
|
||||
templateArgumentTypeNotAssignableNullabilityNullType);
|
||||
if (namedExpression == null) {
|
||||
arguments.positional[positionalShift + i] = expression
|
||||
..parent = arguments;
|
||||
|
|
|
@ -450,8 +450,12 @@ InvalidPackageUri/example: Fail
|
|||
InvalidReturn/analyzerCode: Fail
|
||||
InvalidReturnAsync/analyzerCode: Fail
|
||||
InvalidReturnAsyncNullability/analyzerCode: Fail
|
||||
InvalidReturnAsyncNullabilityNull/analyzerCode: Fail
|
||||
InvalidReturnAsyncNullabilityNullType/analyzerCode: Fail
|
||||
InvalidReturnAsyncPartNullability/analyzerCode: Fail
|
||||
InvalidReturnNullability/analyzerCode: Fail
|
||||
InvalidReturnNullabilityNull/analyzerCode: Fail
|
||||
InvalidReturnNullabilityNullType/analyzerCode: Fail
|
||||
InvalidReturnPartNullability/analyzerCode: Fail
|
||||
InvalidSuperInInitializer/example: Fail
|
||||
InvalidThisInInitializer/example: Fail
|
||||
|
|
|
@ -3318,6 +3318,27 @@ ArgumentTypeNotAssignablePartNullability:
|
|||
method(j);
|
||||
}
|
||||
|
||||
ArgumentTypeNotAssignableNullabilityNull:
|
||||
template: "The value 'null' can't be assigned to the parameter type '#type' because '#type' is not nullable."
|
||||
analyzerCode: ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
configuration: nnbd-strong
|
||||
script: >
|
||||
method(int i) {}
|
||||
main() {
|
||||
method(null);
|
||||
}
|
||||
|
||||
ArgumentTypeNotAssignableNullabilityNullType:
|
||||
template: "The argument type '#type' can't be assigned to the parameter type '#type2' because '#type2' is not nullable."
|
||||
analyzerCode: ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
configuration: nnbd-strong
|
||||
script: >
|
||||
method(int i) {}
|
||||
main() {
|
||||
Null n;
|
||||
method(n);
|
||||
}
|
||||
|
||||
InvalidAssignmentError:
|
||||
template: "A value of type '#type' can't be assigned to a variable of type '#type2'."
|
||||
analyzerCode: INVALID_ASSIGNMENT
|
||||
|
@ -3349,6 +3370,27 @@ InvalidAssignmentErrorPartNullability:
|
|||
i = j;
|
||||
}
|
||||
|
||||
InvalidAssignmentErrorNullabilityNull:
|
||||
template: "The value 'null' can't be assigned to a variable of type '#type' because '#type' is not nullable."
|
||||
analyzerCode: INVALID_ASSIGNMENT
|
||||
configuration: nnbd-strong
|
||||
script: >
|
||||
main() {
|
||||
int i = 0;
|
||||
i = null;
|
||||
}
|
||||
|
||||
InvalidAssignmentErrorNullabilityNullType:
|
||||
template: "A value of type '#type' can't be assigned to a variable of type '#type2' because '#type2' is not nullable."
|
||||
analyzerCode: INVALID_ASSIGNMENT
|
||||
configuration: nnbd-strong
|
||||
script: >
|
||||
main() {
|
||||
Null n;
|
||||
int i = 0;
|
||||
i = n;
|
||||
}
|
||||
|
||||
PatchClassTypeVariablesMismatch:
|
||||
template: "A patch class must have the same number of type variables as its origin class."
|
||||
|
||||
|
@ -3882,6 +3924,16 @@ InvalidReturnPartNullability:
|
|||
configuration: nnbd-strong
|
||||
declaration: "List<int> foo(List<int?> list) { return list; }"
|
||||
|
||||
InvalidReturnNullabilityNull:
|
||||
template: "The value 'null' can't be returned from a function with return type '#type' because '#type' is not nullable."
|
||||
configuration: nnbd-strong
|
||||
declaration: "int foo() { return null; }"
|
||||
|
||||
InvalidReturnNullabilityNullType:
|
||||
template: "A value of type '#type' can't be returned from a function with return type '#type2' because '#type2' is not nullable."
|
||||
configuration: nnbd-strong
|
||||
declaration: "int foo(Null i) { return i; }"
|
||||
|
||||
InvalidReturnAsync:
|
||||
template: "A value of type '#type' can't be returned from an async function with return type '#type2'."
|
||||
configuration: nnbd-strong
|
||||
|
@ -3897,6 +3949,16 @@ InvalidReturnAsyncPartNullability:
|
|||
configuration: nnbd-strong
|
||||
declaration: "Future<List<int>> foo(List<int?> list) async { return list; }"
|
||||
|
||||
InvalidReturnAsyncNullabilityNull:
|
||||
template: "The value 'null' can't be returned from an async function with return type '#type' because '#type' is not nullable."
|
||||
configuration: nnbd-strong
|
||||
declaration: "Future<int> foo() async { return null; }"
|
||||
|
||||
InvalidReturnAsyncNullabilityNullType:
|
||||
template: "A value of type '#type' can't be returned from an async function with return type '#type2' because '#type2' is not nullable."
|
||||
configuration: nnbd-strong
|
||||
declaration: "Future<int> foo(Null n) async { return n; }"
|
||||
|
||||
ImplicitReturnNull:
|
||||
template: "A non-null value must be returned since the return type '#type' doesn't allow null."
|
||||
configuration: nnbd-strong
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// The test checks that if one type isn't assignable to the other only because
|
||||
// of the nullability modifiers, the error message reflects that.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
class A {
|
||||
const A();
|
||||
}
|
||||
|
@ -36,6 +38,14 @@ A foo(B? x, List<B?> l, Map<B?, B?> m, List<B>? l2, Map<B, B>? m2) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
FutureOr<A> local() async {
|
||||
if (true) {
|
||||
return x; // Error.
|
||||
} else {
|
||||
return new Future<B?>.value(x); // Error.
|
||||
}
|
||||
}
|
||||
|
||||
return x; // Error.
|
||||
}
|
||||
|
||||
|
@ -52,4 +62,23 @@ void baz(C c) {
|
|||
bazContext(c);
|
||||
}
|
||||
|
||||
A boz(Null x) {
|
||||
fooContext(x); // Error.
|
||||
fooContext(null); // Error.
|
||||
A a1 = x; // Error.
|
||||
A a2 = null; // Error.
|
||||
if (true) {
|
||||
return x; // Error.
|
||||
} else {
|
||||
return null; // Error.
|
||||
}
|
||||
FutureOr<A> local() async {
|
||||
if (true) {
|
||||
return null; // Error.
|
||||
} else {
|
||||
return new Future<Null>.value(null); // Error.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
|
|
@ -2,6 +2,8 @@ library /*isNonNullableByDefault*/;
|
|||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class A extends core::Object /*hasConstConstructor*/ {
|
||||
const constructor •() → self::A
|
||||
: super core::Object::•()
|
||||
|
@ -29,5 +31,7 @@ static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, co
|
|||
;
|
||||
static method baz(self::C c) → void
|
||||
;
|
||||
static method boz(Null x) → self::A
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
||||
|
|
|
@ -2,109 +2,122 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A>[...l2]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A, A>{...m2}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// Try changing the type of the variable.
|
||||
// for (A y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'Iterable' is from 'dart:core'.
|
||||
// for (A y in l2) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:36:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// case const A():
|
||||
// ^
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:11: Context: The switch expression is here.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:35:11: Context: The switch expression is here.
|
||||
// switch (x) /* Error. */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<B?>.value(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// barContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// List<A> y = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -112,19 +125,63 @@ library /*isNonNullableByDefault*/;
|
|||
// for (List<A> y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// bazContext(c);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(null); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a1 = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a2 = null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<Null>.value(null); // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:async" as asy;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class A extends core::Object /*hasConstConstructor*/ {
|
||||
const constructor •() → self::A
|
||||
|
@ -146,45 +203,45 @@ static method fooContext(self::A x) → void {}
|
|||
static method barContext(core::List<self::A> x) → void {}
|
||||
static method bazContext(() → core::num f) → void {}
|
||||
static method foo(self::B? x, core::List<self::B?> l, core::Map<self::B?, self::B?> m, core::List<self::B>? l2, core::Map<self::B, self::B>? m2) → self::A {
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A);
|
||||
self::A a = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A a = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a = x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A>[...l]; // Error.
|
||||
^"];
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A>[...l2]; // Error.
|
||||
^"];
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^"};
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A, A>{...m2}; // Error.
|
||||
^": null};
|
||||
for (final self::B? #t3 in l) {
|
||||
self::A y = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A y = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
for (A y in l) {} // Error.
|
||||
^" in #t3 as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
for (self::A y in let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
for (self::A y in let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'Iterable' is from 'dart:core'.
|
||||
|
@ -204,52 +261,69 @@ Try changing the type of the variable.
|
|||
break #L1;
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
function local() → FutureOr<self::A> async {
|
||||
if(true) {
|
||||
return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<B?>.value(x); // Error.
|
||||
^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
|
||||
self::barContext(let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
self::barContext(let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
barContext(x); // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>);
|
||||
core::List<self::A> y = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
List<A> y = x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>>[...l]; // Error.
|
||||
^"];
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>, List<A>>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>, List<A>>{...m}; // Error.
|
||||
^"};
|
||||
for (final core::List<self::B?> #t9 in l) {
|
||||
core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
for (final core::List<self::B?> #t11 in l) {
|
||||
core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
for (List<A> y in l) {} // Error.
|
||||
^" in #t9 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
^" in #t11 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
}
|
||||
return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -257,9 +331,54 @@ Try changing the type of the variable.
|
|||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
}
|
||||
static method baz(self::C c) → void {
|
||||
self::bazContext(let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
self::bazContext(let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
bazContext(c);
|
||||
^" in (let final self::C #t13 = c in #t13.==(null) ?{() → core::num?} null : #t13.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
|
||||
^" in (let final self::C #t15 = c in #t15.==(null) ?{() → core::num?} null : #t15.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
|
||||
}
|
||||
static method boz(Null x) → self::A {
|
||||
self::fooContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A);
|
||||
self::fooContext(let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(null); // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A);
|
||||
self::A a1 = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a1 = x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
self::A a2 = let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a2 = null; // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A;
|
||||
if(true) {
|
||||
return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
function local() → FutureOr<self::A> async {
|
||||
if(true) {
|
||||
return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<Null>.value(null); // Error.
|
||||
^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
}
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
||||
|
|
|
@ -2,109 +2,122 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A>[...l2]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A, A>{...m2}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// Try changing the type of the variable.
|
||||
// for (A y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'Iterable' is from 'dart:core'.
|
||||
// for (A y in l2) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:36:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// case const A():
|
||||
// ^
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:11: Context: The switch expression is here.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:35:11: Context: The switch expression is here.
|
||||
// switch (x) /* Error. */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<B?>.value(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// barContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// List<A> y = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -112,19 +125,63 @@ library /*isNonNullableByDefault*/;
|
|||
// for (List<A> y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// bazContext(c);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(null); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a1 = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a2 = null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<Null>.value(null); // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:async" as asy;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class A extends core::Object /*hasConstConstructor*/ {
|
||||
const constructor •() → self::A
|
||||
|
@ -146,34 +203,34 @@ static method fooContext(self::A x) → void {}
|
|||
static method barContext(core::List<self::A> x) → void {}
|
||||
static method bazContext(() → core::num f) → void {}
|
||||
static method foo(self::B? x, core::List<self::B?> l, core::Map<self::B?, self::B?> m, core::List<self::B>? l2, core::Map<self::B, self::B>? m2) → self::A {
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in let self::B? #t2 = x in #t2.==(null) ?{self::A} #t2 as{TypeError,ForNonNullableByDefault} self::A : #t2{self::A});
|
||||
self::A a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A a = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a = x; // Error.
|
||||
^" in let self::B? #t4 = x in #t4.==(null) ?{self::A} #t4 as{TypeError,ForNonNullableByDefault} self::A : #t4{self::A};
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A>[...l]; // Error.
|
||||
^"];
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A>[...l2]; // Error.
|
||||
^"];
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^"};
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A, A>{...m2}; // Error.
|
||||
^": null};
|
||||
{
|
||||
|
@ -181,7 +238,7 @@ static method foo(self::B? x, core::List<self::B?> l, core::Map<self::B?, self::
|
|||
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
|
||||
final self::B? #t5 = :sync-for-iterator.{core::Iterator::current};
|
||||
{
|
||||
self::A y = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A y = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
|
@ -191,7 +248,7 @@ Try changing the type of the variable.
|
|||
}
|
||||
}
|
||||
{
|
||||
core::Iterator<dynamic> :sync-for-iterator = (let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
core::Iterator<dynamic> :sync-for-iterator = (let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'Iterable' is from 'dart:core'.
|
||||
|
@ -215,37 +272,81 @@ Try changing the type of the variable.
|
|||
break #L1;
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
function local() → FutureOr<self::A> /* originally async */ {
|
||||
final asy::_Future<self::A> :async_future = new asy::_Future::•<self::A>();
|
||||
core::bool* :is_sync = false;
|
||||
FutureOr<self::A>? :return_value;
|
||||
dynamic :async_stack_trace;
|
||||
(dynamic) → dynamic :async_op_then;
|
||||
(core::Object, core::StackTrace) → dynamic :async_op_error;
|
||||
core::int :await_jump_var = 0;
|
||||
dynamic :await_ctx_var;
|
||||
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
|
||||
try {
|
||||
#L4:
|
||||
{
|
||||
if(true) {
|
||||
:return_value = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in let self::B? #t11 = x in #t11.==(null) ?{self::A} #t11 as{TypeError,ForNonNullableByDefault} self::A : #t11{self::A};
|
||||
break #L4;
|
||||
}
|
||||
else {
|
||||
:return_value = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<B?>.value(x); // Error.
|
||||
^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
|
||||
return;
|
||||
}
|
||||
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
|
||||
asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
|
||||
}
|
||||
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
|
||||
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
|
||||
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
|
||||
:async_op.call();
|
||||
:is_sync = true;
|
||||
return :async_future;
|
||||
}
|
||||
return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in let self::B? #t11 = x in #t11.==(null) ?{self::A} #t11 as{TypeError,ForNonNullableByDefault} self::A : #t11{self::A};
|
||||
^" in let self::B? #t14 = x in #t14.==(null) ?{self::A} #t14 as{TypeError,ForNonNullableByDefault} self::A : #t14{self::A};
|
||||
}
|
||||
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
|
||||
self::barContext(let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
self::barContext(let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
barContext(x); // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>);
|
||||
core::List<self::A> y = let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
core::List<self::A> y = let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
List<A> y = x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>>[...l]; // Error.
|
||||
^"];
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>, List<A>>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -254,19 +355,19 @@ static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, co
|
|||
{
|
||||
core::Iterator<core::List<self::B?>> :sync-for-iterator = l.{core::Iterable::iterator};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
|
||||
final core::List<self::B?> #t14 = :sync-for-iterator.{core::Iterator::current};
|
||||
final core::List<self::B?> #t17 = :sync-for-iterator.{core::Iterator::current};
|
||||
{
|
||||
core::List<self::A> y = let final<BottomType> #t15 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
core::List<self::A> y = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
for (List<A> y in l) {} // Error.
|
||||
^" in #t14 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
^" in #t17 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
}
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
return let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -274,12 +375,99 @@ Try changing the type of the variable.
|
|||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
}
|
||||
static method baz(self::C c) → void {
|
||||
self::bazContext(let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
self::bazContext(let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
bazContext(c);
|
||||
^" in (let final self::C #t18 = c in #t18.==(null) ?{() → core::num?} null : #t18.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
|
||||
^" in (let final self::C #t21 = c in #t21.==(null) ?{() → core::num?} null : #t21.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
|
||||
}
|
||||
static method boz(Null x) → self::A {
|
||||
self::fooContext(let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in let Null #t23 = x in #t23.==(null) ?{self::A} #t23 as{TypeError,ForNonNullableByDefault} self::A : #t23{self::A});
|
||||
self::fooContext(let final<BottomType> #t24 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(null); // Error.
|
||||
^" in let Null #t25 = null in #t25.==(null) ?{self::A} #t25 as{TypeError,ForNonNullableByDefault} self::A : #t25{self::A});
|
||||
self::A a1 = let final<BottomType> #t26 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a1 = x; // Error.
|
||||
^" in let Null #t27 = x in #t27.==(null) ?{self::A} #t27 as{TypeError,ForNonNullableByDefault} self::A : #t27{self::A};
|
||||
self::A a2 = let final<BottomType> #t28 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a2 = null; // Error.
|
||||
^" in let Null #t29 = null in #t29.==(null) ?{self::A} #t29 as{TypeError,ForNonNullableByDefault} self::A : #t29{self::A};
|
||||
if(true) {
|
||||
return let final<BottomType> #t30 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in let Null #t31 = x in #t31.==(null) ?{self::A} #t31 as{TypeError,ForNonNullableByDefault} self::A : #t31{self::A};
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t32 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in let Null #t33 = null in #t33.==(null) ?{self::A} #t33 as{TypeError,ForNonNullableByDefault} self::A : #t33{self::A};
|
||||
}
|
||||
function local() → FutureOr<self::A> /* originally async */ {
|
||||
final asy::_Future<self::A> :async_future = new asy::_Future::•<self::A>();
|
||||
core::bool* :is_sync = false;
|
||||
FutureOr<self::A>? :return_value;
|
||||
dynamic :async_stack_trace;
|
||||
(dynamic) → dynamic :async_op_then;
|
||||
(core::Object, core::StackTrace) → dynamic :async_op_error;
|
||||
core::int :await_jump_var = 0;
|
||||
dynamic :await_ctx_var;
|
||||
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
|
||||
try {
|
||||
#L5:
|
||||
{
|
||||
if(true) {
|
||||
:return_value = let final<BottomType> #t34 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in let Null #t35 = null in #t35.==(null) ?{self::A} #t35 as{TypeError,ForNonNullableByDefault} self::A : #t35{self::A};
|
||||
break #L5;
|
||||
}
|
||||
else {
|
||||
:return_value = let final<BottomType> #t36 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<Null>.value(null); // Error.
|
||||
^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
break #L5;
|
||||
}
|
||||
}
|
||||
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
|
||||
return;
|
||||
}
|
||||
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
|
||||
asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
|
||||
}
|
||||
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
|
||||
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
|
||||
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
|
||||
:async_op.call();
|
||||
:is_sync = true;
|
||||
return :async_future;
|
||||
}
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
||||
constants {
|
||||
#C1 = self::A {}
|
||||
}
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: MethodInvocation @ org-dartlang-testcase:///assignability_error_messages.dart:67:14 -> BoolConstant(true)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:67:14 -> NullConstant(null)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:67:14 -> NullConstant(null)
|
||||
Evaluated: MethodInvocation @ org-dartlang-testcase:///assignability_error_messages.dart:69:10 -> BoolConstant(true)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:69:10 -> NullConstant(null)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:69:10 -> NullConstant(null)
|
||||
Evaluated: MethodInvocation @ org-dartlang-testcase:///assignability_error_messages.dart:73:12 -> BoolConstant(true)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:73:12 -> NullConstant(null)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:73:12 -> NullConstant(null)
|
||||
Evaluated: MethodInvocation @ org-dartlang-testcase:///assignability_error_messages.dart:77:14 -> BoolConstant(true)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:77:14 -> NullConstant(null)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///assignability_error_messages.dart:77:14 -> NullConstant(null)
|
||||
Extra constant evaluation: evaluated: 216, effectively constant: 12
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
class A {
|
||||
const A();
|
||||
}
|
||||
|
@ -14,4 +16,5 @@ void bazContext(num Function() f) {}
|
|||
A foo(B? x, List<B?> l, Map<B?, B?> m, List<B>? l2, Map<B, B>? m2) {}
|
||||
List<A> bar(List<B?> x, List<List<B?>> l, Map<List<B?>, List<B?>> m) {}
|
||||
void baz(C c) {}
|
||||
A boz(Null x) {}
|
||||
main() {}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
A boz(Null x) {}
|
||||
A foo(B? x, List<B?> l, Map<B?, B?> m, List<B>? l2, Map<B, B>? m2) {}
|
||||
List<A> bar(List<B?> x, List<List<B?>> l, Map<List<B?>, List<B?>> m) {}
|
||||
|
||||
|
|
|
@ -2,109 +2,122 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A>[...l2]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A, A>{...m2}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// Try changing the type of the variable.
|
||||
// for (A y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'Iterable' is from 'dart:core'.
|
||||
// for (A y in l2) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:36:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// case const A():
|
||||
// ^
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:11: Context: The switch expression is here.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:35:11: Context: The switch expression is here.
|
||||
// switch (x) /* Error. */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<B?>.value(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// barContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// List<A> y = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -112,19 +125,63 @@ library /*isNonNullableByDefault*/;
|
|||
// for (List<A> y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// bazContext(c);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(null); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a1 = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a2 = null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<Null>.value(null); // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:async" as asy;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class A extends core::Object /*hasConstConstructor*/ {
|
||||
const constructor •() → self::A
|
||||
|
@ -146,45 +203,45 @@ static method fooContext(self::A x) → void {}
|
|||
static method barContext(core::List<self::A> x) → void {}
|
||||
static method bazContext(() → core::num f) → void {}
|
||||
static method foo(self::B? x, core::List<self::B?> l, core::Map<self::B?, self::B?> m, core::List<self::B>? l2, core::Map<self::B, self::B>? m2) → self::A {
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A);
|
||||
self::A a = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A a = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a = x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A>[...l]; // Error.
|
||||
^"];
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A>[...l2]; // Error.
|
||||
^"];
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^"};
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A, A>{...m2}; // Error.
|
||||
^": null};
|
||||
for (final self::B? #t3 in l) {
|
||||
self::A y = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A y = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
for (A y in l) {} // Error.
|
||||
^" in #t3 as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
for (self::A y in let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
for (self::A y in let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'Iterable' is from 'dart:core'.
|
||||
|
@ -204,52 +261,69 @@ Try changing the type of the variable.
|
|||
break #L1;
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
function local() → FutureOr<self::A> async {
|
||||
if(true) {
|
||||
return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<B?>.value(x); // Error.
|
||||
^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
|
||||
self::barContext(let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
self::barContext(let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
barContext(x); // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>);
|
||||
core::List<self::A> y = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
List<A> y = x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>>[...l]; // Error.
|
||||
^"];
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>, List<A>>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>, List<A>>{...m}; // Error.
|
||||
^"};
|
||||
for (final core::List<self::B?> #t9 in l) {
|
||||
core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
for (final core::List<self::B?> #t11 in l) {
|
||||
core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
for (List<A> y in l) {} // Error.
|
||||
^" in #t9 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
^" in #t11 as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
}
|
||||
return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -257,9 +331,54 @@ Try changing the type of the variable.
|
|||
^" in x as{TypeError,ForNonNullableByDefault} core::List<self::A>;
|
||||
}
|
||||
static method baz(self::C c) → void {
|
||||
self::bazContext(let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
self::bazContext(let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
bazContext(c);
|
||||
^" in (let final self::C #t13 = c in #t13.==(null) ?{() → core::num?} null : #t13.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
|
||||
^" in (let final self::C #t15 = c in #t15.==(null) ?{() → core::num?} null : #t15.{self::C::call}) as{TypeError,ForNonNullableByDefault} () → core::num);
|
||||
}
|
||||
static method boz(Null x) → self::A {
|
||||
self::fooContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A);
|
||||
self::fooContext(let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(null); // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A);
|
||||
self::A a1 = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a1 = x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
self::A a2 = let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a2 = null; // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A;
|
||||
if(true) {
|
||||
return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
function local() → FutureOr<self::A> async {
|
||||
if(true) {
|
||||
return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<Null>.value(null); // Error.
|
||||
^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
}
|
||||
}
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
||||
|
|
|
@ -2,109 +2,122 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A>[...l2]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <A, A>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
// <A, A>{...m2}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// Try changing the type of the variable.
|
||||
// for (A y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'Iterable' is from 'dart:core'.
|
||||
// for (A y in l2) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:36:16: Error: Type 'A' of the case expression is not a subtype of type 'B?' of this switch expression.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// case const A():
|
||||
// ^
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:11: Context: The switch expression is here.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:35:11: Context: The switch expression is here.
|
||||
// switch (x) /* Error. */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<B?>.value(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// barContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// List<A> y = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>>[...l]; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// <List<A>, List<A>>{...m}; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -112,19 +125,63 @@ library /*isNonNullableByDefault*/;
|
|||
// for (List<A> y in l) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
// - 'List' is from 'dart:core'.
|
||||
// - 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
// bazContext(c);
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(x); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// fooContext(null); // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a1 = x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// A a2 = null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return x; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return null; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
// - 'Future' is from 'dart:async'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
// return new Future<Null>.value(null); // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:async" as asy;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class A extends core::Object /*hasConstConstructor*/ {
|
||||
const constructor •() → self::A
|
||||
|
@ -146,34 +203,34 @@ static method fooContext(self::A x) → void {}
|
|||
static method barContext(core::List<self::A> x) → void {}
|
||||
static method bazContext(() → core::num f) → void {}
|
||||
static method foo(self::B? x, core::List<self::B?> l, core::Map<self::B?, self::B?> m, core::List<self::B>? l2, core::Map<self::B, self::B>? m2) → self::A {
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:25:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::fooContext(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:14: Error: The argument type 'B?' can't be assigned to the parameter type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in x);
|
||||
self::A a = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:26:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A a = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:9: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a = x; // Error.
|
||||
^" in x;
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:27:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:10: Error: Can't assign spread elements of type 'B?' to collection elements of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A>[...l]; // Error.
|
||||
^"];
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:28:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:10: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A>[...l2]; // Error.
|
||||
^"];
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry keys of type 'B?' to map entry keys of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:29:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:13: Error: Can't assign spread entry values of type 'B?' to map entry values of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<A, A>{...m}; // Error.
|
||||
^"};
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:30:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<self::A, self::A>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:13: Error: An expression whose value can be 'null' must be null-checked before it can be dereferenced.
|
||||
<A, A>{...m2}; // Error.
|
||||
^": null};
|
||||
{
|
||||
|
@ -181,7 +238,7 @@ static method foo(self::B? x, core::List<self::B?> l, core::Map<self::B?, self::
|
|||
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
|
||||
final self::B? #t3 = :sync-for-iterator.{core::Iterator::current};
|
||||
{
|
||||
self::A y = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:31:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
self::A y = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:33:10: Error: A value of type 'B?' can't be assigned to a variable of type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
|
@ -191,7 +248,7 @@ Try changing the type of the variable.
|
|||
}
|
||||
}
|
||||
{
|
||||
core::Iterator<dynamic> :sync-for-iterator = (let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:32:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
core::Iterator<dynamic> :sync-for-iterator = (let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:34:15: Error: The type 'List<B>?' used in the 'for' loop must implement 'Iterable<dynamic>' because 'List<B>?' is nullable and 'Iterable<dynamic>' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'Iterable' is from 'dart:core'.
|
||||
|
@ -215,37 +272,81 @@ Try changing the type of the variable.
|
|||
break #L1;
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:39:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
function local() → FutureOr<self::A> /* originally async */ {
|
||||
final asy::_Future<self::A> :async_future = new asy::_Future::•<self::A>();
|
||||
core::bool* :is_sync = false;
|
||||
FutureOr<self::A>? :return_value;
|
||||
dynamic :async_stack_trace;
|
||||
(dynamic) → dynamic :async_op_then;
|
||||
(core::Object, core::StackTrace) → dynamic :async_op_error;
|
||||
core::int :await_jump_var = 0;
|
||||
dynamic :await_ctx_var;
|
||||
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
|
||||
try {
|
||||
#L4:
|
||||
{
|
||||
if(true) {
|
||||
:return_value = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: A value of type 'B?' can't be returned from an async function with return type 'FutureOr<A>' because 'B?' is nullable and 'FutureOr<A>' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x;
|
||||
break #L4;
|
||||
}
|
||||
else {
|
||||
:return_value = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:18: Error: A value of type 'Future<B?>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<B?>.value(x); // Error.
|
||||
^" in asy::Future::value<self::B?>(x) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
break #L4;
|
||||
}
|
||||
}
|
||||
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
|
||||
return;
|
||||
}
|
||||
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
|
||||
asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
|
||||
}
|
||||
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
|
||||
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
|
||||
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
|
||||
:async_op.call();
|
||||
:is_sync = true;
|
||||
return :async_future;
|
||||
}
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:49:10: Error: A value of type 'B?' can't be returned from a function with return type 'A' because 'B?' is nullable and 'A' isn't.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x;
|
||||
}
|
||||
static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, core::Map<core::List<self::B?>, core::List<self::B?>> m) → core::List<self::A> {
|
||||
self::barContext(let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:43:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
self::barContext(let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:53:14: Error: The argument type 'List<B?>' can't be assigned to the parameter type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
barContext(x); // Error.
|
||||
^" in x);
|
||||
core::List<self::A> y = let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:44:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:54:15: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
List<A> y = x; // Error.
|
||||
^" in x;
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:45:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>>[invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:55:16: Error: Can't assign spread elements of type 'List<B?>' to collection elements of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>>[...l]; // Error.
|
||||
^"];
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
<core::List<self::A>, core::List<self::A>>{invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry keys of type 'List<B?>' to map entry keys of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
<List<A>, List<A>>{...m}; // Error.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:46:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
^": invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:56:25: Error: Can't assign spread entry values of type 'List<B?>' to map entry values of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -254,19 +355,19 @@ static method bar(core::List<self::B?> x, core::List<core::List<self::B?>> l, co
|
|||
{
|
||||
core::Iterator<core::List<self::B?>> :sync-for-iterator = l.{core::Iterable::iterator};
|
||||
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
|
||||
final core::List<self::B?> #t9 = :sync-for-iterator.{core::Iterator::current};
|
||||
final core::List<self::B?> #t11 = :sync-for-iterator.{core::Iterator::current};
|
||||
{
|
||||
core::List<self::A> y = let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:47:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
core::List<self::A> y = let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:57:16: Error: A value of type 'List<B?>' can't be assigned to a variable of type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
Try changing the type of the variable.
|
||||
for (List<A> y in l) {} // Error.
|
||||
^" in #t9;
|
||||
^" in #t11;
|
||||
}
|
||||
}
|
||||
}
|
||||
return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:48:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
return let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:58:10: Error: A value of type 'List<B?>' can't be returned from a function with return type 'List<A>' because 'B?' is nullable and 'A' isn't.
|
||||
- 'List' is from 'dart:core'.
|
||||
- 'B' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
|
@ -274,9 +375,81 @@ Try changing the type of the variable.
|
|||
^" in x;
|
||||
}
|
||||
static method baz(self::C c) → void {
|
||||
self::bazContext(let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:52:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
self::bazContext(let final<BottomType> #t14 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:62:14: Error: The argument type 'num? Function()' can't be assigned to the parameter type 'num Function()' because 'num?' is nullable and 'num' isn't.
|
||||
bazContext(c);
|
||||
^" in let final self::C #t13 = c in #t13.==(null) ?{() → core::num?} null : #t13.{self::C::call});
|
||||
^" in let final self::C #t15 = c in #t15.==(null) ?{() → core::num?} null : #t15.{self::C::call});
|
||||
}
|
||||
static method boz(Null x) → self::A {
|
||||
self::fooContext(let final<BottomType> #t16 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:66:14: Error: The argument type 'Null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(x); // Error.
|
||||
^" in x);
|
||||
self::fooContext(let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:67:14: Error: The value 'null' can't be assigned to the parameter type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
fooContext(null); // Error.
|
||||
^" in null);
|
||||
self::A a1 = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:68:10: Error: A value of type 'Null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a1 = x; // Error.
|
||||
^" in x;
|
||||
self::A a2 = let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:69:10: Error: The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
A a2 = null; // Error.
|
||||
^" in null;
|
||||
if(true) {
|
||||
return let final<BottomType> #t20 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:71:12: Error: A value of type 'Null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return x; // Error.
|
||||
^" in x;
|
||||
}
|
||||
else {
|
||||
return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:73:12: Error: The value 'null' can't be returned from a function with return type 'A' because 'A' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in null;
|
||||
}
|
||||
function local() → FutureOr<self::A> /* originally async */ {
|
||||
final asy::_Future<self::A> :async_future = new asy::_Future::•<self::A>();
|
||||
core::bool* :is_sync = false;
|
||||
FutureOr<self::A>? :return_value;
|
||||
dynamic :async_stack_trace;
|
||||
(dynamic) → dynamic :async_op_then;
|
||||
(core::Object, core::StackTrace) → dynamic :async_op_error;
|
||||
core::int :await_jump_var = 0;
|
||||
dynamic :await_ctx_var;
|
||||
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
|
||||
try {
|
||||
#L5:
|
||||
{
|
||||
if(true) {
|
||||
:return_value = let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:77:14: Error: The value 'null' can't be returned from an async function with return type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return null; // Error.
|
||||
^" in null;
|
||||
break #L5;
|
||||
}
|
||||
else {
|
||||
:return_value = let final<BottomType> #t23 = invalid-expression "pkg/front_end/testcases/nnbd/assignability_error_messages.dart:79:18: Error: A value of type 'Future<Null>' can't be returned from an async function with return type 'FutureOr<A>'.
|
||||
- 'Future' is from 'dart:async'.
|
||||
- 'A' is from 'pkg/front_end/testcases/nnbd/assignability_error_messages.dart'.
|
||||
return new Future<Null>.value(null); // Error.
|
||||
^" in asy::Future::value<Null>(null) as{TypeError,ForNonNullableByDefault} self::A;
|
||||
break #L5;
|
||||
}
|
||||
}
|
||||
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
|
||||
return;
|
||||
}
|
||||
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
|
||||
asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
|
||||
}
|
||||
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
|
||||
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
|
||||
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
|
||||
:async_op.call();
|
||||
:is_sync = true;
|
||||
return :async_future;
|
||||
}
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
// - 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
// Null x = null;
|
||||
// ^
|
||||
|
@ -28,7 +28,7 @@ class Null extends core::Object {
|
|||
;
|
||||
}
|
||||
static method test() → dynamic {
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
- 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
Null x = null;
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::Null;
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
// - 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
// Null x = null;
|
||||
// ^
|
||||
|
@ -28,7 +28,7 @@ class Null extends core::Object {
|
|||
;
|
||||
}
|
||||
static method test() → dynamic {
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
- 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
Null x = null;
|
||||
^" in let Null #t2 = null in #t2.==(null) ?{self::Null} #t2 as{TypeError,ForNonNullableByDefault} self::Null : #t2{self::Null};
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
// - 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
// Null x = null;
|
||||
// ^
|
||||
|
@ -28,7 +28,7 @@ class Null extends core::Object {
|
|||
;
|
||||
}
|
||||
static method test() → dynamic {
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
- 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
Null x = null;
|
||||
^" in null as{TypeError,ForNonNullableByDefault} self::Null;
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
// pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
// - 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
// Null x = null;
|
||||
// ^
|
||||
|
@ -28,7 +28,7 @@ class Null extends core::Object {
|
|||
;
|
||||
}
|
||||
static method test() → dynamic {
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: A value of type 'Null' can't be assigned to a variable of type 'Null' because 'Null' is nullable and 'Null' isn't.
|
||||
self::Null x = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd/issue41700b.dart:8:12: Error: The value 'null' can't be assigned to a variable of type 'Null' because 'Null' is not nullable.
|
||||
- 'Null' is from 'pkg/front_end/testcases/nnbd/issue41700b.dart'.
|
||||
Null x = null;
|
||||
^" in null;
|
||||
|
|
|
@ -6,11 +6,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /*error*/ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -31,11 +31,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /* error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -78,14 +78,14 @@ String returnImplicit() /*error*/ {
|
|||
}
|
||||
static method returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
static method returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
|
@ -147,14 +147,14 @@ static method localFunctions() → dynamic {
|
|||
}
|
||||
function returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
function returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /*error*/ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -31,11 +31,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /* error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -78,14 +78,14 @@ String returnImplicit() /*error*/ {
|
|||
}
|
||||
static method returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in let Null #t3 = null in #t3.==(null) ?{core::String} #t3 as{TypeError,ForNonNullableByDefault} core::String : #t3{core::String};
|
||||
}
|
||||
static method returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in let Null #t5 = null in #t5.==(null) ?{core::String} #t5 as{TypeError,ForNonNullableByDefault} core::String : #t5{core::String};
|
||||
}
|
||||
|
@ -362,14 +362,14 @@ static method localFunctions() → dynamic {
|
|||
}
|
||||
function returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t10 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in let Null #t11 = null in #t11.==(null) ?{core::String} #t11 as{TypeError,ForNonNullableByDefault} core::String : #t11{core::String};
|
||||
}
|
||||
function returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in let Null #t13 = null in #t13.==(null) ?{core::String} #t13 as{TypeError,ForNonNullableByDefault} core::String : #t13{core::String};
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /*error*/ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -31,11 +31,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /* error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -79,14 +79,14 @@ String returnImplicit() /*error*/ {
|
|||
}
|
||||
static method returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
static method returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
|
@ -151,14 +151,14 @@ static method localFunctions() → dynamic {
|
|||
}
|
||||
function returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
function returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} core::String;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /*error*/ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -31,11 +31,11 @@ library /*isNonNullableByDefault*/;
|
|||
// String returnImplicit() /* error */ {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
// pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
// return null; // error
|
||||
// ^
|
||||
//
|
||||
|
@ -79,14 +79,14 @@ String returnImplicit() /*error*/ {
|
|||
}
|
||||
static method returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:13:10: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null;
|
||||
}
|
||||
static method returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:19:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null;
|
||||
}
|
||||
|
@ -366,14 +366,14 @@ static method localFunctions() → dynamic {
|
|||
}
|
||||
function returnExplicit() → core::String {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:69:12: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null;
|
||||
}
|
||||
function returnMixed(core::bool b) → core::String {
|
||||
if(b) {
|
||||
core::print("foo");
|
||||
return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: A value of type 'Null' can't be returned from a function with return type 'String' because 'Null' is nullable and 'String' isn't.
|
||||
return let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/nnbd/return_null.dart:75:14: Error: The value 'null' can't be returned from a function with return type 'String' because 'String' is not nullable.
|
||||
return null; // error
|
||||
^" in null;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: A value of type 'Null' can't be assigned to a variable of type 'int Function(int)' because 'Null' is nullable and 'int Function(int)' isn't.
|
||||
// pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: The value 'null' can't be assigned to a variable of type 'int Function(int)' because 'int Function(int)' is not nullable.
|
||||
// F f = null; // Static error
|
||||
// ^
|
||||
//
|
||||
|
@ -14,7 +14,7 @@ import "org-dartlang-testcase:///issue42181_lib.dart";
|
|||
static method f1(core::int x) → core::int?
|
||||
return x;
|
||||
static method test() → void {
|
||||
(core::int*) → core::int* f = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: A value of type 'Null' can't be assigned to a variable of type 'int Function(int)' because 'Null' is nullable and 'int Function(int)' isn't.
|
||||
(core::int*) → core::int* f = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: The value 'null' can't be assigned to a variable of type 'int Function(int)' because 'int Function(int)' is not nullable.
|
||||
F f = null; // Static error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} (core::int*) → core::int*;
|
||||
f = #C1;
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: A value of type 'Null' can't be assigned to a variable of type 'int Function(int)' because 'Null' is nullable and 'int Function(int)' isn't.
|
||||
// pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: The value 'null' can't be assigned to a variable of type 'int Function(int)' because 'int Function(int)' is not nullable.
|
||||
// F f = null; // Static error
|
||||
// ^
|
||||
//
|
||||
|
@ -14,7 +14,7 @@ import "org-dartlang-testcase:///issue42181_lib.dart";
|
|||
static method f1(core::int x) → core::int?
|
||||
return x;
|
||||
static method test() → void {
|
||||
(core::int*) → core::int* f = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: A value of type 'Null' can't be assigned to a variable of type 'int Function(int)' because 'Null' is nullable and 'int Function(int)' isn't.
|
||||
(core::int*) → core::int* f = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nnbd_mixed/issue42181.dart:10:9: Error: The value 'null' can't be assigned to a variable of type 'int Function(int)' because 'int Function(int)' is not nullable.
|
||||
F f = null; // Static error
|
||||
^" in null;
|
||||
f = #C1;
|
||||
|
|
|
@ -2,12 +2,12 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
// FutureOr<AAlias> foLegacyNonNullable = null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
// FutureOr<AAliasNonNullable> foNonNullable = null; // error
|
||||
// ^
|
||||
|
@ -21,12 +21,12 @@ import "org-dartlang-testcase:///issue41501_lib.dart";
|
|||
typedef AAliasNonNullable = opt::A;
|
||||
typedef AAliasNullable = opt::A?;
|
||||
static method test() → dynamic {
|
||||
FutureOr<opt::A>foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
FutureOr<opt::A>foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
FutureOr<AAlias> foLegacyNonNullable = null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} FutureOr<opt::A>;
|
||||
FutureOr<opt::A?>foLegacyNullable = null;
|
||||
FutureOr<opt::A>foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
FutureOr<opt::A>foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
FutureOr<AAliasNonNullable> foNonNullable = null; // error
|
||||
^" in null as{TypeError,ForNonNullableByDefault} FutureOr<opt::A>;
|
||||
|
|
|
@ -2,12 +2,12 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
// FutureOr<AAlias> foLegacyNonNullable = null; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
// FutureOr<AAliasNonNullable> foNonNullable = null; // error
|
||||
// ^
|
||||
|
@ -21,12 +21,12 @@ import "org-dartlang-testcase:///issue41501_lib.dart";
|
|||
typedef AAliasNonNullable = opt::A;
|
||||
typedef AAliasNullable = opt::A?;
|
||||
static method test() → dynamic {
|
||||
FutureOr<opt::A>foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
FutureOr<opt::A>foLegacyNonNullable = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
FutureOr<AAlias> foLegacyNonNullable = null; // error
|
||||
^" in null;
|
||||
FutureOr<opt::A?>foLegacyNullable = null;
|
||||
FutureOr<opt::A>foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: A value of type 'Null' can't be assigned to a variable of type 'FutureOr<A>' because 'Null' is nullable and 'FutureOr<A>' isn't.
|
||||
FutureOr<opt::A>foNonNullable = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr<A>' because 'FutureOr<A>' is not nullable.
|
||||
- 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'.
|
||||
FutureOr<AAliasNonNullable> foNonNullable = null; // error
|
||||
^" in null;
|
||||
|
|
|
@ -63,7 +63,7 @@ const int F3;
|
|||
// ^
|
||||
// [cfe] The const variable 'F3' must be initialized.
|
||||
// ^
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'int' because 'Null' is nullable and 'int' isn't.
|
||||
// [cfe] The value 'null' can't be assigned to a variable of type 'int' because 'int' is not nullable.
|
||||
|
||||
class Point {
|
||||
final x, y;
|
||||
|
|
|
@ -56,7 +56,7 @@ main() {
|
|||
// [cfe] Operand of null-aware operation '??' has type 'bool' which excludes null.
|
||||
// ^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_OPERAND
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] The value 'null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
// ^^^^
|
||||
// [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION
|
||||
}
|
||||
|
|
|
@ -57,47 +57,47 @@ void main() {
|
|||
if (nil) {}
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_CONDITION
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
[if (nil) 3];
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_CONDITION
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
nil ? 3 : 4;
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_CONDITION
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
while (nil) {}
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_CONDITION
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
do {} while (nil);
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_CONDITION
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
nil || true;
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_OPERAND
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
nil && true;
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_OPERAND
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
true || nil;
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_OPERAND
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
true && nil;
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_OPERAND
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
for (int i = 0; nil; i++) {}
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_CONDITION
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
[for (int i = 0; nil; i++) 3];
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.NON_BOOL_CONDITION
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'Null' is nullable and 'bool' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'bool' because 'bool' is not nullable.
|
||||
}
|
||||
{
|
||||
// Check that values of type `Object` are not usable as booleans.
|
||||
|
|
|
@ -11,5 +11,5 @@ void main() {
|
|||
int x = null;
|
||||
// ^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'int' because 'Null' is nullable and 'int' isn't.
|
||||
// [cfe] The value 'null' can't be assigned to a variable of type 'int' because 'int' is not nullable.
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void testNullSafeCalls() {
|
|||
takesNever(nil);
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [cfe] The argument type 'Null' can't be assigned to the parameter type 'Never' because 'Null' is nullable and 'Never' isn't.
|
||||
// [cfe] The argument type 'Null' can't be assigned to the parameter type 'Never' because 'Never' is not nullable.
|
||||
takesNever(never);
|
||||
takesNever(3 as dynamic);
|
||||
(takesNever as dynamic)(3);
|
||||
|
@ -41,7 +41,7 @@ void testNullSafeCalls() {
|
|||
takesInt(nil);
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [cfe] The argument type 'Null' can't be assigned to the parameter type 'int' because 'Null' is nullable and 'int' isn't.
|
||||
// [cfe] The argument type 'Null' can't be assigned to the parameter type 'int' because 'int' is not nullable.
|
||||
takesInt(nil as dynamic);
|
||||
(takesInt as dynamic)(nil);
|
||||
(takesInt as dynamic)("hello");
|
||||
|
@ -53,7 +53,7 @@ void testNullSafeCalls() {
|
|||
takesObject(nil);
|
||||
// ^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
|
||||
// [cfe] The argument type 'Null' can't be assigned to the parameter type 'Object' because 'Null' is nullable and 'Object' isn't.
|
||||
// [cfe] The argument type 'Null' can't be assigned to the parameter type 'Object' because 'Object' is not nullable.
|
||||
takesObject(nil as dynamic);
|
||||
(takesObject as dynamic)(nil);
|
||||
}
|
||||
|
@ -205,12 +205,12 @@ void main() {
|
|||
// ^
|
||||
// [analyzer] unspecified
|
||||
// ^
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'Never' because 'Null' is nullable and 'Never' isn't.
|
||||
// [cfe] The value 'null' can't be assigned to a variable of type 'Never' because 'Never' is not nullable.
|
||||
never = nil;
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// ^
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'Never' because 'Null' is nullable and 'Never' isn't.
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'Never' because 'Never' is not nullable.
|
||||
nil = never;
|
||||
testNullSafeCalls();
|
||||
testNullSafeApply();
|
||||
|
|
|
@ -34,7 +34,7 @@ class A {
|
|||
// [cfe] The modifier 'late' should be before the modifier 'final'.
|
||||
// ^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'A' because 'Null' is nullable and 'A' isn't.
|
||||
// [cfe] The value 'null' can't be assigned to a variable of type 'A' because 'A' is not nullable.
|
||||
|
||||
covariant late x15;
|
||||
// ^^^^
|
||||
|
|
|
@ -14,7 +14,7 @@ void main() {
|
|||
F f = null; // typedefs from opted out libraries are treated as non-nullable
|
||||
// ^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'int Function(int)' because 'Null' is nullable and 'int Function(int)' isn't.
|
||||
// [cfe] The value 'null' can't be assigned to a variable of type 'int Function(int)' because 'int Function(int)' is not nullable.
|
||||
|
||||
f = takesNonNullable; // F is int* Function(int*)
|
||||
f(null); // F is int* Function(int*)
|
||||
|
|
Loading…
Reference in a new issue