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

Side by Side Diff: pkg/analyzer/test/src/summary/top_level_inference_test.dart

Issue 2828573002: Fix for instance fields inference when a setter has no parameter. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/strong_mode.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/dart/analysis/driver.dart'; 8 import 'package:analyzer/src/dart/analysis/driver.dart';
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; 9 import 'package:test_reflective_loader/test_reflective_loader.dart';
10 10
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 var library = await _encodeDecodeLibrary(r''' 1443 var library = await _encodeDecodeLibrary(r'''
1444 var V = throw 42; 1444 var V = throw 42;
1445 '''); 1445 ''');
1446 checkElementText( 1446 checkElementText(
1447 library, 1447 library,
1448 r''' 1448 r'''
1449 Null V; 1449 Null V;
1450 '''); 1450 ''');
1451 } 1451 }
1452 1452
1453 test_instanceField_error_noSetterParameter() async {
1454 var library = await _encodeDecodeLibrary(r'''
1455 abstract class A {
1456 int x;
1457 }
1458 class B implements A {
1459 set x() {}
1460 }
1461 ''');
1462 checkElementText(
1463 library,
1464 r'''
1465 abstract class A {
1466 int x;
1467 }
1468 class B implements A {
1469 void set x() {}
1470 }
1471 ''');
1472 }
1473
1453 test_instanceField_fieldFormal() async { 1474 test_instanceField_fieldFormal() async {
1454 var library = await _encodeDecodeLibrary(r''' 1475 var library = await _encodeDecodeLibrary(r'''
1455 class A { 1476 class A {
1456 var f = 0; 1477 var f = 0;
1457 A([this.f = 'hello']); 1478 A([this.f = 'hello']);
1458 } 1479 }
1459 '''); 1480 ''');
1460 checkElementText( 1481 checkElementText(
1461 library, 1482 library,
1462 r''' 1483 r'''
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 2745
2725 Future<LibraryElement> _encodeDecodeLibrary(String text) async { 2746 Future<LibraryElement> _encodeDecodeLibrary(String text) async {
2726 String path = _p('/test.dart'); 2747 String path = _p('/test.dart');
2727 provider.newFile(path, text); 2748 provider.newFile(path, text);
2728 UnitElementResult result = await driver.getUnitElement(path); 2749 UnitElementResult result = await driver.getUnitElement(path);
2729 return result.element.library; 2750 return result.element.library;
2730 } 2751 }
2731 2752
2732 String _p(String path) => provider.convertPath(path); 2753 String _p(String path) => provider.convertPath(path);
2733 } 2754 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/strong_mode.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698