[dartdevc] Reify bottom as Null
Fixes https://github.com/dart-lang/sdk/issues/36832
Change-Id: Ie0869ca350d1951e0736a9d6c92da4a7984117ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101180
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
index a5d6dd0..41c3de7 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
@@ -201,7 +201,9 @@
toString() => 'bottom';
}
-final bottom = BottomType();
+// TODO(vsm): We reify bottom as Null. We will revisit this with
+// non-nullable types.
+final bottom = unwrapType(Null);
class JSObjectType extends DartType {
toString() => 'NativeJavaScriptObject';
diff --git a/tests/language_2/bottom_test.dart b/tests/language_2/bottom_test.dart
new file mode 100644
index 0000000..38ac721
--- /dev/null
+++ b/tests/language_2/bottom_test.dart
@@ -0,0 +1,14 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+void main() {
+ final f1 = () => throw null;
+ final f2 = () => null;
+ Expect.equals(f1.runtimeType, f2.runtimeType);
+
+ final Bottom = (<F>(F Function() f) => F)(() => throw null);
+ Expect.equals(Null, Bottom);
+}