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

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1737903005: Properly resynthesize ClassElementImpl.hasBeenInferred. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_strong_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index 367d5b6313ffdc1e05f1f3adc34559751a221e0d..70298844699d244fcf2072ba92fb55368ea27756 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -42,7 +42,7 @@ class ResynthTest extends ResolverTestCase {
/**
* Determine the analysis options that should be used for this test.
*/
- AnalysisOptionsImpl get options =>
+ AnalysisOptionsImpl createOptions() =>
new AnalysisOptionsImpl()..enableGenericMethods = true;
void addLibrary(String uri) {
@@ -233,6 +233,8 @@ class ResynthTest extends ResolverTestCase {
'$desc.${original.methods[i].name}');
}
compareTypes(resynthesized.type, original.type, desc);
+ expect(resynthesized.hasBeenInferred, original.hasBeenInferred,
+ reason: desc);
}
void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized,
@@ -1085,7 +1087,7 @@ class ResynthTest extends ResolverTestCase {
analysisContext.sourceFactory,
unlinkedSummaries,
linkedSummaries,
- options.strongMode);
+ createOptions().strongMode);
}
fail_library_hasExtUri() {
@@ -1130,7 +1132,7 @@ class ResynthTest extends ResolverTestCase {
@override
void setUp() {
super.setUp();
- resetWithOptions(options);
+ resetWithOptions(createOptions());
}
test_class_abstract() {
@@ -2511,6 +2513,11 @@ class C<T> {
}
test_core() {
+ if (createOptions().strongMode) {
+ // The fake `dart:core` library is always in spec mode, so don't bother
+ // trying to check that it resynthesizes properly; it won't.
+ return;
+ }
String uri = 'dart:core';
LibraryElementImpl original =
resolve2(analysisContext2.sourceFactory.forUri(uri));
@@ -2769,12 +2776,12 @@ f() {}''');
}
test_function_type_parameter() {
- resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ resetWithOptions(createOptions()..enableGenericMethods = true);
checkLibrary('T f<T, U>(U u) => null;');
}
test_function_type_parameter_with_function_typed_parameter() {
- resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ resetWithOptions(createOptions()..enableGenericMethods = true);
checkLibrary('void f<T, U>(T x(U u)) {}');
}
@@ -2783,7 +2790,7 @@ f() {}''');
}
test_generic_gClass_gMethodStatic() {
- resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ resetWithOptions(createOptions()..enableGenericMethods = true);
checkLibrary('''
class C<T, U> {
static void m<V, W>(V v, W w) {
@@ -2983,7 +2990,7 @@ class C<U, V> {
}
test_inferred_function_type_in_generic_closure() {
- if (!options.strongMode) {
+ if (!createOptions().strongMode) {
// The test below uses generic comment syntax because proper generic
// method syntax doesn't support generic closures. So it can only run in
// strong mode.
@@ -3002,7 +3009,7 @@ f<T>() {
}
test_inferred_generic_function_type_in_generic_closure() {
- if (!options.strongMode) {
+ if (!createOptions().strongMode) {
// The test below uses generic comment syntax because proper generic
// method syntax doesn't support generic closures. So it can only run in
// strong mode.
@@ -3458,17 +3465,17 @@ class C {
}
test_method_type_parameter() {
- resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ resetWithOptions(createOptions()..enableGenericMethods = true);
checkLibrary('class C { T f<T, U>(U u) => null; }');
}
test_method_type_parameter_in_generic_class() {
- resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ resetWithOptions(createOptions()..enableGenericMethods = true);
checkLibrary('class C<T, U> { V f<V, W>(T t, U u, W w) => null; }');
}
test_method_type_parameter_with_function_typed_parameter() {
- resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ resetWithOptions(createOptions()..enableGenericMethods = true);
checkLibrary('class C { void f<T, U>(T x(U u)) {} }');
}
@@ -3646,7 +3653,7 @@ void set x(value) {}''');
}
test_syntheticFunctionType_genericClosure() {
- if (!options.strongMode) {
+ if (!createOptions().strongMode) {
// The test below uses generic comment syntax because proper generic
// method syntax doesn't support generic closures. So it can only run in
// strong mode.
@@ -3662,7 +3669,7 @@ bool f() => true;
}
test_syntheticFunctionType_genericClosure_inGenericFunction() {
- if (!options.strongMode) {
+ if (!createOptions().strongMode) {
// The test below uses generic comment syntax because proper generic
// method syntax doesn't support generic closures. So it can only run in
// strong mode.
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_strong_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698