| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 'package:analyzer/dart/element/type.dart'; | 5 import 'package:analyzer/dart/element/type.dart'; |
| 6 import 'package:analyzer/src/summary/format.dart'; | 6 import 'package:analyzer/src/summary/format.dart'; |
| 7 import 'package:analyzer/src/summary/link.dart'; | 7 import 'package:analyzer/src/summary/link.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 final y; | 143 final y; |
| 144 const C() : y = x.length; | 144 const C() : y = x.length; |
| 145 } | 145 } |
| 146 const x = [const C()]; | 146 const x = [const C()]; |
| 147 '''); | 147 '''); |
| 148 testLibrary.libraryCycleForLink.ensureLinked(); | 148 testLibrary.libraryCycleForLink.ensureLinked(); |
| 149 ClassElementForLink classC = testLibrary.getContainedName('C'); | 149 ClassElementForLink classC = testLibrary.getContainedName('C'); |
| 150 expect(classC.unnamedConstructor.isCycleFree, false); | 150 expect(classC.unnamedConstructor.isCycleFree, false); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void test_inferredType_closure_fromBundle() { |
| 154 var bundle = createPackageBundle( |
| 155 ''' |
| 156 var x = () {}; |
| 157 ''', |
| 158 path: '/a.dart'); |
| 159 addBundle(bundle); |
| 160 createLinker(''' |
| 161 import 'a.dart'; |
| 162 var y = x; |
| 163 '''); |
| 164 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); |
| 165 expect( |
| 166 library |
| 167 .getContainedName('y') |
| 168 .asTypeInferenceNode |
| 169 .variableElement |
| 170 .inferredType |
| 171 .toString(), |
| 172 '() → dynamic'); |
| 173 } |
| 174 |
| 153 void test_inferredType_instanceField_dynamic() { | 175 void test_inferredType_instanceField_dynamic() { |
| 154 createLinker(''' | 176 createLinker(''' |
| 155 var x; | 177 var x; |
| 156 class C { | 178 class C { |
| 157 var f = x; // Inferred type: dynamic | 179 var f = x; // Inferred type: dynamic |
| 158 } | 180 } |
| 159 '''); | 181 '''); |
| 160 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); | 182 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); |
| 161 library.libraryCycleForLink.ensureLinked(); | 183 library.libraryCycleForLink.ensureLinked(); |
| 162 ClassElementForLink_Class cls = library.getContainedName('C'); | 184 ClassElementForLink_Class cls = library.getContainedName('C'); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 TypeParameterElementForLink t = c.typeParameters[0]; | 656 TypeParameterElementForLink t = c.typeParameters[0]; |
| 635 TypeParameterElementForLink u = c.typeParameters[1]; | 657 TypeParameterElementForLink u = c.typeParameters[1]; |
| 636 TypeParameterElementForLink v = d.typeParameters[0]; | 658 TypeParameterElementForLink v = d.typeParameters[0]; |
| 637 TypeParameterElementForLink w = d.typeParameters[1]; | 659 TypeParameterElementForLink w = d.typeParameters[1]; |
| 638 expect(c.isTypeParameterInScope(v), false); | 660 expect(c.isTypeParameterInScope(v), false); |
| 639 expect(c.isTypeParameterInScope(w), false); | 661 expect(c.isTypeParameterInScope(w), false); |
| 640 expect(d.isTypeParameterInScope(t), false); | 662 expect(d.isTypeParameterInScope(t), false); |
| 641 expect(d.isTypeParameterInScope(u), false); | 663 expect(d.isTypeParameterInScope(u), false); |
| 642 } | 664 } |
| 643 } | 665 } |
| OLD | NEW |