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

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

Issue 1062723002: Implement the new '?.' operator in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bump analyzer version. Created 5 years, 8 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/analyzer/test/generated/non_error_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 33b976963652a1765af50daca70d7932486d3fc3..25ba9fa30c5b02fd9e2d603b780db347f33b88f7 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -4933,6 +4933,21 @@ class Bar extends Foo {
verify([source]);
}
+ void test_undefinedGetter_typeLiteral_conditionalAccess() {
+ // When applied to a type literal, the conditional access operator '?.' can
+ // be used to access instance getters of Type.
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ Source source = addSource('''
+class A {}
+f() => A?.hashCode;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_undefinedGetter_typeSubstitution() {
Source source = addSource(r'''
class A<E> {
@@ -5008,6 +5023,21 @@ main() {
// A call to verify(source) fails as '(() => null)()' isn't resolved.
}
+ void test_undefinedMethod_typeLiteral_conditionalAccess() {
+ // When applied to a type literal, the conditional access operator '?.' can
+ // be used to access instance methods of Type.
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ Source source = addSource('''
+class A {}
+f() => A?.toString();
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_undefinedOperator_index() {
Source source = addSource(r'''
class A {

Powered by Google App Engine
This is Rietveld 408576698