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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1374813002: fix inference of `hashCode` with library prefix (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 8935837cceedf78ecb964ecc77e284d10e10984c..307c41c2985309425db08df50771fbd23162c410 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -13953,6 +13953,49 @@ main() {
expect(methodInvoke.realTarget.staticType, typeProvider.dynamicType);
}
+
+ void test_objectAccessInference_disabled_for_local_getter() {
+ String name = 'hashCode';
+ String code = '''
+dynamic get $name => null;
+main() {
+ $name; // marker
+}''';
+
+ SimpleIdentifier getter = _findMarkedIdentifier(code, "; // marker");
+ expect(getter.staticType, typeProvider.dynamicType);
+ }
+
+ void test_objectAccessInference_disabled_for_library_prefix() {
+ String name = 'hashCode';
+ addNamedSource('/helper.dart', '''
+library helper;
+dynamic get $name => 42;
+''');
+ String code = '''
+import 'helper.dart' as helper;
+main() {
+ helper.$name; // marker
+}''';
+
+ SimpleIdentifier id = _findMarkedIdentifier(code, "; // marker");
+ PrefixedIdentifier prefixedId = id.parent;
+ expect(id.staticType, typeProvider.dynamicType);
+ expect(prefixedId.staticType, typeProvider.dynamicType);
+ }
+
+ void test_objectAccessInference_enabled_for_cascades() {
+ String name = 'hashCode';
+ String code = '''
+main() {
+ dynamic obj;
+ obj..$name..$name; // marker
+}''';
+ PropertyAccess access = _findMarkedIdentifier(code, "; // marker").parent;
+ expect(access.staticType, typeProvider.dynamicType);
+ expect(access.realTarget.staticType, typeProvider.dynamicType);
+ }
+
void test_propagatedReturnType_localFunction() {
String code = r'''
main() {
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698