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

Side by Side Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 2319233002: Have setters use strict -> like methods (Closed)
Patch Set: fix tests Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be 5 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be
6 // refactored to fit into analyzer. 6 // refactored to fit into analyzer.
7 library analyzer.src.task.strong.checker; 7 library analyzer.src.task.strong.checker;
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 element.enclosingElement.name, 1397 element.enclosingElement.name,
1398 element.name, 1398 element.name,
1399 subType, 1399 subType,
1400 type, 1400 type,
1401 baseType 1401 baseType
1402 ]); 1402 ]);
1403 } 1403 }
1404 } 1404 }
1405 FunctionType concreteSubType = subType; 1405 FunctionType concreteSubType = subType;
1406 FunctionType concreteBaseType = baseType; 1406 FunctionType concreteBaseType = baseType;
1407 if (element is MethodElement) { 1407 if (concreteSubType.typeFormals.isNotEmpty) {
1408 if (concreteSubType.typeFormals.isNotEmpty) { 1408 if (concreteBaseType.typeFormals.isEmpty) {
1409 if (concreteBaseType.typeFormals.isEmpty) { 1409 concreteSubType = rules.instantiateToBounds(concreteSubType);
1410 concreteSubType = rules.instantiateToBounds(concreteSubType);
1411 }
1412 } 1410 }
1413 concreteSubType =
1414 rules.typeToConcreteType(_typeProvider, concreteSubType);
1415 concreteBaseType =
1416 rules.typeToConcreteType(_typeProvider, concreteBaseType);
1417 } 1411 }
1412 concreteSubType =
1413 rules.typeToConcreteType(_typeProvider, concreteSubType);
1414 concreteBaseType =
1415 rules.typeToConcreteType(_typeProvider, concreteBaseType);
1416
1418 if (!rules.isSubtypeOf(concreteSubType, concreteBaseType)) { 1417 if (!rules.isSubtypeOf(concreteSubType, concreteBaseType)) {
1419 // See whether non-subtype cases fit one of our common patterns: 1418 // See whether non-subtype cases fit one of our common patterns:
1420 // 1419 //
1421 // Common pattern 1: Inferable return type (on getters and methods) 1420 // Common pattern 1: Inferable return type (on getters and methods)
1422 // class A { 1421 // class A {
1423 // int get foo => ...; 1422 // int get foo => ...;
1424 // String toString() { ... } 1423 // String toString() { ... }
1425 // } 1424 // }
1426 // class B extends A { 1425 // class B extends A {
1427 // get foo => e; // no type specified. 1426 // get foo => e; // no type specified.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 var visited = new Set<InterfaceType>(); 1475 var visited = new Set<InterfaceType>();
1477 do { 1476 do {
1478 visited.add(current); 1477 visited.add(current);
1479 current.mixins.reversed.forEach( 1478 current.mixins.reversed.forEach(
1480 (m) => _checkIndividualOverridesFromClass(node, m, seen, true)); 1479 (m) => _checkIndividualOverridesFromClass(node, m, seen, true));
1481 _checkIndividualOverridesFromClass(node, current.superclass, seen, true); 1480 _checkIndividualOverridesFromClass(node, current.superclass, seen, true);
1482 current = current.superclass; 1481 current = current.superclass;
1483 } while (!current.isObject && !visited.contains(current)); 1482 } while (!current.isObject && !visited.contains(current));
1484 } 1483 }
1485 } 1484 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698