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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1331843004: Addition bug fixes for new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/test/generated/resolver_test.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 test.src.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 DartType typeZ = getClass(unit, 'Z').element.type; 1904 DartType typeZ = getClass(unit, 'Z').element.type;
1905 1905
1906 expect(field.element.type, typeX); 1906 expect(field.element.type, typeX);
1907 expect(method.element.returnType, typeY); 1907 expect(method.element.returnType, typeY);
1908 expect(method.element.parameters[0].type, typeZ); 1908 expect(method.element.parameters[0].type, typeZ);
1909 } 1909 }
1910 } 1910 }
1911 1911
1912 @reflectiveTest 1912 @reflectiveTest
1913 class InferStaticVariableTypesInUnitTaskTest extends _AbstractDartTaskTest { 1913 class InferStaticVariableTypesInUnitTaskTest extends _AbstractDartTaskTest {
1914 void test_perform() { 1914 void fail_perform_nestedDeclarations() {
1915 enableStrongMode();
1916 AnalysisTarget source = newSource(
1917 '/test.dart',
1918 '''
1919 var Y = (int x, int y) {
1920 int squared(int value) => value * value;
1921 var xSquared = squared(x);
1922 var ySquared = squared(y);
1923 return Math.sqrt(xSquared + ySquared);
1924 };
1925 ''');
1926 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT6,
1927 matcher: isInferStaticVariableTypesInUnitTask);
1928 CompilationUnit unit = outputs[RESOLVED_UNIT6];
1929 VariableDeclaration variableY = getTopLevelVariable(unit, 'Y');
1930
1931 InterfaceType intType = context.typeProvider.intType;
1932 expect(variableY.initializer.staticType, intType);
1933 }
1934
1935 void test_perform_recursive() {
1915 enableStrongMode(); 1936 enableStrongMode();
1916 AnalysisTarget firstSource = newSource( 1937 AnalysisTarget firstSource = newSource(
1917 '/first.dart', 1938 '/first.dart',
1918 ''' 1939 '''
1919 import 'second.dart'; 1940 import 'second.dart';
1920 1941
1921 var a = new M(); 1942 var a = new M();
1922 var c = b; 1943 var c = b;
1923 '''); 1944 ''');
1924 AnalysisTarget secondSource = newSource( 1945 AnalysisTarget secondSource = newSource(
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 /** 2848 /**
2828 * Fill [errorListener] with [result] errors in the current [task]. 2849 * Fill [errorListener] with [result] errors in the current [task].
2829 */ 2850 */
2830 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 2851 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
2831 List<AnalysisError> errors = task.outputs[result]; 2852 List<AnalysisError> errors = task.outputs[result];
2832 expect(errors, isNotNull, reason: result.name); 2853 expect(errors, isNotNull, reason: result.name);
2833 errorListener = new GatheringErrorListener(); 2854 errorListener = new GatheringErrorListener();
2834 errorListener.addAll(errors); 2855 errorListener.addAll(errors);
2835 } 2856 }
2836 } 2857 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698