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

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1368793004: fix inference of object members when a method has no target (Closed) Base URL: git@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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 engine.resolver_test; 5 library engine.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/context.dart' as newContext; 9 import 'package:analyzer/src/context/context.dart' as newContext;
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 12154 matching lines...) Expand 10 before | Expand all | Expand 10 after
12165 main() { 12165 main() {
12166 dynamic v = 3; 12166 dynamic v = 3;
12167 v; // marker 12167 v; // marker
12168 }'''; 12168 }''';
12169 _assertPropagatedAssignedType( 12169 _assertPropagatedAssignedType(
12170 code, typeProvider.dynamicType, typeProvider.intType); 12170 code, typeProvider.dynamicType, typeProvider.intType);
12171 _assertTypeOfMarkedExpression( 12171 _assertTypeOfMarkedExpression(
12172 code, typeProvider.dynamicType, typeProvider.intType); 12172 code, typeProvider.dynamicType, typeProvider.intType);
12173 } 12173 }
12174 12174
12175 void test_localVariableInference_declaredType_disabled_for_toString() {
12176 String name = 'toString';
12177 String code = '''
12178 main() {
12179 dynamic $name = () => null;
12180 $name(); // marker
12181 }''';
12182 SimpleIdentifier identifier = _findMarkedIdentifier(code, "$name = ");
12183 expect(identifier.staticType, typeProvider.dynamicType);
12184 SimpleIdentifier call = _findMarkedIdentifier(code, "(); // marker");
12185 expect(call.staticType, typeProvider.dynamicType);
12186 expect((call.parent as Expression).staticType, typeProvider.dynamicType);
12187 }
12188
12175 void test_localVariableInference_noInitializer_disabled() { 12189 void test_localVariableInference_noInitializer_disabled() {
12176 String code = r''' 12190 String code = r'''
12177 main() { 12191 main() {
12178 var v; 12192 var v;
12179 v = 3; 12193 v = 3;
12180 v; // marker 12194 v; // marker
12181 }'''; 12195 }''';
12182 _assertPropagatedAssignedType( 12196 _assertPropagatedAssignedType(
12183 code, typeProvider.dynamicType, typeProvider.intType); 12197 code, typeProvider.dynamicType, typeProvider.intType);
12184 _assertTypeOfMarkedExpression( 12198 _assertTypeOfMarkedExpression(
(...skipping 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after
14736 // check propagated type 14750 // check propagated type
14737 FunctionType propagatedType = node.propagatedType as FunctionType; 14751 FunctionType propagatedType = node.propagatedType as FunctionType;
14738 expect(propagatedType.returnType, test.typeProvider.stringType); 14752 expect(propagatedType.returnType, test.typeProvider.stringType);
14739 } on AnalysisException catch (e, stackTrace) { 14753 } on AnalysisException catch (e, stackTrace) {
14740 thrownException[0] = new CaughtException(e, stackTrace); 14754 thrownException[0] = new CaughtException(e, stackTrace);
14741 } 14755 }
14742 } 14756 }
14743 return null; 14757 return null;
14744 } 14758 }
14745 } 14759 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698