| 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/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 5719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5730 | 5730 |
| 5731 test_method_inferred_type_static_implicit_return() { | 5731 test_method_inferred_type_static_implicit_return() { |
| 5732 UnlinkedExecutable f = serializeClassText( | 5732 UnlinkedExecutable f = serializeClassText( |
| 5733 'class C extends D { static f() => null; }' | 5733 'class C extends D { static f() => null; }' |
| 5734 ' class D { static int f() => null; }', | 5734 ' class D { static int f() => null; }', |
| 5735 className: 'C') | 5735 className: 'C') |
| 5736 .executables[0]; | 5736 .executables[0]; |
| 5737 expect(f.inferredReturnTypeSlot, 0); | 5737 expect(f.inferredReturnTypeSlot, 0); |
| 5738 } | 5738 } |
| 5739 | 5739 |
| 5740 test_nested_generic_functions() { |
| 5741 UnlinkedExecutable executable = serializeExecutableText(''' |
| 5742 void f<T, U>() { |
| 5743 void g<V, W>() { |
| 5744 void h<X, Y>() { |
| 5745 T t; |
| 5746 U u; |
| 5747 V v; |
| 5748 W w; |
| 5749 X x; |
| 5750 Y y; |
| 5751 } |
| 5752 } |
| 5753 } |
| 5754 '''); |
| 5755 expect(executable.typeParameters, hasLength(2)); |
| 5756 expect(executable.localFunctions[0].typeParameters, hasLength(2)); |
| 5757 expect(executable.localFunctions[0].localFunctions[0].typeParameters, |
| 5758 hasLength(2)); |
| 5759 List<UnlinkedVariable> localVariables = |
| 5760 executable.localFunctions[0].localFunctions[0].localVariables; |
| 5761 checkParamTypeRef(findVariable('t', variables: localVariables).type, 6); |
| 5762 checkParamTypeRef(findVariable('u', variables: localVariables).type, 5); |
| 5763 checkParamTypeRef(findVariable('v', variables: localVariables).type, 4); |
| 5764 checkParamTypeRef(findVariable('w', variables: localVariables).type, 3); |
| 5765 checkParamTypeRef(findVariable('x', variables: localVariables).type, 2); |
| 5766 checkParamTypeRef(findVariable('y', variables: localVariables).type, 1); |
| 5767 } |
| 5768 |
| 5769 test_nested_generic_functions_in_generic_class() { |
| 5770 UnlinkedClass cls = serializeClassText(''' |
| 5771 class C<T, U> { |
| 5772 void g<V, W>() { |
| 5773 void h<X, Y>() { |
| 5774 T t; |
| 5775 U u; |
| 5776 V v; |
| 5777 W w; |
| 5778 X x; |
| 5779 Y y; |
| 5780 } |
| 5781 } |
| 5782 } |
| 5783 '''); |
| 5784 expect(cls.typeParameters, hasLength(2)); |
| 5785 expect(cls.executables[0].typeParameters, hasLength(2)); |
| 5786 expect(cls.executables[0].localFunctions[0].typeParameters, hasLength(2)); |
| 5787 List<UnlinkedVariable> localVariables = |
| 5788 cls.executables[0].localFunctions[0].localVariables; |
| 5789 checkParamTypeRef(findVariable('t', variables: localVariables).type, 6); |
| 5790 checkParamTypeRef(findVariable('u', variables: localVariables).type, 5); |
| 5791 checkParamTypeRef(findVariable('v', variables: localVariables).type, 4); |
| 5792 checkParamTypeRef(findVariable('w', variables: localVariables).type, 3); |
| 5793 checkParamTypeRef(findVariable('x', variables: localVariables).type, 2); |
| 5794 checkParamTypeRef(findVariable('y', variables: localVariables).type, 1); |
| 5795 } |
| 5796 |
| 5740 test_parameter_visibleRange_abstractMethod() { | 5797 test_parameter_visibleRange_abstractMethod() { |
| 5741 UnlinkedExecutable m = findExecutable('m', | 5798 UnlinkedExecutable m = findExecutable('m', |
| 5742 executables: | 5799 executables: |
| 5743 serializeClassText('abstract class C { m(p); }').executables, | 5800 serializeClassText('abstract class C { m(p); }').executables, |
| 5744 failIfAbsent: true); | 5801 failIfAbsent: true); |
| 5745 _assertParameterZeroVisibleRange(m.parameters[0]); | 5802 _assertParameterZeroVisibleRange(m.parameters[0]); |
| 5746 } | 5803 } |
| 5747 | 5804 |
| 5748 test_parameter_visibleRange_function_blockBody() { | 5805 test_parameter_visibleRange_function_blockBody() { |
| 5749 String text = r''' | 5806 String text = r''' |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6636 final String absoluteUri; | 6693 final String absoluteUri; |
| 6637 final String relativeUri; | 6694 final String relativeUri; |
| 6638 final int numTypeParameters; | 6695 final int numTypeParameters; |
| 6639 | 6696 |
| 6640 _PrefixExpectation(this.kind, this.name, | 6697 _PrefixExpectation(this.kind, this.name, |
| 6641 {this.inLibraryDefiningUnit: false, | 6698 {this.inLibraryDefiningUnit: false, |
| 6642 this.absoluteUri, | 6699 this.absoluteUri, |
| 6643 this.relativeUri, | 6700 this.relativeUri, |
| 6644 this.numTypeParameters: 0}); | 6701 this.numTypeParameters: 0}); |
| 6645 } | 6702 } |
| OLD | NEW |