| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import | 6 import |
| 7 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' | 7 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' |
| 8 show TypeMask; | 8 show TypeMask; |
| 9 | 9 |
| 10 import 'compiler_helper.dart'; | 10 import 'compiler_helper.dart'; |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 checkReturn('testIsCheck20', typesTask.dynamicType.nonNullable()); | 537 checkReturn('testIsCheck20', typesTask.dynamicType.nonNullable()); |
| 538 checkReturn('returnAsString', | 538 checkReturn('returnAsString', |
| 539 new TypeMask.subtype(compiler.stringClass.computeType(compiler))); | 539 new TypeMask.subtype(compiler.stringClass.computeType(compiler))); |
| 540 checkReturn('returnIntAsNum', typesTask.intType); | 540 checkReturn('returnIntAsNum', typesTask.intType); |
| 541 checkReturn('returnAsTypedef', typesTask.functionType.nullable()); | 541 checkReturn('returnAsTypedef', typesTask.functionType.nullable()); |
| 542 checkReturn('returnTopLevelGetter', typesTask.intType); | 542 checkReturn('returnTopLevelGetter', typesTask.intType); |
| 543 checkReturn('testDeadCode', typesTask.intType); | 543 checkReturn('testDeadCode', typesTask.intType); |
| 544 checkReturn('testLabeledIf', typesTask.intType.nullable()); | 544 checkReturn('testLabeledIf', typesTask.intType.nullable()); |
| 545 checkReturn('testSwitch1', typesTask.intType | 545 checkReturn('testSwitch1', typesTask.intType |
| 546 .union(typesTask.doubleType, compiler).nullable().simplify(compiler)); | 546 .union(typesTask.doubleType, compiler).nullable().simplify(compiler)); |
| 547 checkReturn('testSwitch2', typesTask.intType); | 547 // TODO(12320): testSwitch2 should be non-nullable. The quick fix for 12320 |
| 548 // models control flow through as though there is an additional empty default |
| 549 // case. |
| 550 checkReturn('testSwitch2', typesTask.intType.nullable()); |
| 548 checkReturn('testSwitch3', interceptorType.nullable()); | 551 checkReturn('testSwitch3', interceptorType.nullable()); |
| 549 checkReturn('testSwitch4', typesTask.intType); | 552 checkReturn('testSwitch4', typesTask.intType); |
| 550 checkReturn('testContinue1', interceptorType.nullable()); | 553 checkReturn('testContinue1', interceptorType.nullable()); |
| 551 checkReturn('testBreak1', interceptorType.nullable()); | 554 checkReturn('testBreak1', interceptorType.nullable()); |
| 552 checkReturn('testContinue2', interceptorType.nullable()); | 555 checkReturn('testContinue2', interceptorType.nullable()); |
| 553 checkReturn('testBreak2', typesTask.intType.nullable()); | 556 checkReturn('testBreak2', typesTask.intType.nullable()); |
| 554 checkReturn('testReturnElementOfConstList1', typesTask.intType); | 557 checkReturn('testReturnElementOfConstList1', typesTask.intType); |
| 555 checkReturn('testReturnElementOfConstList2', typesTask.intType); | 558 checkReturn('testReturnElementOfConstList2', typesTask.intType); |
| 556 checkReturn('testReturnItselfOrInt', typesTask.intType); | 559 checkReturn('testReturnItselfOrInt', typesTask.intType); |
| 557 checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType); | 560 checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 582 checkReturnInClass('B', 'returnInt9', typesTask.intType); | 585 checkReturnInClass('B', 'returnInt9', typesTask.intType); |
| 583 | 586 |
| 584 checkFactoryConstructor(String className, String factoryName) { | 587 checkFactoryConstructor(String className, String factoryName) { |
| 585 var cls = findElement(compiler, className); | 588 var cls = findElement(compiler, className); |
| 586 var element = cls.localLookup(buildSourceString(factoryName)); | 589 var element = cls.localLookup(buildSourceString(factoryName)); |
| 587 Expect.equals(new TypeMask.nonNullExact(cls.rawType), | 590 Expect.equals(new TypeMask.nonNullExact(cls.rawType), |
| 588 typesInferrer.getReturnTypeOfElement(element)); | 591 typesInferrer.getReturnTypeOfElement(element)); |
| 589 } | 592 } |
| 590 checkFactoryConstructor('A', ''); | 593 checkFactoryConstructor('A', ''); |
| 591 } | 594 } |
| OLD | NEW |