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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1410493006: Compute propagated type for final instance fields (partially addresses issue 23001) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 590affc97374d1090d30fc04bed1baa267947b26..c732bcb579422c61967d4b6e1e8e124fa76dd9d8 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -12703,70 +12703,6 @@ class TypeOverrideManagerTest extends EngineTestCase {
@reflectiveTest
class TypePropagationTest extends ResolverTestCase {
- void fail_finalPropertyInducingVariable_classMember_instance() {
- addNamedSource(
- "/lib.dart",
- r'''
-class A {
- final v = 0;
-}''');
- String code = r'''
-import 'lib.dart';
-f(A a) {
- return a.v; // marker
-}''';
- _assertTypeOfMarkedExpression(
- code, typeProvider.dynamicType, typeProvider.intType);
- }
-
- void fail_finalPropertyInducingVariable_classMember_instance_inherited() {
- addNamedSource(
- "/lib.dart",
- r'''
-class A {
- final v = 0;
-}''');
- String code = r'''
-import 'lib.dart';
-class B extends A {
- m() {
- return v; // marker
- }
-}''';
- _assertTypeOfMarkedExpression(
- code, typeProvider.dynamicType, typeProvider.intType);
- }
-
- void fail_finalPropertyInducingVariable_classMember_instance_propagatedTarget() {
- addNamedSource(
- "/lib.dart",
- r'''
-class A {
- final v = 0;
-}''');
- String code = r'''
-import 'lib.dart';
-f(p) {
- if (p is A) {
- return p.v; // marker
- }
-}''';
- _assertTypeOfMarkedExpression(
- code, typeProvider.dynamicType, typeProvider.intType);
- }
-
- void fail_finalPropertyInducingVariable_classMember_instance_unprefixed() {
- String code = r'''
-class A {
- final v = 0;
- m() {
- v; // marker
- }
-}''';
- _assertTypeOfMarkedExpression(
- code, typeProvider.dynamicType, typeProvider.intType);
- }
-
void fail_finalPropertyInducingVariable_classMember_static() {
addNamedSource(
"/lib.dart",
@@ -13089,6 +13025,70 @@ main(CanvasElement canvas) {
expect(identifier.propagatedType.name, "CanvasRenderingContext2D");
}
+ void test_finalPropertyInducingVariable_classMember_instance() {
+ addNamedSource(
+ "/lib.dart",
+ r'''
+class A {
+ final v = 0;
+}''');
+ String code = r'''
+import 'lib.dart';
+f(A a) {
+ return a.v; // marker
+}''';
+ _assertTypeOfMarkedExpression(
+ code, typeProvider.dynamicType, typeProvider.intType);
+ }
+
+ void test_finalPropertyInducingVariable_classMember_instance_inherited() {
+ addNamedSource(
+ "/lib.dart",
+ r'''
+class A {
+ final v = 0;
+}''');
+ String code = r'''
+import 'lib.dart';
+class B extends A {
+ m() {
+ return v; // marker
+ }
+}''';
+ _assertTypeOfMarkedExpression(
+ code, typeProvider.dynamicType, typeProvider.intType);
+ }
+
+ void test_finalPropertyInducingVariable_classMember_instance_propagatedTarget() {
+ addNamedSource(
+ "/lib.dart",
+ r'''
+class A {
+ final v = 0;
+}''');
+ String code = r'''
+import 'lib.dart';
+f(p) {
+ if (p is A) {
+ return p.v; // marker
+ }
+}''';
+ _assertTypeOfMarkedExpression(
+ code, typeProvider.dynamicType, typeProvider.intType);
+ }
+
+ void test_finalPropertyInducingVariable_classMember_instance_unprefixed() {
+ String code = r'''
+class A {
+ final v = 0;
+ m() {
+ v; // marker
+ }
+}''';
+ _assertTypeOfMarkedExpression(
+ code, typeProvider.dynamicType, typeProvider.intType);
+ }
+
void test_forEach() {
String code = r'''
main() {
« pkg/analyzer/lib/src/generated/resolver.dart ('K') | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698