diff --git a/pkg/compiler/test/codegen/data/shift_right_unsigned.dart b/pkg/compiler/test/codegen/data/shift_right_unsigned.dart index 755d7435fc8..23043cfcbe0 100644 --- a/pkg/compiler/test/codegen/data/shift_right_unsigned.dart +++ b/pkg/compiler/test/codegen/data/shift_right_unsigned.dart @@ -2,7 +2,7 @@ // 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.12 +//@dart=2.13 /*member: main:ignore*/ void main() { diff --git a/pkg/compiler/test/codegen/shift_right_unsigned_test.dart b/pkg/compiler/test/codegen/shift_right_unsigned_test.dart index 786bc71b458..d4d6d2c98ea 100644 --- a/pkg/compiler/test/codegen/shift_right_unsigned_test.dart +++ b/pkg/compiler/test/codegen/shift_right_unsigned_test.dart @@ -133,6 +133,7 @@ main() { methodName: 'foo', disableTypeInference: false, enableTripleShift: true, + soundNullSafety: true, check: checkerForAbsentPresent(test)); } diff --git a/pkg/compiler/test/inference/data/shift_right_unsigned.dart b/pkg/compiler/test/inference/data/shift_right_unsigned.dart index 5faf9904433..351869207fd 100644 --- a/pkg/compiler/test/inference/data/shift_right_unsigned.dart +++ b/pkg/compiler/test/inference/data/shift_right_unsigned.dart @@ -2,7 +2,7 @@ // 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.12 +// @dart = 2.13 /*member: main:[null]*/ main() { diff --git a/pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart b/pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart index 0f6432d629b..5c8302a2e3c 100644 --- a/pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart +++ b/pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart @@ -1,7 +1,8 @@ +// @dart = 2.7 + class MyClass { MyClass(); -// @dart = 2.7 @pragma('dart2js:noInline') set internalSetter(int v) { /*7:MyClass.internalSetter*/ throw "error"; diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart index 99c4fc727a4..a9154dd82ee 100644 --- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart +++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart @@ -31,7 +31,8 @@ import 'experimental_flags.dart' as flags show getExperimentEnabledVersionInLibrary, isExperimentEnabled, - isExperimentEnabledInLibrary; + isExperimentEnabledInLibrary, + isExperimentEnabledInLibraryByVersion; import 'file_system.dart' show FileSystem; @@ -299,6 +300,17 @@ class CompilerOptions { experimentReleasedVersionForTesting); } + bool isExperimentEnabledInLibraryByVersion( + ExperimentalFlag flag, Uri importUri, Version version) { + return flags.isExperimentEnabledInLibraryByVersion(flag, importUri, version, + explicitExperimentalFlags: explicitExperimentalFlags, + defaultExperimentFlagsForTesting: defaultExperimentFlagsForTesting, + allowedExperimentalFlags: allowedExperimentalFlagsForTesting, + experimentEnabledVersionForTesting: experimentEnabledVersionForTesting, + experimentReleasedVersionForTesting: + experimentReleasedVersionForTesting); + } + bool equivalent(CompilerOptions other, {bool ignoreOnDiagnostic: true, bool ignoreVerbose: true, diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags.dart index 088b5171937..bd9a076dbf5 100644 --- a/pkg/front_end/lib/src/api_prototype/experimental_flags.dart +++ b/pkg/front_end/lib/src/api_prototype/experimental_flags.dart @@ -182,3 +182,71 @@ Version getExperimentEnabledVersionInLibrary(ExperimentalFlag flag, assert(version != null, "No version for enabling $flag in $canonicalUri."); return version; } + +bool isExperimentEnabledInLibraryByVersion( + ExperimentalFlag flag, Uri canonicalUri, Version version, + {Map defaultExperimentFlagsForTesting, + Map explicitExperimentalFlags, + AllowedExperimentalFlags allowedExperimentalFlags, + Map experimentEnabledVersionForTesting, + Map experimentReleasedVersionForTesting}) { + assert(defaultExperimentalFlags.containsKey(flag), + "No default value for $flag."); + assert(expiredExperimentalFlags.containsKey(flag), + "No expired value for $flag."); + if (expiredExperimentalFlags[flag]) { + return defaultExperimentalFlags[flag]; + } + + bool enabledByDefault; + if (defaultExperimentFlagsForTesting != null) { + enabledByDefault = defaultExperimentFlagsForTesting[flag]; + } + enabledByDefault ??= defaultExperimentalFlags[flag]; + + bool enabledExplicitly = explicitExperimentalFlags[flag] ?? false; + + allowedExperimentalFlags ??= defaultAllowedExperimentalFlags; + + Set allowedFlags; + bool enabledByAllowed = false; + if (canonicalUri.scheme == 'dart') { + allowedFlags = allowedExperimentalFlags.forSdkLibrary(canonicalUri.path); + } else if (canonicalUri.scheme == 'package') { + int index = canonicalUri.path.indexOf('/'); + String packageName; + if (index >= 0) { + packageName = canonicalUri.path.substring(0, index); + } else { + packageName = canonicalUri.path; + } + allowedFlags = allowedExperimentalFlags.forPackage(packageName); + } + if (allowedFlags != null) { + enabledByAllowed = allowedFlags.contains(flag); + } + + if (enabledByDefault || enabledExplicitly || enabledByAllowed) { + // The feature is enabled depending on the library language version. + Version enabledVersion; + if (!enabledByDefault || enabledExplicitly || enabledByAllowed) { + // If the feature is not enabled by default or is enabled by the allowed + // list, use the experiment release version. + if (experimentReleasedVersionForTesting != null) { + enabledVersion = experimentReleasedVersionForTesting[flag]; + } + enabledVersion ??= experimentReleasedVersion[flag]; + } else { + // If the feature is enabled by default and is not enabled by the allowed + // list use the enabled version. + if (experimentEnabledVersionForTesting != null) { + enabledVersion = experimentEnabledVersionForTesting[flag]; + } + enabledVersion ??= experimentEnabledVersion[flag]; + } + return version >= enabledVersion; + } else { + // The feature is not enabled, regardless of library language version. + return false; + } +} diff --git a/pkg/front_end/lib/src/api_prototype/language_version.dart b/pkg/front_end/lib/src/api_prototype/language_version.dart index 84b27fdd4b1..bc5d3530e06 100644 --- a/pkg/front_end/lib/src/api_prototype/language_version.dart +++ b/pkg/front_end/lib/src/api_prototype/language_version.dart @@ -147,9 +147,10 @@ Future uriUsesLegacyLanguageVersion( if (SourceLibraryBuilder.isOptOutTest(uri)) return true; VersionAndPackageUri versionAndLibraryUri = await languageVersionForUri(uri, options); - return (versionAndLibraryUri.version < - options.getExperimentEnabledVersionInLibrary( - ExperimentalFlag.nonNullable, versionAndLibraryUri.packageUri)); + return !options.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.nonNullable, + versionAndLibraryUri.packageUri, + versionAndLibraryUri.version); } class VersionAndPackageUri { diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart index 1ea8dc4f8f1..04951b85014 100644 --- a/pkg/front_end/lib/src/base/processed_options.dart +++ b/pkg/front_end/lib/src/base/processed_options.dart @@ -401,6 +401,11 @@ class ProcessedOptions { return _raw.getExperimentEnabledVersionInLibrary(flag, importUri); } + bool isExperimentEnabledInLibraryByVersion( + flags.ExperimentalFlag flag, Uri importUri, Version version) { + return _raw.isExperimentEnabledInLibraryByVersion(flag, importUri, version); + } + Component _validateNullSafetyMode(Component component) { if (component.mode == NonNullableByDefaultCompiledMode.Invalid) { throw new FormatException( diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart index f318572dd3c..74355bf75df 100644 --- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart +++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart @@ -8,7 +8,7 @@ library fasta.library_builder; import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity; -import 'package:kernel/ast.dart' show Library, Nullability, Version; +import 'package:kernel/ast.dart' show Library, Nullability; import '../combinator.dart' show Combinator; @@ -55,23 +55,6 @@ abstract class LibraryBuilder implements ModifierBuilder { bool mayImplementRestrictedTypes; - /// Set the language version to a specific non-null [version]. - /// - /// If the language version has previously been explicitly set set (i.e. with - /// [explicit] set to true), any subsequent call (explicit or not) should be - /// ignored. - /// Multiple calls with [explicit] set to false should be allowed though. - /// - /// The main idea is that the .packages file specifies a default language - /// version, but that the library can have source code that specifies another - /// one which should be supported, but specifying several in code should not - /// change anything. - /// - /// [offset] and [length] refers to the offset and length of the source code - /// specifying the language version. - void setLanguageVersion(Version version, - {int offset: 0, int length, bool explicit}); - bool get isPart; Loader get loader; @@ -224,27 +207,6 @@ abstract class LibraryBuilderImpl extends ModifierBuilderImpl @override bool get isSynthetic => false; - /// Set the language version to a specific non-null major and minor version. - /// - /// If [version] is null (and no other version has been explicitly set) a - /// problem is issued. - /// - /// If the language version has previously been explicitly set set (i.e. with - /// [explicit] set to true), any subsequent call (explicit or not) should be - /// ignored. - /// Multiple calls with [explicit] set to false should be allowed though. - /// - /// The main idea is that the .packages file specifies a default language - /// version, but that the library can have source code that specifies another - /// one which should be supported, but specifying several in code should not - /// change anything. - /// - /// [offset] and [length] refers to the offset and length of the source code - /// specifying the language version. - @override - void setLanguageVersion(Version version, - {int offset: 0, int length, bool explicit}); - @override Builder get parent => null; diff --git a/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart index c3813c3fdad..27e97e4bdc8 100644 --- a/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart +++ b/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart @@ -28,8 +28,7 @@ import 'package:kernel/ast.dart' StaticGet, StringConstant, StringLiteral, - Typedef, - Version; + Typedef; import '../builder/builder.dart'; import '../builder/class_builder.dart'; @@ -139,10 +138,6 @@ class DillLibraryBuilder extends LibraryBuilderImpl { @override bool get isNonNullableByDefault => library.isNonNullableByDefault; - @override - void setLanguageVersion(Version version, - {int offset: 0, int length, bool explicit}) {} - @override Uri get importUri => library.importUri; diff --git a/pkg/front_end/lib/src/fasta/dill/dill_target.dart b/pkg/front_end/lib/src/fasta/dill/dill_target.dart index 9901f81bfeb..002f35da5a8 100644 --- a/pkg/front_end/lib/src/fasta/dill/dill_target.dart +++ b/pkg/front_end/lib/src/fasta/dill/dill_target.dart @@ -17,6 +17,8 @@ import '../builder/class_builder.dart'; import '../problems.dart' show unsupported; +import '../source/source_library_builder.dart' show LanguageVersion; + import '../target_implementation.dart' show TargetImplementation; import '../ticker.dart' show Ticker; @@ -66,6 +68,7 @@ class DillTarget extends TargetImplementation { Uri uri, Uri fileUri, Uri packageUri, + LanguageVersion packageLanguageVersion, LibraryBuilder origin, Library referencesFrom, bool referenceIsPartOwner) { diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart index 82ba08cde99..a25d4e1b4b5 100644 --- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart +++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart @@ -119,7 +119,8 @@ import 'kernel/kernel_target.dart' show KernelTarget; import 'library_graph.dart' show LibraryGraph; -import 'source/source_library_builder.dart' show SourceLibraryBuilder; +import 'source/source_library_builder.dart' + show ImplicitLanguageVersion, SourceLibraryBuilder; import 'ticker.dart' show Ticker; @@ -1883,12 +1884,12 @@ class IncrementalCompiler implements IncrementalKernelGenerator { libraryUri, debugExprUri, /*packageUri*/ null, + new ImplicitLanguageVersion(libraryBuilder.library.languageVersion), userCode.loader, null, scope: libraryBuilder.scope.createNestedScope("expression"), nameOrigin: libraryBuilder.library, ); - debugLibrary.setLanguageVersion(libraryBuilder.library.languageVersion); ticker.logMs("Created debug library"); if (libraryBuilder is DillLibraryBuilder) { diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart index a178096f728..456dc0901e4 100644 --- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart +++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart @@ -9,38 +9,7 @@ library fasta.kernel_target; import 'package:front_end/src/api_prototype/experimental_flags.dart'; import 'package:front_end/src/fasta/dill/dill_library_builder.dart' show DillLibraryBuilder; -import 'package:kernel/ast.dart' - show - Arguments, - CanonicalName, - Class, - Component, - Constructor, - DartType, - EmptyStatement, - Expression, - Field, - FieldInitializer, - FunctionNode, - Initializer, - InterfaceType, - InvalidInitializer, - InvalidType, - Library, - Name, - NamedExpression, - NonNullableByDefaultCompiledMode, - NullLiteral, - Procedure, - RedirectingInitializer, - Reference, - Source, - SuperInitializer, - Supertype, - TypeParameter, - TypeParameterType, - VariableDeclaration, - VariableGet; +import 'package:kernel/ast.dart'; import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; import 'package:kernel/clone.dart' show CloneVisitorNotMembers; import 'package:kernel/core_types.dart'; @@ -51,7 +20,7 @@ import 'package:kernel/target/targets.dart' show DiagnosticReporter; import 'package:kernel/transformations/value_class.dart' as valueClass; import 'package:kernel/type_algebra.dart' show substitute; import 'package:kernel/type_environment.dart' show TypeEnvironment; -import 'package:package_config/package_config.dart'; +import 'package:package_config/package_config.dart' hide LanguageVersion; import '../../api_prototype/file_system.dart' show FileSystem; import '../../base/nnbd_mode.dart'; @@ -102,7 +71,8 @@ import '../messages.dart' import '../problems.dart' show unhandled; import '../scope.dart' show AmbiguousBuilder; import '../source/source_class_builder.dart' show SourceClassBuilder; -import '../source/source_library_builder.dart' show SourceLibraryBuilder; +import '../source/source_library_builder.dart' + show LanguageVersion, SourceLibraryBuilder; import '../source/source_loader.dart' show SourceLoader; import '../target_implementation.dart' show TargetImplementation; import '../uri_translator.dart' show UriTranslator; @@ -246,6 +216,7 @@ class KernelTarget extends TargetImplementation { Uri uri, Uri fileUri, Uri packageUri, + LanguageVersion packageLanguageVersion, SourceLibraryBuilder origin, Library referencesFrom, bool referenceIsPartOwner) { @@ -295,7 +266,8 @@ class KernelTarget extends TargetImplementation { return builder; } } - return new SourceLibraryBuilder(uri, fileUri, packageUri, loader, origin, + return new SourceLibraryBuilder( + uri, fileUri, packageUri, packageLanguageVersion, loader, origin, referencesFrom: referencesFrom, referenceIsPartOwner: referenceIsPartOwner); } diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart index 06525786150..c7d3cbec2d6 100644 --- a/pkg/front_end/lib/src/fasta/loader.dart +++ b/pkg/front_end/lib/src/fasta/loader.dart @@ -34,12 +34,21 @@ import 'messages.dart' noLength, SummaryTemplate, Template, + messageLanguageVersionInvalidInDotPackages, messagePlatformPrivateLibraryAccess, templateInternalProblemContextSeverity, + templateLanguageVersionTooHigh, templateSourceBodySummary; import 'problems.dart' show internalProblem, unhandled; +import 'source/source_library_builder.dart' as src + show + LanguageVersion, + InvalidLanguageVersion, + ImplicitLanguageVersion, + SourceLibraryBuilder; + import 'target_implementation.dart' show TargetImplementation; import 'ticker.dart' show Ticker; @@ -144,9 +153,9 @@ abstract class Loader { packageForLanguageVersion = target.uriTranslator.packages.packageOf(fileUri); } - bool hasPackageSpecifiedLanguageVersion = false; - Version version; + src.LanguageVersion packageLanguageVersion; Uri packageUri; + Message packageLanguageVersionProblem; if (packageForLanguageVersion != null) { Uri importUri = origin?.importUri ?? uri; if (importUri.scheme != 'dart' && @@ -156,24 +165,50 @@ abstract class Loader { new Uri(scheme: 'package', path: packageForLanguageVersion.name); } if (packageForLanguageVersion.languageVersion != null) { - hasPackageSpecifiedLanguageVersion = true; if (packageForLanguageVersion.languageVersion - is! InvalidLanguageVersion) { - version = new Version( + is InvalidLanguageVersion) { + packageLanguageVersionProblem = + messageLanguageVersionInvalidInDotPackages; + packageLanguageVersion = new src.InvalidLanguageVersion( + fileUri, 0, noLength, target.currentSdkVersion, false); + } else { + Version version = new Version( packageForLanguageVersion.languageVersion.major, packageForLanguageVersion.languageVersion.minor); + if (version > target.currentSdkVersion) { + packageLanguageVersionProblem = + templateLanguageVersionTooHigh.withArguments( + target.currentSdkVersion.major, + target.currentSdkVersion.minor); + packageLanguageVersion = new src.InvalidLanguageVersion( + fileUri, 0, noLength, target.currentSdkVersion, false); + } else { + packageLanguageVersion = new src.ImplicitLanguageVersion(version); + } } } } - LibraryBuilder library = target.createLibraryBuilder(uri, fileUri, - packageUri, origin, referencesFrom, referenceIsPartOwner); + packageLanguageVersion ??= + new src.ImplicitLanguageVersion(target.currentSdkVersion); + + LibraryBuilder library = target.createLibraryBuilder( + uri, + fileUri, + packageUri, + packageLanguageVersion, + origin, + referencesFrom, + referenceIsPartOwner); if (library == null) { throw new StateError("createLibraryBuilder for uri $uri, " "fileUri $fileUri returned null."); } - if (hasPackageSpecifiedLanguageVersion) { - library.setLanguageVersion(version, explicit: false); + if (packageLanguageVersionProblem != null && + library is src.SourceLibraryBuilder) { + library.addPostponedProblem( + packageLanguageVersionProblem, 0, noLength, library.fileUri); } + if (uri.scheme == "dart" && uri.path == "core") { coreLibrary = library; } 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 d13a474f511..f5570cb7625 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 @@ -231,6 +231,17 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { List _implicitlyTypedFields; + /// The language version of this library as defined by the language version + /// of the package it belongs to, if present, or the current language version + /// otherwise. + /// + /// This language version we be used as the language version for the library + /// if the library does not contain an explicit @dart= annotation. + final LanguageVersion packageLanguageVersion; + + /// The actual language version of this library. This is initially the + /// [packageLanguageVersion] but will be updated if the library contains + /// an explicit @dart= language version annotation. LanguageVersion _languageVersion; bool postponedProblemsIssued = false; @@ -247,6 +258,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { SourceLoader loader, Uri fileUri, Uri packageUri, + LanguageVersion packageLanguageVersion, Scope scope, SourceLibraryBuilder actualOrigin, Library library, @@ -257,6 +269,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { loader, fileUri, packageUri, + packageLanguageVersion, new TypeParameterScopeBuilder.library(), scope ?? new Scope.top(), actualOrigin, @@ -268,13 +281,14 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { this.loader, this.fileUri, this._packageUri, + this.packageLanguageVersion, this.libraryDeclaration, this.importScope, this.actualOrigin, this.library, this._nameOrigin, this.referencesFrom) - : _languageVersion = new ImplicitLanguageVersion(library.languageVersion), + : _languageVersion = packageLanguageVersion, currentTypeParameterScopeBuilder = libraryDeclaration, referencesFromIndexed = referencesFrom == null ? null : new IndexedLibrary(referencesFrom), @@ -303,17 +317,21 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { bool _enableExtensionTypesInLibrary; bool get enableConstFunctionsInLibrary => _enableConstFunctionsInLibrary ??= - loader.target.isExperimentEnabledInLibrary( - ExperimentalFlag.constFunctions, _packageUri ?? importUri); + loader.target.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.constFunctions, + _packageUri ?? importUri, + languageVersion.version); - bool get enableVarianceInLibrary => - _enableVarianceInLibrary ??= loader.target.isExperimentEnabledInLibrary( - ExperimentalFlag.variance, _packageUri ?? importUri); + bool get enableVarianceInLibrary => _enableVarianceInLibrary ??= loader.target + .isExperimentEnabledInLibraryByVersion(ExperimentalFlag.variance, + _packageUri ?? importUri, languageVersion.version); bool get enableNonfunctionTypeAliasesInLibrary => _enableNonfunctionTypeAliasesInLibrary ??= loader.target - .isExperimentEnabledInLibrary(ExperimentalFlag.nonfunctionTypeAliases, - _packageUri ?? importUri); + .isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.nonfunctionTypeAliases, + _packageUri ?? importUri, + languageVersion.version); /// Returns `true` if the 'non-nullable' experiment is enabled for this /// library. @@ -331,46 +349,54 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { ExperimentalFlag.nonNullable, _packageUri ?? importUri); bool get enableTripleShiftInLibrary => _enableTripleShiftInLibrary ??= - loader.target.isExperimentEnabledInLibrary( - ExperimentalFlag.tripleShift, _packageUri ?? importUri); + loader.target.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.tripleShift, + _packageUri ?? importUri, + languageVersion.version); bool get enableExtensionMethodsInLibrary => _enableExtensionMethodsInLibrary ??= loader.target - .isExperimentEnabledInLibrary( - ExperimentalFlag.extensionMethods, _packageUri ?? importUri); + .isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.extensionMethods, + _packageUri ?? importUri, + languageVersion.version); bool get enableGenericMetadataInLibrary => _enableGenericMetadataInLibrary ??= - loader.target.isExperimentEnabledInLibrary( - ExperimentalFlag.genericMetadata, _packageUri ?? importUri); + loader.target.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.genericMetadata, + _packageUri ?? importUri, + languageVersion.version); bool get enableExtensionTypesInLibrary => _enableExtensionTypesInLibrary ??= - loader.target.isExperimentEnabledInLibrary( - ExperimentalFlag.extensionTypes, _packageUri ?? importUri); + loader.target.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.extensionTypes, + _packageUri ?? importUri, + languageVersion.version); - void updateLibraryNNBDSettings() { + void _updateLibraryNNBDSettings() { library.isNonNullableByDefault = isNonNullableByDefault; - if (enableNonNullableInLibrary) { - switch (loader.nnbdMode) { - case NnbdMode.Weak: - library.nonNullableByDefaultCompiledMode = - NonNullableByDefaultCompiledMode.Weak; - break; - case NnbdMode.Strong: - library.nonNullableByDefaultCompiledMode = - NonNullableByDefaultCompiledMode.Strong; - break; - case NnbdMode.Agnostic: - library.nonNullableByDefaultCompiledMode = - NonNullableByDefaultCompiledMode.Agnostic; - break; - } - } else { - library.nonNullableByDefaultCompiledMode = - NonNullableByDefaultCompiledMode.Weak; + switch (loader.nnbdMode) { + case NnbdMode.Weak: + library.nonNullableByDefaultCompiledMode = + NonNullableByDefaultCompiledMode.Weak; + break; + case NnbdMode.Strong: + library.nonNullableByDefaultCompiledMode = + NonNullableByDefaultCompiledMode.Strong; + break; + case NnbdMode.Agnostic: + library.nonNullableByDefaultCompiledMode = + NonNullableByDefaultCompiledMode.Agnostic; + break; } } - SourceLibraryBuilder(Uri uri, Uri fileUri, Uri packageUri, Loader loader, + SourceLibraryBuilder( + Uri uri, + Uri fileUri, + Uri packageUri, + LanguageVersion packageLanguageVersion, + Loader loader, SourceLibraryBuilder actualOrigin, {Scope scope, Library target, @@ -381,6 +407,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { loader, fileUri, packageUri, + packageLanguageVersion, scope, actualOrigin, target ?? @@ -390,7 +417,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { reference: referenceIsPartOwner == true ? null : referencesFrom?.reference) - ..setLanguageVersion(loader.target.currentSdkVersion)), + ..setLanguageVersion(packageLanguageVersion.version)), nameOrigin, referencesFrom, referenceIsPartOwner); @@ -425,7 +452,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { bool _ensureIsNonNullableByDefault() { if (_isNonNullableByDefault == null) { _isNonNullableByDefault = _computeIsNonNullableByDefault(); - updateLibraryNNBDSettings(); + _updateLibraryNNBDSettings(); } return _isNonNullableByDefault; } @@ -458,9 +485,17 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { 'vm/dart_2/', // in runtime/tests ]; - LanguageVersion get languageVersion => _languageVersion; + LanguageVersion get languageVersion { + assert( + _languageVersion.isFinal, + "Attempting to read the language version of ${this} before has been " + "finalized."); + return _languageVersion; + } void markLanguageVersionFinal() { + _languageVersion.isFinal = true; + _ensureIsNonNullableByDefault(); if (!isNonNullableByDefault && (loader.nnbdMode == NnbdMode.Strong || loader.nnbdMode == NnbdMode.Agnostic)) { @@ -476,32 +511,29 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { NonNullableByDefaultCompiledMode.Invalid; loader.hasInvalidNnbdModeLibrary = true; } - _languageVersion.isFinal = true; - _ensureIsNonNullableByDefault(); } - @override - void setLanguageVersion(Version version, - {int offset: 0, int length: noLength, bool explicit: false}) { - assert(!_languageVersion.isFinal); - if (languageVersion.isExplicit) return; - - if (version == null) { - addPostponedProblem( - messageLanguageVersionInvalidInDotPackages, offset, length, fileUri); - if (_languageVersion is ImplicitLanguageVersion) { - // If the package set an OK version, but the file set an invalid version - // we want to use the package version. - _languageVersion = new InvalidLanguageVersion( - fileUri, offset, length, explicit, loader.target.currentSdkVersion); - library.setLanguageVersion(_languageVersion.version); - } + /// Set the language version to an explicit major and minor version. + /// + /// The default language version specified by the .packages file is passed + /// to the constructor, but the library can have source code that specifies + /// another one which should be supported. + /// + /// Only the first registered language version is used. + /// + /// [offset] and [length] refers to the offset and length of the source code + /// specifying the language version. + void registerExplicitLanguageVersion(Version version, + {int offset: 0, int length: noLength}) { + if (_languageVersion.isExplicit) { + // If more than once language version exists we use the first. return; } + assert(!_languageVersion.isFinal); - // If trying to set a language version that is higher than the current sdk - // version it's an error. if (version > loader.target.currentSdkVersion) { + // If trying to set a language version that is higher than the current sdk + // version it's an error. addPostponedProblem( templateLanguageVersionTooHigh.withArguments( loader.target.currentSdkVersion.major, @@ -509,19 +541,15 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { offset, length, fileUri); - if (_languageVersion is ImplicitLanguageVersion) { - // If the package set an OK version, but the file set an invalid version - // we want to use the package version. - _languageVersion = new InvalidLanguageVersion( - fileUri, offset, length, explicit, loader.target.currentSdkVersion); - library.setLanguageVersion(_languageVersion.version); - } - return; + // If the package set an OK version, but the file set an invalid version + // we want to use the package version. + _languageVersion = new InvalidLanguageVersion( + fileUri, offset, length, packageLanguageVersion.version, true); + } else { + _languageVersion = new LanguageVersion(version, fileUri, offset, length); } - - _languageVersion = - new LanguageVersion(version, fileUri, offset, length, explicit); - library.setLanguageVersion(version); + library.setLanguageVersion(_languageVersion.version); + _languageVersion.isFinal = true; } ConstructorReferenceBuilder addConstructorReference(Object name, @@ -4150,11 +4178,11 @@ class LanguageVersion { final Uri fileUri; final int charOffset; final int charCount; - final bool isExplicit; bool isFinal = false; - LanguageVersion(this.version, this.fileUri, this.charOffset, this.charCount, - this.isExplicit); + LanguageVersion(this.version, this.fileUri, this.charOffset, this.charCount); + + bool get isExplicit => true; bool get valid => true; @@ -4177,12 +4205,12 @@ class InvalidLanguageVersion implements LanguageVersion { final Uri fileUri; final int charOffset; final int charCount; - final bool isExplicit; final Version version; + final bool isExplicit; bool isFinal = false; InvalidLanguageVersion(this.fileUri, this.charOffset, this.charCount, - this.isExplicit, this.version); + this.version, this.isExplicit); @override bool get valid => false; diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart index eed0da754da..29a36260e4a 100644 --- a/pkg/front_end/lib/src/fasta/source/source_loader.dart +++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart @@ -205,24 +205,24 @@ class SourceLoader extends Loader { Future tokenize(SourceLibraryBuilder library, {bool suppressLexicalErrors: false}) async { - Uri uri = library.fileUri; + Uri fileUri = library.fileUri; // Lookup the file URI in the cache. - List bytes = sourceBytes[uri]; + List bytes = sourceBytes[fileUri]; if (bytes == null) { // Error recovery. - if (uri.scheme == untranslatableUriScheme) { + if (fileUri.scheme == untranslatableUriScheme) { Message message = templateUntranslatableUri.withArguments(library.importUri); library.addProblemAtAccessors(message); bytes = synthesizeSourceForMissingFile(library.importUri, null); - } else if (!uri.hasScheme) { + } else if (!fileUri.hasScheme) { return internalProblem( - templateInternalProblemUriMissingScheme.withArguments(uri), + templateInternalProblemUriMissingScheme.withArguments(fileUri), -1, library.importUri); - } else if (uri.scheme == SourceLibraryBuilder.MALFORMED_URI_SCHEME) { + } else if (fileUri.scheme == SourceLibraryBuilder.MALFORMED_URI_SCHEME) { library.addProblemAtAccessors(messageExpectedUri); bytes = synthesizeSourceForMissingFile(library.importUri, null); } @@ -230,7 +230,7 @@ class SourceLoader extends Loader { Uint8List zeroTerminatedBytes = new Uint8List(bytes.length + 1); zeroTerminatedBytes.setRange(0, bytes.length, bytes); bytes = zeroTerminatedBytes; - sourceBytes[uri] = bytes; + sourceBytes[fileUri] = bytes; } } @@ -239,30 +239,44 @@ class SourceLoader extends Loader { // system. List rawBytes; try { - rawBytes = await fileSystem.entityForUri(uri).readAsBytes(); + rawBytes = await fileSystem.entityForUri(fileUri).readAsBytes(); } on FileSystemException catch (e) { - Message message = templateCantReadFile.withArguments(uri, e.message); + Message message = + templateCantReadFile.withArguments(fileUri, e.message); library.addProblemAtAccessors(message); rawBytes = synthesizeSourceForMissingFile(library.importUri, message); } Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1); zeroTerminatedBytes.setRange(0, rawBytes.length, rawBytes); bytes = zeroTerminatedBytes; - sourceBytes[uri] = bytes; + sourceBytes[fileUri] = bytes; byteCount += rawBytes.length; } ScannerResult result = scan(bytes, includeComments: includeComments, configuration: new ScannerConfiguration( - enableTripleShift: library.enableTripleShiftInLibrary, - enableExtensionMethods: library.enableExtensionMethodsInLibrary, - enableNonNullable: library.enableNonNullableInLibrary), + enableTripleShift: target.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.tripleShift, + library.importUri, + library.packageLanguageVersion.version), + enableExtensionMethods: + target.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.extensionMethods, + library.importUri, + library.packageLanguageVersion.version), + enableNonNullable: target.isExperimentEnabledInLibraryByVersion( + ExperimentalFlag.nonNullable, + library.importUri, + library.packageLanguageVersion.version) && + !SourceLibraryBuilder.isOptOutTest(library.importUri)), languageVersionChanged: (Scanner scanner, LanguageVersionToken version) { if (!suppressLexicalErrors) { - library.setLanguageVersion(new Version(version.major, version.minor), - offset: version.offset, length: version.length, explicit: true); + library.registerExplicitLanguageVersion( + new Version(version.major, version.minor), + offset: version.offset, + length: version.length); } scanner.configuration = new ScannerConfiguration( enableTripleShift: library.enableTripleShiftInLibrary, @@ -295,7 +309,7 @@ class SourceLoader extends Loader { if (!suppressLexicalErrors) { ErrorToken error = token; library.addProblem(error.assertionMessage, offsetForToken(token), - lengthForToken(token), uri); + lengthForToken(token), fileUri); } token = token.next; } diff --git a/pkg/front_end/lib/src/fasta/target_implementation.dart b/pkg/front_end/lib/src/fasta/target_implementation.dart index 8acd6b83492..2b29da2f6e0 100644 --- a/pkg/front_end/lib/src/fasta/target_implementation.dart +++ b/pkg/front_end/lib/src/fasta/target_implementation.dart @@ -17,6 +17,7 @@ import '../base/processed_options.dart' show ProcessedOptions; import 'builder/class_builder.dart'; import 'builder/library_builder.dart'; import 'builder/member_builder.dart'; +import 'source/source_library_builder.dart' show LanguageVersion; import 'compiler_context.dart' show CompilerContext; @@ -66,6 +67,12 @@ abstract class TargetImplementation extends Target { return _options.getExperimentEnabledVersionInLibrary(flag, importUri); } + bool isExperimentEnabledInLibraryByVersion( + ExperimentalFlag flag, Uri importUri, Version version) { + return _options.isExperimentEnabledInLibraryByVersion( + flag, importUri, version); + } + /// Returns `true` if the [flag] is enabled by default. bool isExperimentEnabledByDefault(ExperimentalFlag flag) { return _options.isExperimentEnabledByDefault(flag); @@ -100,10 +107,15 @@ abstract class TargetImplementation extends Target { /// For libraries with a 'package:' [importUri], the package path must match /// the path in the [importUri]. For libraries with a 'dart:' [importUri] the /// [packageUri] must be `null`. + /// + /// [packageLanguageVersion] is the language version defined by the package + /// which the library belongs to, or the current sdk version if the library + /// doesn't belong to a package. LibraryBuilder createLibraryBuilder( Uri uri, Uri fileUri, Uri packageUri, + LanguageVersion packageLanguageVersion, covariant LibraryBuilder origin, Library referencesFrom, bool referenceIsPartOwner); diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status index cebc0ac429d..17b04d67226 100644 --- a/pkg/front_end/messages.status +++ b/pkg/front_end/messages.status @@ -786,6 +786,7 @@ UndefinedExtensionOperator/analyzerCode: Fail UndefinedExtensionOperator/example: Fail UndefinedExtensionSetter/analyzerCode: Fail UndefinedExtensionSetter/example: Fail +UnexpectedModifierInNonNnbd/part_wrapped_script: Fail # Test requires @dart= annotation UnexpectedToken/part_wrapped_script1: Fail UnexpectedToken/script1: Fail UnmatchedToken/part_wrapped_script1: Fail diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml index 9525c92a204..55991939c15 100644 --- a/pkg/front_end/messages.yaml +++ b/pkg/front_end/messages.yaml @@ -5029,8 +5029,9 @@ UnexpectedModifierInNonNnbd: template: "The modifier '#lexeme' is only available in null safe libraries." exampleAllowMoreCodes: true analyzerCode: UNEXPECTED_TOKEN - script: - - "late int x;" + script: | + // @dart=2.9 + late int x; CompilingWithSoundNullSafety: template: "Compiling with sound null safety" diff --git a/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart b/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart index 85cce5b85d6..d95cf7521b7 100644 --- a/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart +++ b/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart @@ -107,6 +107,7 @@ test( bool hadDiagnostic = false; options.onDiagnostic = (DiagnosticMessage message) { + print(message.plainTextFormatted); hadDiagnostic = true; }; diff --git a/pkg/front_end/test/fasta/generator_to_string_test.dart b/pkg/front_end/test/fasta/generator_to_string_test.dart index 88b61464e9c..c1d32eb1e3d 100644 --- a/pkg/front_end/test/fasta/generator_to_string_test.dart +++ b/pkg/front_end/test/fasta/generator_to_string_test.dart @@ -27,7 +27,8 @@ import 'package:kernel/ast.dart' TypeParameter, VariableDeclaration, VariableGet, - VoidType; + VoidType, + defaultLanguageVersion; import 'package:kernel/target/targets.dart' show NoneTarget, TargetFlags; @@ -53,7 +54,7 @@ import 'package:front_end/src/fasta/kernel/expression_generator.dart'; import 'package:front_end/src/fasta/kernel/body_builder.dart' show BodyBuilder; import 'package:front_end/src/fasta/source/source_library_builder.dart' - show SourceLibraryBuilder; + show ImplicitLanguageVersion, SourceLibraryBuilder; void check(String expected, Generator generator) { Expect.stringEquals(expected, "$generator"); @@ -74,6 +75,7 @@ main() async { uri, uri, /*packageUri*/ null, + new ImplicitLanguageVersion(defaultLanguageVersion), new KernelTarget( null, false, diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart index cc1f967ec87..04a3d28752a 100644 --- a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart @@ -1,7 +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. -// @dart=2.9 + const int shiftNegative1 = 2 << -1; const int shiftNegative2 = 2 >>> -1; const int shiftNegative3 = 2 >> -1; @@ -23,7 +23,6 @@ const int binaryAnd = 63 & 106; const int binaryXor = 63 ^ 21; const int binaryShift1 = 21 << 1; -// These aren't currently defined on int :(. const int binaryShift2 = 84 >>> 1; const int binaryShift3 = 21 >>> 64; @@ -36,7 +35,8 @@ const bool binaryGreater = 42 > 42; const int doubleTruncateDiv = 84.2 ~/ 2; const int doubleTruncateDivZero = 84.2 ~/ 0; -const int doubleTruncateDivNull = 84.2 ~/ null; +const dynamic nil = null; +const int doubleTruncateDivNull = 84.2 ~/ nil; const double doubleNan = 0/0; const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.textual_outline.expect index 4be3a27f3f3..4a2cf37cfd6 100644 --- a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.textual_outline.expect +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.textual_outline.expect @@ -1,4 +1,3 @@ -// @dart = 2.9 const int shiftNegative1 = 2 << -1; const int shiftNegative2 = 2 >>> -1; const int shiftNegative3 = 2 >> -1; @@ -28,7 +27,8 @@ const bool binaryGreaterEqual = 42 >= 42; const bool binaryGreater = 42 > 42; const int doubleTruncateDiv = 84.2 ~/ 2; const int doubleTruncateDivZero = 84.2 ~/ 0; -const int doubleTruncateDivNull = 84.2 ~/ null; +const dynamic nil = null; +const int doubleTruncateDivNull = 84.2 ~/ nil; const double doubleNan = 0/0; const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; const int bigNumber = 0x8000000000000000; diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.expect index bb1a380e8e9..e2269a8f189 100644 --- a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.expect +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -61,24 +61,24 @@ library; // const int intdivZero = 2 ~/ 0; // ^ // -// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Error: Constant evaluation error: +// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:37:40: Error: Constant evaluation error: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:37:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:11: Context: While analyzing: +// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:37:11: Context: While analyzing: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ // // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Error: Constant evaluation error: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:11: Context: While analyzing: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:39: Error: Constant evaluation error: @@ -94,43 +94,44 @@ library; import self as self; import "dart:core" as core; -static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'."; -static const field core::int* shiftNegative2 = invalid-expression "Binary operator '>>>' on '2.0' requires non-negative operand, but was '-1.0'."; -static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'."; -static const field core::int* modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'."; -static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +static const field core::int shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int shiftNegative2 = invalid-expression "Binary operator '>>>' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. const int divZero = 2 / 0; ^"; -static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'."; -static const field core::int* unaryMinus = #C1; -static const field core::int* unaryTilde = #C2; -static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed. +static const field core::int intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int unaryMinus = #C1; +static const field core::int unaryTilde = #C2; +static const field core::int unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed. const int unaryPlus = +2; ^"; -static const field core::int* binaryPlus = #C3; -static const field core::int* binaryMinus = #C3; -static const field core::int* binaryTimes = #C3; -static const field core::double* binaryDiv = #C3; -static const field core::int* binaryTildeDiv = #C3; -static const field core::int* binaryMod = #C3; -static const field core::int* binaryOr = #C3; -static const field core::int* binaryAnd = #C3; -static const field core::int* binaryXor = #C3; -static const field core::int* binaryShift1 = #C3; -static const field core::int* binaryShift2 = #C3; -static const field core::int* binaryShift3 = #C4; -static const field core::int* binaryShift4 = #C3; -static const field core::int* binaryShift5 = #C5; -static const field core::bool* binaryLess = #C6; -static const field core::bool* binaryLessEqual = #C7; -static const field core::bool* binaryGreaterEqual = #C7; -static const field core::bool* binaryGreater = #C6; -static const field core::int* doubleTruncateDiv = #C3; -static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; -static const field core::double* doubleNan = #C8; -static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; -static const field core::int* bigNumber = #C9; +static const field core::int binaryPlus = #C3; +static const field core::int binaryMinus = #C3; +static const field core::int binaryTimes = #C3; +static const field core::double binaryDiv = #C3; +static const field core::int binaryTildeDiv = #C3; +static const field core::int binaryMod = #C3; +static const field core::int binaryOr = #C3; +static const field core::int binaryAnd = #C3; +static const field core::int binaryXor = #C3; +static const field core::int binaryShift1 = #C3; +static const field core::int binaryShift2 = #C3; +static const field core::int binaryShift3 = #C4; +static const field core::int binaryShift4 = #C3; +static const field core::int binaryShift5 = #C5; +static const field core::bool binaryLess = #C6; +static const field core::bool binaryLessEqual = #C7; +static const field core::bool binaryGreaterEqual = #C7; +static const field core::bool binaryGreater = #C6; +static const field core::int doubleTruncateDiv = #C3; +static const field core::int doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field dynamic nil = #C8; +static const field core::int doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double doubleNan = #C9; +static const field core::int doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static const field core::int bigNumber = #C10; static method main() → dynamic {} constants { @@ -141,6 +142,7 @@ constants { #C5 = 4294967295.0 #C6 = false #C7 = true - #C8 = NaN - #C9 = 9223372036854776000.0 + #C8 = null + #C9 = NaN + #C10 = 9223372036854776000.0 } diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.outline.expect index 3efcc8e5d0e..2aa115cc6f3 100644 --- a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.outline.expect +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.outline.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -14,43 +14,44 @@ library; import self as self; import "dart:core" as core; -static const field core::int* shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}(){() →* core::int*}){(core::int*) →* core::int*}; -static const field core::int* shiftNegative2 = 2.{core::int::>>>}(1.{core::int::unary-}(){() →* core::int*}){(core::int*) →* core::int*}; -static const field core::int* shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}(){() →* core::int*}){(core::int*) →* core::int*}; -static const field core::int* modZero = 2.{core::num::%}(0){(core::num*) →* core::int*}; -static const field core::int* divZero = let final Never* #t1 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +static const field core::int shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}(){() → core::int}){(core::int) → core::int}; +static const field core::int shiftNegative2 = 2.{core::int::>>>}(1.{core::int::unary-}(){() → core::int}){(core::int) → core::int}; +static const field core::int shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}(){() → core::int}){(core::int) → core::int}; +static const field core::int modZero = 2.{core::num::%}(0){(core::num) → core::int}; +static const field core::int divZero = let final Never #t1 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. const int divZero = 2 / 0; - ^" in 2.{core::num::/}(0){(core::num*) →* core::double*} as{TypeError} core::int*; -static const field core::int* intdivZero = 2.{core::num::~/}(0){(core::num*) →* core::int*}; -static const field core::int* unaryMinus = 2.{core::int::unary-}(){() →* core::int*}; -static const field core::int* unaryTilde = 2.{core::int::~}(){() →* core::int*}; -static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed. + ^" in 2.{core::num::/}(0){(core::num) → core::double} as{TypeError,ForNonNullableByDefault} core::int; +static const field core::int intdivZero = 2.{core::num::~/}(0){(core::num) → core::int}; +static const field core::int unaryMinus = 2.{core::int::unary-}(){() → core::int}; +static const field core::int unaryTilde = 2.{core::int::~}(){() → core::int}; +static const field core::int unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed. const int unaryPlus = +2; - ^"{dynamic}.+(2) as{TypeError,ForDynamic} core::int*; -static const field core::int* binaryPlus = 40.{core::num::+}(2){(core::num*) →* core::int*}; -static const field core::int* binaryMinus = 44.{core::num::-}(2){(core::num*) →* core::int*}; -static const field core::int* binaryTimes = 21.{core::num::*}(2){(core::num*) →* core::int*}; -static const field core::double* binaryDiv = 84.{core::num::/}(2){(core::num*) →* core::double*}; -static const field core::int* binaryTildeDiv = 84.{core::num::~/}(2){(core::num*) →* core::int*}; -static const field core::int* binaryMod = 85.{core::num::%}(43){(core::num*) →* core::int*}; -static const field core::int* binaryOr = 32.{core::int::|}(10){(core::int*) →* core::int*}; -static const field core::int* binaryAnd = 63.{core::int::&}(106){(core::int*) →* core::int*}; -static const field core::int* binaryXor = 63.{core::int::^}(21){(core::int*) →* core::int*}; -static const field core::int* binaryShift1 = 21.{core::int::<<}(1){(core::int*) →* core::int*}; -static const field core::int* binaryShift2 = 84.{core::int::>>>}(1){(core::int*) →* core::int*}; -static const field core::int* binaryShift3 = 21.{core::int::>>>}(64){(core::int*) →* core::int*}; -static const field core::int* binaryShift4 = 84.{core::int::>>}(1){(core::int*) →* core::int*}; -static const field core::int* binaryShift5 = 1.{core::int::unary-}(){() →* core::int*}.{core::int::>>}(1){(core::int*) →* core::int*}; -static const field core::bool* binaryLess = 42.{core::num::<}(42){(core::num*) →* core::bool*}; -static const field core::bool* binaryLessEqual = 42.{core::num::<=}(42){(core::num*) →* core::bool*}; -static const field core::bool* binaryGreaterEqual = 42.{core::num::>=}(42){(core::num*) →* core::bool*}; -static const field core::bool* binaryGreater = 42.{core::num::>}(42){(core::num*) →* core::bool*}; -static const field core::int* doubleTruncateDiv = 84.2.{core::double::~/}(2){(core::num*) →* core::int*}; -static const field core::int* doubleTruncateDivZero = 84.2.{core::double::~/}(0){(core::num*) →* core::int*}; -static const field core::int* doubleTruncateDivNull = 84.2.{core::double::~/}(null){(core::num*) →* core::int*}; -static const field core::double* doubleNan = 0.{core::num::/}(0){(core::num*) →* core::double*}; -static const field core::int* doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan){(core::num*) →* core::int*}; -static const field core::int* bigNumber = -9223372036854775808; + ^"{dynamic}.+(2) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int; +static const field core::int binaryPlus = 40.{core::num::+}(2){(core::num) → core::int}; +static const field core::int binaryMinus = 44.{core::num::-}(2){(core::num) → core::int}; +static const field core::int binaryTimes = 21.{core::num::*}(2){(core::num) → core::int}; +static const field core::double binaryDiv = 84.{core::num::/}(2){(core::num) → core::double}; +static const field core::int binaryTildeDiv = 84.{core::num::~/}(2){(core::num) → core::int}; +static const field core::int binaryMod = 85.{core::num::%}(43){(core::num) → core::int}; +static const field core::int binaryOr = 32.{core::int::|}(10){(core::int) → core::int}; +static const field core::int binaryAnd = 63.{core::int::&}(106){(core::int) → core::int}; +static const field core::int binaryXor = 63.{core::int::^}(21){(core::int) → core::int}; +static const field core::int binaryShift1 = 21.{core::int::<<}(1){(core::int) → core::int}; +static const field core::int binaryShift2 = 84.{core::int::>>>}(1){(core::int) → core::int}; +static const field core::int binaryShift3 = 21.{core::int::>>>}(64){(core::int) → core::int}; +static const field core::int binaryShift4 = 84.{core::int::>>}(1){(core::int) → core::int}; +static const field core::int binaryShift5 = 1.{core::int::unary-}(){() → core::int}.{core::int::>>}(1){(core::int) → core::int}; +static const field core::bool binaryLess = 42.{core::num::<}(42){(core::num) → core::bool}; +static const field core::bool binaryLessEqual = 42.{core::num::<=}(42){(core::num) → core::bool}; +static const field core::bool binaryGreaterEqual = 42.{core::num::>=}(42){(core::num) → core::bool}; +static const field core::bool binaryGreater = 42.{core::num::>}(42){(core::num) → core::bool}; +static const field core::int doubleTruncateDiv = 84.2.{core::double::~/}(2){(core::num) → core::int}; +static const field core::int doubleTruncateDivZero = 84.2.{core::double::~/}(0){(core::num) → core::int}; +static const field dynamic nil = null; +static const field core::int doubleTruncateDivNull = 84.2.{core::double::~/}(self::nil as{TypeError,ForDynamic,ForNonNullableByDefault} core::num){(core::num) → core::int}; +static const field core::double doubleNan = 0.{core::num::/}(0){(core::num) → core::double}; +static const field core::int doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan){(core::num) → core::int}; +static const field core::int bigNumber = -9223372036854775808; static method main() → dynamic ; @@ -72,15 +73,16 @@ Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:21:25 Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:22:26 -> DoubleConstant(42.0) Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:23:26 -> DoubleConstant(42.0) Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:24:29 -> DoubleConstant(42.0) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:27:29 -> DoubleConstant(42.0) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:28:29 -> DoubleConstant(0.0) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:30:29 -> DoubleConstant(42.0) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:31:29 -> DoubleConstant(4294967295.0) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:32:28 -> BoolConstant(false) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:33:33 -> BoolConstant(true) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:34:36 -> BoolConstant(true) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:35:31 -> BoolConstant(false) -Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:37:36 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:26:29 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:27:29 -> DoubleConstant(0.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:29:29 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:30:29 -> DoubleConstant(4294967295.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:31:28 -> BoolConstant(false) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:32:33 -> BoolConstant(true) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:33:36 -> BoolConstant(true) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:34:31 -> BoolConstant(false) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:36:36 -> DoubleConstant(42.0) +Evaluated: AsExpression @ org-dartlang-testcase:///number_folds.dart:39:43 -> NullConstant(null) Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds.dart:40:27 -> DoubleConstant(NaN) Evaluated: StaticGet @ org-dartlang-testcase:///number_folds.dart:41:42 -> DoubleConstant(NaN) -Extra constant evaluation: evaluated: 39, effectively constant: 27 +Extra constant evaluation: evaluated: 40, effectively constant: 28 diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.transformed.expect index bb1a380e8e9..e2269a8f189 100644 --- a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.weak.transformed.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -61,24 +61,24 @@ library; // const int intdivZero = 2 ~/ 0; // ^ // -// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Error: Constant evaluation error: +// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:37:40: Error: Constant evaluation error: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:37:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:11: Context: While analyzing: +// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:37:11: Context: While analyzing: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ // // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Error: Constant evaluation error: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:11: Context: While analyzing: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // // pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:39: Error: Constant evaluation error: @@ -94,43 +94,44 @@ library; import self as self; import "dart:core" as core; -static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'."; -static const field core::int* shiftNegative2 = invalid-expression "Binary operator '>>>' on '2.0' requires non-negative operand, but was '-1.0'."; -static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'."; -static const field core::int* modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'."; -static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +static const field core::int shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int shiftNegative2 = invalid-expression "Binary operator '>>>' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. const int divZero = 2 / 0; ^"; -static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'."; -static const field core::int* unaryMinus = #C1; -static const field core::int* unaryTilde = #C2; -static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed. +static const field core::int intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int unaryMinus = #C1; +static const field core::int unaryTilde = #C2; +static const field core::int unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed. const int unaryPlus = +2; ^"; -static const field core::int* binaryPlus = #C3; -static const field core::int* binaryMinus = #C3; -static const field core::int* binaryTimes = #C3; -static const field core::double* binaryDiv = #C3; -static const field core::int* binaryTildeDiv = #C3; -static const field core::int* binaryMod = #C3; -static const field core::int* binaryOr = #C3; -static const field core::int* binaryAnd = #C3; -static const field core::int* binaryXor = #C3; -static const field core::int* binaryShift1 = #C3; -static const field core::int* binaryShift2 = #C3; -static const field core::int* binaryShift3 = #C4; -static const field core::int* binaryShift4 = #C3; -static const field core::int* binaryShift5 = #C5; -static const field core::bool* binaryLess = #C6; -static const field core::bool* binaryLessEqual = #C7; -static const field core::bool* binaryGreaterEqual = #C7; -static const field core::bool* binaryGreater = #C6; -static const field core::int* doubleTruncateDiv = #C3; -static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; -static const field core::double* doubleNan = #C8; -static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; -static const field core::int* bigNumber = #C9; +static const field core::int binaryPlus = #C3; +static const field core::int binaryMinus = #C3; +static const field core::int binaryTimes = #C3; +static const field core::double binaryDiv = #C3; +static const field core::int binaryTildeDiv = #C3; +static const field core::int binaryMod = #C3; +static const field core::int binaryOr = #C3; +static const field core::int binaryAnd = #C3; +static const field core::int binaryXor = #C3; +static const field core::int binaryShift1 = #C3; +static const field core::int binaryShift2 = #C3; +static const field core::int binaryShift3 = #C4; +static const field core::int binaryShift4 = #C3; +static const field core::int binaryShift5 = #C5; +static const field core::bool binaryLess = #C6; +static const field core::bool binaryLessEqual = #C7; +static const field core::bool binaryGreaterEqual = #C7; +static const field core::bool binaryGreater = #C6; +static const field core::int doubleTruncateDiv = #C3; +static const field core::int doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field dynamic nil = #C8; +static const field core::int doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double doubleNan = #C9; +static const field core::int doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static const field core::int bigNumber = #C10; static method main() → dynamic {} constants { @@ -141,6 +142,7 @@ constants { #C5 = 4294967295.0 #C6 = false #C7 = true - #C8 = NaN - #C9 = 9223372036854776000.0 + #C8 = null + #C9 = NaN + #C10 = 9223372036854776000.0 } diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart new file mode 100644 index 00000000000..90f02de9911 --- /dev/null +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart @@ -0,0 +1,44 @@ +// Copyright (c) 2021, 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.9 + +const int shiftNegative1 = 2 << -1; +const int shiftNegative3 = 2 >> -1; +const int modZero = 2 % 0; +const int divZero = 2 / 0; +const int intdivZero = 2 ~/ 0; +const int unaryMinus = -2; +const int unaryTilde = ~2; +const int unaryPlus = +2; + +const int binaryPlus = 40 + 2; +const int binaryMinus = 44 - 2; +const int binaryTimes = 21 * 2; +const double binaryDiv = 84 / 2; +const int binaryTildeDiv = 84~/ 2; +const int binaryMod = 85 % 43; +const int binaryOr = 32 | 10; +const int binaryAnd = 63 & 106; +const int binaryXor = 63 ^ 21; +const int binaryShift1 = 21 << 1; + +const int binaryShift4 = 84 >> 1; +const int binaryShift5 = -1 >> 1; +const bool binaryLess = 42 < 42; +const bool binaryLessEqual = 42 <= 42; +const bool binaryGreaterEqual = 42 >= 42; +const bool binaryGreater = 42 > 42; + +const int doubleTruncateDiv = 84.2 ~/ 2; +const int doubleTruncateDivZero = 84.2 ~/ 0; +const int doubleTruncateDivNull = 84.2 ~/ null; +const double doubleNan = 0/0; +const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; + +const int bigNumber = 0x8000000000000000; + +main() { + +} \ No newline at end of file diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.textual_outline.expect new file mode 100644 index 00000000000..7f22f68c397 --- /dev/null +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.textual_outline.expect @@ -0,0 +1,32 @@ +// @dart = 2.9 +const int shiftNegative1 = 2 << -1; +const int shiftNegative3 = 2 >> -1; +const int modZero = 2 % 0; +const int divZero = 2 / 0; +const int intdivZero = 2 ~/ 0; +const int unaryMinus = -2; +const int unaryTilde = ~2; +const int unaryPlus = +2; +const int binaryPlus = 40 + 2; +const int binaryMinus = 44 - 2; +const int binaryTimes = 21 * 2; +const double binaryDiv = 84 / 2; +const int binaryTildeDiv = 84~/ 2; +const int binaryMod = 85 % 43; +const int binaryOr = 32 | 10; +const int binaryAnd = 63 & 106; +const int binaryXor = 63 ^ 21; +const int binaryShift1 = 21 << 1; +const int binaryShift4 = 84 >> 1; +const int binaryShift5 = -1 >> 1; +const bool binaryLess = 42 < 42; +const bool binaryLessEqual = 42 <= 42; +const bool binaryGreaterEqual = 42 >= 42; +const bool binaryGreater = 42 > 42; +const int doubleTruncateDiv = 84.2 ~/ 2; +const int doubleTruncateDivZero = 84.2 ~/ 0; +const int doubleTruncateDivNull = 84.2 ~/ null; +const double doubleNan = 0/0; +const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +const int bigNumber = 0x8000000000000000; +main() {} diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.expect new file mode 100644 index 00000000000..220b7007118 --- /dev/null +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.expect @@ -0,0 +1,132 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:14:23: Error: '+' is not a prefix operator. +// Try removing '+'. +// const int unaryPlus = +2; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +// const int divZero = 2 / 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:7:30: Error: Constant evaluation error: +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:7:30: Context: Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'. +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:7:11: Context: While analyzing: +// const int shiftNegative1 = 2 << -1; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:8:30: Error: Constant evaluation error: +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:8:30: Context: Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'. +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:8:11: Context: While analyzing: +// const int shiftNegative3 = 2 >> -1; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:9:23: Error: Constant evaluation error: +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:9:23: Context: Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'. +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:9:11: Context: While analyzing: +// const int modZero = 2 % 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:11:26: Error: Constant evaluation error: +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:11:26: Context: Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'. +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:11:11: Context: While analyzing: +// const int intdivZero = 2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:35:40: Error: Constant evaluation error: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:35:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:35:11: Context: While analyzing: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:36:40: Error: Constant evaluation error: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:36:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:36:11: Context: While analyzing: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:38:39: Error: Constant evaluation error: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:38:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN. +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:38:11: Context: While analyzing: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// +import self as self; +import "dart:core" as core; + +static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int* modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +const int divZero = 2 / 0; + ^"; +static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int* unaryMinus = #C1; +static const field core::int* unaryTilde = #C2; +static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:14:23: Error: This couldn't be parsed. +const int unaryPlus = +2; + ^"; +static const field core::int* binaryPlus = #C3; +static const field core::int* binaryMinus = #C3; +static const field core::int* binaryTimes = #C3; +static const field core::double* binaryDiv = #C3; +static const field core::int* binaryTildeDiv = #C3; +static const field core::int* binaryMod = #C3; +static const field core::int* binaryOr = #C3; +static const field core::int* binaryAnd = #C3; +static const field core::int* binaryXor = #C3; +static const field core::int* binaryShift1 = #C3; +static const field core::int* binaryShift4 = #C3; +static const field core::int* binaryShift5 = #C4; +static const field core::bool* binaryLess = #C5; +static const field core::bool* binaryLessEqual = #C6; +static const field core::bool* binaryGreaterEqual = #C6; +static const field core::bool* binaryGreater = #C5; +static const field core::int* doubleTruncateDiv = #C3; +static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double* doubleNan = #C7; +static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static const field core::int* bigNumber = #C8; +static method main() → dynamic {} + +constants { + #C1 = -2.0 + #C2 = 4294967293.0 + #C3 = 42.0 + #C4 = 4294967295.0 + #C5 = false + #C6 = true + #C7 = NaN + #C8 = 9223372036854776000.0 +} diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.outline.expect new file mode 100644 index 00000000000..92d83009ad7 --- /dev/null +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.outline.expect @@ -0,0 +1,80 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:14:23: Error: '+' is not a prefix operator. +// Try removing '+'. +// const int unaryPlus = +2; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +// const int divZero = 2 / 0; +// ^ +// +import self as self; +import "dart:core" as core; + +static const field core::int* shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}(){() →* core::int*}){(core::int*) →* core::int*}; +static const field core::int* shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}(){() →* core::int*}){(core::int*) →* core::int*}; +static const field core::int* modZero = 2.{core::num::%}(0){(core::num*) →* core::int*}; +static const field core::int* divZero = let final Never* #t1 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +const int divZero = 2 / 0; + ^" in 2.{core::num::/}(0){(core::num*) →* core::double*} as{TypeError} core::int*; +static const field core::int* intdivZero = 2.{core::num::~/}(0){(core::num*) →* core::int*}; +static const field core::int* unaryMinus = 2.{core::int::unary-}(){() →* core::int*}; +static const field core::int* unaryTilde = 2.{core::int::~}(){() →* core::int*}; +static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:14:23: Error: This couldn't be parsed. +const int unaryPlus = +2; + ^"{dynamic}.+(2) as{TypeError,ForDynamic} core::int*; +static const field core::int* binaryPlus = 40.{core::num::+}(2){(core::num*) →* core::int*}; +static const field core::int* binaryMinus = 44.{core::num::-}(2){(core::num*) →* core::int*}; +static const field core::int* binaryTimes = 21.{core::num::*}(2){(core::num*) →* core::int*}; +static const field core::double* binaryDiv = 84.{core::num::/}(2){(core::num*) →* core::double*}; +static const field core::int* binaryTildeDiv = 84.{core::num::~/}(2){(core::num*) →* core::int*}; +static const field core::int* binaryMod = 85.{core::num::%}(43){(core::num*) →* core::int*}; +static const field core::int* binaryOr = 32.{core::int::|}(10){(core::int*) →* core::int*}; +static const field core::int* binaryAnd = 63.{core::int::&}(106){(core::int*) →* core::int*}; +static const field core::int* binaryXor = 63.{core::int::^}(21){(core::int*) →* core::int*}; +static const field core::int* binaryShift1 = 21.{core::int::<<}(1){(core::int*) →* core::int*}; +static const field core::int* binaryShift4 = 84.{core::int::>>}(1){(core::int*) →* core::int*}; +static const field core::int* binaryShift5 = 1.{core::int::unary-}(){() →* core::int*}.{core::int::>>}(1){(core::int*) →* core::int*}; +static const field core::bool* binaryLess = 42.{core::num::<}(42){(core::num*) →* core::bool*}; +static const field core::bool* binaryLessEqual = 42.{core::num::<=}(42){(core::num*) →* core::bool*}; +static const field core::bool* binaryGreaterEqual = 42.{core::num::>=}(42){(core::num*) →* core::bool*}; +static const field core::bool* binaryGreater = 42.{core::num::>}(42){(core::num*) →* core::bool*}; +static const field core::int* doubleTruncateDiv = 84.2.{core::double::~/}(2){(core::num*) →* core::int*}; +static const field core::int* doubleTruncateDivZero = 84.2.{core::double::~/}(0){(core::num*) →* core::int*}; +static const field core::int* doubleTruncateDivNull = 84.2.{core::double::~/}(null){(core::num*) →* core::int*}; +static const field core::double* doubleNan = 0.{core::num::/}(0){(core::num*) →* core::double*}; +static const field core::int* doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan){(core::num*) →* core::int*}; +static const field core::int* bigNumber = -9223372036854775808; +static method main() → dynamic + ; + + +Extra constant evaluation status: +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:7:33 -> DoubleConstant(-1.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:8:33 -> DoubleConstant(-1.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:10:23 -> DoubleConstant(Infinity) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:12:24 -> DoubleConstant(-2.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:13:24 -> DoubleConstant(4294967293.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:16:27 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:17:28 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:18:28 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:19:29 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:20:30 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:21:26 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:22:25 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:23:26 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:24:26 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:25:29 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:27:29 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:28:29 -> DoubleConstant(4294967295.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:29:28 -> BoolConstant(false) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:30:33 -> BoolConstant(true) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:31:36 -> BoolConstant(true) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:32:31 -> BoolConstant(false) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:34:36 -> DoubleConstant(42.0) +Evaluated: InstanceInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:37:27 -> DoubleConstant(NaN) +Evaluated: StaticGet @ org-dartlang-testcase:///number_folds_opt_out.dart:38:42 -> DoubleConstant(NaN) +Extra constant evaluation: evaluated: 35, effectively constant: 24 diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.transformed.expect new file mode 100644 index 00000000000..220b7007118 --- /dev/null +++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart.weak.transformed.expect @@ -0,0 +1,132 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:14:23: Error: '+' is not a prefix operator. +// Try removing '+'. +// const int unaryPlus = +2; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +// const int divZero = 2 / 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:7:30: Error: Constant evaluation error: +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:7:30: Context: Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'. +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:7:11: Context: While analyzing: +// const int shiftNegative1 = 2 << -1; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:8:30: Error: Constant evaluation error: +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:8:30: Context: Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'. +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:8:11: Context: While analyzing: +// const int shiftNegative3 = 2 >> -1; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:9:23: Error: Constant evaluation error: +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:9:23: Context: Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'. +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:9:11: Context: While analyzing: +// const int modZero = 2 % 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:11:26: Error: Constant evaluation error: +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:11:26: Context: Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'. +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:11:11: Context: While analyzing: +// const int intdivZero = 2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:35:40: Error: Constant evaluation error: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:35:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:35:11: Context: While analyzing: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:36:40: Error: Constant evaluation error: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:36:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:36:11: Context: While analyzing: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:38:39: Error: Constant evaluation error: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:38:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN. +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:38:11: Context: While analyzing: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// +import self as self; +import "dart:core" as core; + +static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'."; +static const field core::int* modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +const int divZero = 2 / 0; + ^"; +static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'."; +static const field core::int* unaryMinus = #C1; +static const field core::int* unaryTilde = #C2; +static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds_opt_out.dart:14:23: Error: This couldn't be parsed. +const int unaryPlus = +2; + ^"; +static const field core::int* binaryPlus = #C3; +static const field core::int* binaryMinus = #C3; +static const field core::int* binaryTimes = #C3; +static const field core::double* binaryDiv = #C3; +static const field core::int* binaryTildeDiv = #C3; +static const field core::int* binaryMod = #C3; +static const field core::int* binaryOr = #C3; +static const field core::int* binaryAnd = #C3; +static const field core::int* binaryXor = #C3; +static const field core::int* binaryShift1 = #C3; +static const field core::int* binaryShift4 = #C3; +static const field core::int* binaryShift5 = #C4; +static const field core::bool* binaryLess = #C5; +static const field core::bool* binaryLessEqual = #C6; +static const field core::bool* binaryGreaterEqual = #C6; +static const field core::bool* binaryGreater = #C5; +static const field core::int* doubleTruncateDiv = #C3; +static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double* doubleNan = #C7; +static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static const field core::int* bigNumber = #C8; +static method main() → dynamic {} + +constants { + #C1 = -2.0 + #C2 = 4294967293.0 + #C3 = 42.0 + #C4 = 4294967295.0 + #C5 = false + #C6 = true + #C7 = NaN + #C8 = 9223372036854776000.0 +} diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart b/pkg/front_end/testcases/general/constants/number_folds.dart index a905108b473..1a455796a11 100644 --- a/pkg/front_end/testcases/general/constants/number_folds.dart +++ b/pkg/front_end/testcases/general/constants/number_folds.dart @@ -1,7 +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. -// @dart=2.9 + const int shiftNegative1 = 2 << -1; const int shiftNegative2 = 2 >>> -1; const int shiftNegative3 = 2 >> -1; @@ -23,7 +23,6 @@ const int binaryAnd = 63 & 106; const int binaryXor = 63 ^ 21; const int binaryShift1 = 21 << 1; -// These aren't currently defined on int :(. const int binaryShift2 = 84 >>> 1; const int binaryShift3 = 21 >>> 64; @@ -35,7 +34,8 @@ const bool binaryGreater = 42 > 42; const int doubleTruncateDiv = 84.2 ~/ 2; const int doubleTruncateDivZero = 84.2 ~/ 0; -const int doubleTruncateDivNull = 84.2 ~/ null; +const dynamic nil = null; +const int doubleTruncateDivNull = 84.2 ~/ nil; const double doubleNan = 0/0; const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.textual_outline.expect index 2491b0ab9db..025ab900a72 100644 --- a/pkg/front_end/testcases/general/constants/number_folds.dart.textual_outline.expect +++ b/pkg/front_end/testcases/general/constants/number_folds.dart.textual_outline.expect @@ -1,4 +1,3 @@ -// @dart = 2.9 const int shiftNegative1 = 2 << -1; const int shiftNegative2 = 2 >>> -1; const int shiftNegative3 = 2 >> -1; @@ -27,7 +26,8 @@ const bool binaryGreaterEqual = 42 >= 42; const bool binaryGreater = 42 > 42; const int doubleTruncateDiv = 84.2 ~/ 2; const int doubleTruncateDivZero = 84.2 ~/ 0; -const int doubleTruncateDivNull = 84.2 ~/ null; +const dynamic nil = null; +const int doubleTruncateDivNull = 84.2 ~/ nil; const double doubleNan = 0/0; const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; main() {} diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.weak.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.weak.expect index dc5a80f966f..6de8923fa49 100644 --- a/pkg/front_end/testcases/general/constants/number_folds.dart.weak.expect +++ b/pkg/front_end/testcases/general/constants/number_folds.dart.weak.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -61,24 +61,24 @@ library; // const int intdivZero = 2 ~/ 0; // ^ // -// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Error: Constant evaluation error: +// pkg/front_end/testcases/general/constants/number_folds.dart:36:40: Error: Constant evaluation error: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// pkg/front_end/testcases/general/constants/number_folds.dart:36:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/number_folds.dart:37:11: Context: While analyzing: +// pkg/front_end/testcases/general/constants/number_folds.dart:36:11: Context: While analyzing: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ // // pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Error: Constant evaluation error: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/number_folds.dart:38:11: Context: While analyzing: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // // pkg/front_end/testcases/general/constants/number_folds.dart:40:39: Error: Constant evaluation error: @@ -94,41 +94,42 @@ library; import self as self; import "dart:core" as core; -static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'."; -static const field core::int* shiftNegative2 = invalid-expression "Binary operator '>>>' on '2' requires non-negative operand, but was '-1'."; -static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'."; -static const field core::int* modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +static const field core::int shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'."; +static const field core::int shiftNegative2 = invalid-expression "Binary operator '>>>' on '2' requires non-negative operand, but was '-1'."; +static const field core::int shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'."; +static const field core::int modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. const int divZero = 2 / 0; ^"; -static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* unaryMinus = #C1; -static const field core::int* unaryTilde = #C2; -static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed. +static const field core::int intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int unaryMinus = #C1; +static const field core::int unaryTilde = #C2; +static const field core::int unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed. const int unaryPlus = +2; ^"; -static const field core::int* binaryPlus = #C3; -static const field core::int* binaryMinus = #C3; -static const field core::int* binaryTimes = #C3; -static const field core::double* binaryDiv = #C4; -static const field core::int* binaryTildeDiv = #C3; -static const field core::int* binaryMod = #C3; -static const field core::int* binaryOr = #C3; -static const field core::int* binaryAnd = #C3; -static const field core::int* binaryXor = #C3; -static const field core::int* binaryShift1 = #C3; -static const field core::int* binaryShift2 = #C3; -static const field core::int* binaryShift3 = #C5; -static const field core::int* binaryShift4 = #C3; -static const field core::bool* binaryLess = #C6; -static const field core::bool* binaryLessEqual = #C7; -static const field core::bool* binaryGreaterEqual = #C7; -static const field core::bool* binaryGreater = #C6; -static const field core::int* doubleTruncateDiv = #C3; -static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; -static const field core::double* doubleNan = #C8; -static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static const field core::int binaryPlus = #C3; +static const field core::int binaryMinus = #C3; +static const field core::int binaryTimes = #C3; +static const field core::double binaryDiv = #C4; +static const field core::int binaryTildeDiv = #C3; +static const field core::int binaryMod = #C3; +static const field core::int binaryOr = #C3; +static const field core::int binaryAnd = #C3; +static const field core::int binaryXor = #C3; +static const field core::int binaryShift1 = #C3; +static const field core::int binaryShift2 = #C3; +static const field core::int binaryShift3 = #C5; +static const field core::int binaryShift4 = #C3; +static const field core::bool binaryLess = #C6; +static const field core::bool binaryLessEqual = #C7; +static const field core::bool binaryGreaterEqual = #C7; +static const field core::bool binaryGreater = #C6; +static const field core::int doubleTruncateDiv = #C3; +static const field core::int doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field dynamic nil = #C8; +static const field core::int doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double doubleNan = #C9; +static const field core::int doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; static method main() → dynamic {} constants { @@ -139,5 +140,6 @@ constants { #C5 = 0 #C6 = false #C7 = true - #C8 = NaN + #C8 = null + #C9 = NaN } diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.weak.outline.expect index 844245f6b14..83af03a2fbc 100644 --- a/pkg/front_end/testcases/general/constants/number_folds.dart.weak.outline.expect +++ b/pkg/front_end/testcases/general/constants/number_folds.dart.weak.outline.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -14,41 +14,42 @@ library; import self as self; import "dart:core" as core; -static const field core::int* shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}()); -static const field core::int* shiftNegative2 = 2.{core::int::>>>}(1.{core::int::unary-}()); -static const field core::int* shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}()); -static const field core::int* modZero = 2.{core::num::%}(0); -static const field core::int* divZero = let final Never* #t1 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +static const field core::int shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}()); +static const field core::int shiftNegative2 = 2.{core::int::>>>}(1.{core::int::unary-}()); +static const field core::int shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}()); +static const field core::int modZero = 2.{core::num::%}(0); +static const field core::int divZero = let final Never #t1 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. const int divZero = 2 / 0; - ^" in 2.{core::num::/}(0) as{TypeError} core::int*; -static const field core::int* intdivZero = 2.{core::num::~/}(0); -static const field core::int* unaryMinus = 2.{core::int::unary-}(); -static const field core::int* unaryTilde = 2.{core::int::~}(); -static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed. + ^" in 2.{core::num::/}(0) as{TypeError,ForNonNullableByDefault} core::int; +static const field core::int intdivZero = 2.{core::num::~/}(0); +static const field core::int unaryMinus = 2.{core::int::unary-}(); +static const field core::int unaryTilde = 2.{core::int::~}(); +static const field core::int unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed. const int unaryPlus = +2; - ^".+(2) as{TypeError,ForDynamic} core::int*; -static const field core::int* binaryPlus = 40.{core::num::+}(2); -static const field core::int* binaryMinus = 44.{core::num::-}(2); -static const field core::int* binaryTimes = 21.{core::num::*}(2); -static const field core::double* binaryDiv = 84.{core::num::/}(2); -static const field core::int* binaryTildeDiv = 84.{core::num::~/}(2); -static const field core::int* binaryMod = 85.{core::num::%}(43); -static const field core::int* binaryOr = 32.{core::int::|}(10); -static const field core::int* binaryAnd = 63.{core::int::&}(106); -static const field core::int* binaryXor = 63.{core::int::^}(21); -static const field core::int* binaryShift1 = 21.{core::int::<<}(1); -static const field core::int* binaryShift2 = 84.{core::int::>>>}(1); -static const field core::int* binaryShift3 = 21.{core::int::>>>}(64); -static const field core::int* binaryShift4 = 84.{core::int::>>}(1); -static const field core::bool* binaryLess = 42.{core::num::<}(42); -static const field core::bool* binaryLessEqual = 42.{core::num::<=}(42); -static const field core::bool* binaryGreaterEqual = 42.{core::num::>=}(42); -static const field core::bool* binaryGreater = 42.{core::num::>}(42); -static const field core::int* doubleTruncateDiv = 84.2.{core::double::~/}(2); -static const field core::int* doubleTruncateDivZero = 84.2.{core::double::~/}(0); -static const field core::int* doubleTruncateDivNull = 84.2.{core::double::~/}(null); -static const field core::double* doubleNan = 0.{core::num::/}(0); -static const field core::int* doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan); + ^".+(2) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int; +static const field core::int binaryPlus = 40.{core::num::+}(2); +static const field core::int binaryMinus = 44.{core::num::-}(2); +static const field core::int binaryTimes = 21.{core::num::*}(2); +static const field core::double binaryDiv = 84.{core::num::/}(2); +static const field core::int binaryTildeDiv = 84.{core::num::~/}(2); +static const field core::int binaryMod = 85.{core::num::%}(43); +static const field core::int binaryOr = 32.{core::int::|}(10); +static const field core::int binaryAnd = 63.{core::int::&}(106); +static const field core::int binaryXor = 63.{core::int::^}(21); +static const field core::int binaryShift1 = 21.{core::int::<<}(1); +static const field core::int binaryShift2 = 84.{core::int::>>>}(1); +static const field core::int binaryShift3 = 21.{core::int::>>>}(64); +static const field core::int binaryShift4 = 84.{core::int::>>}(1); +static const field core::bool binaryLess = 42.{core::num::<}(42); +static const field core::bool binaryLessEqual = 42.{core::num::<=}(42); +static const field core::bool binaryGreaterEqual = 42.{core::num::>=}(42); +static const field core::bool binaryGreater = 42.{core::num::>}(42); +static const field core::int doubleTruncateDiv = 84.2.{core::double::~/}(2); +static const field core::int doubleTruncateDivZero = 84.2.{core::double::~/}(0); +static const field dynamic nil = null; +static const field core::int doubleTruncateDivNull = 84.2.{core::double::~/}(self::nil as{TypeError,ForDynamic,ForNonNullableByDefault} core::num); +static const field core::double doubleNan = 0.{core::num::/}(0); +static const field core::int doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan); static method main() → dynamic ; @@ -70,14 +71,15 @@ Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:21:25 - Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:22:26 -> IntConstant(42) Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:23:26 -> IntConstant(42) Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:24:29 -> IntConstant(42) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:27:29 -> IntConstant(42) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:28:29 -> IntConstant(0) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:30:29 -> IntConstant(42) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:31:28 -> BoolConstant(false) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:32:33 -> BoolConstant(true) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:33:36 -> BoolConstant(true) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:34:31 -> BoolConstant(false) -Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:36:36 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:26:29 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:27:29 -> IntConstant(0) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:29:29 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:30:28 -> BoolConstant(false) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:31:33 -> BoolConstant(true) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:32:36 -> BoolConstant(true) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:33:31 -> BoolConstant(false) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:35:36 -> IntConstant(42) +Evaluated: AsExpression @ org-dartlang-testcase:///number_folds.dart:38:43 -> NullConstant(null) Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds.dart:39:27 -> DoubleConstant(NaN) Evaluated: StaticGet @ org-dartlang-testcase:///number_folds.dart:40:42 -> DoubleConstant(NaN) -Extra constant evaluation: evaluated: 38, effectively constant: 26 +Extra constant evaluation: evaluated: 39, effectively constant: 27 diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.weak.transformed.expect index dc5a80f966f..6de8923fa49 100644 --- a/pkg/front_end/testcases/general/constants/number_folds.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/general/constants/number_folds.dart.weak.transformed.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -61,24 +61,24 @@ library; // const int intdivZero = 2 ~/ 0; // ^ // -// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Error: Constant evaluation error: +// pkg/front_end/testcases/general/constants/number_folds.dart:36:40: Error: Constant evaluation error: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// pkg/front_end/testcases/general/constants/number_folds.dart:36:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ -// pkg/front_end/testcases/general/constants/number_folds.dart:37:11: Context: While analyzing: +// pkg/front_end/testcases/general/constants/number_folds.dart:36:11: Context: While analyzing: // const int doubleTruncateDivZero = 84.2 ~/ 0; // ^ // // pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Error: Constant evaluation error: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // pkg/front_end/testcases/general/constants/number_folds.dart:38:11: Context: While analyzing: -// const int doubleTruncateDivNull = 84.2 ~/ null; +// const int doubleTruncateDivNull = 84.2 ~/ nil; // ^ // // pkg/front_end/testcases/general/constants/number_folds.dart:40:39: Error: Constant evaluation error: @@ -94,41 +94,42 @@ library; import self as self; import "dart:core" as core; -static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'."; -static const field core::int* shiftNegative2 = invalid-expression "Binary operator '>>>' on '2' requires non-negative operand, but was '-1'."; -static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'."; -static const field core::int* modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +static const field core::int shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'."; +static const field core::int shiftNegative2 = invalid-expression "Binary operator '>>>' on '2' requires non-negative operand, but was '-1'."; +static const field core::int shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'."; +static const field core::int modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. const int divZero = 2 / 0; ^"; -static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* unaryMinus = #C1; -static const field core::int* unaryTilde = #C2; -static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed. +static const field core::int intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int unaryMinus = #C1; +static const field core::int unaryTilde = #C2; +static const field core::int unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed. const int unaryPlus = +2; ^"; -static const field core::int* binaryPlus = #C3; -static const field core::int* binaryMinus = #C3; -static const field core::int* binaryTimes = #C3; -static const field core::double* binaryDiv = #C4; -static const field core::int* binaryTildeDiv = #C3; -static const field core::int* binaryMod = #C3; -static const field core::int* binaryOr = #C3; -static const field core::int* binaryAnd = #C3; -static const field core::int* binaryXor = #C3; -static const field core::int* binaryShift1 = #C3; -static const field core::int* binaryShift2 = #C3; -static const field core::int* binaryShift3 = #C5; -static const field core::int* binaryShift4 = #C3; -static const field core::bool* binaryLess = #C6; -static const field core::bool* binaryLessEqual = #C7; -static const field core::bool* binaryGreaterEqual = #C7; -static const field core::bool* binaryGreater = #C6; -static const field core::int* doubleTruncateDiv = #C3; -static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; -static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; -static const field core::double* doubleNan = #C8; -static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static const field core::int binaryPlus = #C3; +static const field core::int binaryMinus = #C3; +static const field core::int binaryTimes = #C3; +static const field core::double binaryDiv = #C4; +static const field core::int binaryTildeDiv = #C3; +static const field core::int binaryMod = #C3; +static const field core::int binaryOr = #C3; +static const field core::int binaryAnd = #C3; +static const field core::int binaryXor = #C3; +static const field core::int binaryShift1 = #C3; +static const field core::int binaryShift2 = #C3; +static const field core::int binaryShift3 = #C5; +static const field core::int binaryShift4 = #C3; +static const field core::bool binaryLess = #C6; +static const field core::bool binaryLessEqual = #C7; +static const field core::bool binaryGreaterEqual = #C7; +static const field core::bool binaryGreater = #C6; +static const field core::int doubleTruncateDiv = #C3; +static const field core::int doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field dynamic nil = #C8; +static const field core::int doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double doubleNan = #C9; +static const field core::int doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; static method main() → dynamic {} constants { @@ -139,5 +140,6 @@ constants { #C5 = 0 #C6 = false #C7 = true - #C8 = NaN + #C8 = null + #C9 = NaN } diff --git a/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart new file mode 100644 index 00000000000..0ad98dacccb --- /dev/null +++ b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart @@ -0,0 +1,41 @@ +// Copyright (c) 2021, 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.9 + +const int shiftNegative1 = 2 << -1; +const int shiftNegative3 = 2 >> -1; +const int modZero = 2 % 0; +const int divZero = 2 / 0; +const int intdivZero = 2 ~/ 0; +const int unaryMinus = -2; +const int unaryTilde = ~2; +const int unaryPlus = +2; + +const int binaryPlus = 40 + 2; +const int binaryMinus = 44 - 2; +const int binaryTimes = 21 * 2; +const double binaryDiv = 84 / 2; +const int binaryTildeDiv = 84~/ 2; +const int binaryMod = 85 % 43; +const int binaryOr = 32 | 10; +const int binaryAnd = 63 & 106; +const int binaryXor = 63 ^ 21; +const int binaryShift1 = 21 << 1; + +const int binaryShift4 = 84 >> 1; +const bool binaryLess = 42 < 42; +const bool binaryLessEqual = 42 <= 42; +const bool binaryGreaterEqual = 42 >= 42; +const bool binaryGreater = 42 > 42; + +const int doubleTruncateDiv = 84.2 ~/ 2; +const int doubleTruncateDivZero = 84.2 ~/ 0; +const int doubleTruncateDivNull = 84.2 ~/ null; +const double doubleNan = 0/0; +const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; + +main() { + +} \ No newline at end of file diff --git a/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.textual_outline.expect new file mode 100644 index 00000000000..128603ccd34 --- /dev/null +++ b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.textual_outline.expect @@ -0,0 +1,30 @@ +// @dart = 2.9 +const int shiftNegative1 = 2 << -1; +const int shiftNegative3 = 2 >> -1; +const int modZero = 2 % 0; +const int divZero = 2 / 0; +const int intdivZero = 2 ~/ 0; +const int unaryMinus = -2; +const int unaryTilde = ~2; +const int unaryPlus = +2; +const int binaryPlus = 40 + 2; +const int binaryMinus = 44 - 2; +const int binaryTimes = 21 * 2; +const double binaryDiv = 84 / 2; +const int binaryTildeDiv = 84~/ 2; +const int binaryMod = 85 % 43; +const int binaryOr = 32 | 10; +const int binaryAnd = 63 & 106; +const int binaryXor = 63 ^ 21; +const int binaryShift1 = 21 << 1; +const int binaryShift4 = 84 >> 1; +const bool binaryLess = 42 < 42; +const bool binaryLessEqual = 42 <= 42; +const bool binaryGreaterEqual = 42 >= 42; +const bool binaryGreater = 42 > 42; +const int doubleTruncateDiv = 84.2 ~/ 2; +const int doubleTruncateDivZero = 84.2 ~/ 0; +const int doubleTruncateDivNull = 84.2 ~/ null; +const double doubleNan = 0/0; +const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +main() {} diff --git a/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.expect b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.expect new file mode 100644 index 00000000000..44bc90e2c6c --- /dev/null +++ b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.expect @@ -0,0 +1,129 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:14:23: Error: '+' is not a prefix operator. +// Try removing '+'. +// const int unaryPlus = +2; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +// const int divZero = 2 / 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:7:30: Error: Constant evaluation error: +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:7:30: Context: Binary operator '<<' on '2' requires non-negative operand, but was '-1'. +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:7:11: Context: While analyzing: +// const int shiftNegative1 = 2 << -1; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:8:30: Error: Constant evaluation error: +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:8:30: Context: Binary operator '>>' on '2' requires non-negative operand, but was '-1'. +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:8:11: Context: While analyzing: +// const int shiftNegative3 = 2 >> -1; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:9:23: Error: Constant evaluation error: +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:9:23: Context: Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'. +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:9:11: Context: While analyzing: +// const int modZero = 2 % 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:11:26: Error: Constant evaluation error: +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:11:26: Context: Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'. +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:11:11: Context: While analyzing: +// const int intdivZero = 2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:34:40: Error: Constant evaluation error: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:34:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:34:11: Context: While analyzing: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:35:40: Error: Constant evaluation error: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:35:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:35:11: Context: While analyzing: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:37:39: Error: Constant evaluation error: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:37:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN. +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:37:11: Context: While analyzing: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// +import self as self; +import "dart:core" as core; + +static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'."; +static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'."; +static const field core::int* modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +const int divZero = 2 / 0; + ^"; +static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* unaryMinus = #C1; +static const field core::int* unaryTilde = #C2; +static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:14:23: Error: This couldn't be parsed. +const int unaryPlus = +2; + ^"; +static const field core::int* binaryPlus = #C3; +static const field core::int* binaryMinus = #C3; +static const field core::int* binaryTimes = #C3; +static const field core::double* binaryDiv = #C4; +static const field core::int* binaryTildeDiv = #C3; +static const field core::int* binaryMod = #C3; +static const field core::int* binaryOr = #C3; +static const field core::int* binaryAnd = #C3; +static const field core::int* binaryXor = #C3; +static const field core::int* binaryShift1 = #C3; +static const field core::int* binaryShift4 = #C3; +static const field core::bool* binaryLess = #C5; +static const field core::bool* binaryLessEqual = #C6; +static const field core::bool* binaryGreaterEqual = #C6; +static const field core::bool* binaryGreater = #C5; +static const field core::int* doubleTruncateDiv = #C3; +static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double* doubleNan = #C7; +static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static method main() → dynamic {} + +constants { + #C1 = -2 + #C2 = -3 + #C3 = 42 + #C4 = 42.0 + #C5 = false + #C6 = true + #C7 = NaN +} diff --git a/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.outline.expect new file mode 100644 index 00000000000..df845690edd --- /dev/null +++ b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.outline.expect @@ -0,0 +1,77 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:14:23: Error: '+' is not a prefix operator. +// Try removing '+'. +// const int unaryPlus = +2; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +// const int divZero = 2 / 0; +// ^ +// +import self as self; +import "dart:core" as core; + +static const field core::int* shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}()); +static const field core::int* shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}()); +static const field core::int* modZero = 2.{core::num::%}(0); +static const field core::int* divZero = let final Never* #t1 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +const int divZero = 2 / 0; + ^" in 2.{core::num::/}(0) as{TypeError} core::int*; +static const field core::int* intdivZero = 2.{core::num::~/}(0); +static const field core::int* unaryMinus = 2.{core::int::unary-}(); +static const field core::int* unaryTilde = 2.{core::int::~}(); +static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:14:23: Error: This couldn't be parsed. +const int unaryPlus = +2; + ^".+(2) as{TypeError,ForDynamic} core::int*; +static const field core::int* binaryPlus = 40.{core::num::+}(2); +static const field core::int* binaryMinus = 44.{core::num::-}(2); +static const field core::int* binaryTimes = 21.{core::num::*}(2); +static const field core::double* binaryDiv = 84.{core::num::/}(2); +static const field core::int* binaryTildeDiv = 84.{core::num::~/}(2); +static const field core::int* binaryMod = 85.{core::num::%}(43); +static const field core::int* binaryOr = 32.{core::int::|}(10); +static const field core::int* binaryAnd = 63.{core::int::&}(106); +static const field core::int* binaryXor = 63.{core::int::^}(21); +static const field core::int* binaryShift1 = 21.{core::int::<<}(1); +static const field core::int* binaryShift4 = 84.{core::int::>>}(1); +static const field core::bool* binaryLess = 42.{core::num::<}(42); +static const field core::bool* binaryLessEqual = 42.{core::num::<=}(42); +static const field core::bool* binaryGreaterEqual = 42.{core::num::>=}(42); +static const field core::bool* binaryGreater = 42.{core::num::>}(42); +static const field core::int* doubleTruncateDiv = 84.2.{core::double::~/}(2); +static const field core::int* doubleTruncateDivZero = 84.2.{core::double::~/}(0); +static const field core::int* doubleTruncateDivNull = 84.2.{core::double::~/}(null); +static const field core::double* doubleNan = 0.{core::num::/}(0); +static const field core::int* doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan); +static method main() → dynamic + ; + + +Extra constant evaluation status: +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:7:33 -> IntConstant(-1) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:8:33 -> IntConstant(-1) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:10:23 -> DoubleConstant(Infinity) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:12:24 -> IntConstant(-2) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:13:24 -> IntConstant(-3) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:16:27 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:17:28 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:18:28 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:19:29 -> DoubleConstant(42.0) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:20:30 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:21:26 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:22:25 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:23:26 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:24:26 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:25:29 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:27:29 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:28:28 -> BoolConstant(false) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:29:33 -> BoolConstant(true) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:30:36 -> BoolConstant(true) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:31:31 -> BoolConstant(false) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:33:36 -> IntConstant(42) +Evaluated: MethodInvocation @ org-dartlang-testcase:///number_folds_opt_out.dart:36:27 -> DoubleConstant(NaN) +Evaluated: StaticGet @ org-dartlang-testcase:///number_folds_opt_out.dart:37:42 -> DoubleConstant(NaN) +Extra constant evaluation: evaluated: 34, effectively constant: 23 diff --git a/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.transformed.expect new file mode 100644 index 00000000000..44bc90e2c6c --- /dev/null +++ b/pkg/front_end/testcases/general/constants/number_folds_opt_out.dart.weak.transformed.expect @@ -0,0 +1,129 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:14:23: Error: '+' is not a prefix operator. +// Try removing '+'. +// const int unaryPlus = +2; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +// const int divZero = 2 / 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:7:30: Error: Constant evaluation error: +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:7:30: Context: Binary operator '<<' on '2' requires non-negative operand, but was '-1'. +// const int shiftNegative1 = 2 << -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:7:11: Context: While analyzing: +// const int shiftNegative1 = 2 << -1; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:8:30: Error: Constant evaluation error: +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:8:30: Context: Binary operator '>>' on '2' requires non-negative operand, but was '-1'. +// const int shiftNegative3 = 2 >> -1; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:8:11: Context: While analyzing: +// const int shiftNegative3 = 2 >> -1; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:9:23: Error: Constant evaluation error: +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:9:23: Context: Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'. +// const int modZero = 2 % 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:9:11: Context: While analyzing: +// const int modZero = 2 % 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:11:26: Error: Constant evaluation error: +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:11:26: Context: Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'. +// const int intdivZero = 2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:11:11: Context: While analyzing: +// const int intdivZero = 2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:34:40: Error: Constant evaluation error: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:34:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'. +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:34:11: Context: While analyzing: +// const int doubleTruncateDivZero = 84.2 ~/ 0; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:35:40: Error: Constant evaluation error: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:35:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'. +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:35:11: Context: While analyzing: +// const int doubleTruncateDivNull = 84.2 ~/ null; +// ^ +// +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:37:39: Error: Constant evaluation error: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:37:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN. +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:37:11: Context: While analyzing: +// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan; +// ^ +// +import self as self; +import "dart:core" as core; + +static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'."; +static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'."; +static const field core::int* modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:10:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'. +const int divZero = 2 / 0; + ^"; +static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* unaryMinus = #C1; +static const field core::int* unaryTilde = #C2; +static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds_opt_out.dart:14:23: Error: This couldn't be parsed. +const int unaryPlus = +2; + ^"; +static const field core::int* binaryPlus = #C3; +static const field core::int* binaryMinus = #C3; +static const field core::int* binaryTimes = #C3; +static const field core::double* binaryDiv = #C4; +static const field core::int* binaryTildeDiv = #C3; +static const field core::int* binaryMod = #C3; +static const field core::int* binaryOr = #C3; +static const field core::int* binaryAnd = #C3; +static const field core::int* binaryXor = #C3; +static const field core::int* binaryShift1 = #C3; +static const field core::int* binaryShift4 = #C3; +static const field core::bool* binaryLess = #C5; +static const field core::bool* binaryLessEqual = #C6; +static const field core::bool* binaryGreaterEqual = #C6; +static const field core::bool* binaryGreater = #C5; +static const field core::int* doubleTruncateDiv = #C3; +static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'."; +static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'."; +static const field core::double* doubleNan = #C7; +static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN."; +static method main() → dynamic {} + +constants { + #C1 = -2 + #C2 = -3 + #C3 = 42 + #C4 = 42.0 + #C5 = false + #C6 = true + #C7 = NaN +} diff --git a/pkg/front_end/testcases/general/nsm_covariance.dart b/pkg/front_end/testcases/general/nsm_covariance.dart index d579d47a72d..15b27f762a0 100644 --- a/pkg/front_end/testcases/general/nsm_covariance.dart +++ b/pkg/front_end/testcases/general/nsm_covariance.dart @@ -1,7 +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.9 + import 'nsm_covariance_lib.dart'; abstract class D1 implements A, B {} diff --git a/pkg/front_end/testcases/general/nsm_covariance.dart.weak.outline.expect b/pkg/front_end/testcases/general/nsm_covariance.dart.weak.outline.expect index b434cfeef7b..0376936db4e 100644 --- a/pkg/front_end/testcases/general/nsm_covariance.dart.weak.outline.expect +++ b/pkg/front_end/testcases/general/nsm_covariance.dart.weak.outline.expect @@ -219,44 +219,44 @@ class C4 extends core::Object implements nsm::B, nsm::A { Extra constant evaluation status: -Evaluated: StaticGet @ org-dartlang-testcase:///nsm_covariance.dart:12:4 -> InstanceConstant(const _Override{}) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#_method1) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> ListConstant(const []) -Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#_method2) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> ListConstant(const []) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> ListConstant(const []) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#a) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#b) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#c) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#d) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#_method3) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> ListConstant(const []) -Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#_method4) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> ListConstant(const []) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> ListConstant(const []) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#a) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:11:7 -> SymbolConstant(#b) -Evaluated: StaticGet @ org-dartlang-testcase:///nsm_covariance.dart:17:4 -> InstanceConstant(const _Override{}) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#_method1) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> ListConstant(const []) -Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#_method2) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> ListConstant(const []) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> ListConstant(const []) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#a) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#b) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#c) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#d) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#_method3) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> ListConstant(const []) -Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#_method4) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> ListConstant(const []) -Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> ListConstant(const []) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#a) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:16:7 -> SymbolConstant(#b) +Evaluated: StaticGet @ org-dartlang-testcase:///nsm_covariance.dart:14:4 -> InstanceConstant(const _Override{}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#_method1) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> ListConstant(const []) +Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#_method2) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> ListConstant(const []) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> ListConstant(const []) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#a) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#b) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#c) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#d) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#_method3) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> ListConstant(const []) +Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#_method4) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> ListConstant(const []) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> ListConstant(const []) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#a) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:13:7 -> SymbolConstant(#b) +Evaluated: StaticGet @ org-dartlang-testcase:///nsm_covariance.dart:19:4 -> InstanceConstant(const _Override{}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#_method1) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> ListConstant(const []) +Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#_method2) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> ListConstant(const []) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> ListConstant(const []) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#a) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#b) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#c) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#d) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#_method3) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> ListConstant(const []) +Evaluated: MapLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#_method4) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> ListConstant(const []) +Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> ListConstant(const []) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#a) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance.dart:18:7 -> SymbolConstant(#b) Evaluated: StaticGet @ org-dartlang-testcase:///nsm_covariance_lib.dart:24:4 -> InstanceConstant(const _Override{}) Evaluated: SymbolLiteral @ org-dartlang-testcase:///nsm_covariance_lib.dart:23:7 -> SymbolConstant(#_method1) Evaluated: ListLiteral @ org-dartlang-testcase:///nsm_covariance_lib.dart:23:7 -> ListConstant(const []) diff --git a/pkg/front_end/testcases/incremental/remove_language_version.yaml b/pkg/front_end/testcases/incremental/remove_language_version.yaml new file mode 100644 index 00000000000..fc000e4a6ff --- /dev/null +++ b/pkg/front_end/testcases/incremental/remove_language_version.yaml @@ -0,0 +1,34 @@ +# Copyright (c) 2018, 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.md file. + +# Compile a library with an explicit language version that prohibits use of +# null safety syntax. Remove the explicit language version annotation in +# the update to check the version isn't copied over from the original +# library. + +type: newworld +worlds: + - entry: main.dart + experiments: non-nullable + errors: true + warnings: false + sources: + main.dart: | + // @dart=2.9 + main() { + int? i; + } + expectedLibraryCount: 1 + - entry: main.dart + experiments: non-nullable + invalidate: + - main.dart + errors: false + warnings: false + sources: + main.dart: | + main() { + int? i; + } + expectedLibraryCount: 1 \ No newline at end of file diff --git a/pkg/front_end/testcases/incremental/remove_language_version.yaml.world.1.expect b/pkg/front_end/testcases/incremental/remove_language_version.yaml.world.1.expect new file mode 100644 index 00000000000..033ad4814db --- /dev/null +++ b/pkg/front_end/testcases/incremental/remove_language_version.yaml.world.1.expect @@ -0,0 +1,18 @@ +main = main::main; +library from "org-dartlang-test:///main.dart" as main { +// +// Problems in library: +// +// org-dartlang-test:///main.dart:3:6: Error: Null safety features are disabled for this library. +// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher. +// int? i; +// ^ +// org-dartlang-test:///main.dart:1:1: Context: This is the annotation that opts out this library from null safety features. +// // @dart=2.9 +// ^^^^^^^^^^^^ +// + + static method main() → dynamic { + dart.core::int? i; + } +} diff --git a/pkg/front_end/testcases/incremental/remove_language_version.yaml.world.2.expect b/pkg/front_end/testcases/incremental/remove_language_version.yaml.world.2.expect new file mode 100644 index 00000000000..c699ac4b2dd --- /dev/null +++ b/pkg/front_end/testcases/incremental/remove_language_version.yaml.world.2.expect @@ -0,0 +1,7 @@ +main = main::main; +library from "org-dartlang-test:///main.dart" as main { + + static method main() → dynamic { + dart.core::int? i; + } +} diff --git a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib1.dart b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib1.dart index 1943b6e0950..c9048690df3 100644 --- a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib1.dart +++ b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib1.dart @@ -2,6 +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. -// @dart=2.5 +// @dart=2.9 class LegacyClass1 {} diff --git a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib2.dart b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib2.dart index 1723c1f69f4..c68b9f999fe 100644 --- a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib2.dart +++ b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib2.dart @@ -2,7 +2,7 @@ // 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.5 +// @dart=2.9 class LegacyClass3 {} diff --git a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib3.dart b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib3.dart index 148a8454a96..6dbe951d5a5 100644 --- a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib3.dart +++ b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib3.dart @@ -2,16 +2,14 @@ // 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.5 +// @dart=2.9 export 'export_from_opt_out_lib5.dart'; -class LegacyClass2 { -} +class LegacyClass2 {} legacyMethod1() {} -extension LegacyExtension on String { -} +extension LegacyExtension on String {} -typedef LegacyTypedef = void Function(); \ No newline at end of file +typedef LegacyTypedef = void Function(); diff --git a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib4.dart b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib4.dart index 5a7261a2be3..612326d5a47 100644 --- a/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib4.dart +++ b/pkg/front_end/testcases/nnbd_mixed/export_from_opt_out_lib4.dart @@ -2,6 +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. -// @dart=2.5 +// @dart=2.9 export 'export_from_opt_out_lib5.dart'; diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.expect index 8de447c40ad..fb500caf360 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.expect @@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/; // // Problems in library: // -// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. +// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. // FutureOr foLegacyNonNullable = null; // error // ^ @@ -21,11 +21,11 @@ import "org-dartlang-testcase:///issue41501_lib.dart"; typedef AAliasNonNullable = opt::A; typedef AAliasNullable = opt::A?; static method test() → dynamic { - FutureOrfoLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. + FutureOr<() → opt::A*>foLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foLegacyNonNullable = null; // error - ^" in null as{TypeError,ForNonNullableByDefault} FutureOr; - FutureOrfoLegacyNullable = null; + ^" in null as{TypeError,ForNonNullableByDefault} FutureOr<() → opt::A*>; + FutureOr<() →? opt::A*>foLegacyNullable = null; FutureOrfoNonNullable = let final Never #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foNonNullable = null; // error @@ -50,7 +50,7 @@ import "dart:core" as core; import "dart:async"; import "org-dartlang-testcase:///issue41501.dart"; -typedef AAlias = opt::A*; +typedef AAlias = () →* opt::A*; class A extends core::Object { synthetic constructor •() → opt::A* : super core::Object::•() @@ -67,7 +67,7 @@ class A extends core::Object { abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType } static method test() → dynamic { - FutureOr* foLegacy = null; + FutureOr<() →* opt::A*>* foLegacy = null; FutureOr* foNonNullable = null; FutureOr* foNullable = null; } diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.transformed.expect index a59394b00aa..af7457b2d86 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.strong.transformed.expect @@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/; // // Problems in library: // -// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. +// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. // FutureOr foLegacyNonNullable = null; // error // ^ @@ -21,11 +21,11 @@ import "org-dartlang-testcase:///issue41501_lib.dart"; typedef AAliasNonNullable = opt::A; typedef AAliasNullable = opt::A?; static method test() → dynamic { - FutureOrfoLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. + FutureOr<() → opt::A*>foLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foLegacyNonNullable = null; // error - ^" in let Null #t2 = null in #t2.==(null) ?{FutureOr} #t2 as{TypeError,ForNonNullableByDefault} FutureOr : #t2{FutureOr}; - FutureOrfoLegacyNullable = null; + ^" in let Null #t2 = null in #t2.==(null) ?{FutureOr<() → opt::A*>} #t2 as{TypeError,ForNonNullableByDefault} FutureOr<() → opt::A*> : #t2{FutureOr<() → opt::A*>}; + FutureOr<() →? opt::A*>foLegacyNullable = null; FutureOrfoNonNullable = let final Never #t3 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foNonNullable = null; // error @@ -50,7 +50,7 @@ import "dart:core" as core; import "dart:async"; import "org-dartlang-testcase:///issue41501.dart"; -typedef AAlias = opt::A*; +typedef AAlias = () →* opt::A*; class A extends core::Object { synthetic constructor •() → opt::A* : super core::Object::•() @@ -67,7 +67,7 @@ class A extends core::Object { abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType } static method test() → dynamic { - FutureOr* foLegacy = null; + FutureOr<() →* opt::A*>* foLegacy = null; FutureOr* foNonNullable = null; FutureOr* foNullable = null; } diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.expect index c86c3be18e5..a709e0bbd83 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.expect @@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/; // // Problems in library: // -// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. +// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. // FutureOr foLegacyNonNullable = null; // error // ^ @@ -21,11 +21,11 @@ import "org-dartlang-testcase:///issue41501_lib.dart"; typedef AAliasNonNullable = opt::A; typedef AAliasNullable = opt::A?; static method test() → dynamic { - FutureOrfoLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. + FutureOr<() → opt::A*>foLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foLegacyNonNullable = null; // error - ^" in null as{TypeError,ForNonNullableByDefault} FutureOr; - FutureOrfoLegacyNullable = null; + ^" in null as{TypeError,ForNonNullableByDefault} FutureOr<() → opt::A*>; + FutureOr<() →? opt::A*>foLegacyNullable = null; FutureOrfoNonNullable = let final Never #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foNonNullable = null; // error @@ -43,7 +43,7 @@ import "dart:core" as core; import "dart:async"; import "org-dartlang-testcase:///issue41501.dart"; -typedef AAlias = opt::A*; +typedef AAlias = () →* opt::A*; class A extends core::Object { synthetic constructor •() → opt::A* : super core::Object::•() @@ -60,7 +60,7 @@ class A extends core::Object { abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType } static method test() → dynamic { - FutureOr* foLegacy = null; + FutureOr<() →* opt::A*>* foLegacy = null; FutureOr* foNonNullable = null; FutureOr* foNullable = null; } diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.outline.expect index 1b2a115c643..da69458fdd7 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.outline.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.outline.expect @@ -19,7 +19,7 @@ import "dart:core" as core; import "dart:async"; import "org-dartlang-testcase:///issue41501.dart"; -typedef AAlias = opt::A*; +typedef AAlias = () →* opt::A*; class A extends core::Object { synthetic constructor •() → opt::A* ; diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.transformed.expect index b82561c81db..a75d47817d4 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.weak.transformed.expect @@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/; // // Problems in library: // -// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. +// pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. // FutureOr foLegacyNonNullable = null; // error // ^ @@ -21,11 +21,11 @@ import "org-dartlang-testcase:///issue41501_lib.dart"; typedef AAliasNonNullable = opt::A; typedef AAliasNullable = opt::A?; static method test() → dynamic { - FutureOrfoLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. + FutureOr<() → opt::A*>foLegacyNonNullable = let final Never #t1 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:13:42: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foLegacyNonNullable = null; // error ^" in null; - FutureOrfoLegacyNullable = null; + FutureOr<() →? opt::A*>foLegacyNullable = null; FutureOrfoNonNullable = let final Never #t2 = invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart:15:47: Error: The value 'null' can't be assigned to a variable of type 'FutureOr' because 'FutureOr' is not nullable. - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart'. FutureOr foNonNullable = null; // error @@ -43,7 +43,7 @@ import "dart:core" as core; import "dart:async"; import "org-dartlang-testcase:///issue41501.dart"; -typedef AAlias = opt::A*; +typedef AAlias = () →* opt::A*; class A extends core::Object { synthetic constructor •() → opt::A* : super core::Object::•() @@ -60,7 +60,7 @@ class A extends core::Object { abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType } static method test() → dynamic { - FutureOr* foLegacy = null; + FutureOr<() →* opt::A*>* foLegacy = null; FutureOr* foNonNullable = null; FutureOr* foNullable = null; } diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart index 09e20d1d119..e026cd922be 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501_lib.dart @@ -11,11 +11,10 @@ import 'issue41501.dart'; class A {} -typedef AAlias = A; +typedef AAlias = A Function(); test() { FutureOr foLegacy = null; // ok FutureOr foNonNullable = null; // ok FutureOr foNullable = null; // ok } - diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart similarity index 88% rename from pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart rename to pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart index 0e9dfebf76a..17fef5271ad 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart @@ -1,10 +1,12 @@ // 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.9 -import "issue_43084_lib.dart"; + +import 'issue_43084_lib.dart'; main() { Bar x = new Bar(); print(x); -} \ No newline at end of file +} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.strong.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.strong.expect new file mode 100644 index 00000000000..a8a2594009f --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.strong.expect @@ -0,0 +1,29 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety. +// // @dart=2.9 +// ^^^^^^^^^^^^ +// +import self as self; +import "issue_43084_lib.dart" as iss; +import "dart:core" as core; + +import "org-dartlang-testcase:///issue_43084_lib.dart"; + +static method main() → dynamic { + iss::Foo* x = new iss::Foo::•(); + core::print(x); +} + +library /*isNonNullableByDefault*/; +import self as iss; +import "dart:core" as core; + +typedef Bar = iss::Foo; +class Foo extends core::Object { + synthetic constructor •() → iss::Foo + : super core::Object::•() + ; +} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.strong.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.strong.transformed.expect new file mode 100644 index 00000000000..a8a2594009f --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.strong.transformed.expect @@ -0,0 +1,29 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety. +// // @dart=2.9 +// ^^^^^^^^^^^^ +// +import self as self; +import "issue_43084_lib.dart" as iss; +import "dart:core" as core; + +import "org-dartlang-testcase:///issue_43084_lib.dart"; + +static method main() → dynamic { + iss::Foo* x = new iss::Foo::•(); + core::print(x); +} + +library /*isNonNullableByDefault*/; +import self as iss; +import "dart:core" as core; + +typedef Bar = iss::Foo; +class Foo extends core::Object { + synthetic constructor •() → iss::Foo + : super core::Object::•() + ; +} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.textual_outline.expect new file mode 100644 index 00000000000..e51aa897f2f --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.textual_outline.expect @@ -0,0 +1,4 @@ +// @dart = 2.9 +import 'issue_43084_lib.dart'; + +main() {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..e51aa897f2f --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.textual_outline_modelled.expect @@ -0,0 +1,4 @@ +// @dart = 2.9 +import 'issue_43084_lib.dart'; + +main() {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.expect new file mode 100644 index 00000000000..fd22d378023 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.expect @@ -0,0 +1,22 @@ +library; +import self as self; +import "issue_43084_lib.dart" as iss; +import "dart:core" as core; + +import "org-dartlang-testcase:///issue_43084_lib.dart"; + +static method main() → dynamic { + iss::Foo* x = new iss::Foo::•(); + core::print(x); +} + +library /*isNonNullableByDefault*/; +import self as iss; +import "dart:core" as core; + +typedef Bar = iss::Foo; +class Foo extends core::Object { + synthetic constructor •() → iss::Foo + : super core::Object::•() + ; +} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.outline.expect new file mode 100644 index 00000000000..91de9ad959c --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.outline.expect @@ -0,0 +1,17 @@ +library; +import self as self; + +import "org-dartlang-testcase:///issue_43084_lib.dart"; + +static method main() → dynamic + ; + +library /*isNonNullableByDefault*/; +import self as self2; +import "dart:core" as core; + +typedef Bar = self2::Foo; +class Foo extends core::Object { + synthetic constructor •() → self2::Foo + ; +} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.transformed.expect new file mode 100644 index 00000000000..fd22d378023 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084.dart.weak.transformed.expect @@ -0,0 +1,22 @@ +library; +import self as self; +import "issue_43084_lib.dart" as iss; +import "dart:core" as core; + +import "org-dartlang-testcase:///issue_43084_lib.dart"; + +static method main() → dynamic { + iss::Foo* x = new iss::Foo::•(); + core::print(x); +} + +library /*isNonNullableByDefault*/; +import self as iss; +import "dart:core" as core; + +typedef Bar = iss::Foo; +class Foo extends core::Object { + synthetic constructor •() → iss::Foo + : super core::Object::•() + ; +} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084_lib.dart b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084_lib.dart similarity index 86% rename from pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084_lib.dart rename to pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084_lib.dart index 647ad1db7d5..75163af1831 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084_lib.dart +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/issue_43084_lib.dart @@ -1,7 +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. -// @dart=2.9 + class Foo { } diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/test.options b/pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/test.options similarity index 100% rename from pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/test.options rename to pkg/front_end/testcases/nonfunction_type_aliases/issue_43084/test.options diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart new file mode 100644 index 00000000000..932fe939e56 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.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.12 + +typedef A = int; + +void main() {} \ No newline at end of file diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.strong.expect b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.strong.expect new file mode 100644 index 00000000000..104aeb23036 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.strong.expect @@ -0,0 +1,12 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart:7:11: Error: Can't create typedef from non-function type. +// typedef A = int; +// ^ +// +import self as self; + +typedef A = invalid-type; +static method main() → void {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.strong.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.strong.transformed.expect new file mode 100644 index 00000000000..104aeb23036 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.strong.transformed.expect @@ -0,0 +1,12 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart:7:11: Error: Can't create typedef from non-function type. +// typedef A = int; +// ^ +// +import self as self; + +typedef A = invalid-type; +static method main() → void {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.textual_outline.expect new file mode 100644 index 00000000000..14f266b8bd7 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.textual_outline.expect @@ -0,0 +1,3 @@ +// @dart = 2.12 +typedef A = int; +void main() {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.expect b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.expect new file mode 100644 index 00000000000..104aeb23036 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.expect @@ -0,0 +1,12 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart:7:11: Error: Can't create typedef from non-function type. +// typedef A = int; +// ^ +// +import self as self; + +typedef A = invalid-type; +static method main() → void {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.outline.expect new file mode 100644 index 00000000000..2f9bbe5d71e --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.outline.expect @@ -0,0 +1,13 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart:7:11: Error: Can't create typedef from non-function type. +// typedef A = int; +// ^ +// +import self as self; + +typedef A = invalid-type; +static method main() → void + ; diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.transformed.expect new file mode 100644 index 00000000000..104aeb23036 --- /dev/null +++ b/pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart.weak.transformed.expect @@ -0,0 +1,12 @@ +library /*isNonNullableByDefault*/; +// +// Problems in library: +// +// pkg/front_end/testcases/nonfunction_type_aliases/old_version.dart:7:11: Error: Can't create typedef from non-function type. +// typedef A = int; +// ^ +// +import self as self; + +typedef A = invalid-type; +static method main() → void {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/folder.options b/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/folder.options deleted file mode 100644 index f1e0c430e3e..00000000000 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/folder.options +++ /dev/null @@ -1 +0,0 @@ ---enable-experiment=nonfunction-type-aliases diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.textual_outline.expect deleted file mode 100644 index 9591f62c3d8..00000000000 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.textual_outline.expect +++ /dev/null @@ -1,4 +0,0 @@ -// @dart = 2.9 -import "issue_43084_lib.dart"; - -main() {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.textual_outline_modelled.expect deleted file mode 100644 index 9591f62c3d8..00000000000 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.textual_outline_modelled.expect +++ /dev/null @@ -1,4 +0,0 @@ -// @dart = 2.9 -import "issue_43084_lib.dart"; - -main() {} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.expect b/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.expect deleted file mode 100644 index e216ebfe46d..00000000000 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.expect +++ /dev/null @@ -1,32 +0,0 @@ -library; -import self as self; -import "issue_43084_lib.dart" as iss; -import "dart:core" as core; - -import "org-dartlang-testcase:///issue_43084_lib.dart"; - -static method main() → dynamic { - iss::Foo* x = new iss::Foo::•(); - core::print(x); -} - -library; -import self as iss; -import "dart:core" as core; - -typedef Bar = iss::Foo*; -class Foo extends core::Object { - synthetic constructor •() → iss::Foo* - : 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 -} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.outline.expect deleted file mode 100644 index 796c6b37891..00000000000 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.outline.expect +++ /dev/null @@ -1,27 +0,0 @@ -library; -import self as self; - -import "org-dartlang-testcase:///issue_43084_lib.dart"; - -static method main() → dynamic - ; - -library; -import self as self2; -import "dart:core" as core; - -typedef Bar = self2::Foo*; -class Foo extends core::Object { - synthetic constructor •() → self2::Foo* - ; - 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 -} diff --git a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.transformed.expect deleted file mode 100644 index e216ebfe46d..00000000000 --- a/pkg/front_end/testcases/nonfunction_type_aliases_no_nnbd/issue_43084/issue_43084.dart.weak.transformed.expect +++ /dev/null @@ -1,32 +0,0 @@ -library; -import self as self; -import "issue_43084_lib.dart" as iss; -import "dart:core" as core; - -import "org-dartlang-testcase:///issue_43084_lib.dart"; - -static method main() → dynamic { - iss::Foo* x = new iss::Foo::•(); - core::print(x); -} - -library; -import self as iss; -import "dart:core" as core; - -typedef Bar = iss::Foo*; -class Foo extends core::Object { - synthetic constructor •() → iss::Foo* - : 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 -} diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status index 6585a37f2a4..85205096fdb 100644 --- a/pkg/front_end/testcases/textual_outline.status +++ b/pkg/front_end/testcases/textual_outline.status @@ -32,8 +32,10 @@ general/bug31124: FormatterCrash general/clone_function_type: FormatterCrash general/constants/js_semantics/issue45376: FormatterCrash general/constants/js_semantics/number_folds: FormatterCrash +general/constants/js_semantics/number_folds_opt_out: FormatterCrash general/constants/js_semantics/on_double: FormatterCrash general/constants/number_folds: FormatterCrash +general/constants/number_folds_opt_out: FormatterCrash general/constants/various: FormatterCrash general/constructor_initializer_invalid: FormatterCrash general/duplicated_declarations: FormatterCrash @@ -133,6 +135,7 @@ nonfunction_type_aliases/issue41501: FormatterCrash nonfunction_type_aliases/issue42446: FormatterCrash nonfunction_type_aliases/issue45051: FormatterCrash nonfunction_type_aliases/nullable_supertypes: FormatterCrash +nonfunction_type_aliases/old_version: FormatterCrash nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls: FormatterCrash rasta/bad_redirection: FormatterCrash rasta/issue_000032: FormatterCrash diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart b/pkg/front_end/testcases/triple_shift/invalid_operator.dart index 9e339898bda..97cbba7462a 100644 --- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart +++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart @@ -1,7 +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. -// @dart=2.9 + class Operators1 { operator >>>() => true; } diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.expect b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.expect index 4fc7537ffdf..86bba0850ff 100644 --- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.expect +++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.expect @@ -1,11 +1,7 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // -// pkg/front_end/testcases/triple_shift/invalid_operator.dart:4:1: Error: A library can't opt out of null safety by default, when using sound null safety. -// // @dart=2.9 -// ^^^^^^^^^^^^ -// // pkg/front_end/testcases/triple_shift/invalid_operator.dart:6:12: Error: Operator '>>>' should have exactly one parameter. // operator >>>() => true; // ^^^ @@ -39,123 +35,53 @@ import self as self; import "dart:core" as core; class Operators1 extends core::Object { - synthetic constructor •() → self::Operators1* + synthetic constructor •() → self::Operators1 : super core::Object::•() ; operator >>>() → dynamic return true; - 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 Operators2 extends core::Object { - synthetic constructor •() → self::Operators2* + synthetic constructor •() → self::Operators2 : super core::Object::•() ; operator >>>(dynamic a, dynamic b) → dynamic return true; - 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 Operators3 extends core::Object { - synthetic constructor •() → self::Operators3* + synthetic constructor •() → self::Operators3 : super core::Object::•() ; operator >>>([dynamic a = #C1]) → dynamic return true; - 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 Operators4 extends core::Object { - synthetic constructor •() → self::Operators4* + synthetic constructor •() → self::Operators4 : super core::Object::•() ; operator >>>({dynamic a = #C1}) → dynamic return true; - 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 Operators5 extends core::Object { - synthetic constructor •() → self::Operators5* + synthetic constructor •() → self::Operators5 : super core::Object::•() ; operator >>>(dynamic a, [dynamic b = #C1]) → dynamic return true; - 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 Operators6 extends core::Object { - synthetic constructor •() → self::Operators6* + synthetic constructor •() → self::Operators6 : super core::Object::•() ; operator >>>(dynamic a, {dynamic b = #C1}) → dynamic return true; - 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 Operators7 extends core::Object { - synthetic constructor •() → self::Operators7* + synthetic constructor •() → self::Operators7 : super core::Object::•() ; - operator >>>(dynamic a) → dynamic + operator >>>(dynamic a) → dynamic return true; - 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 {} diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.transformed.expect b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.transformed.expect index 4fc7537ffdf..86bba0850ff 100644 --- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.strong.transformed.expect @@ -1,11 +1,7 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // -// pkg/front_end/testcases/triple_shift/invalid_operator.dart:4:1: Error: A library can't opt out of null safety by default, when using sound null safety. -// // @dart=2.9 -// ^^^^^^^^^^^^ -// // pkg/front_end/testcases/triple_shift/invalid_operator.dart:6:12: Error: Operator '>>>' should have exactly one parameter. // operator >>>() => true; // ^^^ @@ -39,123 +35,53 @@ import self as self; import "dart:core" as core; class Operators1 extends core::Object { - synthetic constructor •() → self::Operators1* + synthetic constructor •() → self::Operators1 : super core::Object::•() ; operator >>>() → dynamic return true; - 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 Operators2 extends core::Object { - synthetic constructor •() → self::Operators2* + synthetic constructor •() → self::Operators2 : super core::Object::•() ; operator >>>(dynamic a, dynamic b) → dynamic return true; - 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 Operators3 extends core::Object { - synthetic constructor •() → self::Operators3* + synthetic constructor •() → self::Operators3 : super core::Object::•() ; operator >>>([dynamic a = #C1]) → dynamic return true; - 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 Operators4 extends core::Object { - synthetic constructor •() → self::Operators4* + synthetic constructor •() → self::Operators4 : super core::Object::•() ; operator >>>({dynamic a = #C1}) → dynamic return true; - 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 Operators5 extends core::Object { - synthetic constructor •() → self::Operators5* + synthetic constructor •() → self::Operators5 : super core::Object::•() ; operator >>>(dynamic a, [dynamic b = #C1]) → dynamic return true; - 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 Operators6 extends core::Object { - synthetic constructor •() → self::Operators6* + synthetic constructor •() → self::Operators6 : super core::Object::•() ; operator >>>(dynamic a, {dynamic b = #C1}) → dynamic return true; - 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 Operators7 extends core::Object { - synthetic constructor •() → self::Operators7* + synthetic constructor •() → self::Operators7 : super core::Object::•() ; - operator >>>(dynamic a) → dynamic + operator >>>(dynamic a) → dynamic return true; - 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 {} diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect index 0c9cae8bc74..a4499833b77 100644 --- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect +++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.textual_outline.expect @@ -1,4 +1,3 @@ -// @dart = 2.9 class Operators1 { operator >>(){} operator>() => true; diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.expect b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.expect index a5258fdac40..86bba0850ff 100644 --- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.expect +++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -35,123 +35,53 @@ import self as self; import "dart:core" as core; class Operators1 extends core::Object { - synthetic constructor •() → self::Operators1* + synthetic constructor •() → self::Operators1 : super core::Object::•() ; operator >>>() → dynamic return true; - 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 Operators2 extends core::Object { - synthetic constructor •() → self::Operators2* + synthetic constructor •() → self::Operators2 : super core::Object::•() ; operator >>>(dynamic a, dynamic b) → dynamic return true; - 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 Operators3 extends core::Object { - synthetic constructor •() → self::Operators3* + synthetic constructor •() → self::Operators3 : super core::Object::•() ; operator >>>([dynamic a = #C1]) → dynamic return true; - 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 Operators4 extends core::Object { - synthetic constructor •() → self::Operators4* + synthetic constructor •() → self::Operators4 : super core::Object::•() ; operator >>>({dynamic a = #C1}) → dynamic return true; - 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 Operators5 extends core::Object { - synthetic constructor •() → self::Operators5* + synthetic constructor •() → self::Operators5 : super core::Object::•() ; operator >>>(dynamic a, [dynamic b = #C1]) → dynamic return true; - 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 Operators6 extends core::Object { - synthetic constructor •() → self::Operators6* + synthetic constructor •() → self::Operators6 : super core::Object::•() ; operator >>>(dynamic a, {dynamic b = #C1}) → dynamic return true; - 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 Operators7 extends core::Object { - synthetic constructor •() → self::Operators7* + synthetic constructor •() → self::Operators7 : super core::Object::•() ; - operator >>>(dynamic a) → dynamic + operator >>>(dynamic a) → dynamic return true; - 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 {} diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.outline.expect b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.outline.expect index d2a1d7f1be9..34eccb8851a 100644 --- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.outline.expect +++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.outline.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -35,116 +35,46 @@ import self as self; import "dart:core" as core; class Operators1 extends core::Object { - synthetic constructor •() → self::Operators1* + synthetic constructor •() → self::Operators1 ; operator >>>() → dynamic ; - 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 Operators2 extends core::Object { - synthetic constructor •() → self::Operators2* + synthetic constructor •() → self::Operators2 ; operator >>>(dynamic a, dynamic b) → dynamic ; - 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 Operators3 extends core::Object { - synthetic constructor •() → self::Operators3* + synthetic constructor •() → self::Operators3 ; operator >>>([dynamic a]) → dynamic ; - 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 Operators4 extends core::Object { - synthetic constructor •() → self::Operators4* + synthetic constructor •() → self::Operators4 ; operator >>>({dynamic a}) → dynamic ; - 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 Operators5 extends core::Object { - synthetic constructor •() → self::Operators5* + synthetic constructor •() → self::Operators5 ; operator >>>(dynamic a, [dynamic b]) → dynamic ; - 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 Operators6 extends core::Object { - synthetic constructor •() → self::Operators6* + synthetic constructor •() → self::Operators6 ; operator >>>(dynamic a, {dynamic b}) → dynamic ; - 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 Operators7 extends core::Object { - synthetic constructor •() → self::Operators7* + synthetic constructor •() → self::Operators7 ; - operator >>>(dynamic a) → dynamic + operator >>>(dynamic a) → dynamic ; - 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 ; diff --git a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.transformed.expect b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.transformed.expect index a5258fdac40..86bba0850ff 100644 --- a/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/triple_shift/invalid_operator.dart.weak.transformed.expect @@ -1,4 +1,4 @@ -library; +library /*isNonNullableByDefault*/; // // Problems in library: // @@ -35,123 +35,53 @@ import self as self; import "dart:core" as core; class Operators1 extends core::Object { - synthetic constructor •() → self::Operators1* + synthetic constructor •() → self::Operators1 : super core::Object::•() ; operator >>>() → dynamic return true; - 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 Operators2 extends core::Object { - synthetic constructor •() → self::Operators2* + synthetic constructor •() → self::Operators2 : super core::Object::•() ; operator >>>(dynamic a, dynamic b) → dynamic return true; - 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 Operators3 extends core::Object { - synthetic constructor •() → self::Operators3* + synthetic constructor •() → self::Operators3 : super core::Object::•() ; operator >>>([dynamic a = #C1]) → dynamic return true; - 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 Operators4 extends core::Object { - synthetic constructor •() → self::Operators4* + synthetic constructor •() → self::Operators4 : super core::Object::•() ; operator >>>({dynamic a = #C1}) → dynamic return true; - 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 Operators5 extends core::Object { - synthetic constructor •() → self::Operators5* + synthetic constructor •() → self::Operators5 : super core::Object::•() ; operator >>>(dynamic a, [dynamic b = #C1]) → dynamic return true; - 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 Operators6 extends core::Object { - synthetic constructor •() → self::Operators6* + synthetic constructor •() → self::Operators6 : super core::Object::•() ; operator >>>(dynamic a, {dynamic b = #C1}) → dynamic return true; - 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 Operators7 extends core::Object { - synthetic constructor •() → self::Operators7* + synthetic constructor •() → self::Operators7 : super core::Object::•() ; - operator >>>(dynamic a) → dynamic + operator >>>(dynamic a) → dynamic return true; - 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 {} diff --git a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart index 1aea4d3d5c3..71aa5cf6b90 100644 --- a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart +++ b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart @@ -1,7 +1,7 @@ // Copyright (c) 2019, 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.9 + class A {} main() { diff --git a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.textual_outline.expect b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.textual_outline.expect index b4adc1611e8..eaa0557a5da 100644 --- a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.textual_outline.expect +++ b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.textual_outline.expect @@ -1,3 +1,2 @@ -// @dart = 2.9 class A {} main() {} diff --git a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.expect b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.expect index 6d3f0f26b05..14e8ddfd544 100644 --- a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.expect +++ b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.expect @@ -1,22 +1,12 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -class A extends core::Object { - synthetic constructor •() → self::A* +class A extends core::Object { + synthetic constructor •() → self::A : 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 { - self::A* a = new self::A::•(); + self::A a = new self::A::•(); } diff --git a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.outline.expect b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.outline.expect index 6031980362f..4f9e5256394 100644 --- a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.outline.expect +++ b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.outline.expect @@ -1,20 +1,10 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -class A extends core::Object { - synthetic constructor •() → self::A* +class A extends core::Object { + synthetic constructor •() → self::A ; - 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 ; diff --git a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.transformed.expect b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.transformed.expect index 6d3f0f26b05..14e8ddfd544 100644 --- a/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/variance/class_type_parameter_modifier.dart.weak.transformed.expect @@ -1,22 +1,12 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -class A extends core::Object { - synthetic constructor •() → self::A* +class A extends core::Object { + synthetic constructor •() → self::A : 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 { - self::A* a = new self::A::•(); + self::A a = new self::A::•(); } diff --git a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart index 1d1c133c09a..983db1db59a 100644 --- a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart +++ b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart @@ -1,16 +1,16 @@ // Copyright (c) 2019, 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.9 + typedef ContraFunction = void Function(T); typedef InvFunction = T Function(T); class Contravariant {} class Invariant {} class A { - final void Function(T) field = null; + final void Function(T)? field = null; void method(T t, void Function(U) u, V v) {} - void method2(T x, [T y]) {} + void method2(T x, [T? y]) {} void set x(T t) {} Map> get mapContra => new Map>(); Map> get mapContraFn => new Map>(); @@ -19,14 +19,14 @@ class A { } class B { - T x; + T? x; T method(T x) => x; void set y(T x) {} } class C { - final void Function(T) field = null; - void method(T x, [T y]) {} + final void Function(T)? field = null; + void method(T x, [T? y]) {} void set x(T t) {} } @@ -39,6 +39,7 @@ class E { E(this.f); int method(T x) { f(x); + return 0; } } diff --git a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.textual_outline.expect b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.textual_outline.expect index aa7684d072d..375b7370df6 100644 --- a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.textual_outline.expect +++ b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.textual_outline.expect @@ -1,12 +1,11 @@ -// @dart = 2.9 typedef ContraFunction = void Function(T); typedef InvFunction = T Function(T); class Contravariant {} class Invariant {} class A { - final void Function(T) field = null; + final void Function(T)? field = null; void method(T t, void Function(U) u, V v) {} - void method2(T x, [T y]) {} + void method2(T x, [T? y]) {} void set x(T t) {} Map> get mapContra => new Map>(); Map> get mapContraFn => new Map>(); @@ -14,13 +13,13 @@ class A { Map> get mapInvFn => new Map>(); } class B { - T x; + T? x; T method(T x) => x; void set y(T x) {} } class C { - final void Function(T) field = null; - void method(T x, [T y]) {} + final void Function(T)? field = null; + void method(T x, [T? y]) {} void set x(T t) {} } abstract class D { diff --git a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.expect b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.expect index 4b64468f9d9..fbf4052508b 100644 --- a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.expect +++ b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.expect @@ -1,191 +1,113 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -typedef ContraFunction = (T*) →* void; -typedef InvFunction = (T*) →* T*; -class Contravariant extends core::Object { - synthetic constructor •() → self::Contravariant* +typedef ContraFunction = (T%) → void; +typedef InvFunction = (T%) → T%; +class Contravariant extends core::Object { + synthetic constructor •() → self::Contravariant : 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 } -class Invariant extends core::Object { - synthetic constructor •() → self::Invariant* +class Invariant extends core::Object { + synthetic constructor •() → self::Invariant : 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 } -class A extends core::Object { - final field (self::A::T*) →* void field = null; - synthetic constructor •() → self::A* +class A extends core::Object { + final field (self::A::T%) →? void field = null; + synthetic constructor •() → self::A : super core::Object::•() ; - method method(self::A::T* t, (self::A::U*) →* void u, generic-covariant-impl self::A::V* v) → void {} - method method2(self::A::T* x, [self::A::T* y = #C1]) → void {} - set x(self::A::T* t) → void {} - get mapContra() → core::Map*>* - return core::Map::•*>(); - get mapContraFn() → core::Map* - return core::Map::•(); - get mapInv() → core::Map*>* - return core::Map::•*>(); - get mapInvFn() → core::Map* - return core::Map::•(); - 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 + method method(self::A::T% t, (self::A::U%) → void u, generic-covariant-impl self::A::V% v) → void {} + method method2(self::A::T% x, [self::A::T? y = #C1]) → void {} + set x(self::A::T% t) → void {} + get mapContra() → core::Map> + return core::Map::•>(); + get mapContraFn() → core::Map + return core::Map::•(); + get mapInv() → core::Map> + return core::Map::•>(); + get mapInvFn() → core::Map + return core::Map::•(); } -class B extends core::Object { - field self::B::T* x = null; - synthetic constructor •() → self::B* +class B extends core::Object { + field self::B::T? x = null; + synthetic constructor •() → self::B : super core::Object::•() ; - method method(self::B::T* x) → self::B::T* + method method(self::B::T% x) → self::B::T% return x; - set y(self::B::T* x) → void {} - abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod - 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 get runtimeType() → core::Type*; -> core::Object::runtimeType + set y(self::B::T% x) → void {} } -class C extends core::Object { - final field (self::C::T*) →* void field = null; - synthetic constructor •() → self::C* +class C extends core::Object { + final field (self::C::T%) →? void field = null; + synthetic constructor •() → self::C : super core::Object::•() ; - method method(self::C::T* x, [self::C::T* y = #C1]) → void {} - set x(self::C::T* t) → void {} - 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 + method method(self::C::T% x, [self::C::T? y = #C1]) → void {} + set x(self::C::T% t) → void {} } -abstract class D extends core::Object { - synthetic constructor •() → self::D* +abstract class D extends core::Object { + synthetic constructor •() → self::D : super core::Object::•() ; - abstract method method(generic-covariant-impl self::D::T* x) → core::int*; - 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 + abstract method method(generic-covariant-impl self::D::T% x) → core::int; } -class E extends core::Object { - final field (self::E::T*) →* void f; - constructor •((self::E::T*) →* void f) → self::E* +class E extends core::Object { + final field (self::E::T%) → void f; + constructor •((self::E::T%) → void f) → self::E : self::E::f = f, super core::Object::•() ; - method method(self::E::T* x) → core::int* { - let final self::E::T* #t1 = x in this.{self::E::f}.call(#t1); + method method(self::E::T% x) → core::int { + let final self::E::T% #t1 = x in this.{self::E::f}.call(#t1); + return 0; } - 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 F extends self::E implements self::D { - constructor •((self::F::T*) →* void f) → self::F* +class F extends self::E implements self::D { + constructor •((self::F::T%) → void f) → self::F : super self::E::•(f) ; - forwarding-stub method method(generic-covariant-impl self::F::T* x) → core::int* + forwarding-stub method method(generic-covariant-impl self::F::T% x) → core::int return super.{self::E::method}(x); } -class NoSuchMethod extends core::Object implements self::B { - synthetic constructor •() → self::NoSuchMethod* +class NoSuchMethod extends core::Object implements self::B { + synthetic constructor •() → self::NoSuchMethod : super core::Object::•() ; - method noSuchMethod(core::Invocation* _) → dynamic + method noSuchMethod(core::Invocation _) → dynamic return 3; - 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 get runtimeType() → core::Type*; -> core::Object::runtimeType - no-such-method-forwarder get x() → self::NoSuchMethod::T* - return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 1, #C3, #C4, core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic} self::NoSuchMethod::T*; - no-such-method-forwarder method method(self::NoSuchMethod::T* x) → self::NoSuchMethod::T* - return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C3, core::List::unmodifiable([x]), core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic} self::NoSuchMethod::T*; - no-such-method-forwarder set y(self::NoSuchMethod::T* x) → void + no-such-method-forwarder get x() → self::NoSuchMethod::T? + return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 1, #C3, #C4, core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic,ForNonNullableByDefault} self::NoSuchMethod::T?; + no-such-method-forwarder method method(self::NoSuchMethod::T% x) → self::NoSuchMethod::T% + return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C3, core::List::unmodifiable([x]), core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic,ForNonNullableByDefault} self::NoSuchMethod::T%; + no-such-method-forwarder set y(self::NoSuchMethod::T% x) → void return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C3, core::List::unmodifiable([x]), core::Map::unmodifiable(#C5))); - no-such-method-forwarder set x(self::NoSuchMethod::T* value) → void + no-such-method-forwarder set x(self::NoSuchMethod::T? value) → void return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 2, #C3, core::List::unmodifiable([value]), core::Map::unmodifiable(#C5))); } static method main() → dynamic { - self::A* a = new self::A::•(); + self::A a = new self::A::•(); self::expect(null, a.{self::A::field}); - a.{self::A::method}(3, (core::num* num) → Null {}, "test"); + a.{self::A::method}(3, (core::num num) → void {}, "test"); a.{self::A::method2}(3); a.{self::A::x} = 3; - core::Map*>* mapContra = a.{self::A::mapContra} as{TypeError,CovarianceCheck} core::Map*>*; - core::Map* mapContraFn = a.{self::A::mapContraFn} as{TypeError,CovarianceCheck} core::Map*; - core::Map*>* mapInv = a.{self::A::mapInv} as{TypeError,CovarianceCheck} core::Map*>*; - core::Map* mapInvFn = a.{self::A::mapInvFn} as{TypeError,CovarianceCheck} core::Map*; - self::B* b = new self::B::•(); + core::Map> mapContra = a.{self::A::mapContra} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map>; + core::Map mapContraFn = a.{self::A::mapContraFn} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map; + core::Map> mapInv = a.{self::A::mapInv} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map>; + core::Map mapInvFn = a.{self::A::mapInvFn} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map; + self::B b = new self::B::•(); b.{self::B::x} = 3; self::expect(3, b.{self::B::x}); self::expect(3, b.{self::B::method}(3)); b.{self::B::y} = 3; - self::C* c = new self::C::•(); + self::C c = new self::C::•(); self::expect(null, c.{self::C::field}); c.{self::C::method}(3, 2); c.{self::C::x} = 3; - self::D* d = new self::F::•((core::String* s) → Null {}); + self::D d = new self::F::•((core::String s) → void {}); d.{self::D::method}("test"); - self::NoSuchMethod* nsm = new self::NoSuchMethod::•(); + self::NoSuchMethod nsm = new self::NoSuchMethod::•(); self::expect(3, nsm.{self::B::method}(3)); } static method expect(dynamic expected, dynamic actual) → dynamic { diff --git a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.outline.expect b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.outline.expect index 22cd762752d..1ce38f448d3 100644 --- a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.outline.expect +++ b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.outline.expect @@ -1,163 +1,84 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -typedef ContraFunction = (T*) →* void; -typedef InvFunction = (T*) →* T*; -class Contravariant extends core::Object { - synthetic constructor •() → self::Contravariant* +typedef ContraFunction = (T%) → void; +typedef InvFunction = (T%) → T%; +class Contravariant extends core::Object { + synthetic constructor •() → self::Contravariant ; - 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 Invariant extends core::Object { - synthetic constructor •() → self::Invariant* +class Invariant extends core::Object { + synthetic constructor •() → self::Invariant ; - 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 A extends core::Object { - final field (self::A::T*) →* void field; - synthetic constructor •() → self::A* +class A extends core::Object { + final field (self::A::T%) →? void field; + synthetic constructor •() → self::A ; - method method(self::A::T* t, (self::A::U*) →* void u, generic-covariant-impl self::A::V* v) → void + method method(self::A::T% t, (self::A::U%) → void u, generic-covariant-impl self::A::V% v) → void ; - method method2(self::A::T* x, [self::A::T* y]) → void + method method2(self::A::T% x, [self::A::T? y]) → void ; - set x(self::A::T* t) → void + set x(self::A::T% t) → void ; - get mapContra() → core::Map*>* + get mapContra() → core::Map> ; - get mapContraFn() → core::Map* + get mapContraFn() → core::Map ; - get mapInv() → core::Map*>* + get mapInv() → core::Map> ; - get mapInvFn() → core::Map* + get mapInvFn() → core::Map ; - 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 B extends core::Object { - field self::B::T* x; - synthetic constructor •() → self::B* +class B extends core::Object { + field self::B::T? x; + synthetic constructor •() → self::B ; - method method(self::B::T* x) → self::B::T* + method method(self::B::T% x) → self::B::T% ; - set y(self::B::T* x) → void + set y(self::B::T% x) → void ; - abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod - 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 get runtimeType() → core::Type*; -> core::Object::runtimeType } -class C extends core::Object { - final field (self::C::T*) →* void field; - synthetic constructor •() → self::C* +class C extends core::Object { + final field (self::C::T%) →? void field; + synthetic constructor •() → self::C ; - method method(self::C::T* x, [self::C::T* y]) → void + method method(self::C::T% x, [self::C::T? y]) → void ; - set x(self::C::T* t) → void + set x(self::C::T% t) → void ; - 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 } -abstract class D extends core::Object { - synthetic constructor •() → self::D* +abstract class D extends core::Object { + synthetic constructor •() → self::D ; - abstract method method(generic-covariant-impl self::D::T* x) → core::int*; - 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 + abstract method method(generic-covariant-impl self::D::T% x) → core::int; } -class E extends core::Object { - final field (self::E::T*) →* void f; - constructor •((self::E::T*) →* void f) → self::E* +class E extends core::Object { + final field (self::E::T%) → void f; + constructor •((self::E::T%) → void f) → self::E ; - method method(self::E::T* x) → core::int* + method method(self::E::T% x) → core::int ; - 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 F extends self::E implements self::D { - constructor •((self::F::T*) →* void f) → self::F* +class F extends self::E implements self::D { + constructor •((self::F::T%) → void f) → self::F ; - forwarding-stub method method(generic-covariant-impl self::F::T* x) → core::int* + forwarding-stub method method(generic-covariant-impl self::F::T% x) → core::int return super.{self::E::method}(x); } -class NoSuchMethod extends core::Object implements self::B { - synthetic constructor •() → self::NoSuchMethod* +class NoSuchMethod extends core::Object implements self::B { + synthetic constructor •() → self::NoSuchMethod ; - method noSuchMethod(core::Invocation* _) → dynamic + method noSuchMethod(core::Invocation _) → dynamic ; - 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 get runtimeType() → core::Type*; -> core::Object::runtimeType - no-such-method-forwarder get x() → self::NoSuchMethod::T* - return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#x, 1, const [], const [], core::Map::unmodifiable(const {}))) as{TypeError,ForDynamic} self::NoSuchMethod::T*; - no-such-method-forwarder method method(self::NoSuchMethod::T* x) → self::NoSuchMethod::T* - return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#method, 0, const [], core::List::unmodifiable([x]), core::Map::unmodifiable(const {}))) as{TypeError,ForDynamic} self::NoSuchMethod::T*; - no-such-method-forwarder set y(self::NoSuchMethod::T* x) → void + no-such-method-forwarder get x() → self::NoSuchMethod::T? + return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#x, 1, const [], const [], core::Map::unmodifiable(const {}))) as{TypeError,ForDynamic,ForNonNullableByDefault} self::NoSuchMethod::T?; + no-such-method-forwarder method method(self::NoSuchMethod::T% x) → self::NoSuchMethod::T% + return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#method, 0, const [], core::List::unmodifiable([x]), core::Map::unmodifiable(const {}))) as{TypeError,ForDynamic,ForNonNullableByDefault} self::NoSuchMethod::T%; + no-such-method-forwarder set y(self::NoSuchMethod::T% x) → void return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#y=, 2, const [], core::List::unmodifiable([x]), core::Map::unmodifiable(const {}))); - no-such-method-forwarder set x(self::NoSuchMethod::T* value) → void + no-such-method-forwarder set x(self::NoSuchMethod::T? value) → void return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#x=, 2, const [], core::List::unmodifiable([value]), core::Map::unmodifiable(const {}))); } static method main() → dynamic @@ -167,17 +88,17 @@ static method expect(dynamic expected, dynamic actual) → dynamic Extra constant evaluation status: -Evaluated: SymbolLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:5 -> SymbolConstant(#x) -Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:5 -> ListConstant(const []) -Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:5 -> ListConstant(const []) -Evaluated: MapLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:5 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:6 -> SymbolConstant(#x) +Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:6 -> ListConstant(const []) +Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:6 -> ListConstant(const []) +Evaluated: MapLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:6 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) Evaluated: SymbolLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:23:5 -> SymbolConstant(#method) Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:23:5 -> ListConstant(const []) Evaluated: MapLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:23:5 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) Evaluated: SymbolLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:24:12 -> SymbolConstant(#y=) Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:24:12 -> ListConstant(const []) Evaluated: MapLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:24:12 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) -Evaluated: SymbolLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:5 -> SymbolConstant(#x=) -Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:5 -> ListConstant(const []) -Evaluated: MapLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:5 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) +Evaluated: SymbolLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:6 -> SymbolConstant(#x=) +Evaluated: ListLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:6 -> ListConstant(const []) +Evaluated: MapLiteral @ org-dartlang-testcase:///generic_covariance_sound_variance.dart:22:6 -> InstanceConstant(const _ImmutableMap{_ImmutableMap._kvPairs: const []}) Extra constant evaluation: evaluated: 42, effectively constant: 13 diff --git a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.transformed.expect b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.transformed.expect index 8f2b714c75f..3719b771bd4 100644 --- a/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/variance/generic_covariance_sound_variance.dart.weak.transformed.expect @@ -1,191 +1,113 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -typedef ContraFunction = (T*) →* void; -typedef InvFunction = (T*) →* T*; -class Contravariant extends core::Object { - synthetic constructor •() → self::Contravariant* +typedef ContraFunction = (T%) → void; +typedef InvFunction = (T%) → T%; +class Contravariant extends core::Object { + synthetic constructor •() → self::Contravariant : 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 } -class Invariant extends core::Object { - synthetic constructor •() → self::Invariant* +class Invariant extends core::Object { + synthetic constructor •() → self::Invariant : 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 } -class A extends core::Object { - final field (self::A::T*) →* void field = null; - synthetic constructor •() → self::A* +class A extends core::Object { + final field (self::A::T%) →? void field = null; + synthetic constructor •() → self::A : super core::Object::•() ; - method method(self::A::T* t, (self::A::U*) →* void u, generic-covariant-impl self::A::V* v) → void {} - method method2(self::A::T* x, [self::A::T* y = #C1]) → void {} - set x(self::A::T* t) → void {} - get mapContra() → core::Map*>* - return core::Map::•*>(); - get mapContraFn() → core::Map* - return core::Map::•(); - get mapInv() → core::Map*>* - return core::Map::•*>(); - get mapInvFn() → core::Map* - return core::Map::•(); - 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 + method method(self::A::T% t, (self::A::U%) → void u, generic-covariant-impl self::A::V% v) → void {} + method method2(self::A::T% x, [self::A::T? y = #C1]) → void {} + set x(self::A::T% t) → void {} + get mapContra() → core::Map> + return core::Map::•>(); + get mapContraFn() → core::Map + return core::Map::•(); + get mapInv() → core::Map> + return core::Map::•>(); + get mapInvFn() → core::Map + return core::Map::•(); } -class B extends core::Object { - field self::B::T* x = null; - synthetic constructor •() → self::B* +class B extends core::Object { + field self::B::T? x = null; + synthetic constructor •() → self::B : super core::Object::•() ; - method method(self::B::T* x) → self::B::T* + method method(self::B::T% x) → self::B::T% return x; - set y(self::B::T* x) → void {} - abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod - 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 get runtimeType() → core::Type*; -> core::Object::runtimeType + set y(self::B::T% x) → void {} } -class C extends core::Object { - final field (self::C::T*) →* void field = null; - synthetic constructor •() → self::C* +class C extends core::Object { + final field (self::C::T%) →? void field = null; + synthetic constructor •() → self::C : super core::Object::•() ; - method method(self::C::T* x, [self::C::T* y = #C1]) → void {} - set x(self::C::T* t) → void {} - 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 + method method(self::C::T% x, [self::C::T? y = #C1]) → void {} + set x(self::C::T% t) → void {} } -abstract class D extends core::Object { - synthetic constructor •() → self::D* +abstract class D extends core::Object { + synthetic constructor •() → self::D : super core::Object::•() ; - abstract method method(generic-covariant-impl self::D::T* x) → core::int*; - 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 + abstract method method(generic-covariant-impl self::D::T% x) → core::int; } -class E extends core::Object { - final field (self::E::T*) →* void f; - constructor •((self::E::T*) →* void f) → self::E* +class E extends core::Object { + final field (self::E::T%) → void f; + constructor •((self::E::T%) → void f) → self::E : self::E::f = f, super core::Object::•() ; - method method(self::E::T* x) → core::int* { - let final self::E::T* #t1 = x in this.{self::E::f}.call(#t1); + method method(self::E::T% x) → core::int { + let final self::E::T% #t1 = x in this.{self::E::f}.call(#t1); + return 0; } - 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 F extends self::E implements self::D { - constructor •((self::F::T*) →* void f) → self::F* +class F extends self::E implements self::D { + constructor •((self::F::T%) → void f) → self::F : super self::E::•(f) ; - forwarding-stub method method(generic-covariant-impl self::F::T* x) → core::int* + forwarding-stub method method(generic-covariant-impl self::F::T% x) → core::int return super.{self::E::method}(x); } -class NoSuchMethod extends core::Object implements self::B { - synthetic constructor •() → self::NoSuchMethod* +class NoSuchMethod extends core::Object implements self::B { + synthetic constructor •() → self::NoSuchMethod : super core::Object::•() ; - method noSuchMethod(core::Invocation* _) → dynamic + method noSuchMethod(core::Invocation _) → dynamic return 3; - 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 get runtimeType() → core::Type*; -> core::Object::runtimeType - no-such-method-forwarder get x() → self::NoSuchMethod::T* - return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 1, #C3, #C4, core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic} self::NoSuchMethod::T*; - no-such-method-forwarder method method(self::NoSuchMethod::T* x) → self::NoSuchMethod::T* - return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(x)), core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic} self::NoSuchMethod::T*; - no-such-method-forwarder set y(self::NoSuchMethod::T* x) → void + no-such-method-forwarder get x() → self::NoSuchMethod::T? + return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 1, #C3, #C4, core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic,ForNonNullableByDefault} self::NoSuchMethod::T?; + no-such-method-forwarder method method(self::NoSuchMethod::T% x) → self::NoSuchMethod::T% + return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(x)), core::Map::unmodifiable(#C5))) as{TypeError,ForDynamic,ForNonNullableByDefault} self::NoSuchMethod::T%; + no-such-method-forwarder set y(self::NoSuchMethod::T% x) → void return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(x)), core::Map::unmodifiable(#C5))); - no-such-method-forwarder set x(self::NoSuchMethod::T* value) → void + no-such-method-forwarder set x(self::NoSuchMethod::T? value) → void return this.{self::NoSuchMethod::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 2, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(value)), core::Map::unmodifiable(#C5))); } static method main() → dynamic { - self::A* a = new self::A::•(); + self::A a = new self::A::•(); self::expect(null, a.{self::A::field}); - a.{self::A::method}(3, (core::num* num) → Null {}, "test"); + a.{self::A::method}(3, (core::num num) → void {}, "test"); a.{self::A::method2}(3); a.{self::A::x} = 3; - core::Map*>* mapContra = a.{self::A::mapContra} as{TypeError,CovarianceCheck} core::Map*>*; - core::Map* mapContraFn = a.{self::A::mapContraFn} as{TypeError,CovarianceCheck} core::Map*; - core::Map*>* mapInv = a.{self::A::mapInv} as{TypeError,CovarianceCheck} core::Map*>*; - core::Map* mapInvFn = a.{self::A::mapInvFn} as{TypeError,CovarianceCheck} core::Map*; - self::B* b = new self::B::•(); + core::Map> mapContra = a.{self::A::mapContra} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map>; + core::Map mapContraFn = a.{self::A::mapContraFn} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map; + core::Map> mapInv = a.{self::A::mapInv} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map>; + core::Map mapInvFn = a.{self::A::mapInvFn} as{TypeError,CovarianceCheck,ForNonNullableByDefault} core::Map; + self::B b = new self::B::•(); b.{self::B::x} = 3; self::expect(3, b.{self::B::x}); self::expect(3, b.{self::B::method}(3)); b.{self::B::y} = 3; - self::C* c = new self::C::•(); + self::C c = new self::C::•(); self::expect(null, c.{self::C::field}); c.{self::C::method}(3, 2); c.{self::C::x} = 3; - self::D* d = new self::F::•((core::String* s) → Null {}); + self::D d = new self::F::•((core::String s) → void {}); d.{self::D::method}("test"); - self::NoSuchMethod* nsm = new self::NoSuchMethod::•(); + self::NoSuchMethod nsm = new self::NoSuchMethod::•(); self::expect(3, nsm.{self::B::method}(3)); } static method expect(dynamic expected, dynamic actual) → dynamic { diff --git a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart index ec067aadc78..2aefefba907 100644 --- a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart +++ b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart @@ -1,7 +1,7 @@ // Copyright (c) 2019, 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.9 + class A {} mixin B on A {} diff --git a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.textual_outline.expect b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.textual_outline.expect index a4e242994b0..dd52422cbfb 100644 --- a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.textual_outline.expect +++ b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.textual_outline.expect @@ -1,4 +1,3 @@ -// @dart = 2.9 class A {} mixin B on A {} main() {} diff --git a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.expect b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.expect index c1ffa9b8d28..abd3eeaeff9 100644 --- a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.expect +++ b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.expect @@ -1,22 +1,12 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; class A extends core::Object { - synthetic constructor •() → self::A* + synthetic constructor •() → self::A : 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 } -abstract class B extends self::A /*isMixinDeclaration*/ { +abstract class B extends self::A /*isMixinDeclaration*/ { } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.outline.expect b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.outline.expect index 65ebf5c0b0e..60dc2311ae1 100644 --- a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.outline.expect +++ b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.outline.expect @@ -1,22 +1,12 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; class A extends core::Object { - synthetic constructor •() → self::A* + synthetic constructor •() → self::A ; - 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 } -abstract class B extends self::A /*isMixinDeclaration*/ { +abstract class B extends self::A /*isMixinDeclaration*/ { } static method main() → dynamic ; diff --git a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.transformed.expect b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.transformed.expect index c1ffa9b8d28..abd3eeaeff9 100644 --- a/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/variance/mixin_type_parameter_modifier.dart.weak.transformed.expect @@ -1,22 +1,12 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; class A extends core::Object { - synthetic constructor •() → self::A* + synthetic constructor •() → self::A : 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 } -abstract class B extends self::A /*isMixinDeclaration*/ { +abstract class B extends self::A /*isMixinDeclaration*/ { } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/variance/unconstrained_inference.dart b/pkg/front_end/testcases/variance/unconstrained_inference.dart index fa68fbee31f..7f68e007a82 100644 --- a/pkg/front_end/testcases/variance/unconstrained_inference.dart +++ b/pkg/front_end/testcases/variance/unconstrained_inference.dart @@ -1,7 +1,7 @@ // Copyright (c) 2019, 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.9 + class Covariant {} class Contravariant {} class Invariant {} diff --git a/pkg/front_end/testcases/variance/unconstrained_inference.dart.textual_outline.expect b/pkg/front_end/testcases/variance/unconstrained_inference.dart.textual_outline.expect index 8440fa06b58..0d3c6339884 100644 --- a/pkg/front_end/testcases/variance/unconstrained_inference.dart.textual_outline.expect +++ b/pkg/front_end/testcases/variance/unconstrained_inference.dart.textual_outline.expect @@ -1,4 +1,3 @@ -// @dart = 2.9 class Covariant {} class Contravariant {} class Invariant {} diff --git a/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.expect b/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.expect index d9a257167a6..0850650b9ab 100644 --- a/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.expect +++ b/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.expect @@ -1,60 +1,30 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -class Covariant extends core::Object { - synthetic constructor •() → self::Covariant* +class Covariant extends core::Object { + synthetic constructor •() → self::Covariant : 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 } -class Contravariant extends core::Object { - synthetic constructor •() → self::Contravariant* +class Contravariant extends core::Object { + synthetic constructor •() → self::Contravariant : 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 } -class Invariant extends core::Object { - synthetic constructor •() → self::Invariant* +class Invariant extends core::Object { + synthetic constructor •() → self::Invariant : 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 covariantListInfer(self::Covariant*>* x) → void {} -static method contravariantListInfer(self::Contravariant*>* x) → void {} -static method invariantListInfer(self::Invariant*>* x) → void {} +static method covariantListInfer(self::Covariant> x) → void {} +static method contravariantListInfer(self::Contravariant> x) → void {} +static method invariantListInfer(self::Invariant> x) → void {} static method main() → dynamic { - self::Covariant* cov = new self::Covariant::•(); - self::covariantListInfer(new self::Covariant::•*>()); - self::Contravariant* contra = new self::Contravariant::•(); - self::contravariantListInfer(new self::Contravariant::•*>()); - self::Invariant* inv = new self::Invariant::•(); - self::invariantListInfer(new self::Invariant::•*>()); + self::Covariant cov = new self::Covariant::•(); + self::covariantListInfer(new self::Covariant::•>()); + self::Contravariant contra = new self::Contravariant::•(); + self::contravariantListInfer(new self::Contravariant::•>()); + self::Invariant inv = new self::Invariant::•(); + self::invariantListInfer(new self::Invariant::•>()); } diff --git a/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.outline.expect b/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.outline.expect index 80e78febb24..c5c73b9012a 100644 --- a/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.outline.expect +++ b/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.outline.expect @@ -1,54 +1,24 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -class Covariant extends core::Object { - synthetic constructor •() → self::Covariant* +class Covariant extends core::Object { + synthetic constructor •() → self::Covariant ; - 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 Contravariant extends core::Object { - synthetic constructor •() → self::Contravariant* +class Contravariant extends core::Object { + synthetic constructor •() → self::Contravariant ; - 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 Invariant extends core::Object { - synthetic constructor •() → self::Invariant* +class Invariant extends core::Object { + synthetic constructor •() → self::Invariant ; - 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 covariantListInfer(self::Covariant*>* x) → void +static method covariantListInfer(self::Covariant> x) → void ; -static method contravariantListInfer(self::Contravariant*>* x) → void +static method contravariantListInfer(self::Contravariant> x) → void ; -static method invariantListInfer(self::Invariant*>* x) → void +static method invariantListInfer(self::Invariant> x) → void ; static method main() → dynamic ; diff --git a/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.transformed.expect b/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.transformed.expect index d9a257167a6..0850650b9ab 100644 --- a/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/variance/unconstrained_inference.dart.weak.transformed.expect @@ -1,60 +1,30 @@ -library; +library /*isNonNullableByDefault*/; import self as self; import "dart:core" as core; -class Covariant extends core::Object { - synthetic constructor •() → self::Covariant* +class Covariant extends core::Object { + synthetic constructor •() → self::Covariant : 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 } -class Contravariant extends core::Object { - synthetic constructor •() → self::Contravariant* +class Contravariant extends core::Object { + synthetic constructor •() → self::Contravariant : 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 } -class Invariant extends core::Object { - synthetic constructor •() → self::Invariant* +class Invariant extends core::Object { + synthetic constructor •() → self::Invariant : 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 covariantListInfer(self::Covariant*>* x) → void {} -static method contravariantListInfer(self::Contravariant*>* x) → void {} -static method invariantListInfer(self::Invariant*>* x) → void {} +static method covariantListInfer(self::Covariant> x) → void {} +static method contravariantListInfer(self::Contravariant> x) → void {} +static method invariantListInfer(self::Invariant> x) → void {} static method main() → dynamic { - self::Covariant* cov = new self::Covariant::•(); - self::covariantListInfer(new self::Covariant::•*>()); - self::Contravariant* contra = new self::Contravariant::•(); - self::contravariantListInfer(new self::Contravariant::•*>()); - self::Invariant* inv = new self::Invariant::•(); - self::invariantListInfer(new self::Invariant::•*>()); + self::Covariant cov = new self::Covariant::•(); + self::covariantListInfer(new self::Covariant::•>()); + self::Contravariant contra = new self::Contravariant::•(); + self::contravariantListInfer(new self::Contravariant::•>()); + self::Invariant inv = new self::Invariant::•(); + self::invariantListInfer(new self::Invariant::•>()); } diff --git a/tests/dartdevc_2/variance_subtype_test.dart b/tests/dartdevc_2/variance_subtype_test.dart deleted file mode 100644 index b93048407de..00000000000 --- a/tests/dartdevc_2/variance_subtype_test.dart +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) 2019, 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.6 - -// SharedOptions=--enable-experiment=variance - -// Tests runtime subtyping with explicit variance modifiers. - -import 'dart:_runtime' show typeRep; -import 'dart:async' show FutureOr; - -import 'runtime_utils.dart'; - -class Upper {} - -class Middle extends Upper {} - -class Lower extends Middle {} - -class Covariant {} - -class Contravariant {} - -class Invariant {} - -class LegacyCovariant {} - -void main() { - // Covariant <: Covariant - checkProperSubtype(typeRep>(), typeRep>()); - - // Covariant <: Covariant - checkSubtype(typeRep>(), typeRep>()); - - // Contravariant <: Contravariant - checkProperSubtype( - typeRep>(), typeRep>()); - - // Contravariant <: Contravariant - checkSubtype( - typeRep>(), typeRep>()); - - // Invariant <: Invariant - checkSubtype(typeRep>(), typeRep>()); - - // Invariant <:> Invariant - checkMutualSubtype( - typeRep>(), typeRep>()); - - // Invariant> <:> Invariant - checkMutualSubtype( - typeRep>>(), typeRep>()); - - // Invariant> <:> Invariant> - checkMutualSubtype( - typeRep>>(), typeRep>>()); - - // LegacyCovariant <: LegacyCovariant - checkProperSubtype( - typeRep>(), typeRep>()); - - // List> <: Iterable> - checkProperSubtype(typeRep>>(), - typeRep>>()); - - // List> <: Iterable> - checkProperSubtype(typeRep>>(), - typeRep>>()); - - // List> <: Iterable> - checkProperSubtype(typeRep>>(), - typeRep>>()); - - // List> <: Iterable> - checkProperSubtype(typeRep>>(), - typeRep>>()); - - // String -> Covariant <: String -> Covariant - checkProperSubtype(typeRep Function(String)>(), - typeRep Function(String)>()); - - // Covariant -> String <: Covariant -> String - checkProperSubtype(typeRep)>(), - typeRep)>()); - - // String -> Contravariant <: String -> Contravariant - checkProperSubtype(typeRep Function(String)>(), - typeRep Function(String)>()); - - // Contravariant -> String <: Contravariant -> String - checkProperSubtype(typeRep)>(), - typeRep)>()); - - // String -> Invariant <: String -> Invariant - checkSubtype(typeRep)>(), - typeRep)>()); - - // Invariant -> String <: Invariant -> String - checkSubtype(typeRep)>(), - typeRep)>()); - - // String -> LegacyCovariant <: String -> LegacyCovariant - checkProperSubtype(typeRep Function(String)>(), - typeRep Function(String)>()); - - // LegacyCovariant -> String <: LegacyCovariant -> String - checkProperSubtype(typeRep)>(), - typeRep)>()); - - // Covariant - checkSubtypeFailure( - typeRep>(), typeRep>()); - - // Contravariant - checkSubtypeFailure( - typeRep>(), typeRep>()); - - // Invariant - checkSubtypeFailure( - typeRep>(), typeRep>()); - - // Invariant - checkSubtypeFailure( - typeRep>(), typeRep>()); - - // LegacyCovariant - checkSubtypeFailure( - typeRep>(), typeRep>()); - - // List> > - checkSubtypeFailure(typeRep>>(), - typeRep>>()); - - // List> > - checkSubtypeFailure(typeRep>>(), - typeRep>>()); - - // List> > - checkSubtypeFailure(typeRep>>(), - typeRep>>()); - - // List> > - checkSubtypeFailure(typeRep>>(), - typeRep>>()); - - // List> > - checkSubtypeFailure(typeRep>>(), - typeRep>>()); - - // String -> Covariant Covariant - checkSubtypeFailure(typeRep Function(String)>(), - typeRep Function(String)>()); - - // Covariant -> String -> String - checkSubtypeFailure(typeRep)>(), - typeRep)>()); - - // String -> Contravariant Contravariant - checkSubtypeFailure(typeRep Function(String)>(), - typeRep Function(String)>()); - - // Contravariant -> String -> String - checkSubtypeFailure(typeRep)>(), - typeRep)>()); - - // String -> Invariant Invariant - checkSubtypeFailure(typeRep Function(String)>(), - typeRep Function(String)>()); - - // Invariant -> String -> String - checkSubtypeFailure(typeRep)>(), - typeRep)>()); - - // String -> Invariant Invariant - checkSubtypeFailure(typeRep Function(String)>(), - typeRep Function(String)>()); - - // Invariant -> String <: Invariant -> String - checkSubtypeFailure(typeRep)>(), - typeRep)>()); - - // String -> LegacyCovariant LegacyCovariant - checkSubtypeFailure(typeRep Function(String)>(), - typeRep Function(String)>()); - - // LegacyCovariant -> String -> String - checkSubtypeFailure(typeRep)>(), - typeRep)>()); -} diff --git a/tests/dartdevc_2/variance_test.dart b/tests/dartdevc_2/variance_test.dart deleted file mode 100644 index 6d84f2f3c55..00000000000 --- a/tests/dartdevc_2/variance_test.dart +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2019, 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.6 - -// SharedOptions=--enable-experiment=variance - -// Tests the emission of explicit variance modifiers. - -import 'dart:_runtime' - show getGenericArgVariances, Variance, legacyTypeRep; - -import 'package:expect/expect.dart'; - -class A {} - -class B {} - -class C {} - -class D {} - -class E {} - -mixin F {} - -class G = Object with F; - -List getVariances(dynamic type) { - // TODO(nshahan) Revisit when we decide if getGenericArgVariances will handle - // legacy and nullable wrappers. - return getGenericArgVariances(type.type); -} - -main() { - Expect.listEquals([Variance.contravariant], getVariances(legacyTypeRep())); - - Expect.listEquals([Variance.covariant], getVariances(legacyTypeRep())); - - Expect.listEquals([Variance.invariant], getVariances(legacyTypeRep())); - - // Implicit variance is not emitted into the generated code. - Expect.isNull(getVariances(legacyTypeRep())); - - Expect.listEquals( - [Variance.invariant, Variance.covariant, Variance.contravariant], - getVariances(legacyTypeRep())); - - Expect.listEquals([Variance.contravariant], getVariances(legacyTypeRep())); - - Expect.listEquals([Variance.invariant], getVariances(legacyTypeRep())); -}