Compile time error for web int literals that cannot be represented exactly

Bug: #33351
Change-Id: I2b99858dfc276dc70c3a36c289030e801145af86
Reviewed-on: https://dart-review.googlesource.com/61180
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 457bb8e..f643697 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -6747,13 +6747,12 @@
     if (int.parse(lexeme.substring(index, index + 1)) < 9) {
       return true;
     }
-    int bound;
+    int bound = 223372036854775808;
     if (isNegative) {
-      bound = 223372036854775808;
+      return int.parse(lexeme.substring(index + 1)) <= bound;
     } else {
-      bound = 223372036854775807;
+      return int.parse(lexeme.substring(index + 1)) < bound;
     }
-    return int.parse(lexeme.substring(index + 1)) <= bound;
   }
 
   /**
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index 71a8c15..891f792 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -42,6 +42,9 @@
   bool get nativeExtensionExpectsString => false;
 
   @override
+  bool get errorOnUnexactWebIntLiterals => true;
+
+  @override
   void performModularTransformationsOnLibraries(
       CoreTypes coreTypes, ClassHierarchy hierarchy, List<ir.Library> libraries,
       {void logger(String msg)}) {}
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index b5cd0b2..7f5367c 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -234,21 +234,6 @@
 
   @override
   void visitIntLiteral(ir.IntLiteral literal) {
-    // Check that this value can be precisely represented as a double, and throw
-    // an error if not:
-    if (new BigInt.from(literal.value) !=
-        new BigInt.from(literal.value.toDouble())) {
-      // TODO(efortuna): Switch to error message.
-      reporter.reportWarningMessage(
-          CURRENT_ELEMENT_SPANNABLE, MessageKind.GENERIC, {
-        'text': 'The integer literal '
-            '${new BigInt.from(literal.value)} cannot be represented'
-            ' exactly in JavaScript and will be rounded to '
-            '${new BigInt.from(literal.value.toDouble())}. Use the rounded '
-            'value to avoid this warning.'
-      });
-    }
-
     impactBuilder.registerConstantLiteral(new IntConstantExpression(
         new BigInt.from(literal.value).toUnsigned(64)));
   }
diff --git a/pkg/dev_compiler/lib/src/kernel/target.dart b/pkg/dev_compiler/lib/src/kernel/target.dart
index 33329bb..56f5b5f 100644
--- a/pkg/dev_compiler/lib/src/kernel/target.dart
+++ b/pkg/dev_compiler/lib/src/kernel/target.dart
@@ -58,6 +58,9 @@
   bool get nativeExtensionExpectsString => false;
 
   @override
+  bool get errorOnUnexactWebIntLiterals => true;
+
+  @override
   bool get enableNoSuchMethodForwarders => true;
 
   @override
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index da38ef1..9775410 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -6326,6 +6326,38 @@
         r"""Try removing the keyword 'var', or replacing it with the name of the return type.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+    Message Function(
+        String string,
+        String
+            string2)> templateWebLiteralCannotBeRepresentedExactly = const Template<
+        Message Function(String string, String string2)>(
+    messageTemplate:
+        r"""The integer literal #string can't be represented exactly in JavaScript.""",
+    tipTemplate:
+        r"""Try changing the literal to something that can be represented in Javascript. In Javascript #string2 is the nearest value that can be represented exactly.""",
+    withArguments: _withArgumentsWebLiteralCannotBeRepresentedExactly);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string, String string2)>
+    codeWebLiteralCannotBeRepresentedExactly =
+    const Code<Message Function(String string, String string2)>(
+        "WebLiteralCannotBeRepresentedExactly",
+        templateWebLiteralCannotBeRepresentedExactly,
+        dart2jsCode: "*fatal*",
+        severity: Severity.error);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsWebLiteralCannotBeRepresentedExactly(
+    String string, String string2) {
+  return new Message(codeWebLiteralCannotBeRepresentedExactly,
+      message:
+          """The integer literal ${string} can't be represented exactly in JavaScript.""",
+      tip: """Try changing the literal to something that can be represented in Javascript. In Javascript ${string2} is the nearest value that can be represented exactly.""",
+      arguments: {'string': string, 'string2': string2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Null> codeWithBeforeExtends = messageWithBeforeExtends;
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 1a1dbe9..7a509df 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -138,6 +138,8 @@
 
   final bool stringExpectedAfterNative;
 
+  final bool errorOnUnexactWebIntLiterals;
+
   /// Whether to ignore an unresolved reference to `main` within the body of
   /// `_getMainClosure` when compiling the current library.
   ///
@@ -235,6 +237,8 @@
             library.loader.target.backendTarget.enableNative(library.uri),
         stringExpectedAfterNative =
             library.loader.target.backendTarget.nativeExtensionExpectsString,
+        errorOnUnexactWebIntLiterals =
+            library.loader.target.backendTarget.errorOnUnexactWebIntLiterals,
         ignoreMainInGetMainClosure = library.uri.scheme == 'dart' &&
             (library.uri.path == "_builtin" || library.uri.path == "ui"),
         needsImplicitSuperInitializer =
@@ -1628,6 +1632,9 @@
     if (value == null) {
       push(new LargeIntAccessGenerator(this, token));
     } else {
+      if (errorOnUnexactWebIntLiterals) {
+        checkWebIntLiteralsErrorIfUnexact(value, token);
+      }
       push(forest.literalInt(value, token));
     }
   }
@@ -2485,6 +2492,9 @@
           int value = int.tryParse("-" + receiver.token.lexeme);
           if (value != null) {
             receiverValue = forest.literalInt(value, token);
+            if (errorOnUnexactWebIntLiterals) {
+              checkWebIntLiteralsErrorIfUnexact(value, token);
+            }
           }
         }
       }
@@ -4189,6 +4199,26 @@
     return library.loader.handledErrors.isNotEmpty &&
         forest.isErroneousNode(node);
   }
+
+  void checkWebIntLiteralsErrorIfUnexact(int value, Token token) {
+    BigInt asInt = new BigInt.from(value).toUnsigned(64);
+    BigInt asDouble = new BigInt.from(asInt.toDouble());
+    if (asInt != asDouble) {
+      String nearest;
+      if (token.lexeme.startsWith("0x") || token.lexeme.startsWith("0X")) {
+        nearest = '0x${asDouble.toRadixString(16)}';
+      } else {
+        nearest = '$asDouble';
+      }
+      library.addCompileTimeError(
+          fasta.templateWebLiteralCannotBeRepresentedExactly
+              .withArguments(token.lexeme, nearest),
+          token.charOffset,
+          token.charCount,
+          uri,
+          wasHandled: true);
+    }
+  }
 }
 
 class Identifier {
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 7820263..44d3ab7 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -409,5 +409,7 @@
 UnterminatedString/script8: Fail
 UnterminatedToken/analyzerCode: Fail
 UnterminatedToken/example: Fail
+WebLiteralCannotBeRepresentedExactly/analyzerCode: Fail
+WebLiteralCannotBeRepresentedExactly/example: Fail
 YieldAsIdentifier/example: Fail
 YieldNotGenerator/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 7292c04..80657f8 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -2332,3 +2332,9 @@
 MissingExplicitTypeArguments:
   template: "No type arguments provided, #count possible."
   severity: IGNORED
+
+WebLiteralCannotBeRepresentedExactly:
+  template: "The integer literal #string can't be represented exactly in JavaScript."
+  tip: "Try changing the literal to something that can be represented in Javascript. In Javascript #string2 is the nearest value that can be represented exactly."
+  severity: ERROR
+  dart2jsCode: "*fatal*"
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart
index 6b03c7e..76fb9ff 100644
--- a/pkg/kernel/lib/target/targets.dart
+++ b/pkg/kernel/lib/target/targets.dart
@@ -192,6 +192,13 @@
   // we should at least unify the VM and non-VM variants.
   bool get nativeExtensionExpectsString => false;
 
+  /// Whether integer literals that cannot be represented exactly on the web
+  /// (i.e. in Javascript) should cause an error to be issued.
+  /// An example of such a number is `2^53 + 1` where in Javascript - because
+  /// integers are represented as doubles
+  /// `Math.pow(2, 53) = Math.pow(2, 53) + 1`.
+  bool get errorOnUnexactWebIntLiterals => false;
+
   /// Builds an expression that instantiates an [Invocation] that can be passed
   /// to [noSuchMethod].
   Expression instantiateInvocation(CoreTypes coreTypes, Expression receiver,
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 750ea6a..60298fa 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -7044,13 +7044,28 @@
 Language/Types/Type_Void/syntax_t09: MissingCompileTimeError
 LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color_t01: Pass, RuntimeError
 LayoutTests/fast/canvas/rgba-parsing_t01: Pass, RuntimeError
+LayoutTests/fast/files/blob-parts-slice-test_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LayoutTests/fast/files/blob-slice-overflow_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LayoutTests/fast/files/blob-slice-test_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/Duration/Duration_A01_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/Duration/Duration_A02_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/Duration/inDays_A01_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/Duration/inHours_A01_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/Duration/inMilliseconds_A01_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/Duration/inMinutes_A01_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/Duration/inSeconds_A01_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 LibTest/core/Invocation/namedArguments_A01_t01: RuntimeError
 LibTest/core/double/isInfinite_A01_t03: CompileTimeError # Larger than 64 bit int
+LibTest/core/double/operator_GE_A01_t02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/double/operator_GT_A01_t02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/double/operator_LE_A01_t02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+LibTest/core/double/operator_LT_A01_t02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 LibTest/core/int/abs_A01_t01: CompileTimeError # Larger than 64 bit int
 LibTest/core/int/ceilToDouble_A01_t01: CompileTimeError # Larger than 64 bit int
 LibTest/core/int/ceil_A01_t01: CompileTimeError # Larger than 64 bit int
 LibTest/core/int/floorToDouble_A01_t01: CompileTimeError # Larger than 64 bit int
 LibTest/core/int/floor_A01_t01: CompileTimeError # Larger than 64 bit int
+LibTest/core/int/hashCode_A01_t01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 LibTest/core/int/isInfinite_A01_t01: CompileTimeError # Larger than 64 bit int
 LibTest/core/int/isNaN_A01_t01: CompileTimeError # Larger than 64 bit int
 LibTest/core/int/isNegative_A01_t01: CompileTimeError # Larger than 64 bit int
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 1cb40c4..f457fda 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -191,11 +191,13 @@
 bit_twiddling_bigint_test: CompileTimeError #Large integer literal. Not representable in JS.
 bit_twiddling_test: CompileTimeError # Large integer literal. Not representable in JS.
 compare_to2_test: RuntimeError
+date_time_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 double_ceil_test: CompileTimeError # Large integer literal. Not representable in JS.
 double_floor_test: CompileTimeError # Large integer literal. Not representable in JS.
 double_parse_test/01: RuntimeError
 double_round_test: CompileTimeError # Large integer literal. Not representable in JS.
 double_truncate_test: CompileTimeError # Large integer literal. Not representable in JS.
+growable_list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 hash_set_test/01: RuntimeError
 int_ceil_test: CompileTimeError # Large integer literal. Not representable in JS.
 int_ceil_to_double_test: CompileTimeError # Large integer literal. Not representable in JS.
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index e46be42..1683b0a 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -31,9 +31,37 @@
 
 [ $compiler == dartdevk ]
 bigint_from_test: RuntimeError # Issue 32589
+bigint_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_twiddling_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 bool_from_environment2_test/03: Crash
+compare_to2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+date_time_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_ceil_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_floor_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_round_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_truncate_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+growable_list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_ceil_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_ceil_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_floor_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_floor_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_from_environment_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 int_modulo_arith_test/modPow: RuntimeError
 int_modulo_arith_test/none: RuntimeError
+int_parse_radix_int64_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_int64_test/02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_int64_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_round_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_round_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_to_int_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_truncate_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_truncate_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_arith_vm_test/modPow: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_arith_vm_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_to_string_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_parse_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_parse_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_sign_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 string_from_environment3_test/03: Crash
 
 [ $compiler == precompiler ]
@@ -226,8 +254,35 @@
 uri_base_test: Crash # RangeError (index): Invalid value: Valid value range is empty: 0
 
 [ $compiler == dart2js && $fasta ]
-int_parse_radix_int64_test/02: RuntimeError # WontFix: Int not precisely representable in JS
+bigint_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_twiddling_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+compare_to2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+date_time_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_ceil_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_floor_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_round_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+double_truncate_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+growable_list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_ceil_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_ceil_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_floor_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_floor_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_from_environment_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_int64_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_int64_test/02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_parse_radix_int64_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 int_parse_radix_test/01: RuntimeError
+int_round_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_round_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_to_int_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_truncate_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int_truncate_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_arith_vm_test/modPow: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_arith_vm_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+integer_to_string_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_parse_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_parse_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+num_sign_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 
 [ $compiler == dart2js && $fasta && $host_checked && $strong ]
 error_stack_trace1_test: RuntimeError # Issue 12399
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index ac10795..4c6c2c1 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -335,6 +335,7 @@
 deferred_not_loaded_check_test: RuntimeError
 deferred_redirecting_factory_test: RuntimeError
 deopt_inlined_function_lazy_test: CompileTimeError # Int larger than 64 bits.
+deopt_smi_op_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 double_int_to_string_test: RuntimeError
 duplicate_export_negative_test: Fail
 duplicate_implements_test/01: MissingCompileTimeError
@@ -387,6 +388,7 @@
 left_shift_test: RuntimeError
 library_env_test/has_mirror_support: RuntimeError, OK
 list_literal4_test: RuntimeError
+list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 main_not_a_function_test/01: CompileTimeError
 many_overridden_no_such_method_test: RuntimeError
 method_override5_test: RuntimeError
@@ -395,6 +397,7 @@
 method_override7_test/02: MissingCompileTimeError
 method_override8_test/00: MissingCompileTimeError
 method_override8_test/01: MissingCompileTimeError
+mint_arithmetic_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 mint_arithmetic_test: RuntimeError
 mint_compares_test: CompileTimeError # Int larger than 64 bits
 mixin_forwarding_constructor4_test/01: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index ff637f7..8d8804b 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -829,6 +829,10 @@
 type_variable_promotion_test: RuntimeError
 
 [ $compiler == dart2js && $fasta ]
+arithmetic_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_operations_test/03: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_operations_test/04: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_operations_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 call_method_as_cast_test/06: RuntimeError
 call_method_implicit_tear_off_implements_function_test/05: RuntimeError
 call_method_implicit_tear_off_implements_function_test/06: RuntimeError
@@ -840,10 +844,27 @@
 const_dynamic_type_literal_test/03: Pass # but it shouldn't until we fix issue 17207
 constructor_redirect_cycle_test/01: Crash # Stack Overflow
 constructor_redirect_indirect_cycle_test/01: Crash # Stack Overflow
+deopt_inlined_function_lazy_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+deopt_smi_op_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 duplicate_interface_implements_test/01: MissingCompileTimeError
 function_propagation_test: RuntimeError
 generic_test/01: MissingCompileTimeError # front end does not validate `extends`
+guess_cid_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+identical_closure2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 instantiate_tearoff_of_call_test: RuntimeError
+int2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/04: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/05: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/10: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/20: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/40: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+int64_literal_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+mint_arithmetic_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+mint_compares_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+mint_identical_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 mixin_type_parameter_inference_error_test/none: CompileTimeError
 mixin_type_parameter_inference_previous_mixin_test/01: CompileTimeError
 mixin_type_parameter_inference_previous_mixin_test/02: CompileTimeError
@@ -859,6 +880,7 @@
 mixin_type_parameter_inference_test/13: CompileTimeError
 mixin_type_parameter_inference_test/16: CompileTimeError
 mixin_type_parameter_inference_test/none: CompileTimeError
+number_identity_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 partial_tearoff_instantiation_test/05: Pass # for the wrong reason.
 partial_tearoff_instantiation_test/06: Pass # for the wrong reason.
 partial_tearoff_instantiation_test/07: Pass # for the wrong reason.
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index eb1a481..e8e6bc4 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -288,6 +288,7 @@
 [ $compiler == dartdevk ]
 additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
 additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
+arithmetic_int64_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 async_or_generator_return_type_stacktrace_test/01: MissingCompileTimeError
 async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
 async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
@@ -296,6 +297,9 @@
 bad_override_test/01: MissingCompileTimeError
 bad_override_test/02: MissingCompileTimeError
 bad_override_test/03: MissingCompileTimeError
+bit_operations_test/03: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_operations_test/04: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+bit_operations_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 built_in_identifier_type_annotation_test/dynamic-funarg: RuntimeError # Issue 30450, test name contains hyphen
 built_in_identifier_type_annotation_test/dynamic-funret: RuntimeError # Issue 30450, test name contains hyphen
 built_in_identifier_type_annotation_test/dynamic-list: RuntimeError # Issue 30450, test name contains hyphen
@@ -354,6 +358,8 @@
 deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
 deferred_inheritance_constraints_test/redirecting_constructor: MissingCompileTimeError
 deferred_load_library_wrong_args_test/01: CompileTimeError
+deopt_inlined_function_lazy_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+deopt_smi_op_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 double_identical_test: RuntimeError # Negative and positive zero are distinct, but not in ddk
 duplicate_implements_test/01: MissingCompileTimeError
 duplicate_implements_test/02: MissingCompileTimeError
@@ -389,6 +395,8 @@
 getter_override_test/01: MissingCompileTimeError
 getter_override_test/02: MissingCompileTimeError
 getter_override_test/03: MissingCompileTimeError
+guess_cid_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+identical_closure2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 identical_const_test/01: MissingCompileTimeError
 identical_const_test/02: MissingCompileTimeError
 identical_const_test/03: MissingCompileTimeError
@@ -405,6 +413,7 @@
 implicit_creation/implicit_const_not_default_values_test/e6: Pass
 implicit_creation/implicit_const_not_default_values_test/e9: Pass
 instantiate_tearoff_of_call_test: CompileTimeError
+int2_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 issue18628_2_test/01: MissingCompileTimeError
 issue31596_override_test/07: MissingCompileTimeError
 issue31596_override_test/08: MissingCompileTimeError
@@ -413,6 +422,7 @@
 issue31596_super_test/03: CompileTimeError
 issue31596_super_test/04: MissingCompileTimeError
 issue31596_super_test/05: RuntimeError
+list_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 malbounded_instantiation_test/01: MissingCompileTimeError
 malbounded_instantiation_test/02: MissingCompileTimeError
 malbounded_instantiation_test/03: MissingCompileTimeError
@@ -436,6 +446,9 @@
 method_override7_test/01: MissingCompileTimeError
 method_override7_test/02: MissingCompileTimeError
 method_override_test: CompileTimeError # Issue 31616
+mint_arithmetic_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+mint_compares_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+mint_identical_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 mixin_forwarding_constructor4_test/01: MissingCompileTimeError
 mixin_forwarding_constructor4_test/02: MissingCompileTimeError
 mixin_forwarding_constructor4_test/03: MissingCompileTimeError
@@ -517,6 +530,7 @@
 named_parameters_default_eq_test/02: MissingCompileTimeError
 no_such_method_mock_test: RuntimeError # Issue 31426 - Kernel does not introduce nSM for implemented fields.
 null_no_such_method_test: CompileTimeError # Issue 31533
+number_identity_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 override_field_test/01: MissingCompileTimeError
 override_field_test/02: MissingCompileTimeError
 override_inheritance_field_test/04: CompileTimeError # Issue 31616
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 116c44e..9dd0262 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -278,6 +278,7 @@
 
 [ $compiler == dart2js && $fasta ]
 mirrors/*: SkipByDesign # mirrors not supported
+typed_data/int64_list_load_store_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 
 [ $compiler == dart2js && $fasta && $host_checked ]
 async/stream_controller_async_test: Crash
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index fed5352..ac52cb5 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -683,6 +683,10 @@
 html/indexeddb_5_test: RuntimeError
 html/js_typed_interop_default_arg_test/explicit_argument: RuntimeError
 html/js_typed_interop_test: RuntimeError
+math/double_pow_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+typed_data/int32x4_arithmetic_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+typed_data/int32x4_arithmetic_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+typed_data/int64_list_load_store_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 
 [ $compiler == dart2js && $fasta && $host_checked ]
 html/custom/mirrors_2_test: Crash # 'file:*/pkg/compiler/lib/src/common_elements.dart': Failed assertion: line 405 pos 12: 'element.name == '=='': is not true.
diff --git a/tests/lib_2/lib_2_dartdevc.status b/tests/lib_2/lib_2_dartdevc.status
index 2fdab77..5a926e1 100644
--- a/tests/lib_2/lib_2_dartdevc.status
+++ b/tests/lib_2/lib_2_dartdevc.status
@@ -14,6 +14,10 @@
 convert/chunked_conversion_utf87_test: RuntimeError
 convert/utf82_test: RuntimeError
 html/debugger_test: CompileTimeError
+math/double_pow_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+typed_data/int32x4_arithmetic_test/int64: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+typed_data/int32x4_arithmetic_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
+typed_data/int64_list_load_store_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
 
 [ $runtime == chrome && ($compiler == dartdevc || $compiler == dartdevk) ]
 html/element_animate_test/timing_dict: RuntimeError # Issue 29922