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

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

Issue 1815253002: Fix another unguarded cast to an impl class (issue 26034, case 2) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/dart/element/element.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) 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/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/dart/element/type.dart'; 9 import 'package:analyzer/dart/element/type.dart';
10 import 'package:analyzer/src/dart/element/element.dart'; 10 import 'package:analyzer/src/dart/element/element.dart';
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // A 113 // A
114 { 114 {
115 ClassElement elementA = unitElement.getType("A"); 115 ClassElement elementA = unitElement.getType("A");
116 ClassTypeAlias nodeA = elementA.computeNode(); 116 ClassTypeAlias nodeA = elementA.computeNode();
117 expect(nodeA, isNotNull); 117 expect(nodeA, isNotNull);
118 expect(nodeA.name.name, "A"); 118 expect(nodeA.name.name, "A");
119 expect(nodeA.element, same(elementA)); 119 expect(nodeA.element, same(elementA));
120 } 120 }
121 } 121 }
122 122
123 void test_constructors_mixinApplicationWithHandle() {
124 AnalysisContext context = createAnalysisContext();
125 context.sourceFactory = new SourceFactory([]);
126
127 ElementLocation location = new ElementLocationImpl.con2('');
128 ClassElementImpl classA = ElementFactory.classElement2("A");
129 classA.mixinApplication = true;
130 TestElementResynthesizer resynthesizer =
131 new TestElementResynthesizer(context, {location: classA});
132 ClassElementHandle classAHandle =
133 new ClassElementHandle(resynthesizer, location);
134 ClassElementImpl classB =
135 ElementFactory.classElement("B", new InterfaceTypeImpl(classAHandle));
136 classB.mixinApplication = true;
137
138 expect(classB.constructors, hasLength(1));
139 }
140
123 void test_getAllSupertypes_interface() { 141 void test_getAllSupertypes_interface() {
124 ClassElement classA = ElementFactory.classElement2("A"); 142 ClassElement classA = ElementFactory.classElement2("A");
125 ClassElement classB = ElementFactory.classElement("B", classA.type); 143 ClassElement classB = ElementFactory.classElement("B", classA.type);
126 ClassElementImpl elementC = ElementFactory.classElement2("C"); 144 ClassElementImpl elementC = ElementFactory.classElement2("C");
127 InterfaceType typeObject = classA.supertype; 145 InterfaceType typeObject = classA.supertype;
128 InterfaceType typeA = classA.type; 146 InterfaceType typeA = classA.type;
129 InterfaceType typeB = classB.type; 147 InterfaceType typeB = classB.type;
130 InterfaceType typeC = elementC.type; 148 InterfaceType typeC = elementC.type;
131 elementC.interfaces = <InterfaceType>[typeB]; 149 elementC.interfaces = <InterfaceType>[typeB];
132 List<InterfaceType> supers = elementC.allSupertypes; 150 List<InterfaceType> supers = elementC.allSupertypes;
(...skipping 4037 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 } 4188 }
4171 4189
4172 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction 4190 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction
4173 extends InterfaceTypeImpl { 4191 extends InterfaceTypeImpl {
4174 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) 4192 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0)
4175 : super(arg0); 4193 : super(arg0);
4176 4194
4177 @override 4195 @override
4178 bool get isDartCoreFunction => true; 4196 bool get isDartCoreFunction => true;
4179 } 4197 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698