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

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

Issue 1161343002: Issue 23409. Don't set 'propagatedType' in (vs. after) 'name is Type'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9ad5144e6474a70a0a18c4920bf08005d3793f1f..8307a9cc1527a94b50ffe108d856e5091c1def34 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -12411,16 +12411,30 @@ A f(var p) {
assertNoErrors(source);
verify([source]);
CompilationUnit unit = resolveCompilationUnit(source, library);
- ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
- InterfaceType typeA = classA.element.type;
+ // prepare A
+ InterfaceType typeA;
+ {
+ ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
+ typeA = classA.element.type;
+ }
+ // verify "f"
FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
BlockFunctionBody body =
function.functionExpression.body as BlockFunctionBody;
IfStatement ifStatement = body.block.statements[0] as IfStatement;
- ReturnStatement statement =
- (ifStatement.thenStatement as Block).statements[0] as ReturnStatement;
- SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
- expect(variableName.propagatedType, same(typeA));
+ // "p is A"
+ {
+ IsExpression isExpression = ifStatement.condition;
+ SimpleIdentifier variableName = isExpression.expression;
+ expect(variableName.propagatedType, isNull);
+ }
+ // "return p;"
+ {
+ ReturnStatement statement =
+ (ifStatement.thenStatement as Block).statements[0] as ReturnStatement;
+ SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
+ expect(variableName.propagatedType, same(typeA));
+ }
}
void test_is_if_lessSpecific() {
« no previous file with comments | « pkg/analyzer/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698