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

Side by Side Diff: pkg/analyzer/test/src/dart/element/element_test.dart

Issue 3000183002: Fix ClassElement.allSupertypes to include interfaces of mixins (issue 29767) (Closed)
Patch Set: address comments Created 3 years, 4 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
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 analyzer.test.src.dart.element.element_test; 5 library analyzer.test.src.dart.element.element_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/constant/value.dart'; 8 import 'package:analyzer/dart/constant/value.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 ClassElement classB = ElementFactory.classElement("B", classA.type); 163 ClassElement classB = ElementFactory.classElement("B", classA.type);
164 ClassElementImpl classC = ElementFactory.classElement2("C"); 164 ClassElementImpl classC = ElementFactory.classElement2("C");
165 InterfaceType typeObject = classA.supertype; 165 InterfaceType typeObject = classA.supertype;
166 InterfaceType typeA = classA.type; 166 InterfaceType typeA = classA.type;
167 InterfaceType typeB = classB.type; 167 InterfaceType typeB = classB.type;
168 InterfaceType typeC = classC.type; 168 InterfaceType typeC = classC.type;
169 classC.mixins = <InterfaceType>[typeB]; 169 classC.mixins = <InterfaceType>[typeB];
170 List<InterfaceType> supers = classC.allSupertypes; 170 List<InterfaceType> supers = classC.allSupertypes;
171 List<InterfaceType> types = new List<InterfaceType>(); 171 List<InterfaceType> types = new List<InterfaceType>();
172 types.addAll(supers); 172 types.addAll(supers);
173 expect(types.contains(typeA), isFalse); 173 expect(types.contains(typeA), isTrue);
174 expect(types.contains(typeB), isTrue); 174 expect(types.contains(typeB), isTrue);
175 expect(types.contains(typeObject), isTrue); 175 expect(types.contains(typeObject), isTrue);
176 expect(types.contains(typeC), isFalse); 176 expect(types.contains(typeC), isFalse);
177 } 177 }
178 178
179 void test_getAllSupertypes_recursive() { 179 void test_getAllSupertypes_recursive() {
180 ClassElementImpl classA = ElementFactory.classElement2("A"); 180 ClassElementImpl classA = ElementFactory.classElement2("A");
181 ClassElementImpl classB = ElementFactory.classElement("B", classA.type); 181 ClassElementImpl classB = ElementFactory.classElement("B", classA.type);
182 classA.supertype = classB.type; 182 classA.supertype = classB.type;
183 List<InterfaceType> supers = classB.allSupertypes; 183 List<InterfaceType> supers = classB.allSupertypes;
(...skipping 4171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 } 4355 }
4356 4356
4357 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction 4357 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction
4358 extends InterfaceTypeImpl { 4358 extends InterfaceTypeImpl {
4359 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) 4359 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0)
4360 : super(arg0); 4360 : super(arg0);
4361 4361
4362 @override 4362 @override
4363 bool get isDartCoreFunction => true; 4363 bool get isDartCoreFunction => true;
4364 } 4364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698