Chromium Code Reviews| Index: pkg/analyzer/test/src/summary/resynthesize_common.dart |
| diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart |
| index e1448b4333ef7faaa83c94476cc460821772d40c..e1d722904edddca975dc6507ae546310771ddae9 100644 |
| --- a/pkg/analyzer/test/src/summary/resynthesize_common.dart |
| +++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart |
| @@ -926,7 +926,11 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest { |
| } |
| expect(resynthesized.defaultValueCode, original.defaultValueCode, |
| reason: desc); |
| - expect(resynthesized.isCovariant, original.isCovariant, reason: desc); |
| + expect((resynthesized as ParameterElementImpl).isExplicitlyCovariant, |
| + (original as ParameterElementImpl).isExplicitlyCovariant, |
| + reason: desc); |
| + expect(resynthesized.isCovariant, original.isCovariant, |
| + reason: '$desc isCovariant'); |
|
scheglov
2017/01/20 00:30:18
We already cast to Impl(s) below.
Brian Wilkerson
2017/01/20 15:59:07
Ok. I moved the first test after the casts and rem
|
| ParameterElementImpl resynthesizedActual = |
| getActualElement(resynthesized, desc); |
| ParameterElementImpl originalActual = getActualElement(original, desc); |
| @@ -1205,6 +1209,11 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest { |
| return element.isConst; |
| } |
| return false; |
| + } else if (modifier == Modifier.COVARIANT) { |
| + if (element is ParameterElementImpl) { |
| + return element.isExplicitlyCovariant; |
| + } |
| + return false; |
| } else if (modifier == Modifier.DEFERRED) { |
| if (element is ImportElement) { |
| return element.isDeferred; |
| @@ -2822,35 +2831,6 @@ class D { |
| '''); |
| } |
| - void test_covariant_parameter() { |
| - // Note: due to dartbug.com/27393, the keyword "checked" is identified by |
| - // its presence in a library called "meta". If that bug is fixed, this test |
| - // my need to be changed. |
| - checkLibrary(r''' |
| -library meta; |
| -const checked = null; |
| -class A<T> { |
| - void f(@checked T t) {} |
| -} |
| -'''); |
| - } |
| - |
| - void test_covariant_parameter_inherited() { |
| - // Note: due to dartbug.com/27393, the keyword "checked" is identified by |
| - // its presence in a library called "meta". If that bug is fixed, this test |
| - // my need to be changed. |
| - checkLibrary(r''' |
| -library meta; |
| -const checked = null; |
| -class A<T> { |
| - void f(@checked T t) {} |
| -} |
| -class B<T> extends A<T> { |
| - void f(T t) {} |
| -} |
| -'''); |
| - } |
| - |
| test_defaultValue_refersToGenericClass_constructor() { |
| checkLibrary(''' |
| class B<T> { |
| @@ -3103,6 +3083,13 @@ class B extends A {} |
| checkLibrary('export "a.dart"; export "b.dart";'); |
| } |
| + test_field_covariant() { |
| + checkLibrary(''' |
| +class C { |
| + covariant int x; |
| +}'''); |
| + } |
| + |
| test_field_documented() { |
| checkLibrary(''' |
| class C { |
| @@ -4174,22 +4161,6 @@ class C { |
| 'class C extends D { f() => null; } abstract class D { int f(); }'); |
| } |
| - test_method_parameter_parameters() { |
| - checkLibrary('class C { f(g(x, y)) {} }'); |
| - } |
| - |
| - test_method_parameter_parameters_in_generic_class() { |
| - checkLibrary('class C<A, B> { f(A g(B x)) {} }'); |
| - } |
| - |
| - test_method_parameter_return_type() { |
| - checkLibrary('class C { f(int g()) {} }'); |
| - } |
| - |
| - test_method_parameter_return_type_void() { |
| - checkLibrary('class C { f(void g()) {} }'); |
| - } |
| - |
| test_method_type_parameter() { |
| prepareAnalysisContext(createOptions()); |
| checkLibrary('class C { T f<T, U>(U u) => null; }'); |
| @@ -4289,6 +4260,67 @@ void f<T, U>() { |
| checkLibrary('class C { bool operator<=(C other) => false; }'); |
| } |
| + void test_parameter_checked() { |
| + // Note: due to dartbug.com/27393, the keyword "checked" is identified by |
| + // its presence in a library called "meta". If that bug is fixed, this test |
| + // my need to be changed. |
| + checkLibrary(r''' |
| +library meta; |
| +const checked = null; |
| +class A<T> { |
| + void f(@checked T t) {} |
| +} |
| +'''); |
| + } |
| + |
| + void test_parameter_checked_inherited() { |
| + // Note: due to dartbug.com/27393, the keyword "checked" is identified by |
| + // its presence in a library called "meta". If that bug is fixed, this test |
| + // my need to be changed. |
| + checkLibrary(r''' |
| +library meta; |
| +const checked = null; |
| +class A<T> { |
| + void f(@checked T t) {} |
| +} |
| +class B<T> extends A<T> { |
| + void f(T t) {} |
| +} |
| +'''); |
| + } |
| + |
| + test_parameter_covariant() { |
| + prepareAnalysisContext(createOptions()); |
| + checkLibrary('class C { void m(covariant C c) {} }'); |
| + } |
| + |
| + void test_parameter_covariant_inherited() { |
| + checkLibrary(r''' |
| +class A<T> { |
| + void f(covariant T t) {} |
| +} |
| +class B<T> extends A<T> { |
| + void f(T t) {} |
| +} |
| +'''); |
| + } |
| + |
| + test_parameter_parameters() { |
| + checkLibrary('class C { f(g(x, y)) {} }'); |
| + } |
| + |
| + test_parameter_parameters_in_generic_class() { |
| + checkLibrary('class C<A, B> { f(A g(B x)) {} }'); |
| + } |
| + |
| + test_parameter_return_type() { |
| + checkLibrary('class C { f(int g()) {} }'); |
| + } |
| + |
| + test_parameter_return_type_void() { |
| + checkLibrary('class C { f(void g()) {} }'); |
| + } |
| + |
| test_parameterTypeNotInferred_constructor() { |
| // Strong mode doesn't do type inference on constructor parameters, so it's |
| // ok that we don't store inferred type info for them in summaries. |
| @@ -4363,6 +4395,10 @@ void f() { |
| '''); |
| } |
| + test_setter_covariant() { |
| + checkLibrary('class C { void set x(covariant int value); }'); |
| + } |
| + |
| test_setter_documented() { |
| checkLibrary(''' |
| // Extra comment so doc comment offset != 0 |