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

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

Issue 644283002: Type check field assignments during constant evaluation. (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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 " final int x;", 728 " final int x;",
729 " const A() : x = '';", 729 " const A() : x = '';",
730 "}"])); 730 "}"]));
731 resolve(source); 731 resolve(source);
732 assertErrors(source, [ 732 assertErrors(source, [
733 CheckedModeCompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE, 733 CheckedModeCompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
734 StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE]); 734 StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE]);
735 verify([source]); 735 verify([source]);
736 } 736 }
737 737
738 void test_fieldTypeMismatch() {
739 Source source = addSource(EngineTestCase.createSource([
740 "class A {",
741 " const A(x) : y = x;",
742 " final int y;",
743 "}",
744 "var v = const A('foo');"]));
745 resolve(source);
746 assertErrors(source, [
747 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH]);
748 verify([source]);
749 }
750
751 void test_fieldTypeOk_null() {
752 Source source = addSource(EngineTestCase.createSource([
753 "class A {",
754 " const A(x) : y = x;",
755 " final int y;",
756 "}",
757 "var v = const A(null);"]));
758 resolve(source);
759 assertNoErrors(source);
760 verify([source]);
761 }
762
738 void test_listElementTypeNotAssignable() { 763 void test_listElementTypeNotAssignable() {
739 Source source = addSource(EngineTestCase.createSource(["var v = const <Strin g> [42];"])); 764 Source source = addSource(EngineTestCase.createSource(["var v = const <Strin g> [42];"]));
740 resolve(source); 765 resolve(source);
741 assertErrors(source, [ 766 assertErrors(source, [
742 CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, 767 CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
743 StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE]); 768 StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE]);
744 verify([source]); 769 verify([source]);
745 } 770 }
746 771
747 void test_mapKeyTypeNotAssignable() { 772 void test_mapKeyTypeNotAssignable() {
(...skipping 22611 matching lines...) Expand 10 before | Expand all | Expand 10 after
23359 runReflectiveTests(HintCodeTest); 23384 runReflectiveTests(HintCodeTest);
23360 runReflectiveTests(MemberMapTest); 23385 runReflectiveTests(MemberMapTest);
23361 runReflectiveTests(NonErrorResolverTest); 23386 runReflectiveTests(NonErrorResolverTest);
23362 runReflectiveTests(NonHintCodeTest); 23387 runReflectiveTests(NonHintCodeTest);
23363 runReflectiveTests(SimpleResolverTest); 23388 runReflectiveTests(SimpleResolverTest);
23364 runReflectiveTests(StaticTypeWarningCodeTest); 23389 runReflectiveTests(StaticTypeWarningCodeTest);
23365 runReflectiveTests(StaticWarningCodeTest); 23390 runReflectiveTests(StaticWarningCodeTest);
23366 runReflectiveTests(StrictModeTest); 23391 runReflectiveTests(StrictModeTest);
23367 runReflectiveTests(TypePropagationTest); 23392 runReflectiveTests(TypePropagationTest);
23368 } 23393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698