| OLD | NEW |
| 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 library analyzer.test.src.summary.summary_common; | 5 library analyzer.test.src.summary.summary_common; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/dart/scanner/reader.dart'; | 10 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| (...skipping 7664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7675 UnlinkedClass cls = | 7675 UnlinkedClass cls = |
| 7676 serializeClassText('class C { final x = <dynamic, int>{}; }'); | 7676 serializeClassText('class C { final x = <dynamic, int>{}; }'); |
| 7677 EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot); | 7677 EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot); |
| 7678 // Check that x has inferred type `Map<dynamic, int>`. | 7678 // Check that x has inferred type `Map<dynamic, int>`. |
| 7679 checkLinkedTypeRef(type, 'dart:core', 'dart:core', 'Map', | 7679 checkLinkedTypeRef(type, 'dart:core', 'dart:core', 'Map', |
| 7680 numTypeParameters: 2, numTypeArguments: 2); | 7680 numTypeParameters: 2, numTypeArguments: 2); |
| 7681 checkLinkedTypeRef(type.typeArguments[0], null, null, 'dynamic'); | 7681 checkLinkedTypeRef(type.typeArguments[0], null, null, 'dynamic'); |
| 7682 checkLinkedTypeRef(type.typeArguments[1], 'dart:core', 'dart:core', 'int'); | 7682 checkLinkedTypeRef(type.typeArguments[1], 'dart:core', 'dart:core', 'int'); |
| 7683 } | 7683 } |
| 7684 | 7684 |
| 7685 test_inferred_type_reference_shared_prefixed() { |
| 7686 if (!strongMode || skipFullyLinkedData) { |
| 7687 return; |
| 7688 } |
| 7689 // Variable `y` has an inferred type of `p.C`. Verify that the reference |
| 7690 // used by the explicit type of `x` is re-used for the inferred type. |
| 7691 addNamedSource('/a.dart', 'class C {}'); |
| 7692 serializeLibraryText('import "a.dart" as p; p.C x; var y = new p.C();'); |
| 7693 EntityRef xType = findVariable('x').type; |
| 7694 EntityRef yType = getTypeRefForSlot(findVariable('y').inferredTypeSlot); |
| 7695 expect(yType.reference, xType.reference); |
| 7696 } |
| 7697 |
| 7685 test_inferred_type_refers_to_bound_type_param() { | 7698 test_inferred_type_refers_to_bound_type_param() { |
| 7686 if (!strongMode || skipFullyLinkedData) { | 7699 if (!strongMode || skipFullyLinkedData) { |
| 7687 return; | 7700 return; |
| 7688 } | 7701 } |
| 7689 UnlinkedClass cls = serializeClassText( | 7702 UnlinkedClass cls = serializeClassText( |
| 7690 'class C<T> extends D<int, T> { var v; }' | 7703 'class C<T> extends D<int, T> { var v; }' |
| 7691 ' abstract class D<U, V> { Map<V, U> get v; }', | 7704 ' abstract class D<U, V> { Map<V, U> get v; }', |
| 7692 className: 'C'); | 7705 className: 'C'); |
| 7693 EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot); | 7706 EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot); |
| 7694 // Check that v has inferred type Map<T, int>. | 7707 // Check that v has inferred type Map<T, int>. |
| (...skipping 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9973 class _PrefixExpectation { | 9986 class _PrefixExpectation { |
| 9974 final ReferenceKind kind; | 9987 final ReferenceKind kind; |
| 9975 final String name; | 9988 final String name; |
| 9976 final String absoluteUri; | 9989 final String absoluteUri; |
| 9977 final String relativeUri; | 9990 final String relativeUri; |
| 9978 final int numTypeParameters; | 9991 final int numTypeParameters; |
| 9979 | 9992 |
| 9980 _PrefixExpectation(this.kind, this.name, | 9993 _PrefixExpectation(this.kind, this.name, |
| 9981 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); | 9994 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); |
| 9982 } | 9995 } |
| OLD | NEW |