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

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

Issue 637303005: Type check constant variable declarations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.resolver_test; 8 library engine.resolver_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 "class A<T> {", 803 "class A<T> {",
804 " const A(T x);", 804 " const A(T x);",
805 "}", 805 "}",
806 "var v = const A<int>('foo');"])); 806 "var v = const A<int>('foo');"]));
807 resolve(source); 807 resolve(source);
808 assertErrors(source, [ 808 assertErrors(source, [
809 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, 809 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
810 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 810 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
811 verify([source]); 811 verify([source]);
812 } 812 }
813
814 void test_topLevelVarAssignable_null() {
815 Source source = addSource(EngineTestCase.createSource([
816 "const int x = null;"]));
817 resolve(source);
818 assertNoErrors(source);
819 verify([source]);
820 }
821
822 void test_topLevelVarNotAssignable() {
823 Source source = addSource(EngineTestCase.createSource([
824 "const int x = 'foo';"]));
825 resolve(source);
826 assertErrors(source, [
827 CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
828 StaticTypeWarningCode.INVALID_ASSIGNMENT]);
829 verify([source]);
830 }
813 } 831 }
814 832
815 class CompileTimeErrorCodeTest extends ResolverTestCase { 833 class CompileTimeErrorCodeTest extends ResolverTestCase {
816 void fail_compileTimeConstantRaisesException() { 834 void fail_compileTimeConstantRaisesException() {
817 Source source = addSource(EngineTestCase.createSource([])); 835 Source source = addSource(EngineTestCase.createSource([]));
818 resolve(source); 836 resolve(source);
819 assertErrors(source, [CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCE PTION]); 837 assertErrors(source, [CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCE PTION]);
820 verify([source]); 838 verify([source]);
821 } 839 }
822 840
(...skipping 22518 matching lines...) Expand 10 before | Expand all | Expand 10 after
23341 runReflectiveTests(HintCodeTest); 23359 runReflectiveTests(HintCodeTest);
23342 runReflectiveTests(MemberMapTest); 23360 runReflectiveTests(MemberMapTest);
23343 runReflectiveTests(NonErrorResolverTest); 23361 runReflectiveTests(NonErrorResolverTest);
23344 runReflectiveTests(NonHintCodeTest); 23362 runReflectiveTests(NonHintCodeTest);
23345 runReflectiveTests(SimpleResolverTest); 23363 runReflectiveTests(SimpleResolverTest);
23346 runReflectiveTests(StaticTypeWarningCodeTest); 23364 runReflectiveTests(StaticTypeWarningCodeTest);
23347 runReflectiveTests(StaticWarningCodeTest); 23365 runReflectiveTests(StaticWarningCodeTest);
23348 runReflectiveTests(StrictModeTest); 23366 runReflectiveTests(StrictModeTest);
23349 runReflectiveTests(TypePropagationTest); 23367 runReflectiveTests(TypePropagationTest);
23350 } 23368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698