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

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1423993005: Quick Fix for CAN_BE_NULL_AFTER_NULL_AWARE. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library engine.resolver_test; 5 library engine.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/context.dart' as newContext; 9 import 'package:analyzer/src/context/context.dart' as newContext;
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 m() { 2351 m() {
2352 var i = ''; 2352 var i = '';
2353 n(i); 2353 n(i);
2354 } 2354 }
2355 n(int i) {}'''); 2355 n(int i) {}''');
2356 computeLibrarySourceErrors(source); 2356 computeLibrarySourceErrors(source);
2357 assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 2357 assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
2358 verify([source]); 2358 verify([source]);
2359 } 2359 }
2360 2360
2361 void test_canBeNullAfterNullAware_false_methodInvocation() {
2362 Source source = addSource(r'''
2363 m(x) {
2364 x?.a()?.b();
2365 }
2366 ''');
2367 computeLibrarySourceErrors(source);
2368 assertNoErrors(source);
2369 verify([source]);
2370 }
2371
2372 void test_canBeNullAfterNullAware_false_propertyAccess() {
2373 Source source = addSource(r'''
2374 m(x) {
2375 x?.a?.b;
2376 }
2377 ''');
2378 computeLibrarySourceErrors(source);
2379 assertNoErrors(source);
2380 verify([source]);
2381 }
2382
2361 void test_canBeNullAfterNullAware_methodInvocation() { 2383 void test_canBeNullAfterNullAware_methodInvocation() {
2362 Source source = addSource(r''' 2384 Source source = addSource(r'''
2363 m(x) { 2385 m(x) {
2364 x?.a.b(); 2386 x?.a.b();
2365 } 2387 }
2366 '''); 2388 ''');
2367 computeLibrarySourceErrors(source); 2389 computeLibrarySourceErrors(source);
2368 assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]); 2390 assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
2369 verify([source]); 2391 verify([source]);
2370 } 2392 }
(...skipping 12691 matching lines...) Expand 10 before | Expand all | Expand 10 after
15062 15084
15063 void _resolveTestUnit(String code) { 15085 void _resolveTestUnit(String code) {
15064 testCode = code; 15086 testCode = code;
15065 testSource = addSource(testCode); 15087 testSource = addSource(testCode);
15066 LibraryElement library = resolve2(testSource); 15088 LibraryElement library = resolve2(testSource);
15067 assertNoErrors(testSource); 15089 assertNoErrors(testSource);
15068 verify([testSource]); 15090 verify([testSource]);
15069 testUnit = resolveCompilationUnit(testSource, library); 15091 testUnit = resolveCompilationUnit(testSource, library);
15070 } 15092 }
15071 } 15093 }
OLDNEW
« pkg/analyzer/lib/src/generated/resolver.dart ('K') | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698