Version 2.11.0-195.0.dev
Merge commit '749b622a6bd0bbfeb1bdda8881333ee2575e5f99' into 'dev'
diff --git a/DEPS b/DEPS
index 88be3b3..b5cc604 100644
--- a/DEPS
+++ b/DEPS
@@ -154,7 +154,7 @@
"term_glyph_rev": "6a0f9b6fb645ba75e7a00a4e20072678327a0347",
"test_reflective_loader_tag": "0.1.9",
"test_rev": "e37a93bbeae23b215972d1659ac865d71287ff6a",
- "tflite_native_rev": "3c777c40608a2a9f1427bfe0028ab48e7116b4c1",
+ "tflite_native_rev": "0.4.0+1",
"typed_data_tag": "f94fc57b8e8c0e4fe4ff6cfd8290b94af52d3719",
"usage_tag": "3.4.0",
"vector_math_rev": "0c9f5d68c047813a6dcdeb88ba7a42daddf25025",
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index a87e07a..77c0646 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -42,7 +42,6 @@
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary2/linked_element_builder.dart';
import 'package:analyzer/src/summary2/linked_unit_context.dart';
import 'package:analyzer/src/summary2/reference.dart';
import 'package:analyzer/src/util/comment.dart';
@@ -1298,15 +1297,16 @@
if (_enums != null) return _enums;
if (linkedNode != null) {
+ var containerRef = reference.getChild('@enum');
CompilationUnit linkedNode = this.linkedNode;
- _enums = <ClassElement>[];
- for (var node in linkedNode.declarations) {
- if (node is EnumDeclaration) {
- var element = _elementBuilder.enumDeclaration(node);
- _enums.add(element);
+ _enums = linkedNode.declarations.whereType<EnumDeclaration>().map((node) {
+ var name = node.name.name;
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as EnumElementImpl;
}
- }
- return _enums;
+ return EnumElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
}
return _enums ??= const <ClassElement>[];
@@ -1328,11 +1328,19 @@
if (linkedNode != null) {
CompilationUnit linkedNode = this.linkedNode;
+ var containerRef = reference.getChild('@extension');
_extensions = <ExtensionElement>[];
for (var node in linkedNode.declarations) {
if (node is ExtensionDeclaration) {
- var element = _elementBuilder.extensionDeclaration(node);
- _extensions.add(element);
+ var refName = linkedContext.getExtensionRefName(node);
+ var reference = containerRef.getChild(refName);
+ if (reference.hasElementFor(node)) {
+ _extensions.add(reference.element);
+ } else {
+ _extensions.add(
+ ExtensionElementImpl.forLinkedNode(this, reference, node),
+ );
+ }
}
}
return _extensions;
@@ -1355,14 +1363,18 @@
if (linkedNode != null) {
CompilationUnit linkedNode = this.linkedNode;
- _functions = <FunctionElement>[];
- for (var node in linkedNode.declarations) {
- if (node is FunctionDeclaration && node.propertyKeyword == null) {
- var element = _elementBuilder.functionDeclaration(node);
- _functions.add(element as FunctionElement);
+ var containerRef = reference.getChild('@function');
+ return _functions = linkedNode.declarations
+ .whereType<FunctionDeclaration>()
+ .where((node) => !node.isGetter && !node.isSetter)
+ .map((node) {
+ var name = node.name.name;
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as FunctionElementImpl;
}
- }
- return _functions;
+ return FunctionElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
}
return _functions ?? const <FunctionElement>[];
}
@@ -1382,17 +1394,23 @@
if (linkedNode != null) {
CompilationUnit linkedNode = this.linkedNode;
- _typeAliases = <FunctionTypeAliasElement>[];
- for (var node in linkedNode.declarations) {
+ var containerRef = reference.getChild('@typeAlias');
+ return _typeAliases = linkedNode.declarations.where((node) {
+ return node is FunctionTypeAlias || node is GenericTypeAlias;
+ }).map((node) {
+ String name;
if (node is FunctionTypeAlias) {
- var element = _elementBuilder.functionTypeAlias(node);
- _typeAliases.add(element);
- } else if (node is GenericTypeAlias) {
- var element = _elementBuilder.genericTypeAlias(node);
- _typeAliases.add(element);
+ name = node.name.name;
+ } else {
+ name = (node as GenericTypeAlias).name.name;
}
- }
- return _typeAliases;
+
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as GenericTypeAliasElementImpl;
+ }
+ return GenericTypeAliasElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
}
return _typeAliases ?? const <FunctionTypeAliasElement>[];
@@ -1424,14 +1442,16 @@
if (linkedNode != null) {
CompilationUnit linkedNode = this.linkedNode;
- _mixins = <ClassElement>[];
- for (var node in linkedNode.declarations) {
- if (node is MixinDeclaration) {
- var element = _elementBuilder.mixinDeclaration(node);
- _mixins.add(element);
+ var containerRef = reference.getChild('@mixin');
+ var declarations = linkedNode.declarations;
+ return _mixins = declarations.whereType<MixinDeclaration>().map((node) {
+ var name = node.name.name;
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ return reference.element as MixinElementImpl;
}
- }
- return _mixins;
+ return MixinElementImpl.forLinkedNode(this, reference, node);
+ }).toList();
}
return _mixins ?? const <ClassElement>[];
@@ -1483,14 +1503,24 @@
if (linkedNode != null) {
CompilationUnit linkedNode = this.linkedNode;
+ var containerRef = reference.getChild('@class');
_types = <ClassElement>[];
for (var node in linkedNode.declarations) {
+ String name;
if (node is ClassDeclaration) {
- var element = _elementBuilder.classDeclaration(node);
- _types.add(element);
+ name = node.name.name;
} else if (node is ClassTypeAlias) {
- var element = _elementBuilder.classTypeAlias(node);
- _types.add(element);
+ name = node.name.name;
+ } else {
+ continue;
+ }
+ var reference = containerRef.getChild(name);
+ if (reference.hasElementFor(node)) {
+ _types.add(reference.element);
+ } else {
+ _types.add(
+ ClassElementImpl.forLinkedNode(this, reference, node),
+ );
}
}
return _types;
@@ -1623,13 +1653,18 @@
var variableList = <TopLevelVariableElement>[];
variableMap[unit] = variableList;
- var elementBuilder = unit._elementBuilder;
var unitNode = unit.linkedContext.unit_withDeclarations;
var unitDeclarations = unitNode.declarations;
var variables = context.topLevelVariables(unitNode);
for (var variable in variables) {
- var variableElement = elementBuilder.topLevelVariable(variable);
+ var name = variable.name.name;
+ var reference = unit.reference.getChild('@variable').getChild(name);
+ var variableElement = TopLevelVariableElementImpl.forLinkedNodeFactory(
+ unit,
+ reference,
+ variable,
+ );
variableList.add(variableElement);
accessorList.add(variableElement.getter);
@@ -1645,9 +1680,15 @@
if (!isGetter && !isSetter) continue;
var name = node.name.name;
+ var containerRef = isGetter
+ ? unit.reference.getChild('@getter')
+ : unit.reference.getChild('@setter');
- var accessorElement = elementBuilder.functionDeclaration(node)
- as PropertyAccessorElementImpl;
+ var accessorElement = PropertyAccessorElementImpl.forLinkedNode(
+ unit,
+ containerRef.getChild(name),
+ node,
+ );
accessorList.add(accessorElement);
var fieldRef = unit.reference.getChild('@field').getChild(name);
@@ -2988,10 +3029,6 @@
return _enclosingElement?.typeParameterContext;
}
- LinkedElementBuilder get _elementBuilder {
- return linkedContext.elementBuilder;
- }
-
NullabilitySuffix get _noneOrStarSuffix {
return library?.isNonNullableByDefault == true
? NullabilitySuffix.none
diff --git a/pkg/analyzer/lib/src/summary2/linked_element_builder.dart b/pkg/analyzer/lib/src/summary2/linked_element_builder.dart
deleted file mode 100644
index fcfc0d3..0000000
--- a/pkg/analyzer/lib/src/summary2/linked_element_builder.dart
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/src/dart/ast/ast.dart';
-import 'package:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/summary2/linked_unit_context.dart';
-import 'package:analyzer/src/summary2/reference.dart';
-
-class LinkedElementBuilder {
- final CompilationUnitElementImpl _unitElement;
- final Reference _classRef;
- final Reference _enumRef;
- final Reference _extensionRef;
- final Reference _functionRef;
- final Reference _getterRef;
- final Reference _mixinRef;
- final Reference _setterRef;
- final Reference _typeAliasRef;
- final Reference _variableRef;
-
- var _nextUnnamedExtensionId = 0;
-
- LinkedElementBuilder(LinkedUnitContext unitContext)
- : _unitElement = unitContext.reference.element,
- _classRef = unitContext.reference.getChild('@class'),
- _enumRef = unitContext.reference.getChild('@enum'),
- _extensionRef = unitContext.reference.getChild('@extension'),
- _functionRef = unitContext.reference.getChild('@function'),
- _getterRef = unitContext.reference.getChild('@getter'),
- _mixinRef = unitContext.reference.getChild('@mixin'),
- _setterRef = unitContext.reference.getChild('@setter'),
- _typeAliasRef = unitContext.reference.getChild('@typeAlias'),
- _variableRef = unitContext.reference.getChild('@variable');
-
- ClassElementImpl classDeclaration(ClassDeclaration node) {
- var element = node.declaredElement as ClassElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- element = ClassElementImpl.forLinkedNode(
- _unitElement,
- _classRef.getChild(nameNode.name),
- node,
- );
- nameNode.staticElement = element;
- return element;
- }
-
- ClassElementImpl classTypeAlias(ClassTypeAlias node) {
- var element = node.declaredElement as ClassElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- element = ClassElementImpl.forLinkedNode(
- _unitElement,
- _classRef.getChild(nameNode.name),
- node,
- );
- nameNode.staticElement = element;
- return element;
- }
-
- EnumElementImpl enumDeclaration(EnumDeclaration node) {
- var element = node.declaredElement as EnumElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- element = EnumElementImpl.forLinkedNode(
- _unitElement,
- _enumRef.getChild(nameNode.name),
- node,
- );
- nameNode.staticElement = element;
- return element;
- }
-
- ExtensionElementImpl extensionDeclaration(ExtensionDeclarationImpl node) {
- var element = node.declaredElement as ExtensionElementImpl;
- if (element != null) {
- return element;
- }
-
- var name = node.name?.name;
- var refName = name ?? 'extension-${_nextUnnamedExtensionId++}';
- element = ExtensionElementImpl.forLinkedNode(
- _unitElement,
- _extensionRef.getChild(refName),
- node,
- );
- node.declaredElement = element;
- return element;
- }
-
- ExecutableElementImpl functionDeclaration(FunctionDeclaration node) {
- var element = node.declaredElement as ExecutableElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- var name = nameNode.name;
-
- if (node.isGetter) {
- element = PropertyAccessorElementImpl.forLinkedNode(
- _unitElement,
- _getterRef.getChild(name),
- node,
- );
- } else if (node.isSetter) {
- element = PropertyAccessorElementImpl.forLinkedNode(
- _unitElement,
- _setterRef.getChild(name),
- node,
- );
- } else {
- element = FunctionElementImpl.forLinkedNode(
- _unitElement,
- _functionRef.getChild(name),
- node,
- );
- }
-
- nameNode.staticElement = element;
- return element;
- }
-
- GenericTypeAliasElementImpl functionTypeAlias(FunctionTypeAlias node) {
- var element = node.declaredElement as GenericTypeAliasElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- element = GenericTypeAliasElementImpl.forLinkedNode(
- _unitElement,
- _typeAliasRef.getChild(nameNode.name),
- node,
- );
- nameNode.staticElement = element;
- return element;
- }
-
- GenericTypeAliasElementImpl genericTypeAlias(GenericTypeAlias node) {
- var element = node.declaredElement as GenericTypeAliasElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- element = GenericTypeAliasElementImpl.forLinkedNode(
- _unitElement,
- _typeAliasRef.getChild(nameNode.name),
- node,
- );
- nameNode.staticElement = element;
- return element;
- }
-
- MixinElementImpl mixinDeclaration(MixinDeclaration node) {
- var element = node.declaredElement as MixinElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- element = MixinElementImpl.forLinkedNode(
- _unitElement,
- _mixinRef.getChild(nameNode.name),
- node,
- );
- nameNode.staticElement = element;
- return element;
- }
-
- TopLevelVariableElementImpl topLevelVariable(VariableDeclaration node) {
- var element = node.declaredElement as TopLevelVariableElementImpl;
- if (element != null) {
- return element;
- }
-
- var nameNode = node.name;
- element = TopLevelVariableElementImpl.forLinkedNodeFactory(
- _unitElement,
- _variableRef.getChild(nameNode.name),
- node,
- );
- nameNode.staticElement = element;
- return element;
- }
-}
diff --git a/pkg/analyzer/lib/src/summary2/linked_element_factory.dart b/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
index b47435a..112fab4 100644
--- a/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
+++ b/pkg/analyzer/lib/src/summary2/linked_element_factory.dart
@@ -337,14 +337,8 @@
_indexUnitElementDeclarations(unit);
assert(reference.node != null, '$reference');
}
-
- var elementBuilder = unit.linkedContext.elementBuilder;
- var node = reference.node;
- if (node is ClassDeclaration) {
- return elementBuilder.classDeclaration(node);
- } else {
- return elementBuilder.classTypeAlias(node);
- }
+ ClassElementImpl.forLinkedNode(unit, reference, reference.node);
+ return reference.element;
}
ConstructorElementImpl _constructor(
@@ -420,8 +414,8 @@
_indexUnitElementDeclarations(unit);
assert(reference.node != null, '$reference');
}
- var elementBuilder = unit.linkedContext.elementBuilder;
- return elementBuilder.enumDeclaration(reference.node);
+ EnumElementImpl.forLinkedNode(unit, reference, reference.node);
+ return reference.element;
}
ExtensionElementImpl _extension(
@@ -430,8 +424,8 @@
_indexUnitElementDeclarations(unit);
assert(reference.node != null, '$reference');
}
- var elementBuilder = unit.linkedContext.elementBuilder;
- return elementBuilder.extensionDeclaration(reference.node);
+ ExtensionElementImpl.forLinkedNode(unit, reference, reference.node);
+ return reference.element;
}
FieldElementImpl _field(ClassElementImpl enclosing, Reference reference) {
@@ -473,8 +467,8 @@
_indexUnitElementDeclarations(unit);
assert(reference.node != null, '$reference');
}
- var elementBuilder = unit.linkedContext.elementBuilder;
- return elementBuilder.mixinDeclaration(reference.node);
+ MixinElementImpl.forLinkedNode(unit, reference, reference.node);
+ return reference.element;
}
Element _parameter(ExecutableElementImpl enclosing, Reference reference) {
@@ -497,14 +491,8 @@
_indexUnitElementDeclarations(unit);
assert(reference.node != null, '$reference');
}
-
- var elementBuilder = unit.linkedContext.elementBuilder;
- var node = reference.node;
- if (node is FunctionTypeAlias) {
- return elementBuilder.functionTypeAlias(node);
- } else {
- return elementBuilder.genericTypeAlias(node);
- }
+ GenericTypeAliasElementImpl.forLinkedNode(unit, reference, reference.node);
+ return reference.element;
}
/// Index nodes for which we choose to create elements individually,
diff --git a/pkg/analyzer/lib/src/summary2/linked_unit_context.dart b/pkg/analyzer/lib/src/summary2/linked_unit_context.dart
index 73c1f77..24a749f 100644
--- a/pkg/analyzer/lib/src/summary2/linked_unit_context.dart
+++ b/pkg/analyzer/lib/src/summary2/linked_unit_context.dart
@@ -19,7 +19,6 @@
import 'package:analyzer/src/summary2/ast_binary_reader.dart';
import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/linked_bundle_context.dart';
-import 'package:analyzer/src/summary2/linked_element_builder.dart';
import 'package:analyzer/src/summary2/reference.dart';
import 'package:analyzer/src/summary2/type_builder.dart';
@@ -39,8 +38,6 @@
AstBinaryReader _astReader;
- LinkedElementBuilder _elementBuilder;
-
CompilationUnit _unit;
bool _hasDirectivesRead = false;
@@ -69,10 +66,6 @@
_hasDirectivesRead = _unit != null;
}
- LinkedElementBuilder get elementBuilder {
- return _elementBuilder ??= LinkedElementBuilder(this);
- }
-
bool get hasPartOfDirective {
for (var directive in unit_withDirectives.directives) {
if (directive is PartOfDirective) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 8618dbe..edb4a54 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -1019,6 +1019,19 @@
/// As such the return value should be checked (e.g. `is AbortConstant`)
/// before further use.
Constant _evaluateSubexpression(Expression node) {
+ if (node is ConstantExpression) {
+ if (node.constant is! UnevaluatedConstant) {
+ // ConstantExpressions just pointing to an actual constant can be
+ // short-circuited. Note that it's accepted instead of just returned to
+ // get canonicalization.
+ return node.accept(this);
+ }
+ } else if (node is BasicLiteral) {
+ // Basic literals (string literals, int literals, double literals,
+ // bool literals and null literals) can be short-circuited too.
+ return node.accept(this);
+ }
+
bool wasUnevaluated = seenUnevaluatedChild;
seenUnevaluatedChild = false;
Constant result;
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index c0d4818..f7492b8 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -477,12 +477,6 @@
} else {
loader.registerStrongOptOutLibrary(this);
}
- _languageVersion = new InvalidLanguageVersion(
- fileUri,
- _languageVersion.charOffset,
- _languageVersion.charCount,
- _languageVersion.isExplicit,
- loader.target.currentSdkVersion);
}
}
_languageVersion.isFinal = true;
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
index 2464c9a..133297c 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
@@ -296,105 +296,6 @@
return type == coreTypes.nullType;
}
- /// Computes [type] as if declared without nullability markers.
- ///
- /// The algorithm implemented by [_isNullabilityAwareSubtypeMatch] uses the
- /// notion of the nullable and the legacy type constructors, that is, int? and
- /// int* are applications of the nullable and the legacy type constructors to
- /// type int correspondingly. The algorithm requires the ability to peel off
- /// the two type constructors from the underlying types, which is done by
- /// [_computeRawType].
- DartType _computeRawType(DartType type) {
- if (type is TypeParameterType) {
- if (type.promotedBound == null) {
- // The default nullability for library is used when there are no
- // nullability markers on the type.
- return new TypeParameterType.withDefaultNullabilityForLibrary(
- type.parameter, _currentLibrary);
- } else {
- // Intersection types can't be arguments to the nullable and the legacy
- // type constructors, so nothing can be peeled off.
- return type;
- }
- } else if (type == coreTypes.nullType) {
- return type;
- } else {
- // For most types, peeling off the nullability constructors means that
- // they become non-nullable.
- return type.withDeclaredNullability(Nullability.nonNullable);
- }
- }
-
- /// Returns true if [type] is declared without nullability markers.
- ///
- /// The algorithm implemented by [_isNullabilityAwareSubtypeMatch] uses the
- /// notion of the nullable and the legacy type constructors, that is, int? and
- /// int* are applications of the nullable and the legacy type constructors to
- /// type int correspondingly. The algorithm requires the ability to detect if
- /// a type is raw, that is, if it is declared without any of the two
- /// constructors. Method [_isRawTypeParameterType] implements that check for
- /// [TypeParameterType]s. For most types, comparing their
- /// [DartType.declaredNullability] is enough, but the case of
- /// [TypeParameterType]s is more complex for two reasons: (1) intersection
- /// types are encoded as [TypeParameterType]s, and they can't be arguments of
- /// the nullability constructors, and (2) if a [TypeParameterType] is declared
- /// raw, its semantic nullability can be anything from
- /// [Nullability.nonNullable], [Nullability.undetermined], and
- /// [Nullability.legacy], depending on the bound. [_isRawTypeParameterType]
- /// checks if [type] has the same nullability as if it was declared without
- /// any nullability markers by the programmer.
- bool _isRawTypeParameterType(TypeParameterType type) {
- // The default nullability for library is used when there are no nullability
- // markers on the type.
- return type.promotedBound == null &&
- type.declaredNullability ==
- new TypeParameterType.withDefaultNullabilityForLibrary(
- type.parameter, _currentLibrary)
- .declaredNullability;
- }
-
- /// Returns true if [type] is an application of the nullable type constructor.
- ///
- /// The algorithm implemented by [_isNullabilityAwareSubtypeMatch] uses the
- /// notion of the nullable type constructor, that is, int? is an application
- /// of the nullable type constructor to type int. The algorithm requires the
- /// ability to detect if a type is an application of the nullable constructor
- /// to another type, which is done by [_isNullableTypeConstructorApplication].
- bool _isNullableTypeConstructorApplication(DartType type) {
- return type.declaredNullability == Nullability.nullable &&
- type is! DynamicType &&
- type is! VoidType &&
- type != coreTypes.nullType;
- }
-
- /// Returns true if [type] is an application of the legacy type constructor.
- ///
- /// The algorithm implemented by [_isNullabilityAwareSubtypeMatch] uses the
- /// notion of the legacy type constructor, that is, int* is an application of
- /// the legacy type constructor to type int. The algorithm requires the
- /// ability to detect if a type is an application of the nullable constructor
- /// to another type, which is done by [_isNullableTypeConstructorApplication].
- bool _isLegacyTypeConstructorApplication(DartType type) {
- if (type is TypeParameterType) {
- if (type.promotedBound == null) {
- // The legacy nullability is considered an application of the legacy
- // nullability constructor if it doesn't match the default nullability
- // of the type-parameter type for the library.
- return type.declaredNullability == Nullability.legacy &&
- type.declaredNullability !=
- new TypeParameterType.withDefaultNullabilityForLibrary(
- type.parameter, _currentLibrary)
- .declaredNullability;
- } else {
- return false;
- }
- } else if (type is InvalidType) {
- return false;
- } else {
- return type.declaredNullability == Nullability.legacy;
- }
- }
-
/// Matches [p] against [q] as a subtype against supertype.
///
/// Returns true if [p] is a subtype of [q] under some constraints, and false
@@ -473,7 +374,7 @@
//
// Under constraint _ <: X <: Q.
if (p is TypeParameterType &&
- _isRawTypeParameterType(p) &&
+ isTypeParameterTypeWithoutNullabilityMarker(p, _currentLibrary) &&
_parametersToConstrain.contains(p.parameter)) {
_constrainParameterUpper(p.parameter, q);
return true;
@@ -483,7 +384,7 @@
//
// Under constraint P <: X <: _.
if (q is TypeParameterType &&
- _isRawTypeParameterType(q) &&
+ isTypeParameterTypeWithoutNullabilityMarker(q, _currentLibrary) &&
_parametersToConstrain.contains(q.parameter)) {
_constrainParameterLower(q.parameter, p);
return true;
@@ -502,8 +403,11 @@
// If P is a legacy type P0* then the match holds under constraint set C:
//
// Only if P0 is a subtype match for Q under constraint set C.
- if (_isLegacyTypeConstructorApplication(p)) {
- return _isNullabilityAwareSubtypeMatch(_computeRawType(p), q,
+ if (isLegacyTypeConstructorApplication(p, _currentLibrary)) {
+ return _isNullabilityAwareSubtypeMatch(
+ computeTypeWithoutNullabilityMarker(p, _currentLibrary,
+ nullType: coreTypes.nullType),
+ q,
constrainSupertype: constrainSupertype);
}
@@ -513,11 +417,14 @@
// set C.
// Or if P is not dynamic or void and P is a subtype match for Q0? under
// constraint set C.
- if (_isLegacyTypeConstructorApplication(q)) {
+ if (isLegacyTypeConstructorApplication(q, _currentLibrary)) {
final int baseConstraintCount = _protoConstraints.length;
if ((p is DynamicType || p is VoidType) &&
- _isNullabilityAwareSubtypeMatch(p, _computeRawType(q),
+ _isNullabilityAwareSubtypeMatch(
+ p,
+ computeTypeWithoutNullabilityMarker(q, _currentLibrary,
+ nullType: coreTypes.nullType),
constrainSupertype: constrainSupertype)) {
return true;
}
@@ -580,12 +487,17 @@
// Or if P is a subtype match for Q0 under non-empty constraint set C.
// Or if P is a subtype match for Null under constraint set C.
// Or if P is a subtype match for Q0 under empty constraint set C.
- if (_isNullableTypeConstructorApplication(q)) {
+ if (isNullableTypeConstructorApplication(q, nullType: coreTypes.nullType)) {
final int baseConstraintCount = _protoConstraints.length;
- final DartType rawP = _computeRawType(p);
- final DartType rawQ = _computeRawType(q);
+ final DartType rawP = computeTypeWithoutNullabilityMarker(
+ p, _currentLibrary,
+ nullType: coreTypes.nullType);
+ final DartType rawQ = computeTypeWithoutNullabilityMarker(
+ q, _currentLibrary,
+ nullType: coreTypes.nullType);
- if (_isNullableTypeConstructorApplication(p) &&
+ if (isNullableTypeConstructorApplication(p,
+ nullType: coreTypes.nullType) &&
_isNullabilityAwareSubtypeMatch(rawP, rawQ,
constrainSupertype: constrainSupertype)) {
return true;
@@ -641,9 +553,12 @@
//
// If P0 is a subtype match for Q under constraint set C1.
// And if Null is a subtype match for Q under constraint set C2.
- if (_isNullableTypeConstructorApplication(p)) {
+ if (isNullableTypeConstructorApplication(p, nullType: coreTypes.nullType)) {
final int baseConstraintCount = _protoConstraints.length;
- if (_isNullabilityAwareSubtypeMatch(_computeRawType(p), q,
+ if (_isNullabilityAwareSubtypeMatch(
+ computeTypeWithoutNullabilityMarker(p, _currentLibrary,
+ nullType: coreTypes.nullType),
+ q,
constrainSupertype: constrainSupertype) &&
_isNullabilityAwareSubtypeMatch(coreTypes.nullType, q,
constrainSupertype: constrainSupertype)) {
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index 16c406d..cd83c1b 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -165,6 +165,7 @@
checkpoint
chunks
ci
+circuited
ck
cl
claim
diff --git a/pkg/front_end/test/spell_checking_list_common.txt b/pkg/front_end/test/spell_checking_list_common.txt
index 267154d..267dd7a 100644
--- a/pkg/front_end/test/spell_checking_list_common.txt
+++ b/pkg/front_end/test/spell_checking_list_common.txt
@@ -1069,6 +1069,7 @@
executes
executing
execution
+exempt
exercise
exhaustive
exist
@@ -2130,6 +2131,7 @@
peel
peeled
peeling
+peels
pending
percent
percolate
diff --git a/pkg/front_end/testcases/general/main_declaration.dart b/pkg/front_end/testcases/general/main_declaration.dart
new file mode 100644
index 0000000..e4df1b0
--- /dev/null
+++ b/pkg/front_end/testcases/general/main_declaration.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'main_declaration_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/general/main_declaration.dart.outline.expect b/pkg/front_end/testcases/general/main_declaration.dart.outline.expect
new file mode 100644
index 0000000..600a236
--- /dev/null
+++ b/pkg/front_end/testcases/general/main_declaration.dart.outline.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///main_declaration_lib.dart";
+
+static method main() → dynamic
+ ;
+
+library;
+import self as self2;
+import "dart:core" as core;
+
+static method main(core::String* args) → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/main_declaration.dart.strong.expect b/pkg/front_end/testcases/general/main_declaration.dart.strong.expect
new file mode 100644
index 0000000..58118e1
--- /dev/null
+++ b/pkg/front_end/testcases/general/main_declaration.dart.strong.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///main_declaration_lib.dart";
+
+static method main() → dynamic {}
+
+library;
+import self as self2;
+import "dart:core" as core;
+
+static method main(core::String* args) → dynamic {}
diff --git a/pkg/front_end/testcases/general/main_declaration.dart.strong.transformed.expect b/pkg/front_end/testcases/general/main_declaration.dart.strong.transformed.expect
new file mode 100644
index 0000000..58118e1
--- /dev/null
+++ b/pkg/front_end/testcases/general/main_declaration.dart.strong.transformed.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///main_declaration_lib.dart";
+
+static method main() → dynamic {}
+
+library;
+import self as self2;
+import "dart:core" as core;
+
+static method main(core::String* args) → dynamic {}
diff --git a/pkg/front_end/testcases/general/main_declaration.dart.textual_outline.expect b/pkg/front_end/testcases/general/main_declaration.dart.textual_outline.expect
new file mode 100644
index 0000000..5ab8783
--- /dev/null
+++ b/pkg/front_end/testcases/general/main_declaration.dart.textual_outline.expect
@@ -0,0 +1,3 @@
+import 'main_declaration_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/general/main_declaration.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/main_declaration.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..5ab8783
--- /dev/null
+++ b/pkg/front_end/testcases/general/main_declaration.dart.textual_outline_modelled.expect
@@ -0,0 +1,3 @@
+import 'main_declaration_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/general/main_declaration_lib.dart b/pkg/front_end/testcases/general/main_declaration_lib.dart
new file mode 100644
index 0000000..f0d8fb7
--- /dev/null
+++ b/pkg/front_end/testcases/general/main_declaration_lib.dart
@@ -0,0 +1,6 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This would be an invalid main declaration in a null safe library.
+main(String args) {}
diff --git a/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.outline.expect b/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.outline.expect
index 7ddeb49..db00c38 100644
--- a/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.outline.expect
+++ b/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.outline.expect
@@ -34,7 +34,7 @@
static method throws(() → dynamic f, core::String message) → dynamic
;
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -45,5 +45,5 @@
import self as self2;
import "dart:core" as core;
-static method computeInitialValue() → core::int
+static method computeInitialValue() → core::int*
;
diff --git a/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.expect b/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.expect
index 2a73d8e..cc020ed 100644
--- a/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.expect
+++ b/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.expect
@@ -21,7 +21,7 @@
: super core::Object::•()
;
static get nonNullableStaticField() → core::int
- return let final core::int? #t1 = self::Class::_#nonNullableStaticField in #t1.==(null) ?{core::int} let final core::int #t2 = (let final core::int #t3 = self::Class::nonNullableStaticFieldReads in let final core::int #t4 = self::Class::nonNullableStaticFieldReads = #t3.{core::num::+}(1) in #t3).{core::num::==}(0) ?{core::int} self::Class::nonNullableStaticField : ini::computeInitialValue() in self::Class::_#nonNullableStaticField.==(null) ?{core::int} self::Class::_#nonNullableStaticField = #t2 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableStaticField' has been assigned during initialization.") : #t1{core::int};
+ return let final core::int? #t1 = self::Class::_#nonNullableStaticField in #t1.==(null) ?{core::int} let final core::int #t2 = (let final core::int #t3 = self::Class::nonNullableStaticFieldReads in let final core::int #t4 = self::Class::nonNullableStaticFieldReads = #t3.{core::num::+}(1) in #t3).{core::num::==}(0) ?{core::int*} self::Class::nonNullableStaticField : ini::computeInitialValue() in self::Class::_#nonNullableStaticField.==(null) ?{core::int} self::Class::_#nonNullableStaticField = #t2 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableStaticField' has been assigned during initialization.") : #t1{core::int};
static get nullableStaticField() → core::int? {
if(!self::Class::_#nullableStaticField#isSet) {
final core::int? #t5 = (let final core::int #t6 = self::Class::nullableStaticFieldReads in let final core::int #t7 = self::Class::nullableStaticFieldReads = #t6.{core::num::+}(1) in #t6).{core::num::==}(0) ?{core::int?} self::Class::nullableStaticField : ini::computeInitialValue();
@@ -33,7 +33,7 @@
return self::Class::_#nullableStaticField;
}
get nonNullableInstanceField() → core::int
- return let final core::int? #t8 = this.{self::Class::_#Class#nonNullableInstanceField} in #t8.==(null) ?{core::int} let final core::int #t9 = (let final core::int #t10 = this.{self::Class::nonNullableInstanceFieldReads} in let final core::int #t11 = this.{self::Class::nonNullableInstanceFieldReads} = #t10.{core::num::+}(1) in #t10).{core::num::==}(0) ?{core::int} this.{self::Class::nonNullableInstanceField} : ini::computeInitialValue() in this.{self::Class::_#Class#nonNullableInstanceField}.==(null) ?{core::int} this.{self::Class::_#Class#nonNullableInstanceField} = #t9 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableInstanceField' has been assigned during initialization.") : #t8{core::int};
+ return let final core::int? #t8 = this.{self::Class::_#Class#nonNullableInstanceField} in #t8.==(null) ?{core::int} let final core::int #t9 = (let final core::int #t10 = this.{self::Class::nonNullableInstanceFieldReads} in let final core::int #t11 = this.{self::Class::nonNullableInstanceFieldReads} = #t10.{core::num::+}(1) in #t10).{core::num::==}(0) ?{core::int*} this.{self::Class::nonNullableInstanceField} : ini::computeInitialValue() in this.{self::Class::_#Class#nonNullableInstanceField}.==(null) ?{core::int} this.{self::Class::_#Class#nonNullableInstanceField} = #t9 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableInstanceField' has been assigned during initialization.") : #t8{core::int};
get nullableInstanceField() → core::int? {
if(!this.{self::Class::_#Class#nullableInstanceField#isSet}) {
final core::int? #t12 = (let final core::int #t13 = this.{self::Class::nullableInstanceFieldReads} in let final core::int #t14 = this.{self::Class::nullableInstanceFieldReads} = #t13.{core::num::+}(1) in #t13).{core::num::==}(0) ?{core::int?} this.{self::Class::nullableInstanceField} : ini::computeInitialValue();
@@ -51,7 +51,7 @@
static field core::int? _#nullableTopLevelField = null;
static field core::bool _#nullableTopLevelField#isSet = false;
static get nonNullableTopLevelField() → core::int
- return let final core::int? #t15 = self::_#nonNullableTopLevelField in #t15.==(null) ?{core::int} let final core::int #t16 = (let final core::int #t17 = self::nonNullableTopLevelFieldReads in let final core::int #t18 = self::nonNullableTopLevelFieldReads = #t17.{core::num::+}(1) in #t17).{core::num::==}(0) ?{core::int} self::nonNullableTopLevelField : ini::computeInitialValue() in self::_#nonNullableTopLevelField.==(null) ?{core::int} self::_#nonNullableTopLevelField = #t16 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableTopLevelField' has been assigned during initialization.") : #t15{core::int};
+ return let final core::int? #t15 = self::_#nonNullableTopLevelField in #t15.==(null) ?{core::int} let final core::int #t16 = (let final core::int #t17 = self::nonNullableTopLevelFieldReads in let final core::int #t18 = self::nonNullableTopLevelFieldReads = #t17.{core::num::+}(1) in #t17).{core::num::==}(0) ?{core::int*} self::nonNullableTopLevelField : ini::computeInitialValue() in self::_#nonNullableTopLevelField.==(null) ?{core::int} self::_#nonNullableTopLevelField = #t16 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableTopLevelField' has been assigned during initialization.") : #t15{core::int};
static get nullableTopLevelField() → core::int? {
if(!self::_#nullableTopLevelField#isSet) {
final core::int? #t19 = (let final core::int #t20 = self::nullableTopLevelFieldReads in let final core::int #t21 = self::nullableTopLevelFieldReads = #t20.{core::num::+}(1) in #t20).{core::num::==}(0) ?{core::int?} self::nullableTopLevelField : ini::computeInitialValue();
@@ -82,7 +82,7 @@
throw "${message}: ${value}";
}
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -90,14 +90,8 @@
// // @dart=2.8
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out_lib.dart:7:30: Error: A value of type 'Null' can't be returned from a function with return type 'int'.
-// int computeInitialValue() => null;
-// ^
-//
import self as ini;
import "dart:core" as core;
-static method computeInitialValue() → core::int
- return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out_lib.dart:7:30: Error: A value of type 'Null' can't be returned from a function with return type 'int'.
-int computeInitialValue() => null;
- ^" in null as{TypeError,ForNonNullableByDefault} core::int;
+static method computeInitialValue() → core::int*
+ return null;
diff --git a/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.transformed.expect b/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.transformed.expect
index 9c70f2f..cc020ed 100644
--- a/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out.dart.strong.transformed.expect
@@ -21,7 +21,7 @@
: super core::Object::•()
;
static get nonNullableStaticField() → core::int
- return let final core::int? #t1 = self::Class::_#nonNullableStaticField in #t1.==(null) ?{core::int} let final core::int #t2 = (let final core::int #t3 = self::Class::nonNullableStaticFieldReads in let final core::int #t4 = self::Class::nonNullableStaticFieldReads = #t3.{core::num::+}(1) in #t3).{core::num::==}(0) ?{core::int} self::Class::nonNullableStaticField : ini::computeInitialValue() in self::Class::_#nonNullableStaticField.==(null) ?{core::int} self::Class::_#nonNullableStaticField = #t2 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableStaticField' has been assigned during initialization.") : #t1{core::int};
+ return let final core::int? #t1 = self::Class::_#nonNullableStaticField in #t1.==(null) ?{core::int} let final core::int #t2 = (let final core::int #t3 = self::Class::nonNullableStaticFieldReads in let final core::int #t4 = self::Class::nonNullableStaticFieldReads = #t3.{core::num::+}(1) in #t3).{core::num::==}(0) ?{core::int*} self::Class::nonNullableStaticField : ini::computeInitialValue() in self::Class::_#nonNullableStaticField.==(null) ?{core::int} self::Class::_#nonNullableStaticField = #t2 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableStaticField' has been assigned during initialization.") : #t1{core::int};
static get nullableStaticField() → core::int? {
if(!self::Class::_#nullableStaticField#isSet) {
final core::int? #t5 = (let final core::int #t6 = self::Class::nullableStaticFieldReads in let final core::int #t7 = self::Class::nullableStaticFieldReads = #t6.{core::num::+}(1) in #t6).{core::num::==}(0) ?{core::int?} self::Class::nullableStaticField : ini::computeInitialValue();
@@ -33,7 +33,7 @@
return self::Class::_#nullableStaticField;
}
get nonNullableInstanceField() → core::int
- return let final core::int? #t8 = this.{self::Class::_#Class#nonNullableInstanceField} in #t8.==(null) ?{core::int} let final core::int #t9 = (let final core::int #t10 = this.{self::Class::nonNullableInstanceFieldReads} in let final core::int #t11 = this.{self::Class::nonNullableInstanceFieldReads} = #t10.{core::num::+}(1) in #t10).{core::num::==}(0) ?{core::int} this.{self::Class::nonNullableInstanceField} : ini::computeInitialValue() in this.{self::Class::_#Class#nonNullableInstanceField}.==(null) ?{core::int} this.{self::Class::_#Class#nonNullableInstanceField} = #t9 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableInstanceField' has been assigned during initialization.") : #t8{core::int};
+ return let final core::int? #t8 = this.{self::Class::_#Class#nonNullableInstanceField} in #t8.==(null) ?{core::int} let final core::int #t9 = (let final core::int #t10 = this.{self::Class::nonNullableInstanceFieldReads} in let final core::int #t11 = this.{self::Class::nonNullableInstanceFieldReads} = #t10.{core::num::+}(1) in #t10).{core::num::==}(0) ?{core::int*} this.{self::Class::nonNullableInstanceField} : ini::computeInitialValue() in this.{self::Class::_#Class#nonNullableInstanceField}.==(null) ?{core::int} this.{self::Class::_#Class#nonNullableInstanceField} = #t9 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableInstanceField' has been assigned during initialization.") : #t8{core::int};
get nullableInstanceField() → core::int? {
if(!this.{self::Class::_#Class#nullableInstanceField#isSet}) {
final core::int? #t12 = (let final core::int #t13 = this.{self::Class::nullableInstanceFieldReads} in let final core::int #t14 = this.{self::Class::nullableInstanceFieldReads} = #t13.{core::num::+}(1) in #t13).{core::num::==}(0) ?{core::int?} this.{self::Class::nullableInstanceField} : ini::computeInitialValue();
@@ -51,7 +51,7 @@
static field core::int? _#nullableTopLevelField = null;
static field core::bool _#nullableTopLevelField#isSet = false;
static get nonNullableTopLevelField() → core::int
- return let final core::int? #t15 = self::_#nonNullableTopLevelField in #t15.==(null) ?{core::int} let final core::int #t16 = (let final core::int #t17 = self::nonNullableTopLevelFieldReads in let final core::int #t18 = self::nonNullableTopLevelFieldReads = #t17.{core::num::+}(1) in #t17).{core::num::==}(0) ?{core::int} self::nonNullableTopLevelField : ini::computeInitialValue() in self::_#nonNullableTopLevelField.==(null) ?{core::int} self::_#nonNullableTopLevelField = #t16 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableTopLevelField' has been assigned during initialization.") : #t15{core::int};
+ return let final core::int? #t15 = self::_#nonNullableTopLevelField in #t15.==(null) ?{core::int} let final core::int #t16 = (let final core::int #t17 = self::nonNullableTopLevelFieldReads in let final core::int #t18 = self::nonNullableTopLevelFieldReads = #t17.{core::num::+}(1) in #t17).{core::num::==}(0) ?{core::int*} self::nonNullableTopLevelField : ini::computeInitialValue() in self::_#nonNullableTopLevelField.==(null) ?{core::int} self::_#nonNullableTopLevelField = #t16 : throw new _in::LateInitializationErrorImpl::•("Field 'nonNullableTopLevelField' has been assigned during initialization.") : #t15{core::int};
static get nullableTopLevelField() → core::int? {
if(!self::_#nullableTopLevelField#isSet) {
final core::int? #t19 = (let final core::int #t20 = self::nullableTopLevelFieldReads in let final core::int #t21 = self::nullableTopLevelFieldReads = #t20.{core::num::+}(1) in #t20).{core::num::==}(0) ?{core::int?} self::nullableTopLevelField : ini::computeInitialValue();
@@ -82,7 +82,7 @@
throw "${message}: ${value}";
}
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -90,21 +90,8 @@
// // @dart=2.8
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out_lib.dart:7:30: Error: A value of type 'Null' can't be returned from a function with return type 'int'.
-// int computeInitialValue() => null;
-// ^
-//
import self as ini;
import "dart:core" as core;
-static method computeInitialValue() → core::int
- return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/late_lowering/initializer_rewrite_from_opt_out_lib.dart:7:30: Error: A value of type 'Null' can't be returned from a function with return type 'int'.
-int computeInitialValue() => null;
- ^" in let core::Null? #t23 = null in #t23.==(null) ?{core::int} #t23 as{TypeError,ForNonNullableByDefault} core::int : #t23{core::int};
-
-
-Extra constant evaluation status:
-Evaluated: MethodInvocation @ org-dartlang-testcase:///initializer_rewrite_from_opt_out_lib.dart:7:30 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///initializer_rewrite_from_opt_out_lib.dart:7:30 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///initializer_rewrite_from_opt_out_lib.dart:7:30 -> NullConstant(null)
-Extra constant evaluation: evaluated: 185, effectively constant: 3
+static method computeInitialValue() → core::int*
+ return null;
diff --git a/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.outline.expect b/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.outline.expect
index edaef86..8fc95bd 100644
--- a/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.outline.expect
+++ b/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.outline.expect
@@ -1,4 +1,4 @@
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
diff --git a/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.expect b/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.expect
index 3e34630..6ffbd4b 100644
--- a/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.expect
+++ b/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.expect
@@ -1,4 +1,4 @@
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -6,43 +6,6 @@
// // @dart=2.8
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:10:19: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// topLevelField = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:14:21: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// c.instanceField = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:16:28: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// c.instanceTypeVariable = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:17:33: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// c.finalInstanceTypeVariable = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:19:23: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// Class.staticField = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:33:46: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// throws(() => c.finalInstanceTypeVariable = null);
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:36:16: Error: The argument type 'Null' can't be assigned to the parameter type 'int'.
-// method(true, null, null);
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:36:3: Error: Inferred type argument 'Null' doesn't conform to the bound 'Object' of the type variable 'T' on 'method'.
-// - 'Object' is from 'dart:core'.
-// Try specifying type arguments explicitly so that they conform to the bounds.
-// method(true, null, null);
-// ^
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out_lib.dart:18:8: Context: This is the type variable whose bound isn't conformed to.
-// method<T extends Object>(bool b, int i, T t) {
-// ^
-//
import self as self;
import "non_nullable_from_opt_out_lib.dart" as non;
import "dart:core" as core;
@@ -50,24 +13,14 @@
import "org-dartlang-testcase:///non_nullable_from_opt_out_lib.dart";
static method main() → dynamic {
- non::topLevelField = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:10:19: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- topLevelField = null;
- ^" in null as{TypeError,ForNonNullableByDefault} core::int;
+ non::topLevelField = null;
non::finalTopLevelField = null;
- non::Class<core::int> c = new non::Class::•<core::int>();
- c.{non::Class::instanceField} = let final<BottomType> #t2 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:14:21: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- c.instanceField = null;
- ^" in null as{TypeError,ForNonNullableByDefault} core::int;
+ non::Class<core::int*>* c = new non::Class::•<core::int*>();
+ c.{non::Class::instanceField} = null;
c.{non::Class::finalInstanceField} = null;
- c.{non::Class::instanceTypeVariable} = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:16:28: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- c.instanceTypeVariable = null;
- ^" in null as{TypeError,ForNonNullableByDefault} core::int;
- c.{non::Class::finalInstanceTypeVariable} = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:17:33: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- c.finalInstanceTypeVariable = null;
- ^" in null as{TypeError,ForNonNullableByDefault} core::int;
- non::Class::staticField = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:19:23: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- Class.staticField = null;
- ^" in null as{TypeError,ForNonNullableByDefault} core::int;
+ c.{non::Class::instanceTypeVariable} = null;
+ c.{non::Class::finalInstanceTypeVariable} = null;
+ non::Class::staticField = null;
non::Class::staticFinalField = null;
non::expect(null, non::topLevelField);
non::expect(null, non::finalTopLevelField);
@@ -79,13 +32,9 @@
non::expect(null, non::Class::staticFinalField);
non::throws(() → core::Null? => non::finalTopLevelField = null);
non::throws(() → core::Null? => c.{non::Class::finalInstanceField} = null);
- non::throws(() → core::Null? => c.{non::Class::finalInstanceTypeVariable} = let final<BottomType> #t6 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:33:46: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- throws(() => c.finalInstanceTypeVariable = null);
- ^" in null as{TypeError,ForNonNullableByDefault} core::int);
+ non::throws(() → core::Null? => c.{non::Class::finalInstanceTypeVariable} = null);
non::throws(() → core::Null? => non::Class::staticFinalField = null);
- non::method<core::Null?>(true, let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:36:16: Error: The argument type 'Null' can't be assigned to the parameter type 'int'.
- method(true, null, null);
- ^" in null as{TypeError,ForNonNullableByDefault} core::int, null);
+ non::method<core::Null?>(true, null, null);
}
library /*isNonNullableByDefault*/;
@@ -106,87 +55,87 @@
: super core::Object::•()
;
get instanceField() → core::int
- return let final core::int? #t8 = this.{non::Class::_#Class#instanceField} in #t8.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'instanceField' has not been initialized.") : #t8{core::int};
- set instanceField(core::int #t9) → void
- this.{non::Class::_#Class#instanceField} = #t9;
+ return let final core::int? #t1 = this.{non::Class::_#Class#instanceField} in #t1.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'instanceField' has not been initialized.") : #t1{core::int};
+ set instanceField(core::int #t2) → void
+ this.{non::Class::_#Class#instanceField} = #t2;
get finalInstanceField() → dynamic
return this.{non::Class::_#Class#finalInstanceField#isSet} ?{dynamic} this.{non::Class::_#Class#finalInstanceField} : throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceField' has not been initialized.");
- set finalInstanceField(dynamic #t10) → void
+ set finalInstanceField(dynamic #t3) → void
if(this.{non::Class::_#Class#finalInstanceField#isSet})
throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceField' has already been initialized.");
else {
this.{non::Class::_#Class#finalInstanceField#isSet} = true;
- this.{non::Class::_#Class#finalInstanceField} = #t10;
+ this.{non::Class::_#Class#finalInstanceField} = #t3;
}
get instanceTypeVariable() → non::Class::T
- return let final non::Class::T? #t11 = this.{non::Class::_#Class#instanceTypeVariable} in #t11.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'instanceTypeVariable' has not been initialized.") : #t11{non::Class::T};
- set instanceTypeVariable(generic-covariant-impl non::Class::T #t12) → void
- this.{non::Class::_#Class#instanceTypeVariable} = #t12;
+ return let final non::Class::T? #t4 = this.{non::Class::_#Class#instanceTypeVariable} in #t4.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'instanceTypeVariable' has not been initialized.") : #t4{non::Class::T};
+ set instanceTypeVariable(generic-covariant-impl non::Class::T #t5) → void
+ this.{non::Class::_#Class#instanceTypeVariable} = #t5;
get finalInstanceTypeVariable() → non::Class::T
- return let final non::Class::T? #t13 = this.{non::Class::_#Class#finalInstanceTypeVariable} in #t13.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceTypeVariable' has not been initialized.") : #t13{non::Class::T};
- set finalInstanceTypeVariable(non::Class::T #t14) → void
+ return let final non::Class::T? #t6 = this.{non::Class::_#Class#finalInstanceTypeVariable} in #t6.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceTypeVariable' has not been initialized.") : #t6{non::Class::T};
+ set finalInstanceTypeVariable(non::Class::T #t7) → void
if(this.{non::Class::_#Class#finalInstanceTypeVariable}.==(null))
- this.{non::Class::_#Class#finalInstanceTypeVariable} = #t14;
+ this.{non::Class::_#Class#finalInstanceTypeVariable} = #t7;
else
throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceTypeVariable' has already been initialized.");
static get staticField() → core::int
- return let final core::int? #t15 = non::Class::_#staticField in #t15.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'staticField' has not been initialized.") : #t15{core::int};
- static set staticField(core::int #t16) → void
- non::Class::_#staticField = #t16;
+ return let final core::int? #t8 = non::Class::_#staticField in #t8.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'staticField' has not been initialized.") : #t8{core::int};
+ static set staticField(core::int #t9) → void
+ non::Class::_#staticField = #t9;
static get staticFinalField() → dynamic
return non::Class::_#staticFinalField#isSet ?{dynamic} non::Class::_#staticFinalField : throw new _in::LateInitializationErrorImpl::•("Field 'staticFinalField' has not been initialized.");
- static set staticFinalField(dynamic #t17) → void
+ static set staticFinalField(dynamic #t10) → void
if(non::Class::_#staticFinalField#isSet)
throw new _in::LateInitializationErrorImpl::•("Field 'staticFinalField' has already been initialized.");
else {
non::Class::_#staticFinalField#isSet = true;
- non::Class::_#staticFinalField = #t17;
+ non::Class::_#staticFinalField = #t10;
}
}
static field core::int? _#topLevelField = null;
static field dynamic _#finalTopLevelField = null;
static field core::bool _#finalTopLevelField#isSet = false;
static get topLevelField() → core::int
- return let final core::int? #t18 = non::_#topLevelField in #t18.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'topLevelField' has not been initialized.") : #t18{core::int};
-static set topLevelField(core::int #t19) → void
- non::_#topLevelField = #t19;
+ return let final core::int? #t11 = non::_#topLevelField in #t11.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'topLevelField' has not been initialized.") : #t11{core::int};
+static set topLevelField(core::int #t12) → void
+ non::_#topLevelField = #t12;
static get finalTopLevelField() → dynamic
return non::_#finalTopLevelField#isSet ?{dynamic} non::_#finalTopLevelField : throw new _in::LateInitializationErrorImpl::•("Field 'finalTopLevelField' has not been initialized.");
-static set finalTopLevelField(dynamic #t20) → void
+static set finalTopLevelField(dynamic #t13) → void
if(non::_#finalTopLevelField#isSet)
throw new _in::LateInitializationErrorImpl::•("Field 'finalTopLevelField' has already been initialized.");
else {
non::_#finalTopLevelField#isSet = true;
- non::_#finalTopLevelField = #t20;
+ non::_#finalTopLevelField = #t13;
}
static method method<T extends core::Object = core::Object>(core::bool b, core::int i, non::method::T t) → dynamic {
core::int? local;
function #local#get() → core::int
- return let final core::int? #t21 = local in #t21.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Local 'local' has not been initialized.") : #t21{core::int};
- function #local#set(core::int #t22) → dynamic
- return local = #t22;
+ return let final core::int? #t14 = local in #t14.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Local 'local' has not been initialized.") : #t14{core::int};
+ function #local#set(core::int #t15) → dynamic
+ return local = #t15;
final dynamic finalLocal;
core::bool #finalLocal#isSet = false;
function #finalLocal#get() → dynamic
return #finalLocal#isSet ?{dynamic} finalLocal : throw new _in::LateInitializationErrorImpl::•("Local 'finalLocal' has not been initialized.");
- function #finalLocal#set(dynamic #t23) → dynamic
+ function #finalLocal#set(dynamic #t16) → dynamic
if(#finalLocal#isSet)
throw new _in::LateInitializationErrorImpl::•("Local 'finalLocal' has already been initialized.");
else {
#finalLocal#isSet = true;
- return finalLocal = #t23;
+ return finalLocal = #t16;
}
non::method::T? localTypeVariable;
function #localTypeVariable#get() → non::method::T
- return let final non::method::T? #t24 = localTypeVariable in #t24.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'localTypeVariable' has not been initialized.") : #t24{non::method::T};
- function #localTypeVariable#set(non::method::T #t25) → dynamic
- return localTypeVariable = #t25;
+ return let final non::method::T? #t17 = localTypeVariable in #t17.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'localTypeVariable' has not been initialized.") : #t17{non::method::T};
+ function #localTypeVariable#set(non::method::T #t18) → dynamic
+ return localTypeVariable = #t18;
final non::method::T? finalLocalTypeVariable;
function #finalLocalTypeVariable#get() → non::method::T
- return let final non::method::T? #t26 = finalLocalTypeVariable in #t26.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'finalLocalTypeVariable' has not been initialized.") : #t26{non::method::T};
- function #finalLocalTypeVariable#set(non::method::T #t27) → dynamic
+ return let final non::method::T? #t19 = finalLocalTypeVariable in #t19.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'finalLocalTypeVariable' has not been initialized.") : #t19{non::method::T};
+ function #finalLocalTypeVariable#set(non::method::T #t20) → dynamic
if(finalLocalTypeVariable.==(null))
- return finalLocalTypeVariable = #t27;
+ return finalLocalTypeVariable = #t20;
else
throw new _in::LateInitializationErrorImpl::•("Local 'finalLocalTypeVariable' has already been initialized.");
if(b) {
diff --git a/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.transformed.expect b/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.transformed.expect
index 0980864..6ffbd4b 100644
--- a/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart.strong.transformed.expect
@@ -1,4 +1,4 @@
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -6,43 +6,6 @@
// // @dart=2.8
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:10:19: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// topLevelField = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:14:21: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// c.instanceField = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:16:28: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// c.instanceTypeVariable = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:17:33: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// c.finalInstanceTypeVariable = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:19:23: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// Class.staticField = null;
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:33:46: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
-// throws(() => c.finalInstanceTypeVariable = null);
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:36:16: Error: The argument type 'Null' can't be assigned to the parameter type 'int'.
-// method(true, null, null);
-// ^
-//
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:36:3: Error: Inferred type argument 'Null' doesn't conform to the bound 'Object' of the type variable 'T' on 'method'.
-// - 'Object' is from 'dart:core'.
-// Try specifying type arguments explicitly so that they conform to the bounds.
-// method(true, null, null);
-// ^
-// pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out_lib.dart:18:8: Context: This is the type variable whose bound isn't conformed to.
-// method<T extends Object>(bool b, int i, T t) {
-// ^
-//
import self as self;
import "non_nullable_from_opt_out_lib.dart" as non;
import "dart:core" as core;
@@ -50,24 +13,14 @@
import "org-dartlang-testcase:///non_nullable_from_opt_out_lib.dart";
static method main() → dynamic {
- non::topLevelField = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:10:19: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- topLevelField = null;
- ^" in let core::Null? #t2 = null in #t2.==(null) ?{core::int} #t2 as{TypeError,ForNonNullableByDefault} core::int : #t2{core::int};
+ non::topLevelField = null;
non::finalTopLevelField = null;
- non::Class<core::int> c = new non::Class::•<core::int>();
- c.{non::Class::instanceField} = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:14:21: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- c.instanceField = null;
- ^" in let core::Null? #t4 = null in #t4.==(null) ?{core::int} #t4 as{TypeError,ForNonNullableByDefault} core::int : #t4{core::int};
+ non::Class<core::int*>* c = new non::Class::•<core::int*>();
+ c.{non::Class::instanceField} = null;
c.{non::Class::finalInstanceField} = null;
- c.{non::Class::instanceTypeVariable} = let final<BottomType> #t5 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:16:28: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- c.instanceTypeVariable = null;
- ^" in let core::Null? #t6 = null in #t6.==(null) ?{core::int} #t6 as{TypeError,ForNonNullableByDefault} core::int : #t6{core::int};
- c.{non::Class::finalInstanceTypeVariable} = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:17:33: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- c.finalInstanceTypeVariable = null;
- ^" in let core::Null? #t8 = null in #t8.==(null) ?{core::int} #t8 as{TypeError,ForNonNullableByDefault} core::int : #t8{core::int};
- non::Class::staticField = let final<BottomType> #t9 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:19:23: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- Class.staticField = null;
- ^" in let core::Null? #t10 = null in #t10.==(null) ?{core::int} #t10 as{TypeError,ForNonNullableByDefault} core::int : #t10{core::int};
+ c.{non::Class::instanceTypeVariable} = null;
+ c.{non::Class::finalInstanceTypeVariable} = null;
+ non::Class::staticField = null;
non::Class::staticFinalField = null;
non::expect(null, non::topLevelField);
non::expect(null, non::finalTopLevelField);
@@ -79,13 +32,9 @@
non::expect(null, non::Class::staticFinalField);
non::throws(() → core::Null? => non::finalTopLevelField = null);
non::throws(() → core::Null? => c.{non::Class::finalInstanceField} = null);
- non::throws(() → core::Null? => c.{non::Class::finalInstanceTypeVariable} = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:33:46: Error: A value of type 'Null' can't be assigned to a variable of type 'int'.
- throws(() => c.finalInstanceTypeVariable = null);
- ^" in let core::Null? #t12 = null in #t12.==(null) ?{core::int} #t12 as{TypeError,ForNonNullableByDefault} core::int : #t12{core::int});
+ non::throws(() → core::Null? => c.{non::Class::finalInstanceTypeVariable} = null);
non::throws(() → core::Null? => non::Class::staticFinalField = null);
- non::method<core::Null?>(true, let final<BottomType> #t13 = invalid-expression "pkg/front_end/testcases/late_lowering/non_nullable_from_opt_out.dart:36:16: Error: The argument type 'Null' can't be assigned to the parameter type 'int'.
- method(true, null, null);
- ^" in let core::Null? #t14 = null in #t14.==(null) ?{core::int} #t14 as{TypeError,ForNonNullableByDefault} core::int : #t14{core::int}, null);
+ non::method<core::Null?>(true, null, null);
}
library /*isNonNullableByDefault*/;
@@ -106,87 +55,87 @@
: super core::Object::•()
;
get instanceField() → core::int
- return let final core::int? #t15 = this.{non::Class::_#Class#instanceField} in #t15.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'instanceField' has not been initialized.") : #t15{core::int};
- set instanceField(core::int #t16) → void
- this.{non::Class::_#Class#instanceField} = #t16;
+ return let final core::int? #t1 = this.{non::Class::_#Class#instanceField} in #t1.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'instanceField' has not been initialized.") : #t1{core::int};
+ set instanceField(core::int #t2) → void
+ this.{non::Class::_#Class#instanceField} = #t2;
get finalInstanceField() → dynamic
return this.{non::Class::_#Class#finalInstanceField#isSet} ?{dynamic} this.{non::Class::_#Class#finalInstanceField} : throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceField' has not been initialized.");
- set finalInstanceField(dynamic #t17) → void
+ set finalInstanceField(dynamic #t3) → void
if(this.{non::Class::_#Class#finalInstanceField#isSet})
throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceField' has already been initialized.");
else {
this.{non::Class::_#Class#finalInstanceField#isSet} = true;
- this.{non::Class::_#Class#finalInstanceField} = #t17;
+ this.{non::Class::_#Class#finalInstanceField} = #t3;
}
get instanceTypeVariable() → non::Class::T
- return let final non::Class::T? #t18 = this.{non::Class::_#Class#instanceTypeVariable} in #t18.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'instanceTypeVariable' has not been initialized.") : #t18{non::Class::T};
- set instanceTypeVariable(generic-covariant-impl non::Class::T #t19) → void
- this.{non::Class::_#Class#instanceTypeVariable} = #t19;
+ return let final non::Class::T? #t4 = this.{non::Class::_#Class#instanceTypeVariable} in #t4.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'instanceTypeVariable' has not been initialized.") : #t4{non::Class::T};
+ set instanceTypeVariable(generic-covariant-impl non::Class::T #t5) → void
+ this.{non::Class::_#Class#instanceTypeVariable} = #t5;
get finalInstanceTypeVariable() → non::Class::T
- return let final non::Class::T? #t20 = this.{non::Class::_#Class#finalInstanceTypeVariable} in #t20.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceTypeVariable' has not been initialized.") : #t20{non::Class::T};
- set finalInstanceTypeVariable(non::Class::T #t21) → void
+ return let final non::Class::T? #t6 = this.{non::Class::_#Class#finalInstanceTypeVariable} in #t6.==(null) ?{non::Class::T} throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceTypeVariable' has not been initialized.") : #t6{non::Class::T};
+ set finalInstanceTypeVariable(non::Class::T #t7) → void
if(this.{non::Class::_#Class#finalInstanceTypeVariable}.==(null))
- this.{non::Class::_#Class#finalInstanceTypeVariable} = #t21;
+ this.{non::Class::_#Class#finalInstanceTypeVariable} = #t7;
else
throw new _in::LateInitializationErrorImpl::•("Field 'finalInstanceTypeVariable' has already been initialized.");
static get staticField() → core::int
- return let final core::int? #t22 = non::Class::_#staticField in #t22.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'staticField' has not been initialized.") : #t22{core::int};
- static set staticField(core::int #t23) → void
- non::Class::_#staticField = #t23;
+ return let final core::int? #t8 = non::Class::_#staticField in #t8.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'staticField' has not been initialized.") : #t8{core::int};
+ static set staticField(core::int #t9) → void
+ non::Class::_#staticField = #t9;
static get staticFinalField() → dynamic
return non::Class::_#staticFinalField#isSet ?{dynamic} non::Class::_#staticFinalField : throw new _in::LateInitializationErrorImpl::•("Field 'staticFinalField' has not been initialized.");
- static set staticFinalField(dynamic #t24) → void
+ static set staticFinalField(dynamic #t10) → void
if(non::Class::_#staticFinalField#isSet)
throw new _in::LateInitializationErrorImpl::•("Field 'staticFinalField' has already been initialized.");
else {
non::Class::_#staticFinalField#isSet = true;
- non::Class::_#staticFinalField = #t24;
+ non::Class::_#staticFinalField = #t10;
}
}
static field core::int? _#topLevelField = null;
static field dynamic _#finalTopLevelField = null;
static field core::bool _#finalTopLevelField#isSet = false;
static get topLevelField() → core::int
- return let final core::int? #t25 = non::_#topLevelField in #t25.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'topLevelField' has not been initialized.") : #t25{core::int};
-static set topLevelField(core::int #t26) → void
- non::_#topLevelField = #t26;
+ return let final core::int? #t11 = non::_#topLevelField in #t11.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Field 'topLevelField' has not been initialized.") : #t11{core::int};
+static set topLevelField(core::int #t12) → void
+ non::_#topLevelField = #t12;
static get finalTopLevelField() → dynamic
return non::_#finalTopLevelField#isSet ?{dynamic} non::_#finalTopLevelField : throw new _in::LateInitializationErrorImpl::•("Field 'finalTopLevelField' has not been initialized.");
-static set finalTopLevelField(dynamic #t27) → void
+static set finalTopLevelField(dynamic #t13) → void
if(non::_#finalTopLevelField#isSet)
throw new _in::LateInitializationErrorImpl::•("Field 'finalTopLevelField' has already been initialized.");
else {
non::_#finalTopLevelField#isSet = true;
- non::_#finalTopLevelField = #t27;
+ non::_#finalTopLevelField = #t13;
}
static method method<T extends core::Object = core::Object>(core::bool b, core::int i, non::method::T t) → dynamic {
core::int? local;
function #local#get() → core::int
- return let final core::int? #t28 = local in #t28.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Local 'local' has not been initialized.") : #t28{core::int};
- function #local#set(core::int #t29) → dynamic
- return local = #t29;
+ return let final core::int? #t14 = local in #t14.==(null) ?{core::int} throw new _in::LateInitializationErrorImpl::•("Local 'local' has not been initialized.") : #t14{core::int};
+ function #local#set(core::int #t15) → dynamic
+ return local = #t15;
final dynamic finalLocal;
core::bool #finalLocal#isSet = false;
function #finalLocal#get() → dynamic
return #finalLocal#isSet ?{dynamic} finalLocal : throw new _in::LateInitializationErrorImpl::•("Local 'finalLocal' has not been initialized.");
- function #finalLocal#set(dynamic #t30) → dynamic
+ function #finalLocal#set(dynamic #t16) → dynamic
if(#finalLocal#isSet)
throw new _in::LateInitializationErrorImpl::•("Local 'finalLocal' has already been initialized.");
else {
#finalLocal#isSet = true;
- return finalLocal = #t30;
+ return finalLocal = #t16;
}
non::method::T? localTypeVariable;
function #localTypeVariable#get() → non::method::T
- return let final non::method::T? #t31 = localTypeVariable in #t31.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'localTypeVariable' has not been initialized.") : #t31{non::method::T};
- function #localTypeVariable#set(non::method::T #t32) → dynamic
- return localTypeVariable = #t32;
+ return let final non::method::T? #t17 = localTypeVariable in #t17.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'localTypeVariable' has not been initialized.") : #t17{non::method::T};
+ function #localTypeVariable#set(non::method::T #t18) → dynamic
+ return localTypeVariable = #t18;
final non::method::T? finalLocalTypeVariable;
function #finalLocalTypeVariable#get() → non::method::T
- return let final non::method::T? #t33 = finalLocalTypeVariable in #t33.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'finalLocalTypeVariable' has not been initialized.") : #t33{non::method::T};
- function #finalLocalTypeVariable#set(non::method::T #t34) → dynamic
+ return let final non::method::T? #t19 = finalLocalTypeVariable in #t19.==(null) ?{non::method::T} throw new _in::LateInitializationErrorImpl::•("Local 'finalLocalTypeVariable' has not been initialized.") : #t19{non::method::T};
+ function #finalLocalTypeVariable#set(non::method::T #t20) → dynamic
if(finalLocalTypeVariable.==(null))
- return finalLocalTypeVariable = #t34;
+ return finalLocalTypeVariable = #t20;
else
throw new _in::LateInitializationErrorImpl::•("Local 'finalLocalTypeVariable' has already been initialized.");
if(b) {
@@ -215,28 +164,3 @@
}
throw "Missing exception";
}
-
-
-Extra constant evaluation status:
-Evaluated: MethodInvocation @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:10:19 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:10:19 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:10:19 -> NullConstant(null)
-Evaluated: MethodInvocation @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:14:21 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:14:21 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:14:21 -> NullConstant(null)
-Evaluated: MethodInvocation @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:16:28 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:16:28 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:16:28 -> NullConstant(null)
-Evaluated: MethodInvocation @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:17:33 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:17:33 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:17:33 -> NullConstant(null)
-Evaluated: MethodInvocation @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:19:23 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:19:23 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:19:23 -> NullConstant(null)
-Evaluated: MethodInvocation @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:33:46 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:33:46 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:33:46 -> NullConstant(null)
-Evaluated: MethodInvocation @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:36:16 -> BoolConstant(true)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:36:16 -> NullConstant(null)
-Evaluated: VariableGet @ org-dartlang-testcase:///non_nullable_from_opt_out.dart:36:16 -> NullConstant(null)
-Extra constant evaluation: evaluated: 291, effectively constant: 21
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart b/pkg/front_end/testcases/nnbd/issue43536.dart
new file mode 100644
index 0000000..ac26684
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class C<T> {
+ foo<E extends T>(List<E> list) {
+ List<E> variable = method(list);
+ }
+
+ List<F> method<F extends T>(List<F> list) => list;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart.outline.expect b/pkg/front_end/testcases/nnbd/issue43536.dart.outline.expect
new file mode 100644
index 0000000..15e7e74
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart.outline.expect
@@ -0,0 +1,14 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::C<self::C::T%>
+ ;
+ method foo<generic-covariant-impl E extends self::C::T% = self::C::T%>(core::List<self::C::foo::E%> list) → dynamic
+ ;
+ method method<generic-covariant-impl F extends self::C::T% = self::C::T%>(core::List<self::C::method::F%> list) → core::List<self::C::method::F%>
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart.strong.expect b/pkg/front_end/testcases/nnbd/issue43536.dart.strong.expect
new file mode 100644
index 0000000..e22d4b0
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart.strong.expect
@@ -0,0 +1,15 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::C<self::C::T%>
+ : super core::Object::•()
+ ;
+ method foo<generic-covariant-impl E extends self::C::T% = self::C::T%>(core::List<self::C::foo::E%> list) → dynamic {
+ core::List<self::C::foo::E%> variable = this.{self::C::method}<self::C::foo::E%>(list);
+ }
+ method method<generic-covariant-impl F extends self::C::T% = self::C::T%>(core::List<self::C::method::F%> list) → core::List<self::C::method::F%>
+ return list;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/issue43536.dart.strong.transformed.expect
new file mode 100644
index 0000000..e22d4b0
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::C<self::C::T%>
+ : super core::Object::•()
+ ;
+ method foo<generic-covariant-impl E extends self::C::T% = self::C::T%>(core::List<self::C::foo::E%> list) → dynamic {
+ core::List<self::C::foo::E%> variable = this.{self::C::method}<self::C::foo::E%>(list);
+ }
+ method method<generic-covariant-impl F extends self::C::T% = self::C::T%>(core::List<self::C::method::F%> list) → core::List<self::C::method::F%>
+ return list;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/issue43536.dart.textual_outline.expect
new file mode 100644
index 0000000..89b6571
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart.textual_outline.expect
@@ -0,0 +1,6 @@
+class C<T> {
+ foo<E extends T>(List<E> list) {}
+ List<F> method<F extends T>(List<F> list) => list;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/issue43536.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..2ba6b44
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart.textual_outline_modelled.expect
@@ -0,0 +1,6 @@
+class C<T> {
+ List<F> method<F extends T>(List<F> list) => list;
+ foo<E extends T>(List<E> list) {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart.weak.expect b/pkg/front_end/testcases/nnbd/issue43536.dart.weak.expect
new file mode 100644
index 0000000..e22d4b0
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart.weak.expect
@@ -0,0 +1,15 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::C<self::C::T%>
+ : super core::Object::•()
+ ;
+ method foo<generic-covariant-impl E extends self::C::T% = self::C::T%>(core::List<self::C::foo::E%> list) → dynamic {
+ core::List<self::C::foo::E%> variable = this.{self::C::method}<self::C::foo::E%>(list);
+ }
+ method method<generic-covariant-impl F extends self::C::T% = self::C::T%>(core::List<self::C::method::F%> list) → core::List<self::C::method::F%>
+ return list;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/issue43536.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/issue43536.dart.weak.transformed.expect
new file mode 100644
index 0000000..e22d4b0
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd/issue43536.dart.weak.transformed.expect
@@ -0,0 +1,15 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::C<self::C::T%>
+ : super core::Object::•()
+ ;
+ method foo<generic-covariant-impl E extends self::C::T% = self::C::T%>(core::List<self::C::foo::E%> list) → dynamic {
+ core::List<self::C::foo::E%> variable = this.{self::C::method}<self::C::foo::E%>(list);
+ }
+ method method<generic-covariant-impl F extends self::C::T% = self::C::T%>(core::List<self::C::method::F%> list) → core::List<self::C::method::F%>
+ return list;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.outline.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.outline.expect
index acb4c8d..953b07d 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.outline.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.outline.expect
@@ -13,6 +13,8 @@
library;
import self as self2;
+import "dart:core" as core;
+static field core::int* x;
static method foo() → void
;
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.expect
index b5f4dc2..6501ffc 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.expect
@@ -17,6 +17,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.transformed.expect
index b5f4dc2..6501ffc 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.transformed.expect
@@ -17,6 +17,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.expect
index dfa3681..c9d352f 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.expect
@@ -12,6 +12,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.transformed.expect
index dfa3681..c9d352f 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.weak.transformed.expect
@@ -12,6 +12,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart
index 930d387..ed07dd6 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart
@@ -1,5 +1,7 @@
// @dart = 2.7
+int x;
+
void foo() {
print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.outline.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.outline.expect
index 7a170f8..f0ae2dc 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.outline.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.outline.expect
@@ -6,7 +6,7 @@
static method main() → dynamic
;
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -15,6 +15,8 @@
// ^^^^^^^^^^^^^^
//
import self as self2;
+import "dart:core" as core;
+static field core::int* x;
static method foo() → void
;
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.expect
index 701927d..fecb1f5 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.expect
@@ -8,7 +8,7 @@
str::foo();
}
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -19,6 +19,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.transformed.expect
index 701927d..fecb1f5 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.strong.transformed.expect
@@ -8,7 +8,7 @@
str::foo();
}
-library /*isNonNullableByDefault*/;
+library;
//
// Problems in library:
//
@@ -19,6 +19,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.expect
index dfa3681..c9d352f 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.expect
@@ -12,6 +12,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.transformed.expect
index dfa3681..c9d352f 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong.dart.weak.transformed.expect
@@ -12,6 +12,7 @@
import self as str;
import "dart:core" as core;
+static field core::int* x;
static method foo() → void {
core::print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong_lib.dart b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong_lib.dart
index 930d387..ed07dd6 100644
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong_lib.dart
+++ b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_source/strong_lib.dart
@@ -1,5 +1,7 @@
// @dart = 2.7
+int x;
+
void foo() {
print("hello");
}
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart
index a08c72e..a3a3556 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart
@@ -1,3 +1,5 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+
+int x;
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart
index a08c72e..0ba8a05 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart
@@ -1,3 +1,5 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+
+int y;
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib1.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib1.dart
index a08c72e..a3a3556 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib1.dart
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib1.dart
@@ -1,3 +1,5 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+
+int x;
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib2.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib2.dart
index a08c72e..0ba8a05 100644
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib2.dart
+++ b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_source/opt_out_package/lib/regular_lib2.dart
@@ -1,3 +1,5 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+
+int y;
diff --git a/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart
new file mode 100644
index 0000000..a219889
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart=2.8
+
+import 'main_declaration_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.textual_outline.expect
new file mode 100644
index 0000000..34a9e3a
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.textual_outline.expect
@@ -0,0 +1,4 @@
+// @dart = 2.8
+import 'main_declaration_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..34a9e3a
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.textual_outline_modelled.expect
@@ -0,0 +1,4 @@
+// @dart = 2.8
+import 'main_declaration_lib.dart';
+
+main() {}
diff --git a/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.weak.expect b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.weak.expect
new file mode 100644
index 0000000..58118e1
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.weak.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///main_declaration_lib.dart";
+
+static method main() → dynamic {}
+
+library;
+import self as self2;
+import "dart:core" as core;
+
+static method main(core::String* args) → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.weak.transformed.expect b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.weak.transformed.expect
new file mode 100644
index 0000000..58118e1
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd_mixed/main_declaration.dart.weak.transformed.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+
+import "org-dartlang-testcase:///main_declaration_lib.dart";
+
+static method main() → dynamic {}
+
+library;
+import self as self2;
+import "dart:core" as core;
+
+static method main(core::String* args) → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd_mixed/main_declaration_lib.dart b/pkg/front_end/testcases/nnbd_mixed/main_declaration_lib.dart
new file mode 100644
index 0000000..9fb74f3
--- /dev/null
+++ b/pkg/front_end/testcases/nnbd_mixed/main_declaration_lib.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart=2.8
+
+// This would be an invalid main declaration in a null safe library.
+main(String args) {}
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart b/pkg/front_end/testcases/value_class/value_implements_non_value.dart
index ccb27e8..6b6cf57 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import '../nnbd_mixed/nnbd_opt_out_language_version.dart';
import 'value_class_support_lib.dart';
class Animal {
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.outline.expect b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.outline.expect
index 73b6a82..4896c3e 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.outline.expect
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.outline.expect
@@ -3,7 +3,6 @@
import "dart:core" as core;
import "value_class_support_lib.dart" as val;
-import "org-dartlang-testcase-sdk:///pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart";
import "org-dartlang-testcase:///value_class_support_lib.dart";
class Animal extends core::Object {
@@ -36,38 +35,6 @@
;
library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:1:1: Error: A library can't opt out of null safety by default, when using sound null safety.
-// // @dart=2.4
-// ^^^^^^^^^^^^
-//
-import self as self2;
-import "dart:core" as core;
-
-class late extends core::Object {
- synthetic constructor •() → self2::late
- ;
- get g() → core::int
- ;
-}
-class required extends core::Object {
- synthetic constructor •() → self2::required
- ;
- get g() → core::int
- ;
-}
-class C extends core::Object {
- field self2::late l;
- field self2::required r;
- synthetic constructor •() → self2::C
- ;
-}
-static method main() → dynamic
- ;
-
-library /*isNonNullableByDefault*/;
import self as val;
import "dart:core" as core;
@@ -83,6 +50,6 @@
Extra constant evaluation status:
-Evaluated: StaticGet @ org-dartlang-testcase:///value_implements_non_value.dart:12:2 -> StringConstant("valueClass")
-Evaluated: StaticGet @ org-dartlang-testcase:///value_implements_non_value.dart:22:2 -> StringConstant("valueClass")
+Evaluated: StaticGet @ org-dartlang-testcase:///value_implements_non_value.dart:11:2 -> StringConstant("valueClass")
+Evaluated: StaticGet @ org-dartlang-testcase:///value_implements_non_value.dart:21:2 -> StringConstant("valueClass")
Extra constant evaluation: evaluated: 2, effectively constant: 2
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.expect b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.expect
index 0c996cf..ea9e6be 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.expect
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.expect
@@ -2,69 +2,69 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
// Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:9:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:8:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:15:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:25:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
@@ -73,7 +73,6 @@
import "dart:core" as core;
import "value_class_support_lib.dart" as val;
-import "org-dartlang-testcase-sdk:///pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart";
import "org-dartlang-testcase:///value_class_support_lib.dart";
class Animal extends core::Object {
@@ -119,26 +118,26 @@
return new self::Cat2::•(numberOfLegs: numberOfLegs, numberOfWhiskers: numberOfWhiskers);
}
static method main() → dynamic {
- self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat;
- self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat;
- self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat;
self::expect(true, firstCat.{core::Object::==}(secondCat));
self::expect(false, firstCat.{core::Object::==}(thirdCat));
self::expect(true, firstCat.{core::Object::hashCode}.{core::num::==}(secondCat.{core::Object::hashCode}));
self::expect(false, firstCat.{core::Object::hashCode}.{core::num::==}(thirdCat.{core::Object::hashCode}));
- self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat2;
- self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat2;
- self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat2;
self::expect(true, firstCat2.{core::Object::==}(secondCat2));
@@ -152,68 +151,6 @@
}
library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:1:1: Error: A library can't opt out of null safety by default, when using sound null safety.
-// // @dart=2.4
-// ^^^^^^^^^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:3:7: Error: Can't use 'late' as a name here.
-// class late {
-// ^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:7:7: Error: Can't use 'required' as a name here.
-// class required {
-// ^^^^^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:12:8: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-// Try adding the name of the type of the variable or the keyword 'var'.
-// late l = late();
-// ^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:13:3: Error: Can't have modifier 'required' here.
-// Try removing 'required'.
-// required r = required();
-// ^^^^^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:13:12: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-// Try adding the name of the type of the variable or the keyword 'var'.
-// required r = required();
-// ^
-//
-import self as self2;
-import "dart:core" as core;
-
-class late extends core::Object {
- synthetic constructor •() → self2::late
- : super core::Object::•()
- ;
- get g() → core::int
- return 1;
-}
-class required extends core::Object {
- synthetic constructor •() → self2::required
- : super core::Object::•()
- ;
- get g() → core::int
- return 2;
-}
-class C extends core::Object {
- field self2::late l = new self2::late::•();
- field self2::required r = new self2::required::•();
- synthetic constructor •() → self2::C
- : super core::Object::•()
- ;
-}
-static method main() → dynamic {
- if(!new self2::C::•().{self2::C::l}.{self2::late::g}.{core::num::==}(1))
- throw "Expected 1";
- if(!new self2::C::•().{self2::C::r}.{self2::required::g}.{core::num::==}(2))
- throw "Expected 2";
-}
-
-library /*isNonNullableByDefault*/;
import self as val;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.transformed.expect b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.transformed.expect
index 8073f01..dfd6ccf 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.strong.transformed.expect
@@ -2,69 +2,69 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
// Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:9:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:8:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:15:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:25:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
@@ -73,7 +73,6 @@
import "dart:core" as core;
import "value_class_support_lib.dart" as val;
-import "org-dartlang-testcase-sdk:///pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart";
import "org-dartlang-testcase:///value_class_support_lib.dart";
class Animal extends core::Object {
@@ -119,26 +118,26 @@
return new self::Cat2::•(numberOfLegs: numberOfLegs, numberOfWhiskers: numberOfWhiskers);
}
static method main() → dynamic {
- self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^";
self::expect(true, firstCat.{core::Object::==}(secondCat));
self::expect(false, firstCat.{core::Object::==}(thirdCat));
self::expect(true, firstCat.{core::Object::hashCode}.{core::num::==}(secondCat.{core::Object::hashCode}));
self::expect(false, firstCat.{core::Object::hashCode}.{core::num::==}(thirdCat.{core::Object::hashCode}));
- self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^";
self::expect(true, firstCat2.{core::Object::==}(secondCat2));
@@ -152,68 +151,6 @@
}
library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:1:1: Error: A library can't opt out of null safety by default, when using sound null safety.
-// // @dart=2.4
-// ^^^^^^^^^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:3:7: Error: Can't use 'late' as a name here.
-// class late {
-// ^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:7:7: Error: Can't use 'required' as a name here.
-// class required {
-// ^^^^^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:12:8: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-// Try adding the name of the type of the variable or the keyword 'var'.
-// late l = late();
-// ^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:13:3: Error: Can't have modifier 'required' here.
-// Try removing 'required'.
-// required r = required();
-// ^^^^^^^^
-//
-// pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart:13:12: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-// Try adding the name of the type of the variable or the keyword 'var'.
-// required r = required();
-// ^
-//
-import self as self2;
-import "dart:core" as core;
-
-class late extends core::Object {
- synthetic constructor •() → self2::late
- : super core::Object::•()
- ;
- get g() → core::int
- return 1;
-}
-class required extends core::Object {
- synthetic constructor •() → self2::required
- : super core::Object::•()
- ;
- get g() → core::int
- return 2;
-}
-class C extends core::Object {
- field self2::late l = new self2::late::•();
- field self2::required r = new self2::required::•();
- synthetic constructor •() → self2::C
- : super core::Object::•()
- ;
-}
-static method main() → dynamic {
- if(!new self2::C::•().{self2::C::l}.{self2::late::g}.{core::num::==}(1))
- throw "Expected 1";
- if(!new self2::C::•().{self2::C::r}.{self2::required::g}.{core::num::==}(2))
- throw "Expected 2";
-}
-
-library /*isNonNullableByDefault*/;
import self as val;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline.expect b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline.expect
index 2d8e9d2..bf86aab 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline.expect
@@ -1,4 +1,3 @@
-import '../nnbd_mixed/nnbd_opt_out_language_version.dart';
import 'value_class_support_lib.dart';
class Animal {
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline_modelled.expect
index 43b3505..0b34b85 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline_modelled.expect
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.textual_outline_modelled.expect
@@ -1,4 +1,3 @@
-import '../nnbd_mixed/nnbd_opt_out_language_version.dart';
import 'value_class_support_lib.dart';
abstract class Animal2 {
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.expect b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.expect
index 25f2810..ea9e6be 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.expect
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.expect
@@ -2,69 +2,69 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
// Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:9:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:8:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:15:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:25:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
@@ -73,7 +73,6 @@
import "dart:core" as core;
import "value_class_support_lib.dart" as val;
-import "org-dartlang-testcase-sdk:///pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart";
import "org-dartlang-testcase:///value_class_support_lib.dart";
class Animal extends core::Object {
@@ -119,26 +118,26 @@
return new self::Cat2::•(numberOfLegs: numberOfLegs, numberOfWhiskers: numberOfWhiskers);
}
static method main() → dynamic {
- self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat;
- self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat;
- self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat;
self::expect(true, firstCat.{core::Object::==}(secondCat));
self::expect(false, firstCat.{core::Object::==}(thirdCat));
self::expect(true, firstCat.{core::Object::hashCode}.{core::num::==}(secondCat.{core::Object::hashCode}));
self::expect(false, firstCat.{core::Object::hashCode}.{core::num::==}(thirdCat.{core::Object::hashCode}));
- self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat2;
- self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat2;
- self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} self::Cat2;
self::expect(true, firstCat2.{core::Object::==}(secondCat2));
@@ -151,68 +150,6 @@
throw "Expected=${expected}, actual=${actual}";
}
-library;
-import self as self2;
-import "dart:core" as core;
-
-class late extends core::Object {
- synthetic constructor •() → self2::late*
- : super core::Object::•()
- ;
- get g() → core::int*
- return 1;
- abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
- abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
- abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
- abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
- abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
- abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
- abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
- abstract member-signature method toString() → core::String*; -> core::Object::toString
- abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
- abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
-}
-class required extends core::Object {
- synthetic constructor •() → self2::required*
- : super core::Object::•()
- ;
- get g() → core::int*
- return 2;
- abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
- abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
- abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
- abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
- abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
- abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
- abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
- abstract member-signature method toString() → core::String*; -> core::Object::toString
- abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
- abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
-}
-class C extends core::Object {
- field self2::late* l = new self2::late::•();
- field self2::required* r = new self2::required::•();
- synthetic constructor •() → self2::C*
- : super core::Object::•()
- ;
- abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
- abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
- abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
- abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
- abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
- abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
- abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
- abstract member-signature method toString() → core::String*; -> core::Object::toString
- abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
- abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
-}
-static method main() → dynamic {
- if(!new self2::C::•().{self2::C::l}.{self2::late::g}.{core::num::==}(1))
- throw "Expected 1";
- if(!new self2::C::•().{self2::C::r}.{self2::required::g}.{core::num::==}(2))
- throw "Expected 2";
-}
-
library /*isNonNullableByDefault*/;
import self as val;
import "dart:core" as core;
diff --git a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.transformed.expect b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.transformed.expect
index 97545af..dfd6ccf 100644
--- a/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/value_class/value_implements_non_value.dart.weak.transformed.expect
@@ -2,69 +2,69 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
// Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
// Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:12:7: Context: The class 'Cat' has a constructor that takes no arguments.
// class Cat implements Animal {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
// Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
// ^^^^^^^^^^^^
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:7: Context: The class 'Cat2' has a constructor that takes no arguments.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:22:7: Context: The class 'Cat2' has a constructor that takes no arguments.
// class Cat2 implements Animal2 {
// ^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:9:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:8:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:13:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:15:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:14:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfLegs' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:23:13: Error: Final field 'numberOfLegs' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfLegs;
// ^^^^^^^^^^^^
//
-// pkg/front_end/testcases/value_class/value_implements_non_value.dart:25:13: Error: Final field 'numberOfWhiskers' is not initialized.
+// pkg/front_end/testcases/value_class/value_implements_non_value.dart:24:13: Error: Final field 'numberOfWhiskers' is not initialized.
// Try to initialize the field in the declaration or in every constructor.
// final int numberOfWhiskers;
// ^^^^^^^^^^^^^^^^
@@ -73,7 +73,6 @@
import "dart:core" as core;
import "value_class_support_lib.dart" as val;
-import "org-dartlang-testcase-sdk:///pkg/front_end/testcases/nnbd_mixed/nnbd_opt_out_language_version.dart";
import "org-dartlang-testcase:///value_class_support_lib.dart";
class Animal extends core::Object {
@@ -119,26 +118,26 @@
return new self::Cat2::•(numberOfLegs: numberOfLegs, numberOfWhiskers: numberOfWhiskers);
}
static method main() → dynamic {
- self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:29:22: Error: No named parameter with the name 'numberOfLegs'.
Cat firstCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:23: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:30:23: Error: No named parameter with the name 'numberOfLegs'.
Cat secondCat = Cat(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:32:22: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:31:22: Error: No named parameter with the name 'numberOfLegs'.
Cat thirdCat = Cat(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^";
self::expect(true, firstCat.{core::Object::==}(secondCat));
self::expect(false, firstCat.{core::Object::==}(thirdCat));
self::expect(true, firstCat.{core::Object::hashCode}.{core::num::==}(secondCat.{core::Object::hashCode}));
self::expect(false, firstCat.{core::Object::hashCode}.{core::num::==}(thirdCat.{core::Object::hashCode}));
- self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 firstCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:39:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 firstCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:26: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 secondCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:40:26: Error: No named parameter with the name 'numberOfLegs'.
Cat2 secondCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 10);
^^^^^^^^^^^^";
- self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:42:25: Error: No named parameter with the name 'numberOfLegs'.
+ self::Cat2 thirdCat2 = invalid-expression "pkg/front_end/testcases/value_class/value_implements_non_value.dart:41:25: Error: No named parameter with the name 'numberOfLegs'.
Cat2 thirdCat2 = Cat2(numberOfLegs: 4, numberOfWhiskers: 0);
^^^^^^^^^^^^";
self::expect(true, firstCat2.{core::Object::==}(secondCat2));
@@ -151,68 +150,6 @@
throw "Expected=${expected}, actual=${actual}";
}
-library;
-import self as self2;
-import "dart:core" as core;
-
-class late extends core::Object {
- synthetic constructor •() → self2::late*
- : super core::Object::•()
- ;
- get g() → core::int*
- return 1;
- abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
- abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
- abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
- abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
- abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
- abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
- abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
- abstract member-signature method toString() → core::String*; -> core::Object::toString
- abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
- abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
-}
-class required extends core::Object {
- synthetic constructor •() → self2::required*
- : super core::Object::•()
- ;
- get g() → core::int*
- return 2;
- abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
- abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
- abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
- abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
- abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
- abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
- abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
- abstract member-signature method toString() → core::String*; -> core::Object::toString
- abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
- abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
-}
-class C extends core::Object {
- field self2::late* l = new self2::late::•();
- field self2::required* r = new self2::required::•();
- synthetic constructor •() → self2::C*
- : super core::Object::•()
- ;
- abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
- abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
- abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
- abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
- abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
- abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
- abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
- abstract member-signature method toString() → core::String*; -> core::Object::toString
- abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
- abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
-}
-static method main() → dynamic {
- if(!new self2::C::•().{self2::C::l}.{self2::late::g}.{core::num::==}(1))
- throw "Expected 1";
- if(!new self2::C::•().{self2::C::r}.{self2::required::g}.{core::num::==}(2))
- throw "Expected 2";
-}
-
library /*isNonNullableByDefault*/;
import self as val;
import "dart:core" as core;
diff --git a/pkg/kernel/lib/src/standard_bounds.dart b/pkg/kernel/lib/src/standard_bounds.dart
index 51a5ab9..15d25e9 100644
--- a/pkg/kernel/lib/src/standard_bounds.dart
+++ b/pkg/kernel/lib/src/standard_bounds.dart
@@ -396,17 +396,19 @@
// without using the nullability of the outermost type. The result uses
// [intersectNullabilities] to compute the resulting type if the subtype
// relation is established.
- DartType nonNullableType1 =
- type1.withDeclaredNullability(Nullability.nonNullable);
- DartType nonNullableType2 =
- type2.withDeclaredNullability(Nullability.nonNullable);
- if (isSubtypeOf(nonNullableType1, nonNullableType2,
- SubtypeCheckMode.withNullabilities)) {
+ DartType typeWithoutNullabilityMarker1 =
+ computeTypeWithoutNullabilityMarker(type1, clientLibrary,
+ nullType: coreTypes.nullType);
+ DartType typeWithoutNullabilityMarker2 =
+ computeTypeWithoutNullabilityMarker(type2, clientLibrary,
+ nullType: coreTypes.nullType);
+ if (isSubtypeOf(typeWithoutNullabilityMarker1,
+ typeWithoutNullabilityMarker2, SubtypeCheckMode.withNullabilities)) {
return type1.withDeclaredNullability(intersectNullabilities(
type1.declaredNullability, type2.declaredNullability));
}
- if (isSubtypeOf(nonNullableType2, nonNullableType1,
- SubtypeCheckMode.withNullabilities)) {
+ if (isSubtypeOf(typeWithoutNullabilityMarker2,
+ typeWithoutNullabilityMarker1, SubtypeCheckMode.withNullabilities)) {
return type2.withDeclaredNullability(intersectNullabilities(
type1.declaredNullability, type2.declaredNullability));
}
@@ -753,21 +755,23 @@
// T1 <: T2 without using the nullability of the outermost type. The result
// uses [uniteNullabilities] to compute the resulting type if the subtype
// relation is established.
- InterfaceType nonNonNullableType1 =
- type1.withDeclaredNullability(Nullability.nonNullable);
- InterfaceType nonNonNullableType2 =
- type2.withDeclaredNullability(Nullability.nonNullable);
+ InterfaceType typeWithoutNullabilityMarker1 =
+ computeTypeWithoutNullabilityMarker(type1, clientLibrary,
+ nullType: coreTypes.nullType);
+ InterfaceType typeWithoutNullabilityMarker2 =
+ computeTypeWithoutNullabilityMarker(type2, clientLibrary,
+ nullType: coreTypes.nullType);
- if (isSubtypeOf(nonNonNullableType1, nonNonNullableType2,
- SubtypeCheckMode.withNullabilities)) {
+ if (isSubtypeOf(typeWithoutNullabilityMarker1,
+ typeWithoutNullabilityMarker2, SubtypeCheckMode.withNullabilities)) {
return type2.withDeclaredNullability(
uniteNullabilities(type1.nullability, type2.nullability));
}
// UP(T1, T2) = T1 if T2 <: T1
// Note that both types must be class types at this point.
- if (isSubtypeOf(nonNonNullableType2, nonNonNullableType1,
- SubtypeCheckMode.withNullabilities)) {
+ if (isSubtypeOf(typeWithoutNullabilityMarker2,
+ typeWithoutNullabilityMarker1, SubtypeCheckMode.withNullabilities)) {
return type1.withDeclaredNullability(uniteNullabilities(
type1.declaredNullability, type2.declaredNullability));
}
diff --git a/pkg/kernel/lib/type_algebra.dart b/pkg/kernel/lib/type_algebra.dart
index 632c18d..dccad1c 100644
--- a/pkg/kernel/lib/type_algebra.dart
+++ b/pkg/kernel/lib/type_algebra.dart
@@ -1035,16 +1035,18 @@
/// Implementation of [unwrapNullabilityConstructor] as a visitor.
///
-/// Implementing the function as a visitor makes the necessity of supporting a new implementation of [DartType] visible at compile time.
-// TODO(dmitryas): Remove CoreTypes as the second argument when NullType is landed.
+/// Implementing the function as a visitor makes the necessity of supporting a
+/// new implementation of [DartType] visible at compile time.
+// TODO(dmitryas): Remove CoreTypes as the second argument when NullType is
+// landed.
class _NullabilityConstructorUnwrapper
implements DartTypeVisitor1<DartType, CoreTypes> {
const _NullabilityConstructorUnwrapper();
@override
DartType defaultDartType(DartType node, CoreTypes coreTypes) {
- throw new UnsupportedError(
- "Unsupported operation: _NullabilityConstructorUnwrapper(${node.runtimeType})");
+ throw new UnsupportedError("Unsupported operation: "
+ "_NullabilityConstructorUnwrapper(${node.runtimeType})");
}
@override
@@ -1185,3 +1187,93 @@
return super.visitTypeParameterType(node);
}
}
+
+/// Computes [type] as if declared without nullability markers.
+///
+/// For example, int? and int* are considered applications of the nullable and
+/// the legacy type constructors to type int correspondingly.
+/// [computeTypeWithoutNullabilityMarker] peels off these type constructors,
+/// returning the non-nullable version of type int. In case of
+/// [TypeParameterType]s, the result may be either [Nullability.nonNullable] or
+/// [Nullability.undetermined], depending on the bound.
+DartType computeTypeWithoutNullabilityMarker(
+ DartType type, Library clientLibrary,
+ {DartType nullType}) {
+ assert(nullType != null);
+ if (type is TypeParameterType) {
+ if (type.promotedBound == null) {
+ // The default nullability for library is used when there are no
+ // nullability markers on the type.
+ return new TypeParameterType.withDefaultNullabilityForLibrary(
+ type.parameter, clientLibrary);
+ } else {
+ // Intersection types can't be arguments to the nullable and the legacy
+ // type constructors, so nothing can be peeled off.
+ return type;
+ }
+ } else if (type == nullType) {
+ return type;
+ } else {
+ // For most types, peeling off the nullability constructors means that
+ // they become non-nullable.
+ return type.withDeclaredNullability(Nullability.nonNullable);
+ }
+}
+
+/// Returns true if [type] is declared without nullability markers.
+///
+/// An example of the nullable type constructor application is T? where T is a
+/// type parameter. Some examples of types declared without nullability markers
+/// are T% and S, where T and S are type parameters such that T extends Object?
+/// and S extends Object.
+bool isTypeParameterTypeWithoutNullabilityMarker(
+ TypeParameterType type, Library clientLibrary) {
+ // The default nullability for library is used when there are no nullability
+ // markers on the type.
+ return type.promotedBound == null &&
+ type.declaredNullability ==
+ new TypeParameterType.withDefaultNullabilityForLibrary(
+ type.parameter, clientLibrary)
+ .declaredNullability;
+}
+
+/// Returns true if [type] is an application of the nullable type constructor.
+///
+/// A type is considered an application of the nullable type constructor if it
+/// was declared with the ? marker. Some examples of such types are int?,
+/// String?, Object?, and T? where T is a type parameter. Types dynamic, void,
+/// and Null are nullable, but aren't considered applications of the nullable
+/// type constructor.
+bool isNullableTypeConstructorApplication(DartType type, {DartType nullType}) {
+ assert(nullType != null);
+ return type.declaredNullability == Nullability.nullable &&
+ type is! DynamicType &&
+ type is! VoidType &&
+ type != nullType;
+}
+
+/// Returns true if [type] is an application of the legacy type constructor.
+///
+/// A type is considered an application of the legacy type constructor if it was
+/// declared within a legacy library and is not one of exempt types, such as
+/// dynamic or void.
+bool isLegacyTypeConstructorApplication(DartType type, Library clientLibrary) {
+ if (type is TypeParameterType) {
+ if (type.promotedBound == null) {
+ // The legacy nullability is considered an application of the legacy
+ // nullability constructor if it doesn't match the default nullability
+ // of the type-parameter type for the library.
+ return type.declaredNullability == Nullability.legacy &&
+ type.declaredNullability !=
+ new TypeParameterType.withDefaultNullabilityForLibrary(
+ type.parameter, clientLibrary)
+ .declaredNullability;
+ } else {
+ return false;
+ }
+ } else if (type is InvalidType) {
+ return false;
+ } else {
+ return type.declaredNullability == Nullability.legacy;
+ }
+}
diff --git a/tools/VERSION b/tools/VERSION
index 39715f5..15ebdcb 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 194
+PRERELEASE 195
PRERELEASE_PATCH 0
\ No newline at end of file