Migrate language_2/double_literals to NNBD.

Change-Id: I6c9041c80cec102c301e59b3bc30d8a86b9b98b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142300
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
diff --git a/tests/language/double_literals/double_literal_coercion_error_test.dart b/tests/language/double_literals/double_literal_coercion_error_test.dart
new file mode 100644
index 0000000..6b574fc
--- /dev/null
+++ b/tests/language/double_literals/double_literal_coercion_error_test.dart
@@ -0,0 +1,299 @@
+// 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 file.
+
+// Introduces a context with double as type.
+void notDouble([double value = 0.0]) {
+  if (value != 0.0) throw "unreachable";
+}
+
+main() {
+  notDouble(
+    // Large decimal numbers which are not representable as doubles.
+    9007199254740993, //     2^53+2^0      //# 001: compile-time error
+    18014398509481983, //    2^54-2^0      //# 002: compile-time error
+    18014398509481985, //    2^54+2^0      //# 003: compile-time error
+    18014398509481986, //    2^54+2^1      //# 004: compile-time error
+    4611686018427387903, //  2^62-2^0      //# 005: compile-time error
+    4611686018427387902, //  2^62-2^1      //# 006: compile-time error
+    4611686018427387900, //  2^62-2^2      //# 007: compile-time error
+    4611686018427387896, //  2^62-2^3      //# 008: compile-time error
+    4611686018427387888, //  2^62-2^4      //# 009: compile-time error
+    4611686018427387872, //  2^62-2^5      //# 010: compile-time error
+    4611686018427387840, //  2^62-2^6      //# 011: compile-time error
+    4611686018427387776, //  2^62-2^7      //# 012: compile-time error
+    4611686018427387648, //  2^62-2^8      //# 013: compile-time error
+    4611686018427387905, //  2^62+2^0      //# 014: compile-time error
+    4611686018427387906, //  2^62+2^1      //# 015: compile-time error
+    4611686018427387908, //  2^62+2^2      //# 016: compile-time error
+    4611686018427387912, //  2^62+2^3      //# 017: compile-time error
+    4611686018427387920, //  2^62+2^4      //# 018: compile-time error
+    4611686018427387936, //  2^62+2^5      //# 019: compile-time error
+    4611686018427387968, //  2^62+2^6      //# 020: compile-time error
+    4611686018427388032, //  2^62+2^7      //# 021: compile-time error
+    4611686018427388160, //  2^62+2^8      //# 022: compile-time error
+    4611686018427388416, //  2^62+2^9      //# 023: compile-time error
+    9223372036854775807, //  2^63-2^0      //# 024: compile-time error
+    9223372036854775806, //  2^63-2^1      //# 025: compile-time error
+    9223372036854775804, //  2^63-2^2      //# 026: compile-time error
+    9223372036854775800, //  2^63-2^3      //# 027: compile-time error
+    9223372036854775792, //  2^63-2^4      //# 028: compile-time error
+    9223372036854775776, //  2^63-2^5      //# 029: compile-time error
+    9223372036854775744, //  2^63-2^6      //# 030: compile-time error
+    9223372036854775680, //  2^63-2^7      //# 031: compile-time error
+    9223372036854775552, //  2^63-2^8      //# 032: compile-time error
+    9223372036854775296, //  2^63-2^9      //# 033: compile-time error
+    9223372036854775809, //  2^63+2^0      //# 034: compile-time error
+    9223372036854775810, //  2^63+2^1      //# 035: compile-time error
+    9223372036854775812, //  2^63+2^2      //# 036: compile-time error
+    9223372036854775816, //  2^63+2^3      //# 037: compile-time error
+    9223372036854775824, //  2^63+2^4      //# 038: compile-time error
+    9223372036854775840, //  2^63+2^5      //# 039: compile-time error
+    9223372036854775872, //  2^63+2^6      //# 040: compile-time error
+    9223372036854775936, //  2^63+2^7      //# 041: compile-time error
+    9223372036854776064, //  2^63+2^8      //# 042: compile-time error
+    9223372036854776320, //  2^63+2^9      //# 043: compile-time error
+    9223372036854776832, //  2^63+2^10     //# 044: compile-time error
+    18446744073709551615, // 2^64-2^0      //# 045: compile-time error
+    18446744073709551614, // 2^64-2^1      //# 046: compile-time error
+    18446744073709551612, // 2^64-2^2      //# 047: compile-time error
+    18446744073709551608, // 2^64-2^3      //# 048: compile-time error
+    18446744073709551600, // 2^64-2^4      //# 049: compile-time error
+    18446744073709551584, // 2^64-2^5      //# 050: compile-time error
+    18446744073709551552, // 2^64-2^6      //# 051: compile-time error
+    18446744073709551488, // 2^64-2^7      //# 052: compile-time error
+    18446744073709551360, // 2^64-2^8      //# 053: compile-time error
+    18446744073709551104, // 2^64-2^9      //# 054: compile-time error
+    18446744073709550592, // 2^64-2^10     //# 055: compile-time error
+    18446744073709551617, // 2^64+2^0      //# 056: compile-time error
+    18446744073709551618, // 2^64+2^1      //# 057: compile-time error
+    18446744073709551620, // 2^64+2^2      //# 058: compile-time error
+    18446744073709551624, // 2^64+2^3      //# 059: compile-time error
+    18446744073709551632, // 2^64+2^4      //# 060: compile-time error
+    18446744073709551648, // 2^64+2^5      //# 061: compile-time error
+    18446744073709551680, // 2^64+2^6      //# 062: compile-time error
+    18446744073709551744, // 2^64+2^7      //# 063: compile-time error
+    18446744073709551872, // 2^64+2^8      //# 064: compile-time error
+    18446744073709552128, // 2^64+2^9      //# 065: compile-time error
+    18446744073709552640, // 2^64+2^10     //# 066: compile-time error
+    18446744073709553664, // 2^64+2^11     //# 067: compile-time error
+    179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858367, // maxValue - 1 //# 068 : compile-time error
+    179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858369, // maxValue + 1 //# 069 : compile-time error
+    359538626972463141629054847463408713596141135051689993197834953606314521560057077521179117265533756343080917907028764928468642653778928365536935093407075033972099821153102564152490980180778657888151737016910267884609166473806445896331617118664246696549595652408289446337476354361838599762500808052368249716734, // maxValue * 2 //# 070P : compile-time error
+
+    // Negative numbers too.
+    -9007199254740993, //     -(2^53+2^0)  //# 071: compile-time error
+    -18014398509481983, //    -(2^54-2^0)  //# 072: compile-time error
+    -18014398509481985, //    -(2^54+2^0)  //# 073: compile-time error
+    -18014398509481986, //    -(2^54+2^1)  //# 074: compile-time error
+    -4611686018427387903, //  -(2^62-2^0)  //# 075: compile-time error
+    -4611686018427387902, //  -(2^62-2^1)  //# 076: compile-time error
+    -4611686018427387900, //  -(2^62-2^2)  //# 077: compile-time error
+    -4611686018427387896, //  -(2^62-2^3)  //# 078: compile-time error
+    -4611686018427387888, //  -(2^62-2^4)  //# 079: compile-time error
+    -4611686018427387872, //  -(2^62-2^5)  //# 080: compile-time error
+    -4611686018427387840, //  -(2^62-2^6)  //# 081: compile-time error
+    -4611686018427387776, //  -(2^62-2^7)  //# 082: compile-time error
+    -4611686018427387648, //  -(2^62-2^8)  //# 083: compile-time error
+    -4611686018427387905, //  -(2^62+2^0)  //# 084: compile-time error
+    -4611686018427387906, //  -(2^62+2^1)  //# 085: compile-time error
+    -4611686018427387908, //  -(2^62+2^2)  //# 086: compile-time error
+    -4611686018427387912, //  -(2^62+2^3)  //# 087: compile-time error
+    -4611686018427387920, //  -(2^62+2^4)  //# 088: compile-time error
+    -4611686018427387936, //  -(2^62+2^5)  //# 089: compile-time error
+    -4611686018427387968, //  -(2^62+2^6)  //# 090: compile-time error
+    -4611686018427388032, //  -(2^62+2^7)  //# 091: compile-time error
+    -4611686018427388160, //  -(2^62+2^8)  //# 092: compile-time error
+    -4611686018427388416, //  -(2^62+2^9)  //# 093: compile-time error
+    -9223372036854775807, //  -(2^63-2^0)  //# 094: compile-time error
+    -9223372036854775806, //  -(2^63-2^1)  //# 095: compile-time error
+    -9223372036854775804, //  -(2^63-2^2)  //# 096: compile-time error
+    -9223372036854775800, //  -(2^63-2^3)  //# 097: compile-time error
+    -9223372036854775792, //  -(2^63-2^4)  //# 098: compile-time error
+    -9223372036854775776, //  -(2^63-2^5)  //# 099: compile-time error
+    -9223372036854775744, //  -(2^63-2^6)  //# 100: compile-time error
+    -9223372036854775680, //  -(2^63-2^7)  //# 101: compile-time error
+    -9223372036854775552, //  -(2^63-2^8)  //# 102: compile-time error
+    -9223372036854775296, //  -(2^63-2^9)  //# 103: compile-time error
+    -9223372036854775809, //  -(2^63+2^0)  //# 104: compile-time error
+    -9223372036854775810, //  -(2^63+2^1)  //# 105: compile-time error
+    -9223372036854775812, //  -(2^63+2^2)  //# 106: compile-time error
+    -9223372036854775816, //  -(2^63+2^3)  //# 107: compile-time error
+    -9223372036854775824, //  -(2^63+2^4)  //# 108: compile-time error
+    -9223372036854775840, //  -(2^63+2^5)  //# 109: compile-time error
+    -9223372036854775872, //  -(2^63+2^6)  //# 110: compile-time error
+    -9223372036854775936, //  -(2^63+2^7)  //# 111: compile-time error
+    -9223372036854776064, //  -(2^63+2^8)  //# 112: compile-time error
+    -9223372036854776320, //  -(2^63+2^9)  //# 113: compile-time error
+    -9223372036854776832, //  -(2^63+2^10) //# 114: compile-time error
+    -18446744073709551615, // -(2^64-2^0)  //# 115: compile-time error
+    -18446744073709551614, // -(2^64-2^1)  //# 116: compile-time error
+    -18446744073709551612, // -(2^64-2^2)  //# 117: compile-time error
+    -18446744073709551608, // -(2^64-2^3)  //# 118: compile-time error
+    -18446744073709551600, // -(2^64-2^4)  //# 119: compile-time error
+    -18446744073709551584, // -(2^64-2^5)  //# 120: compile-time error
+    -18446744073709551552, // -(2^64-2^6)  //# 121: compile-time error
+    -18446744073709551488, // -(2^64-2^7)  //# 122: compile-time error
+    -18446744073709551360, // -(2^64-2^8)  //# 123: compile-time error
+    -18446744073709551104, // -(2^64-2^9)  //# 124: compile-time error
+    -18446744073709550592, // -(2^64-2^10) //# 125: compile-time error
+    -18446744073709551617, // -(2^64+2^0)  //# 126: compile-time error
+    -18446744073709551618, // -(2^64+2^1)  //# 127: compile-time error
+    -18446744073709551620, // -(2^64+2^2)  //# 128: compile-time error
+    -18446744073709551624, // -(2^64+2^3)  //# 129: compile-time error
+    -18446744073709551632, // -(2^64+2^4)  //# 130: compile-time error
+    -18446744073709551648, // -(2^64+2^5)  //# 131: compile-time error
+    -18446744073709551680, // -(2^64+2^6)  //# 132: compile-time error
+    -18446744073709551744, // -(2^64+2^7)  //# 133: compile-time error
+    -18446744073709551872, // -(2^64+2^8)  //# 134: compile-time error
+    -18446744073709552128, // -(2^64+2^9)  //# 135: compile-time error
+    -18446744073709552640, // -(2^64+2^10) //# 136: compile-time error
+    -18446744073709553664, // -(2^64+2^11) //# 137: compile-time error
+    -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858367, // -(maxValue - 1) //# 138 : compile-time error
+    -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858369, // -(maxValue + 1) //# 139 : compile-time error
+    -359538626972463141629054847463408713596141135051689993197834953606314521560057077521179117265533756343080917907028764928468642653778928365536935093407075033972099821153102564152490980180778657888151737016910267884609166473806445896331617118664246696549595652408289446337476354361838599762500808052368249716734, // -(maxValue * 2) //# 140B : compile-time error
+
+    // Same numbers as hexadecimal literals.
+    0x20000000000001, //    2^53+2^0      //# 141: compile-time error
+    0x3fffffffffffff, //    2^54-2^0      //# 142: compile-time error
+    0x40000000000001, //    2^54+2^0      //# 143: compile-time error
+    0x40000000000002, //    2^54+2^1      //# 144: compile-time error
+    0x3fffffffffffffff, //  2^62-2^0      //# 145: compile-time error
+    0x3ffffffffffffffe, //  2^62-2^1      //# 146: compile-time error
+    0x3ffffffffffffffc, //  2^62-2^2      //# 147: compile-time error
+    0x3ffffffffffffff8, //  2^62-2^3      //# 148: compile-time error
+    0x3ffffffffffffff0, //  2^62-2^4      //# 149: compile-time error
+    0x3fffffffffffffe0, //  2^62-2^5      //# 150: compile-time error
+    0x3fffffffffffffc0, //  2^62-2^6      //# 151: compile-time error
+    0x3fffffffffffff80, //  2^62-2^7      //# 152: compile-time error
+    0x3fffffffffffff00, //  2^62-2^8      //# 153: compile-time error
+    0x4000000000000001, //  2^62+2^0      //# 154: compile-time error
+    0x4000000000000002, //  2^62+2^1      //# 155: compile-time error
+    0x4000000000000004, //  2^62+2^2      //# 156: compile-time error
+    0x4000000000000008, //  2^62+2^3      //# 157: compile-time error
+    0x4000000000000010, //  2^62+2^4      //# 158: compile-time error
+    0x4000000000000020, //  2^62+2^5      //# 159: compile-time error
+    0x4000000000000040, //  2^62+2^6      //# 160: compile-time error
+    0x4000000000000080, //  2^62+2^7      //# 161: compile-time error
+    0x4000000000000100, //  2^62+2^8      //# 162: compile-time error
+    0x4000000000000200, //  2^62+2^9      //# 163: compile-time error
+    0x7fffffffffffffff, //  2^63-2^0      //# 164: compile-time error
+    0x7ffffffffffffffe, //  2^63-2^1      //# 165: compile-time error
+    0x7ffffffffffffffc, //  2^63-2^2      //# 166: compile-time error
+    0x7ffffffffffffff8, //  2^63-2^3      //# 167: compile-time error
+    0x7ffffffffffffff0, //  2^63-2^4      //# 168: compile-time error
+    0x7fffffffffffffe0, //  2^63-2^5      //# 169: compile-time error
+    0x7fffffffffffffc0, //  2^63-2^6      //# 170: compile-time error
+    0x7fffffffffffff80, //  2^63-2^7      //# 171: compile-time error
+    0x7fffffffffffff00, //  2^63-2^8      //# 172: compile-time error
+    0x7ffffffffffffe00, //  2^63-2^9      //# 173: compile-time error
+    0x8000000000000001, //  2^63+2^0      //# 174: compile-time error
+    0x8000000000000002, //  2^63+2^1      //# 175: compile-time error
+    0x8000000000000004, //  2^63+2^2      //# 176: compile-time error
+    0x8000000000000008, //  2^63+2^3      //# 177: compile-time error
+    0x8000000000000010, //  2^63+2^4      //# 178: compile-time error
+    0x8000000000000020, //  2^63+2^5      //# 179: compile-time error
+    0x8000000000000040, //  2^63+2^6      //# 180: compile-time error
+    0x8000000000000080, //  2^63+2^7      //# 181: compile-time error
+    0x8000000000000100, //  2^63+2^8      //# 182: compile-time error
+    0x8000000000000200, //  2^63+2^9      //# 183: compile-time error
+    0x8000000000000400, //  2^63+2^10     //# 184: compile-time error
+    0xffffffffffffffff, //  2^64-2^0      //# 185: compile-time error
+    0xfffffffffffffffe, //  2^64-2^1      //# 186: compile-time error
+    0xfffffffffffffffc, //  2^64-2^2      //# 187: compile-time error
+    0xfffffffffffffff8, //  2^64-2^3      //# 188: compile-time error
+    0xfffffffffffffff0, //  2^64-2^4      //# 189: compile-time error
+    0xffffffffffffffe0, //  2^64-2^5      //# 190: compile-time error
+    0xffffffffffffffc0, //  2^64-2^6      //# 191: compile-time error
+    0xffffffffffffff80, //  2^64-2^7      //# 192: compile-time error
+    0xffffffffffffff00, //  2^64-2^8      //# 193: compile-time error
+    0xfffffffffffffe00, //  2^64-2^9      //# 194: compile-time error
+    0xfffffffffffffc00, //  2^64-2^10     //# 195: compile-time error
+    0x10000000000000001, // 2^64+2^0      //# 196: compile-time error
+    0x10000000000000002, // 2^64+2^1      //# 197: compile-time error
+    0x10000000000000004, // 2^64+2^2      //# 198: compile-time error
+    0x10000000000000008, // 2^64+2^3      //# 199: compile-time error
+    0x10000000000000010, // 2^64+2^4      //# 200: compile-time error
+    0x10000000000000020, // 2^64+2^5      //# 201: compile-time error
+    0x10000000000000040, // 2^64+2^6      //# 202: compile-time error
+    0x10000000000000080, // 2^64+2^7      //# 203: compile-time error
+    0x10000000000000100, // 2^64+2^8      //# 204: compile-time error
+    0x10000000000000200, // 2^64+2^9      //# 205: compile-time error
+    0x10000000000000400, // 2^64+2^10     //# 206: compile-time error
+    0x10000000000000800, // 2^64+2^11     //# 207: compile-time error
+    0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, // maxValue - 1 //# 208 : compile-time error
+    0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, // maxValue + 1 //# 209 : compile-time error
+    0x1fffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, // maxValue * 2 //# 210V : compile-time error
+
+    -0x20000000000001, //    -(2^53+2^0)      //# 211: compile-time error
+    -0x3fffffffffffff, //    -(2^54-2^0)      //# 212: compile-time error
+    -0x40000000000001, //    -(2^54+2^0)      //# 213: compile-time error
+    -0x40000000000002, //    -(2^54+2^1)      //# 214: compile-time error
+    -0x3fffffffffffffff, //  -(2^62-2^0)      //# 215: compile-time error
+    -0x3ffffffffffffffe, //  -(2^62-2^1)      //# 216: compile-time error
+    -0x3ffffffffffffffc, //  -(2^62-2^2)      //# 217: compile-time error
+    -0x3ffffffffffffff8, //  -(2^62-2^3)      //# 218: compile-time error
+    -0x3ffffffffffffff0, //  -(2^62-2^4)      //# 219: compile-time error
+    -0x3fffffffffffffe0, //  -(2^62-2^5)      //# 220: compile-time error
+    -0x3fffffffffffffc0, //  -(2^62-2^6)      //# 221: compile-time error
+    -0x3fffffffffffff80, //  -(2^62-2^7)      //# 222: compile-time error
+    -0x3fffffffffffff00, //  -(2^62-2^8)      //# 223: compile-time error
+    -0x4000000000000001, //  -(2^62+2^0)      //# 224: compile-time error
+    -0x4000000000000002, //  -(2^62+2^1)      //# 225: compile-time error
+    -0x4000000000000004, //  -(2^62+2^2)      //# 226: compile-time error
+    -0x4000000000000008, //  -(2^62+2^3)      //# 227: compile-time error
+    -0x4000000000000010, //  -(2^62+2^4)      //# 228: compile-time error
+    -0x4000000000000020, //  -(2^62+2^5)      //# 229: compile-time error
+    -0x4000000000000040, //  -(2^62+2^6)      //# 230: compile-time error
+    -0x4000000000000080, //  -(2^62+2^7)      //# 231: compile-time error
+    -0x4000000000000100, //  -(2^62+2^8)      //# 232: compile-time error
+    -0x4000000000000200, //  -(2^62+2^9)      //# 233: compile-time error
+    -0x7fffffffffffffff, //  -(2^63-2^0)      //# 234: compile-time error
+    -0x7ffffffffffffffe, //  -(2^63-2^1)      //# 235: compile-time error
+    -0x7ffffffffffffffc, //  -(2^63-2^2)      //# 236: compile-time error
+    -0x7ffffffffffffff8, //  -(2^63-2^3)      //# 237: compile-time error
+    -0x7ffffffffffffff0, //  -(2^63-2^4)      //# 238: compile-time error
+    -0x7fffffffffffffe0, //  -(2^63-2^5)      //# 239: compile-time error
+    -0x7fffffffffffffc0, //  -(2^63-2^6)      //# 240: compile-time error
+    -0x7fffffffffffff80, //  -(2^63-2^7)      //# 241: compile-time error
+    -0x7fffffffffffff00, //  -(2^63-2^8)      //# 242: compile-time error
+    -0x7ffffffffffffe00, //  -(2^63-2^9)      //# 243: compile-time error
+    -0x8000000000000001, //  -(2^63+2^0)      //# 244: compile-time error
+    -0x8000000000000002, //  -(2^63+2^1)      //# 245: compile-time error
+    -0x8000000000000004, //  -(2^63+2^2)      //# 246: compile-time error
+    -0x8000000000000008, //  -(2^63+2^3)      //# 247: compile-time error
+    -0x8000000000000010, //  -(2^63+2^4)      //# 248: compile-time error
+    -0x8000000000000020, //  -(2^63+2^5)      //# 249: compile-time error
+    -0x8000000000000040, //  -(2^63+2^6)      //# 250: compile-time error
+    -0x8000000000000080, //  -(2^63+2^7)      //# 251: compile-time error
+    -0x8000000000000100, //  -(2^63+2^8)      //# 252: compile-time error
+    -0x8000000000000200, //  -(2^63+2^9)      //# 253: compile-time error
+    -0x8000000000000400, //  -(2^63+2^10)     //# 254: compile-time error
+    -0xffffffffffffffff, //  -(2^64-2^0)      //# 255: compile-time error
+    -0xfffffffffffffffe, //  -(2^64-2^1)      //# 256: compile-time error
+    -0xfffffffffffffffc, //  -(2^64-2^2)      //# 257: compile-time error
+    -0xfffffffffffffff8, //  -(2^64-2^3)      //# 258: compile-time error
+    -0xfffffffffffffff0, //  -(2^64-2^4)      //# 259: compile-time error
+    -0xffffffffffffffe0, //  -(2^64-2^5)      //# 260: compile-time error
+    -0xffffffffffffffc0, //  -(2^64-2^6)      //# 261: compile-time error
+    -0xffffffffffffff80, //  -(2^64-2^7)      //# 262: compile-time error
+    -0xffffffffffffff00, //  -(2^64-2^8)      //# 263: compile-time error
+    -0xfffffffffffffe00, //  -(2^64-2^9)      //# 264: compile-time error
+    -0xfffffffffffffc00, //  -(2^64-2^10)     //# 265: compile-time error
+    -0x10000000000000001, // -(2^64+2^0)      //# 266: compile-time error
+    -0x10000000000000002, // -(2^64+2^1)      //# 267: compile-time error
+    -0x10000000000000004, // -(2^64+2^2)      //# 268: compile-time error
+    -0x10000000000000008, // -(2^64+2^3)      //# 269: compile-time error
+    -0x10000000000000010, // -(2^64+2^4)      //# 270: compile-time error
+    -0x10000000000000020, // -(2^64+2^5)      //# 271: compile-time error
+    -0x10000000000000040, // -(2^64+2^6)      //# 272: compile-time error
+    -0x10000000000000080, // -(2^64+2^7)      //# 273: compile-time error
+    -0x10000000000000100, // -(2^64+2^8)      //# 274: compile-time error
+    -0x10000000000000200, // -(2^64+2^9)      //# 275: compile-time error
+    -0x10000000000000400, // -(2^64+2^10)     //# 276: compile-time error
+    -0x10000000000000800, // -(2^64+2^11)     //# 277: compile-time error
+    -0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, // -(maxValue - 1) //# 278 : compile-time error
+    -0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, // -(maxValue + 1) //# 279 : compile-time error
+    -0x1fffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, // -(maxValue * 2) //# 280 : compile-time error
+  );
+}
diff --git a/tests/language/double_literals/double_literal_coercion_test.dart b/tests/language/double_literals/double_literal_coercion_test.dart
new file mode 100644
index 0000000..b18b22f
--- /dev/null
+++ b/tests/language/double_literals/double_literal_coercion_test.dart
@@ -0,0 +1,149 @@
+// 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 file.
+
+import "package:expect/expect.dart";
+
+// Pass expected value and then decimal literal value in a double context.
+void expectDouble(double expectedValue, double actualValue) {
+  Expect.identical(expectedValue, actualValue);
+}
+
+// Some exact powers of two as double values.
+double p2_8 = 256.0;
+double p2_30 = 1073741824.0;
+double p2_31 = 2147483648.0;
+double p2_32 = 4294967296.0;
+double p2_52 = 4503599627370496.0;
+double p2_53 = 9007199254740992.0;
+double p2_54 = 18014398509481984.0;
+double p2_62 = 4611686018427387904.0;
+double p2_63 = 9223372036854775808.0;
+double p2_64 = 18446744073709551616.0;
+double maxValue = 1.7976931348623157e+308;
+
+main() {
+  expectDouble(0.0, 0);
+  expectDouble(1.0, 1);
+  expectDouble(0.0, 00);
+  expectDouble(1.0, 01);
+  expectDouble(p2_8 - 1, 255);
+  expectDouble(p2_8, 256);
+  expectDouble(p2_8 + 1, 257);
+  expectDouble(p2_30 - 1, 1073741823);
+  expectDouble(p2_30, 1073741824);
+  expectDouble(p2_30 + 1, 1073741825);
+  expectDouble(p2_31 - 1, 2147483647);
+  expectDouble(p2_31, 2147483648);
+  expectDouble(p2_31 + 1, 2147483649);
+  expectDouble(p2_32 - 1, 4294967295);
+  expectDouble(p2_32, 4294967296);
+  expectDouble(p2_32 + 1, 4294967297);
+  expectDouble(p2_52 - 1, 4503599627370495);
+  expectDouble(p2_52, 4503599627370496);
+  expectDouble(p2_52 + 1, 4503599627370497);
+  expectDouble(p2_53 - 1, 9007199254740991);
+  expectDouble(p2_53, 9007199254740992);
+  expectDouble(p2_53 + 2, 9007199254740994);
+  expectDouble(p2_54 - 2, 18014398509481982);
+  expectDouble(p2_54, 18014398509481984);
+  expectDouble(p2_54 + 4, 18014398509481988);
+  expectDouble(p2_62, 4611686018427387904);
+  expectDouble(p2_63, 9223372036854775808);
+  expectDouble(p2_64, 18446744073709551616);
+  expectDouble(maxValue,
+      179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368);
+
+  expectDouble(-0.0, -0);
+  expectDouble(-1.0, -1);
+  expectDouble(-0.0, -00);
+  expectDouble(-1.0, -01);
+  expectDouble(-(p2_8 - 1), -255);
+  expectDouble(-(p2_8), -256);
+  expectDouble(-(p2_8 + 1), -257);
+  expectDouble(-(p2_30 - 1), -1073741823);
+  expectDouble(-(p2_30), -1073741824);
+  expectDouble(-(p2_30 + 1), -1073741825);
+  expectDouble(-(p2_31 - 1), -2147483647);
+  expectDouble(-(p2_31), -2147483648);
+  expectDouble(-(p2_31 + 1), -2147483649);
+  expectDouble(-(p2_32 - 1), -4294967295);
+  expectDouble(-(p2_32), -4294967296);
+  expectDouble(-(p2_32 + 1), -4294967297);
+  expectDouble(-(p2_52 - 1), -4503599627370495);
+  expectDouble(-(p2_52), -4503599627370496);
+  expectDouble(-(p2_52 + 1), -4503599627370497);
+  expectDouble(-(p2_53 - 1), -9007199254740991);
+  expectDouble(-(p2_53), -9007199254740992);
+  expectDouble(-(p2_53 + 2), -9007199254740994);
+  expectDouble(-(p2_54 - 2), -18014398509481982);
+  expectDouble(-(p2_54), -18014398509481984);
+  expectDouble(-(p2_54 + 4), -18014398509481988);
+  expectDouble(-(p2_62), -4611686018427387904);
+  expectDouble(-(p2_63), -9223372036854775808);
+  expectDouble(-(p2_64), -18446744073709551616);
+  expectDouble(-maxValue,
+      -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368);
+
+  expectDouble(0.0, 0x0);
+  expectDouble(1.0, 0x1);
+  expectDouble(0.0, 0x00);
+  expectDouble(1.0, 0x01);
+  expectDouble(p2_8 - 1, 0xff);
+  expectDouble(p2_8, 0x100);
+  expectDouble(p2_8 + 1, 0x101);
+  expectDouble(p2_30 - 1, 0x3fffffff);
+  expectDouble(p2_30, 0x40000000);
+  expectDouble(p2_30 + 1, 0x40000001);
+  expectDouble(p2_31 - 1, 0x7fffffff);
+  expectDouble(p2_31, 0x80000000);
+  expectDouble(p2_31 + 1, 0x80000001);
+  expectDouble(p2_32 - 1, 0xffffffff);
+  expectDouble(p2_32, 0x100000000);
+  expectDouble(p2_32 + 1, 0x100000001);
+  expectDouble(p2_52 - 1, 0xfffffffffffff);
+  expectDouble(p2_52, 0x10000000000000);
+  expectDouble(p2_52 + 1, 0x10000000000001);
+  expectDouble(p2_53 - 1, 0x1fffffffffffff);
+  expectDouble(p2_53, 0x20000000000000);
+  expectDouble(p2_53 + 2, 0x20000000000002);
+  expectDouble(p2_54 - 2, 0x3ffffffffffffe);
+  expectDouble(p2_54, 0x40000000000000);
+  expectDouble(p2_54 + 4, 0x40000000000004);
+  expectDouble(p2_62, 0x4000000000000000);
+  expectDouble(p2_63, 0x8000000000000000);
+  expectDouble(p2_64, 0x10000000000000000);
+  expectDouble(maxValue,
+      0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
+
+  expectDouble(-0.0, -0x0);
+  expectDouble(-1.0, -0x1);
+  expectDouble(-0.0, -0x00);
+  expectDouble(-1.0, -0x01);
+  expectDouble(-(p2_8 - 1), -0xff);
+  expectDouble(-(p2_8), -0x100);
+  expectDouble(-(p2_8 + 1), -0x101);
+  expectDouble(-(p2_30 - 1), -0x3fffffff);
+  expectDouble(-(p2_30), -0x40000000);
+  expectDouble(-(p2_30 + 1), -0x40000001);
+  expectDouble(-(p2_31 - 1), -0x7fffffff);
+  expectDouble(-(p2_31), -0x80000000);
+  expectDouble(-(p2_31 + 1), -0x80000001);
+  expectDouble(-(p2_32 - 1), -0xffffffff);
+  expectDouble(-(p2_32), -0x100000000);
+  expectDouble(-(p2_32 + 1), -0x100000001);
+  expectDouble(-(p2_52 - 1), -0xfffffffffffff);
+  expectDouble(-(p2_52), -0x10000000000000);
+  expectDouble(-(p2_52 + 1), -0x10000000000001);
+  expectDouble(-(p2_53 - 1), -0x1fffffffffffff);
+  expectDouble(-(p2_53), -0x20000000000000);
+  expectDouble(-(p2_53 + 2), -0x20000000000002);
+  expectDouble(-(p2_54 - 2), -0x3ffffffffffffe);
+  expectDouble(-(p2_54), -0x40000000000000);
+  expectDouble(-(p2_54 + 4), -0x40000000000004);
+  expectDouble(-(p2_62), -0x4000000000000000);
+  expectDouble(-(p2_63), -0x8000000000000000);
+  expectDouble(-(p2_64), -0x10000000000000000);
+  expectDouble(-maxValue,
+      -0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
+}
diff --git a/tests/language/double_literals/implicit_double_context_test.dart b/tests/language/double_literals/implicit_double_context_test.dart
new file mode 100644
index 0000000..117b5cd
--- /dev/null
+++ b/tests/language/double_literals/implicit_double_context_test.dart
@@ -0,0 +1,683 @@
+// 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 file.
+
+import "dart:async" show FutureOr;
+
+import "package:expect/expect.dart";
+
+// Check that integer literals in a double context are allowed
+// for various double context.
+
+main() {
+  // Variable initializer context.
+  double v1 = 0;
+  Expect.identical(0.0, v1);
+  double v2 = 1;
+  Expect.identical(1.0, v2);
+  double v3 = -0;
+  Expect.identical(-0.0, v3);
+  double v4 = -1;
+  Expect.identical(-1.0, v4);
+  double v5 = 9223372036854775808; // 2^63, not valid signed 64-bit integer.
+  Expect.identical(9223372036854775808.0, v5);
+  double v6 = 18446744073709551616; // 2^64.
+  Expect.identical(18446744073709551616.0, v6);
+  double v7 = 0x02; // Hex literal.
+  Expect.identical(2.0, v7);
+  double v8 = -0x02; // Hex literal.
+  Expect.identical(-2.0, v8);
+
+  // Const variable initializer context.
+  const double c1 = 0;
+  Expect.identical(0.0, c1);
+  const double c2 = 1;
+  Expect.identical(1.0, c2);
+  const double c3 = -0;
+  Expect.identical(-0.0, c3);
+  const double c4 = -1;
+  Expect.identical(-1.0, c4);
+  const double c5 = 9223372036854775808;
+  Expect.identical(9223372036854775808.0, c5);
+  const double c6 = 18446744073709551616;
+  Expect.identical(18446744073709551616.0, c6);
+  const double c7 = 0x02; // Hex literal.
+  Expect.identical(2.0, c7);
+  const double c8 = -0x02; // Hex literal.
+  Expect.identical(-2.0, c8);
+
+  // Assignment context, variable.
+  double value;
+  value = 0;
+  Expect.identical(0.0, value);
+  value = 1;
+  Expect.identical(1.0, value);
+  value = -0;
+  Expect.identical(-0.0, value);
+  value = -1;
+  Expect.identical(-1.0, value);
+  value = 9223372036854775808;
+  Expect.identical(9223372036854775808.0, value);
+  value = 18446744073709551616;
+  Expect.identical(18446744073709551616.0, value);
+  value = 0x02;
+  Expect.identical(2.0, value);
+  value = -0x02;
+  Expect.identical(-2.0, value);
+
+  // Assignment context, setter.
+  setter = 0;
+  Expect.identical(0.0, lastSetValue);
+  setter = 1;
+  Expect.identical(1.0, lastSetValue);
+  setter = -0;
+  Expect.identical(-0.0, lastSetValue);
+  setter = -1;
+  Expect.identical(-1.0, lastSetValue);
+  setter = 9223372036854775808;
+  Expect.identical(9223372036854775808.0, lastSetValue);
+  setter = 18446744073709551616;
+  Expect.identical(18446744073709551616.0, lastSetValue);
+  setter = 0x02;
+  Expect.identical(2.0, lastSetValue);
+  setter = -0x02;
+  Expect.identical(-2.0, lastSetValue);
+
+  // Argument context.
+  test(0.0, 0);
+  test(1.0, 1);
+  test(-0.0, -0);
+  test(-1.0, -1);
+  test(9223372036854775808.0, 9223372036854775808);
+  test(18446744073709551616.0, 18446744073709551616);
+  test(2.0, 0x02);
+  test(-2.0, -0x02);
+
+  // Argument context, operator setter.
+  List<double> box = [0.5];
+  box[0] = 0;
+  Expect.identical(0.0, box[0]);
+  box[0] = 1;
+  Expect.identical(1.0, box[0]);
+  box[0] = -0;
+  Expect.identical(-0.0, box[0]);
+  box[0] = -1;
+  Expect.identical(-1.0, box[0]);
+  box[0] = 9223372036854775808;
+  Expect.identical(9223372036854775808.0, box[0]);
+  box[0] = 18446744073709551616;
+  Expect.identical(18446744073709551616.0, box[0]);
+  box[0] = 0x02;
+  Expect.identical(2.0, box[0]);
+  box[0] = -0x02;
+  Expect.identical(-2.0, box[0]);
+
+  // Argument context, custom operators.
+  var oper = Oper();
+  Expect.identical(0.0, oper + 0);
+  Expect.identical(1.0, oper + 1);
+  Expect.identical(-0.0, oper + -0);
+  Expect.identical(-1.0, oper + -1);
+  Expect.identical(9223372036854775808.0, oper + 9223372036854775808);
+  Expect.identical(18446744073709551616.0, oper + 18446744073709551616);
+  Expect.identical(2.0, oper + 0x02);
+  Expect.identical(-2.0, oper + -0x02);
+
+  Expect.identical(0.0, oper >> 0);
+  Expect.identical(1.0, oper >> 1);
+  Expect.identical(-0.0, oper >> -0);
+  Expect.identical(-1.0, oper >> -1);
+  Expect.identical(9223372036854775808.0, oper >> 9223372036854775808);
+  Expect.identical(18446744073709551616.0, oper >> 18446744073709551616);
+  Expect.identical(2.0, oper >> 0x02);
+  Expect.identical(-2.0, oper >> -0x02);
+
+  Expect.identical(0.0, oper[0]);
+  Expect.identical(1.0, oper[1]);
+  Expect.identical(-0.0, oper[-0]);
+  Expect.identical(-1.0, oper[-1]);
+  Expect.identical(9223372036854775808.0, oper[9223372036854775808]);
+  Expect.identical(18446744073709551616.0, oper[18446744073709551616]);
+  Expect.identical(2.0, oper[0x02]);
+  Expect.identical(-2.0, oper[-0x02]);
+
+  // Explicit return context.
+  double fun1() => 0;
+  Expect.identical(0.0, fun1());
+  double fun2() => 1;
+  Expect.identical(1.0, fun2());
+  double fun3() => -0;
+  Expect.identical(-0.0, fun3());
+  double fun4() => -1;
+  Expect.identical(-1.0, fun4());
+  double fun5() => 9223372036854775808;
+  Expect.identical(9223372036854775808.0, fun5());
+  double fun6() => 18446744073709551616;
+  Expect.identical(18446744073709551616.0, fun6());
+  double fun7() => 0x02;
+  Expect.identical(2.0, fun7());
+  double fun8() => -0x02;
+  Expect.identical(-2.0, fun8());
+
+  // Inferred return context.
+  testFun(0.0, () => 0);
+  testFun(1.0, () => 1);
+  testFun(-0.0, () => -0);
+  testFun(-1.0, () => -1);
+  testFun(9223372036854775808.0, () => 9223372036854775808);
+  testFun(18446744073709551616.0, () => 18446744073709551616);
+  testFun(2.0, () => 0x02);
+  testFun(-2.0, () => -0x02);
+
+  // Function default value context.
+  Object deffun1([double v = 0]) => v;
+  Expect.identical(0.0, deffun1());
+  Object deffun2([double v = 1]) => v;
+  Expect.identical(1.0, deffun2());
+  Object deffun3([double v = -0]) => v;
+  Expect.identical(-0.0, deffun3());
+  Object deffun4([double v = -1]) => v;
+  Expect.identical(-1.0, deffun4());
+  Object deffun5([double v = 9223372036854775808]) => v;
+  Expect.identical(9223372036854775808.0, deffun5());
+  Object deffun6([double v = 18446744073709551616]) => v;
+  Expect.identical(18446744073709551616.0, deffun6());
+  Object deffun7([double v = 0x02]) => v;
+  Expect.identical(2.0, deffun7());
+  Object deffun8([double v = -0x02]) => v;
+  Expect.identical(-2.0, deffun8());
+
+  // Explicit collection literal context.
+  box = <double>[0];
+  Expect.identical(0.0, box[0]);
+  box = <double>[1];
+  Expect.identical(1.0, box[0]);
+  box = <double>[-0];
+  Expect.identical(-0.0, box[0]);
+  box = <double>[-1];
+  Expect.identical(-1.0, box[0]);
+  box = <double>[9223372036854775808];
+  Expect.identical(9223372036854775808.0, box[0]);
+  box = <double>[18446744073709551616];
+  Expect.identical(18446744073709551616.0, box[0]);
+  box = <double>[0x02];
+  Expect.identical(2.0, box[0]);
+  box = <double>[-0x02];
+  Expect.identical(-2.0, box[0]);
+
+  // Implicit collection literal context.
+  box = [0];
+  Expect.identical(0.0, box[0]);
+  box = [1];
+  Expect.identical(1.0, box[0]);
+  box = [-0];
+  Expect.identical(-0.0, box[0]);
+  box = [-1];
+  Expect.identical(-1.0, box[0]);
+  box = [9223372036854775808];
+  Expect.identical(9223372036854775808.0, box[0]);
+  box = [18446744073709551616];
+  Expect.identical(18446744073709551616.0, box[0]);
+  box = [0x02];
+  Expect.identical(2.0, box[0]);
+  box = [-0x02];
+  Expect.identical(-2.0, box[0]);
+
+  Map<double?, double?> map;
+  // Explicit map key context.
+  map = <double, Null>{0: null};
+  Expect.identical(0.0, map.keys.first);
+  map = <double, Null>{1: null};
+  Expect.identical(1.0, map.keys.first);
+  map = <double, Null>{-0: null};
+  Expect.identical(-0.0, map.keys.first);
+  map = <double, Null>{-1: null};
+  Expect.identical(-1.0, map.keys.first);
+  map = <double, Null>{9223372036854775808: null};
+  Expect.identical(9223372036854775808.0, map.keys.first);
+  map = <double, Null>{18446744073709551616: null};
+  Expect.identical(18446744073709551616.0, map.keys.first);
+  map = <double, Null>{0x02: null};
+  Expect.identical(2.0, map.keys.first);
+  map = <double, Null>{-0x02: null};
+  Expect.identical(-2.0, map.keys.first);
+
+  // Implicit map key context.
+  map = {0: null};
+  Expect.identical(0.0, map.keys.first);
+  map = {1: null};
+  Expect.identical(1.0, map.keys.first);
+  map = {-0: null};
+  Expect.identical(-0.0, map.keys.first);
+  map = {-1: null};
+  Expect.identical(-1.0, map.keys.first);
+  map = {9223372036854775808: null};
+  Expect.identical(9223372036854775808.0, map.keys.first);
+  map = {18446744073709551616: null};
+  Expect.identical(18446744073709551616.0, map.keys.first);
+  map = {0x02: null};
+  Expect.identical(2.0, map.keys.first);
+  map = {-0x02: null};
+  Expect.identical(-2.0, map.keys.first);
+
+  // Explicit map value context.
+  map = <Null, double>{null: 0};
+  Expect.identical(0.0, map.values.first);
+  map = <Null, double>{null: 1};
+  Expect.identical(1.0, map.values.first);
+  map = <Null, double>{null: -0};
+  Expect.identical(-0.0, map.values.first);
+  map = <Null, double>{null: -1};
+  Expect.identical(-1.0, map.values.first);
+  map = <Null, double>{null: 9223372036854775808};
+  Expect.identical(9223372036854775808.0, map.values.first);
+  map = <Null, double>{null: 18446744073709551616};
+  Expect.identical(18446744073709551616.0, map.values.first);
+  map = <Null, double>{null: 0x02};
+  Expect.identical(2.0, map.values.first);
+  map = <Null, double>{null: -0x02};
+  Expect.identical(-2.0, map.values.first);
+
+  // Implicit map value context.
+  map = {null: 0};
+  Expect.identical(0.0, map.values.first);
+  map = {null: 1};
+  Expect.identical(1.0, map.values.first);
+  map = {null: -0};
+  Expect.identical(-0.0, map.values.first);
+  map = {null: -1};
+  Expect.identical(-1.0, map.values.first);
+  map = {null: 9223372036854775808};
+  Expect.identical(9223372036854775808.0, map.values.first);
+  map = {null: 18446744073709551616};
+  Expect.identical(18446744073709551616.0, map.values.first);
+  map = {null: 0x02};
+  Expect.identical(2.0, map.values.first);
+  map = {null: -0x02};
+  Expect.identical(-2.0, map.values.first);
+
+  // Top-level contexts
+  Expect.identical(0.0, ts1);
+  Expect.identical(1.0, ts2);
+  Expect.identical(-0.0, ts3);
+  Expect.identical(-1.0, ts4);
+  Expect.identical(9223372036854775808.0, ts5);
+  Expect.identical(18446744073709551616.0, ts6);
+  Expect.identical(2.0, ts7);
+  Expect.identical(-2.0, ts8);
+
+  Expect.identical(0.0, tc1);
+  Expect.identical(1.0, tc2);
+  Expect.identical(-0.0, tc3);
+  Expect.identical(-1.0, tc4);
+  Expect.identical(9223372036854775808.0, tc5);
+  Expect.identical(18446744073709551616.0, tc6);
+  Expect.identical(2.0, tc7);
+  Expect.identical(-2.0, tc8);
+
+  Expect.identical(0.0, tg1);
+  Expect.identical(1.0, tg2);
+  Expect.identical(-0.0, tg3);
+  Expect.identical(-1.0, tg4);
+  Expect.identical(9223372036854775808.0, tg5);
+  Expect.identical(18446744073709551616.0, tg6);
+  Expect.identical(2.0, tg7);
+  Expect.identical(-2.0, tg8);
+
+  // Class contexts
+  var c = new C.ci1();
+  Expect.identical(0.0, c.v1);
+  Expect.identical(1.0, c.v2);
+  Expect.identical(-0.0, c.v3);
+  Expect.identical(-1.0, c.v4);
+  Expect.identical(9223372036854775808.0, c.v5);
+  Expect.identical(18446744073709551616.0, c.v6);
+  Expect.identical(2.0, c.v7);
+  Expect.identical(-2.0, c.v8);
+
+  Expect.identical(0.0, C.s1);
+  Expect.identical(1.0, C.s2);
+  Expect.identical(-0.0, C.s3);
+  Expect.identical(-1.0, C.s4);
+  Expect.identical(9223372036854775808.0, C.s5);
+  Expect.identical(18446744073709551616.0, C.s6);
+  Expect.identical(2.0, C.s7);
+  Expect.identical(-2.0, C.s8);
+
+  Expect.identical(0.0, C.c1);
+  Expect.identical(1.0, C.c2);
+  Expect.identical(-0.0, C.c3);
+  Expect.identical(-1.0, C.c4);
+  Expect.identical(9223372036854775808.0, C.c5);
+  Expect.identical(18446744073709551616.0, C.c6);
+  Expect.identical(2.0, C.c7);
+  Expect.identical(-2.0, C.c8);
+
+  Expect.identical(0.0, new C.cc1().d);
+  Expect.identical(1.0, new C.cc2().d);
+  Expect.identical(-0.0, new C.cc3().d);
+  Expect.identical(-1.0, new C.cc4().d);
+  Expect.identical(9223372036854775808.0, new C.cc5().d);
+  Expect.identical(18446744073709551616.0, new C.cc6().d);
+  Expect.identical(2.0, new C.cc7().d);
+  Expect.identical(-2.0, new C.cc8().d);
+
+  Expect.identical(0.0, const C.cc1().d);
+  Expect.identical(1.0, const C.cc2().d);
+  Expect.identical(-0.0, const C.cc3().d);
+  Expect.identical(-1.0, const C.cc4().d);
+  Expect.identical(9223372036854775808.0, const C.cc5().d);
+  Expect.identical(18446744073709551616.0, const C.cc6().d);
+  Expect.identical(2.0, const C.cc7().d);
+  Expect.identical(-2.0, const C.cc8().d);
+
+  Expect.identical(0.0, new C.ci1().d);
+  Expect.identical(1.0, new C.ci2().d);
+  Expect.identical(-0.0, new C.ci3().d);
+  Expect.identical(-1.0, new C.ci4().d);
+  Expect.identical(9223372036854775808.0, new C.ci5().d);
+  Expect.identical(18446744073709551616.0, new C.ci6().d);
+  Expect.identical(2.0, new C.ci7().d);
+  Expect.identical(-2.0, new C.ci8().d);
+
+  Expect.identical(0.0, const C.ci1().d);
+  Expect.identical(1.0, const C.ci2().d);
+  Expect.identical(-0.0, const C.ci3().d);
+  Expect.identical(-1.0, const C.ci4().d);
+  Expect.identical(9223372036854775808.0, const C.ci5().d);
+  Expect.identical(18446744073709551616.0, const C.ci6().d);
+  Expect.identical(2.0, const C.ci7().d);
+  Expect.identical(-2.0, const C.ci8().d);
+
+  // Nested context, `?:`.
+  v1 = false ? 42.0 : 0;
+  Expect.identical(0.0, v1);
+  v2 = false ? 42.0 : 1;
+  Expect.identical(1.0, v2);
+  v3 = false ? 42.0 : -0;
+  Expect.identical(-0.0, v3);
+  v4 = false ? 42.0 : -1;
+  Expect.identical(-1.0, v4);
+  v5 = false ? 42.0 : 9223372036854775808;
+  Expect.identical(9223372036854775808.0, v5);
+  v6 = false ? 42.0 : 18446744073709551616;
+  Expect.identical(18446744073709551616.0, v6);
+  v7 = false ? 42.0 : 0x02; // Hex literal.
+  Expect.identical(2.0, v7);
+  v8 = false ? 42.0 : -0x02; // Hex literal.
+  Expect.identical(-2.0, v8);
+
+  // Nested context, `??`.
+  double? nl = double.tryParse("not a double"); // Returns null typed as double.
+  v1 = nl ?? 0;
+  Expect.identical(0.0, v1);
+  v2 = nl ?? 1;
+  Expect.identical(1.0, v2);
+  v3 = nl ?? -0;
+  Expect.identical(-0.0, v3);
+  v4 = nl ?? -1;
+  Expect.identical(-1.0, v4);
+  v5 = nl ?? 9223372036854775808;
+  Expect.identical(9223372036854775808.0, v5);
+  v6 = nl ?? 18446744073709551616;
+  Expect.identical(18446744073709551616.0, v6);
+  v7 = nl ?? 0x02; // Hex literal.
+  Expect.identical(2.0, v7);
+  v8 = nl ?? -0x02; // Hex literal.
+  Expect.identical(-2.0, v8);
+
+  // Nested context, `..`.
+  v1 = 0..toString();
+  Expect.identical(0.0, v1);
+  v2 = 1..toString();
+  Expect.identical(1.0, v2);
+  v3 = -0
+    ..toString();
+  Expect.identical(-0.0, v3);
+  v4 = -1
+    ..toString();
+  Expect.identical(-1.0, v4);
+  v5 = 9223372036854775808..toString();
+  Expect.identical(9223372036854775808.0, v5);
+  v6 = 18446744073709551616..toString();
+  Expect.identical(18446744073709551616.0, v6);
+  v7 = 0x02..toString(); // Hex literal.
+  Expect.identical(2.0, v7);
+  v8 = -0x02
+    ..toString(); // Hex literal.
+  Expect.identical(-2.0, v8);
+
+  // Nexted context, double assignment.
+  Object object;
+  object = value = 0;
+  Expect.identical(0.0, value);
+  object = value = 1;
+  Expect.identical(1.0, value);
+  object = value = -0;
+  Expect.identical(-0.0, value);
+  object = value = -1;
+  Expect.identical(-1.0, value);
+  object = value = 9223372036854775808;
+  Expect.identical(9223372036854775808.0, value);
+  object = value = 18446744073709551616;
+  Expect.identical(18446744073709551616.0, value);
+  object = value = 0x02;
+  Expect.identical(2.0, value);
+  object = value = -0x02;
+  Expect.identical(-2.0, value);
+
+  // Nested context, value of assignment.
+  Expect.identical(0.0, value = 0);
+  Expect.identical(1.0, value = 1);
+  Expect.identical(-0.0, value = -0);
+  Expect.identical(-1.0, value = -1);
+  Expect.identical(9223372036854775808.0, value = 9223372036854775808);
+  Expect.identical(18446744073709551616.0, value = 18446744073709551616);
+  Expect.identical(2.0, value = 0x02);
+  Expect.identical(-2.0, value = -0x02);
+
+  // JavaScript platforms represent integers as doubles, so negating them will
+  // result in negative zero, unfortunately.
+  int zero = 0;
+  bool platformHasNegativeZeroInts = (-zero).isNegative;
+
+  // Not promoted without a double context.
+  num x = -0;
+  Expect.identical(0, x);
+  Expect.equals(x.isNegative, platformHasNegativeZeroInts);
+
+  var list = [3.14, 2.17, -0];
+  Expect.notType<List<double>>(list);
+  Expect.identical(0, list[2]);
+  Expect.equals(list[2].isNegative, platformHasNegativeZeroInts);
+
+  // FutureOr<double> also forces double.
+  // "Type that int is not assignable to, but double is."
+  FutureOr<double> fo1 = 0;
+  Expect.identical(0.0, fo1);
+  FutureOr<double> fo2 = 1;
+  Expect.identical(1.0, fo2);
+  FutureOr<double> fo3 = -0;
+  Expect.identical(-0.0, fo3);
+  FutureOr<double> fo4 = -1;
+  Expect.identical(-1.0, fo4);
+  FutureOr<double> fo5 = 9223372036854775808;
+  Expect.identical(9223372036854775808.0, fo5);
+  FutureOr<double> fo6 = 18446744073709551616;
+  Expect.identical(18446744073709551616.0, fo6);
+  FutureOr<double> fo7 = 0x02; // Hex literal.
+  Expect.identical(2.0, fo7);
+  FutureOr<double> fo8 = -0x02; // Hex literal.
+  Expect.identical(-2.0, fo8);
+
+  // Some other FutureOr cases, without being exhaustive.
+  {
+    Object func([FutureOr<double> x = 9223372036854775808]) => x;
+    Expect.identical(9223372036854775808.0, func(9223372036854775808));
+    Expect.identical(9223372036854775808.0, func());
+    FutureOr<double> func2() => 9223372036854775808;
+    Expect.identical(9223372036854775808.0, func2());
+    testGeneric<FutureOr<double>>(9223372036854775808.0, 9223372036854775808);
+    List<FutureOr<double>> l = [9223372036854775808];
+    testGeneric<FutureOr<double>>(9223372036854775808.0, l[0]);
+    l.add(9223372036854775808);
+    testGeneric<FutureOr<double>>(9223372036854775808.0, l[1]);
+    l.add(0.0);
+    l[2] = 9223372036854775808;
+    testGeneric<FutureOr<double>>(9223372036854775808.0, l[2]);
+  }
+
+  // Type variables statically bound to double also force doubles:
+  testGeneric<double>(0.0, 0);
+  testGeneric<double>(1.0, 1);
+  testGeneric<double>(-0.0, -0);
+  testGeneric<double>(-1.0, -1);
+  testGeneric<double>(9223372036854775808.0, 9223372036854775808);
+  testGeneric<double>(18446744073709551616.0, 18446744073709551616);
+  testGeneric<double>(2.0, 0x02);
+  testGeneric<double>(-2.0, -0x02);
+
+  // Uses static type, not run-time type.
+  Super sub = Sub();
+  Expect.identical(0.0, sub.method(0));
+  Expect.identical(1.0, sub.method(1));
+  Expect.identical(-0.0, sub.method(-0));
+  Expect.identical(-1.0, sub.method(-1));
+  Expect.identical(9223372036854775808.0, sub.method(9223372036854775808));
+  Expect.identical(18446744073709551616.0, sub.method(18446744073709551616));
+  Expect.identical(2.0, sub.method(0x02));
+  Expect.identical(-2.0, sub.method(-0x02));
+
+  {
+    // Check that the correct value is used as receiver for the cascade.
+    var collector = StringBuffer();
+    double tricky = -42
+      ..toString().codeUnits.forEach(collector.writeCharCode);
+    Expect.equals("${-42.0}", collector.toString());
+  }
+
+  bool isDigit(int charCode) => (charCode ^ 0x30) <= 9;
+  // Throws because double context does not affect "4", so the toString does
+  // not contain any non-digit (like ".", which it would if 4 was a double).
+  // The context type of "4.toString..." is not double, and the `-`
+  // is not having a literal as operand.
+  Expect.throws(() {
+    double tricky =
+        -4.toString().codeUnits.firstWhere((c) => !isDigit(c)).toDouble();
+  });
+}
+
+void test(double expect, double value) {
+  Expect.identical(expect, value);
+}
+
+void testFun(double expect, double f()) {
+  Expect.identical(expect, f());
+}
+
+void testGeneric<T>(double expect, T value) {
+  Expect.identical(expect, value);
+}
+
+class Oper {
+  Object operator +(double value) => value;
+  Object operator >>(double value) => value;
+  Object operator [](double value) => value;
+}
+
+class C {
+  // Instance variable initializer
+  final double v1 = 0;
+  final double v2 = 1;
+  final double v3 = -0;
+  final double v4 = -1;
+  final double v5 = 9223372036854775808;
+  final double v6 = 18446744073709551616;
+  final double v7 = 0x02; // Hex literal.
+  final double v8 = -0x02; // Hex literal.
+
+  // Static class variable initializer
+  static double s1 = 0;
+  static double s2 = 1;
+  static double s3 = -0;
+  static double s4 = -1;
+  static double s5 = 9223372036854775808;
+  static double s6 = 18446744073709551616;
+  static double s7 = 0x02; // Hex literal.
+  static double s8 = -0x02; // Hex literal.
+
+  // Const class variable initializer context.
+  static const double c1 = 0;
+  static const double c2 = 1;
+  static const double c3 = -0;
+  static const double c4 = -1;
+  static const double c5 = 9223372036854775808;
+  static const double c6 = 18446744073709551616;
+  static const double c7 = 0x02; // Hex literal.
+  static const double c8 = -0x02; // Hex literal.
+
+  final double d;
+
+  // Default value context for a double initializing formal.
+  const C.cc1([this.d = 0]);
+  const C.cc2([this.d = 1]);
+  const C.cc3([this.d = -0]);
+  const C.cc4([this.d = -1]);
+  const C.cc5([this.d = 9223372036854775808]);
+  const C.cc6([this.d = 18446744073709551616]);
+  const C.cc7([this.d = 0x02]);
+  const C.cc8([this.d = -0x02]);
+
+  // Initializer list expressions context.
+  const C.ci1() : this.d = 0;
+  const C.ci2() : this.d = 1;
+  const C.ci3() : this.d = -0;
+  const C.ci4() : this.d = -1;
+  const C.ci5() : this.d = 9223372036854775808;
+  const C.ci6() : this.d = 18446744073709551616;
+  const C.ci7() : this.d = 0x02;
+  const C.ci8() : this.d = -0x02;
+}
+
+// Top-level lazy variable initializer
+double ts1 = 0;
+double ts2 = 1;
+double ts3 = -0;
+double ts4 = -1;
+double ts5 = 9223372036854775808;
+double ts6 = 18446744073709551616;
+double ts7 = 0x02; // Hex literal.
+double ts8 = -0x02; // Hex literal.
+
+// Top-level const variable initializer.
+const double tc1 = 0;
+const double tc2 = 1;
+const double tc3 = -0;
+const double tc4 = -1;
+const double tc5 = 9223372036854775808; // 2^63, invalid signed 64-bit integer.
+const double tc6 = 18446744073709551616;
+const double tc7 = 0x02; // Hex literal.
+const double tc8 = -0x02; // Hex literal.
+
+// Top-level getter return context.
+double get tg1 => 0;
+double get tg2 => 1;
+double get tg3 => -0;
+double get tg4 => -1;
+double get tg5 => 9223372036854775808;
+double get tg6 => 18446744073709551616;
+double get tg7 => 0x02; // Hex literal.
+double get tg8 => -0x02; // Hex literal.
+
+Object? lastSetValue = null;
+void set setter(double v) {
+  lastSetValue = v;
+}
+
+abstract class Super {
+  Object method(double v);
+}
+
+class Sub implements Super {
+  Object method(Object o) => o;
+}