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

Unified Diff: tests/compiler/dart2js/type_checker_test.dart

Issue 88483002: Compute suggestions for failed type promotions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years 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
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/type_checker_test.dart
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index 8ca53a84ef9b0c572d620ab748eb367bb79585f2..3f086fc5851a67f4bed5fdd89d7604752920d48c 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -1518,6 +1518,12 @@ testTypePromotionHints() {
class E<T> extends D<T> {
T e;
}
+ class F<S, U> extends E<S> {
+ S f;
+ }
+ class G<V> extends F<V, V> {
+ V g;
+ }
''');
check(String text, {warnings, hints, infos}) {
@@ -1530,7 +1536,7 @@ testTypePromotionHints() {
var x = a.c;
}''',
warnings: [MessageKind.MEMBER_NOT_FOUND.warning],
- hints: [MessageKind.NOT_MORE_SPECIFIC],
+ hints: [MessageKind.NOT_MORE_SPECIFIC_SUBTYPE],
infos: []);
check(r'''
@@ -1540,7 +1546,7 @@ testTypePromotionHints() {
}''',
warnings: [MessageKind.MEMBER_NOT_FOUND.warning,
MessageKind.MEMBER_NOT_FOUND.warning],
- hints: [MessageKind.NOT_MORE_SPECIFIC],
+ hints: [MessageKind.NOT_MORE_SPECIFIC_SUBTYPE],
infos: []);
check(r'''
@@ -1555,10 +1561,40 @@ testTypePromotionHints() {
check('''
D<int> d = new E();
- if (d is E) {
+ if (d is E) { // Suggest E<int>.
var x = d.e;
}''',
warnings: [MessageKind.MEMBER_NOT_FOUND.warning],
+ hints: [checkMessage(MessageKind.NOT_MORE_SPECIFIC_SUGGESTION,
+ {'shownTypeSuggestion': 'E<int>'})],
+ infos: []);
+
+ check('''
+ D<int> d = new F();
+ if (d is F) { // Suggest F<int, dynamic>.
+ var x = d.f;
+ }''',
+ warnings: [MessageKind.MEMBER_NOT_FOUND.warning],
+ hints: [checkMessage(MessageKind.NOT_MORE_SPECIFIC_SUGGESTION,
+ {'shownTypeSuggestion': 'F<int, dynamic>'})],
+ infos: []);
+
+ check('''
+ D<int> d = new G();
+ if (d is G) { // Suggest G<int>.
+ var x = d.f;
+ }''',
+ warnings: [MessageKind.MEMBER_NOT_FOUND.warning],
+ hints: [checkMessage(MessageKind.NOT_MORE_SPECIFIC_SUGGESTION,
+ {'shownTypeSuggestion': 'G<int>'})],
+ infos: []);
+
+ check('''
+ F<double, int> f = new G();
+ if (f is G) { // Cannot suggest a more specific type.
+ var x = f.g;
+ }''',
+ warnings: [MessageKind.MEMBER_NOT_FOUND.warning],
hints: [MessageKind.NOT_MORE_SPECIFIC],
infos: []);
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698