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/error/listener.dart'; | 9 import 'package:analyzer/error/listener.dart'; |
10 import 'package:analyzer/src/dart/scanner/reader.dart'; | 10 import 'package:analyzer/src/dart/scanner/reader.dart'; |
(...skipping 9936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9947 test_unresolved_reference_shared() { | 9947 test_unresolved_reference_shared() { |
9948 // Both `x` and `y` use unresolved identifier `C` as their type. Verify | 9948 // Both `x` and `y` use unresolved identifier `C` as their type. Verify |
9949 // that they both use the same unresolved reference. | 9949 // that they both use the same unresolved reference. |
9950 serializeLibraryText('C x; C y;', allowErrors: true); | 9950 serializeLibraryText('C x; C y;', allowErrors: true); |
9951 EntityRef xType = findVariable('x').type; | 9951 EntityRef xType = findVariable('x').type; |
9952 EntityRef yType = findVariable('y').type; | 9952 EntityRef yType = findVariable('y').type; |
9953 expect(xType.reference, yType.reference); | 9953 expect(xType.reference, yType.reference); |
9954 } | 9954 } |
9955 | 9955 |
9956 test_unused_type_parameter() { | 9956 test_unused_type_parameter() { |
9957 if (skipFullyLinkedData) { | 9957 if (!strongMode || skipFullyLinkedData) { |
Paul Berry
2016/09/21 21:18:12
I'm concerned because this means we're no longer t
scheglov
2016/09/21 21:42:37
The behavior is consistent with other *infer* test
Paul Berry
2016/09/21 22:09:10
Ah, sorry--I missed that detail. Thanks.
| |
9958 return; | 9958 return; |
9959 } | 9959 } |
9960 // Unused type parameters get converted to `dynamic`. | |
9961 UnlinkedVariable variable = serializeVariableText(''' | 9960 UnlinkedVariable variable = serializeVariableText(''' |
9962 class C<T> { | 9961 class C<T> { |
9963 void f() {} | 9962 void f() {} |
9964 } | 9963 } |
9965 C<int> c; | 9964 C<int> c; |
9966 var v = c.f; | 9965 var v = c.f; |
9967 '''); | 9966 '''); |
9968 EntityRef type = | 9967 EntityRef type = |
9969 getTypeRefForSlot(variable.initializer.inferredReturnTypeSlot); | 9968 getTypeRefForSlot(variable.initializer.inferredReturnTypeSlot); |
9970 expect(type.typeArguments, hasLength(1)); | 9969 expect(type.typeArguments, hasLength(1)); |
9971 checkLinkedTypeRef(type.typeArguments[0], null, null, 'dynamic'); | 9970 checkLinkedTypeRef(type.typeArguments[0], 'dart:core', 'dart:core', 'int'); |
9972 } | 9971 } |
9973 | 9972 |
9974 test_variable() { | 9973 test_variable() { |
9975 String text = 'int i;'; | 9974 String text = 'int i;'; |
9976 UnlinkedVariable v = serializeVariableText(text, variableName: 'i'); | 9975 UnlinkedVariable v = serializeVariableText(text, variableName: 'i'); |
9977 expect(v.nameOffset, text.indexOf('i;')); | 9976 expect(v.nameOffset, text.indexOf('i;')); |
9978 expect(findExecutable('i'), isNull); | 9977 expect(findExecutable('i'), isNull); |
9979 expect(findExecutable('i='), isNull); | 9978 expect(findExecutable('i='), isNull); |
9980 expect(unlinkedUnits[0].publicNamespace.names, hasLength(2)); | 9979 expect(unlinkedUnits[0].publicNamespace.names, hasLength(2)); |
9981 expect(unlinkedUnits[0].publicNamespace.names[0].kind, | 9980 expect(unlinkedUnits[0].publicNamespace.names[0].kind, |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10338 class _PrefixExpectation { | 10337 class _PrefixExpectation { |
10339 final ReferenceKind kind; | 10338 final ReferenceKind kind; |
10340 final String name; | 10339 final String name; |
10341 final String absoluteUri; | 10340 final String absoluteUri; |
10342 final String relativeUri; | 10341 final String relativeUri; |
10343 final int numTypeParameters; | 10342 final int numTypeParameters; |
10344 | 10343 |
10345 _PrefixExpectation(this.kind, this.name, | 10344 _PrefixExpectation(this.kind, this.name, |
10346 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); | 10345 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); |
10347 } | 10346 } |
OLD | NEW |