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/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
9 import 'package:analyzer/dart/constant/value.dart'; | 9 import 'package:analyzer/dart/constant/value.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 13957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13968 r''' | 13968 r''' |
13969 /** | 13969 /** |
13970 * Docs | 13970 * Docs |
13971 */ | 13971 */ |
13972 typedef dynamic F(); | 13972 typedef dynamic F(); |
13973 '''); | 13973 '''); |
13974 } | 13974 } |
13975 } | 13975 } |
13976 | 13976 |
13977 test_typedef_generic() { | 13977 test_typedef_generic() { |
13978 checkLibrary( | 13978 var library = checkLibrary( |
13979 'typedef F<T> = Function<S>(List<S> list, Function<A>(A), T);'); | 13979 'typedef F<T> = int Function<S>(List<S> list, num Function<A>(A), T);'); |
| 13980 if (isStrongMode) { |
| 13981 checkElementText( |
| 13982 library, |
| 13983 r''' |
| 13984 typedef F<T> = int Function<S>(List<S> list, <A>(A) → num , T ); |
| 13985 '''); |
| 13986 } else { |
| 13987 checkElementText( |
| 13988 library, |
| 13989 r''' |
| 13990 typedef F<T> = int Function<S>(List<S> list, <A>(A) → num , T ); |
| 13991 '''); |
| 13992 } |
| 13993 } |
| 13994 |
| 13995 test_typedef_generic_asFieldType() { |
| 13996 shouldCompareLibraryElements = false; |
| 13997 var library = checkLibrary(r''' |
| 13998 typedef Foo<S> = S Function<T>(T x); |
| 13999 class A { |
| 14000 Foo<int> f; |
| 14001 } |
| 14002 '''); |
| 14003 if (isStrongMode) { |
| 14004 checkElementText( |
| 14005 library, |
| 14006 r''' |
| 14007 typedef Foo<S> = S Function<T>(T x); |
| 14008 class A { |
| 14009 <T>(T) → int f; |
| 14010 } |
| 14011 '''); |
| 14012 } else { |
| 14013 checkElementText( |
| 14014 library, |
| 14015 r''' |
| 14016 typedef Foo<S> = S Function<T>(T x); |
| 14017 class A { |
| 14018 <T>(T) → int f; |
| 14019 } |
| 14020 '''); |
| 14021 } |
13980 } | 14022 } |
13981 | 14023 |
13982 test_typedef_parameter_parameters() { | 14024 test_typedef_parameter_parameters() { |
13983 var library = checkLibrary('typedef F(g(x, y));'); | 14025 var library = checkLibrary('typedef F(g(x, y));'); |
13984 if (isStrongMode) { | 14026 if (isStrongMode) { |
13985 checkElementText( | 14027 checkElementText( |
13986 library, | 14028 library, |
13987 r''' | 14029 r''' |
13988 typedef dynamic F((dynamic, dynamic) → dynamic g); | 14030 typedef dynamic F((dynamic, dynamic) → dynamic g); |
13989 '''); | 14031 '''); |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15149 fail('Unexpectedly tried to get unlinked summary for $uri'); | 15191 fail('Unexpectedly tried to get unlinked summary for $uri'); |
15150 } | 15192 } |
15151 return serializedUnit; | 15193 return serializedUnit; |
15152 } | 15194 } |
15153 | 15195 |
15154 @override | 15196 @override |
15155 bool hasLibrarySummary(String uri) { | 15197 bool hasLibrarySummary(String uri) { |
15156 return true; | 15198 return true; |
15157 } | 15199 } |
15158 } | 15200 } |
OLD | NEW |