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

Unified Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart

Issue 2846103002: Generated front_end/testcases/inference test files from Analyzer tests. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/front_end.iml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
index 446f29cf444fafde70d4871ef7a062b5dccb975f..4e250d8c1252f0ebb537fc5429faa595c2120b73 100644
--- a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
+++ b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
@@ -58,8 +58,9 @@ Future<Null> _runFrontEndInferenceTests() async {
try {
String code = file.readAsStringSync();
await test.runTest(file.path, code);
- } catch (_) {
+ } catch (_, st) {
print(_);
+ print(st);
} finally {
await test.tearDown();
}
@@ -68,6 +69,10 @@ Future<Null> _runFrontEndInferenceTests() async {
class _FrontEndInferenceTest extends BaseAnalysisDriverTest {
Future<Null> runTest(String path, String code) async {
+// if (!path
Paul Berry 2017/04/27 21:19:29 Was this left in by accident?
+// .endsWith('downwards_inference_on_generic_function_expressions.dart')) {
+// return;
+// }
Uri uri = provider.pathContext.toUri(path);
List<int> lineStarts = new LineInfo.fromContent(code).lineStarts;
@@ -107,6 +112,11 @@ class _InstrumentationValueForType extends fasta.InstrumentationValue {
void _appendElementName(StringBuffer buffer, Element element) {
String name = element.name;
+ if (element.library == null) {
+ // TODO(scheglov) This is wrong - every element must be in a library.
+ buffer.write('<unknown>::$name');
+ return;
+ }
String libraryName = element.library.name;
if (libraryName == '') {
throw new StateError('The element $name must be in a named library.');
@@ -142,7 +152,7 @@ class _InstrumentationValueForType extends fasta.InstrumentationValue {
StringBuffer buffer, List<ParameterElement> parameters) {
_appendList<ParameterElement>(buffer, '(', ')', parameters, ', ',
(parameter) {
- _appendType(buffer, type);
+ _appendType(buffer, parameter.type);
buffer.write(' ');
buffer.write(parameter.name);
}, includeEmpty: true);
@@ -223,6 +233,26 @@ class _InstrumentationVisitor extends RecursiveAstVisitor<Null> {
}
}
+ visitListLiteral(ListLiteral node) {
+ super.visitListLiteral(node);
+ if (node.typeArguments == null) {
+ DartType type = node.staticType;
+ if (type is InterfaceType) {
+ _recordTypeArguments(node.offset, type.typeArguments);
+ }
+ }
+ }
+
+ visitMapLiteral(MapLiteral node) {
+ super.visitMapLiteral(node);
+ if (node.typeArguments == null) {
+ DartType type = node.staticType;
+ if (type is InterfaceType) {
+ _recordTypeArguments(node.offset, type.typeArguments);
+ }
+ }
+ }
+
visitSimpleIdentifier(SimpleIdentifier node) {
super.visitSimpleIdentifier(node);
Element element = node.staticElement;
« no previous file with comments | « no previous file | pkg/front_end/front_end.iml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698