From 706c7e4a588a50592f4431e9c27ce1ce3c386701 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 8 Sep 2021 14:07:25 +0000 Subject: [PATCH] Revert "Remove explicit bool type hack." This reverts commit 4a54307a39316001b85a3ffe230dff18b0812e0d. Reason for revert: Broke internal build, golem Original change's description: > Remove explicit bool type hack. > > During the fix for https://github.com/dart-lang/language/issues/1785, > an explicit `bool` type was added to the variable `nullable` to ensure > that it would properly participate in type promotion while the fix was > still being rolled out. Now that the fix is in place, this explicit > type is no longer needed. > > TEST=standard trybots > Change-Id: Ied468b17dafa03075fd54c0df915e0a539420697 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212266 > Reviewed-by: Alexander Markov > Commit-Queue: Paul Berry TBR=paulberry@google.com,alexmarkov@google.com Change-Id: I748060275968e1a87a78e90d3770b17543549f33 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212783 Reviewed-by: Paul Berry Commit-Queue: Paul Berry --- .dart_tool/package_config.json | 4 ++-- pkg/vm/lib/transformations/type_flow/transformer.dart | 8 +++++++- pkg/vm/pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index f9c157edc0f..b6def050f3c 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -11,7 +11,7 @@ "constraint, update this by running tools/generate_package_config.dart." ], "configVersion": 2, - "generated": "2021-09-07T14:56:54.026010", + "generated": "2021-09-01T12:41:37.776425", "generator": "tools/generate_package_config.dart", "packages": [ { @@ -761,7 +761,7 @@ "name": "vm", "rootUri": "../pkg/vm", "packageUri": "lib/", - "languageVersion": "2.15" + "languageVersion": "2.12" }, { "name": "vm_service", diff --git a/pkg/vm/lib/transformations/type_flow/transformer.dart b/pkg/vm/lib/transformations/type_flow/transformer.dart index 02f23ab3e0e..2ed3a8e9eaf 100644 --- a/pkg/vm/lib/transformations/type_flow/transformer.dart +++ b/pkg/vm/lib/transformations/type_flow/transformer.dart @@ -315,7 +315,13 @@ class AnnotateKernel extends RecursiveVisitor { Constant? constantValue; bool isInt = false; - final nullable = type is NullableType; + // Note: the explicit type `bool` is needed because the checked-in version + // of the CFE that we use for bootstrapping doesn't yet have constructor + // tearoffs enabled, and the fix for bug + // https://github.com/dart-lang/language/issues/1785 only takes effect when + // constructor tearoffs are enabled. TODO(paulberry): remove the type after + // the bootstrap CFE enables constructor tearoffs. + final bool nullable = type is NullableType; if (nullable) { type = type.baseType; } diff --git a/pkg/vm/pubspec.yaml b/pkg/vm/pubspec.yaml index 9b70250bede..20b2cd728dd 100644 --- a/pkg/vm/pubspec.yaml +++ b/pkg/vm/pubspec.yaml @@ -4,7 +4,7 @@ description: VM specific Dart code and helper scripts publish_to: none environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: args: ^1.4.4