Version 2.2.1-dev.4.2
* Cherry-pick ab66a3808b28dfc94eaf0ed151c13f4fc696b5dc to dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f4ea3b0..ebda709 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.2.1-dev.4.2
+
+* Cherry-pick ab66a3808b28dfc94eaf0ed151c13f4fc696b5dc to dev
+
## 2.2.1-dev.4.1
* Cherry-pick 72b7e95c74b3ec0f0530322923713162a83013e2 to dev
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index d35150d..e6c5630 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -2191,6 +2191,14 @@
// With JS semantics, an integer is also a double.
return true;
}
+
+ if (constantType == typeEnvironment.doubleType &&
+ type == typeEnvironment.intType) {
+ double value = (constant as DoubleConstant).value;
+ if (value.isFinite && value == value.truncateToDouble()) {
+ return true;
+ }
+ }
}
return typeEnvironment.isSubtypeOf(constantType, type);
}
diff --git a/tests/compiler/dart2js_extra/issue36562_test.dart b/tests/compiler/dart2js_extra/issue36562_test.dart
new file mode 100644
index 0000000..cd43f16
--- /dev/null
+++ b/tests/compiler/dart2js_extra/issue36562_test.dart
@@ -0,0 +1,12 @@
+// 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.
+
+const int x = 0;
+
+const List<int> l = const [
+ 1,
+ -x,
+];
+
+main() => print(l);
diff --git a/tools/VERSION b/tools/VERSION
index 014fd75..e0edd34 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -34,6 +34,6 @@
MINOR 2
PATCH 1
PRERELEASE 4
-PRERELEASE_PATCH 1
+PRERELEASE_PATCH 2
ABI_VERSION 2
OLDEST_SUPPORTED_ABI_VERSION 1