| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/constant/value.dart'; | 8 import 'package:analyzer/dart/constant/value.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3610 f({void g(int x, void h())}) => null; | 3610 f({void g(int x, void h())}) => null; |
| 3611 var v = f(g: (x, y) {}); | 3611 var v = f(g: (x, y) {}); |
| 3612 '''); | 3612 '''); |
| 3613 } | 3613 } |
| 3614 | 3614 |
| 3615 test_inferred_type_refers_to_setter_function_typed_parameter_type() { | 3615 test_inferred_type_refers_to_setter_function_typed_parameter_type() { |
| 3616 checkLibrary('class C extends D { void set f(g) {} }' | 3616 checkLibrary('class C extends D { void set f(g) {} }' |
| 3617 ' abstract class D { void set f(int g(String s)); }'); | 3617 ' abstract class D { void set f(int g(String s)); }'); |
| 3618 } | 3618 } |
| 3619 | 3619 |
| 3620 void test_inferredType_definedInSdkLibraryPart() { |
| 3621 addSource( |
| 3622 '/a.dart', |
| 3623 r''' |
| 3624 import 'dart:async'; |
| 3625 class A { |
| 3626 m(Stream p) {} |
| 3627 } |
| 3628 '''); |
| 3629 LibraryElement library = checkLibrary(r''' |
| 3630 import 'a.dart'; |
| 3631 class B extends A { |
| 3632 m(p) {} |
| 3633 } |
| 3634 '''); |
| 3635 ClassElement b = library.definingCompilationUnit.types[0]; |
| 3636 ParameterElement p = b.methods[0].parameters[0]; |
| 3637 // This test should verify that we correctly record inferred types, |
| 3638 // when the type is defined in a part of an SDK library. So, test that |
| 3639 // the type is actually in a part. |
| 3640 Element streamElement = p.type.element; |
| 3641 if (streamElement is ClassElement) { |
| 3642 expect(streamElement.source, isNot(streamElement.library.source)); |
| 3643 } |
| 3644 } |
| 3645 |
| 3620 void test_inferredType_usesSyntheticFunctionType_functionTypedParam() { | 3646 void test_inferredType_usesSyntheticFunctionType_functionTypedParam() { |
| 3621 checkLibrary(''' | 3647 checkLibrary(''' |
| 3622 int f(int x(String y)) => null; | 3648 int f(int x(String y)) => null; |
| 3623 String g(int x(String y)) => null; | 3649 String g(int x(String y)) => null; |
| 3624 var v = [f, g]; | 3650 var v = [f, g]; |
| 3625 '''); | 3651 '''); |
| 3626 } | 3652 } |
| 3627 | 3653 |
| 3628 test_inheritance_errors() { | 3654 test_inheritance_errors() { |
| 3629 checkLibrary(''' | 3655 checkLibrary(''' |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4777 fail('Unexpectedly tried to get unlinked summary for $uri'); | 4803 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 4778 } | 4804 } |
| 4779 return serializedUnit; | 4805 return serializedUnit; |
| 4780 } | 4806 } |
| 4781 | 4807 |
| 4782 @override | 4808 @override |
| 4783 bool hasLibrarySummary(String uri) { | 4809 bool hasLibrarySummary(String uri) { |
| 4784 return true; | 4810 return true; |
| 4785 } | 4811 } |
| 4786 } | 4812 } |
| OLD | NEW |