Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: pkg/expect/lib/expect.dart

Issue 875163004: Support [AssumeDynamic] and [TrustTypeAnnotations] in the inferrer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/expect/lib/expect.dart
diff --git a/pkg/expect/lib/expect.dart b/pkg/expect/lib/expect.dart
index ed094ddb49ce8378181f8fc3b40e3c225d807b08..2ca6ed3e9dae2d22875d20d085d97d1f71dd5add 100644
--- a/pkg/expect/lib/expect.dart
+++ b/pkg/expect/lib/expect.dart
@@ -406,14 +406,21 @@ class NoInlining {
/// Annotation class for testing of dart2js. Use this as metadata on method
/// declarations to make the type inferrer trust the parameter and return types,
/// effectively asserting the runtime values will (at least) be subtypes of the
-/// annotated types.
+/// annotated types.
+///
+/// While the actually inferred type is guaranteed to be a subtype of the
+/// annotation, it often is more precise. In particular, if a method is only
+/// called with `null`, the inferrer will still infer null. To ensure that
+/// the annotated type is also the inferred type, additionally use
+/// [AssumeDynamic].
class TrustTypeAnnotations {
const TrustTypeAnnotations();
}
/// Annotation class for testing of dart2js. Use this as metadata on method
/// declarations to disable closed world assumptions on parameters, effectively
-/// assuming that the runtime arguments could be any value.
+/// assuming that the runtime arguments could be any value. Note that the
+/// constraints due to [TrustTypeAnnotations] still apply.
class AssumeDynamic {
const AssumeDynamic();
-}
+}
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_nodes.dart ('k') | tests/compiler/dart2js/expect_annotations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698