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

Side by Side Diff: pkg/analyzer/test/src/summary/summary_test.dart

Issue 1530363002: Fix summary resynthesis for operators ending in '='. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Konstantin's suggestion Created 5 years 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/test/src/summary/resynthesize_test.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) 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_test; 5 library analyzer.test.src.summary.summary_test;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/java_engine_io.dart'; 9 import 'package:analyzer/src/generated/java_engine_io.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 expect(executable.isAbstract, false); 1279 expect(executable.isAbstract, false);
1280 expect(executable.isConst, false); 1280 expect(executable.isConst, false);
1281 expect(executable.isFactory, false); 1281 expect(executable.isFactory, false);
1282 expect(executable.isStatic, false); 1282 expect(executable.isStatic, false);
1283 expect(executable.parameters, hasLength(1)); 1283 expect(executable.parameters, hasLength(1));
1284 checkTypeRef(executable.returnType, null, null, 'C'); 1284 checkTypeRef(executable.returnType, null, null, 'C');
1285 expect(executable.typeParameters, isEmpty); 1285 expect(executable.typeParameters, isEmpty);
1286 expect(executable.isExternal, false); 1286 expect(executable.isExternal, false);
1287 } 1287 }
1288 1288
1289 test_executable_operator_equal() {
1290 UnlinkedExecutable executable =
1291 serializeClassText('class C { bool operator==(C other) => false; }')
1292 .executables[0];
1293 expect(executable.name, '==');
1294 }
1295
1289 test_executable_operator_external() { 1296 test_executable_operator_external() {
1290 UnlinkedExecutable executable = 1297 UnlinkedExecutable executable =
1291 serializeClassText('class C { external C operator+(C c); }') 1298 serializeClassText('class C { external C operator+(C c); }')
1292 .executables[0]; 1299 .executables[0];
1293 expect(executable.isExternal, true); 1300 expect(executable.isExternal, true);
1294 } 1301 }
1295 1302
1303 test_executable_operator_greater_equal() {
1304 UnlinkedExecutable executable =
1305 serializeClassText('class C { bool operator>=(C other) => false; }')
1306 .executables[0];
1307 expect(executable.name, '>=');
1308 }
1309
1296 test_executable_operator_index() { 1310 test_executable_operator_index() {
1297 UnlinkedExecutable executable = 1311 UnlinkedExecutable executable =
1298 serializeClassText('class C { bool operator[](int i) => null; }') 1312 serializeClassText('class C { bool operator[](int i) => null; }')
1299 .executables[0]; 1313 .executables[0];
1300 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod); 1314 expect(executable.kind, UnlinkedExecutableKind.functionOrMethod);
1301 expect(executable.name, '[]'); 1315 expect(executable.name, '[]');
1302 expect(executable.hasImplicitReturnType, false); 1316 expect(executable.hasImplicitReturnType, false);
1303 expect(executable.isAbstract, false); 1317 expect(executable.isAbstract, false);
1304 expect(executable.isConst, false); 1318 expect(executable.isConst, false);
1305 expect(executable.isFactory, false); 1319 expect(executable.isFactory, false);
(...skipping 11 matching lines...) Expand all
1317 expect(executable.hasImplicitReturnType, false); 1331 expect(executable.hasImplicitReturnType, false);
1318 expect(executable.isAbstract, false); 1332 expect(executable.isAbstract, false);
1319 expect(executable.isConst, false); 1333 expect(executable.isConst, false);
1320 expect(executable.isFactory, false); 1334 expect(executable.isFactory, false);
1321 expect(executable.isStatic, false); 1335 expect(executable.isStatic, false);
1322 expect(executable.parameters, hasLength(2)); 1336 expect(executable.parameters, hasLength(2));
1323 expect(executable.returnType, isNull); 1337 expect(executable.returnType, isNull);
1324 expect(executable.typeParameters, isEmpty); 1338 expect(executable.typeParameters, isEmpty);
1325 } 1339 }
1326 1340
1341 test_executable_operator_less_equal() {
1342 UnlinkedExecutable executable =
1343 serializeClassText('class C { bool operator<=(C other) => false; }')
1344 .executables[0];
1345 expect(executable.name, '<=');
1346 }
1347
1327 test_executable_param_function_typed() { 1348 test_executable_param_function_typed() {
1328 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}'); 1349 UnlinkedExecutable executable = serializeExecutableText('f(g()) {}');
1329 expect(executable.parameters[0].isFunctionTyped, isTrue); 1350 expect(executable.parameters[0].isFunctionTyped, isTrue);
1330 // Since the parameter is function-typed it is considered to have an 1351 // Since the parameter is function-typed it is considered to have an
1331 // explicit type, even though that explicit type itself has an implicit 1352 // explicit type, even though that explicit type itself has an implicit
1332 // return type. 1353 // return type.
1333 expect(executable.parameters[0].hasImplicitType, isFalse); 1354 expect(executable.parameters[0].hasImplicitType, isFalse);
1334 } 1355 }
1335 1356
1336 test_executable_param_function_typed_explicit_return_type() { 1357 test_executable_param_function_typed_explicit_return_type() {
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 serializeClassText('class C { static int i; }').fields[0]; 2125 serializeClassText('class C { static int i; }').fields[0];
2105 expect(variable.isStatic, isTrue); 2126 expect(variable.isStatic, isTrue);
2106 } 2127 }
2107 2128
2108 test_variable_type() { 2129 test_variable_type() {
2109 UnlinkedVariable variable = 2130 UnlinkedVariable variable =
2110 serializeVariableText('int i;', variableName: 'i'); 2131 serializeVariableText('int i;', variableName: 'i');
2111 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); 2132 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int');
2112 } 2133 }
2113 } 2134 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698