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

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

Issue 649733002: Check field type when evaluating initializing formals. (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
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | tests/language/language_analyzer2.status » ('j') | 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 // 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 " const A(this.x);", 586 " const A(this.x);",
587 "}", 587 "}",
588 "var v = const A('foo');"])); 588 "var v = const A('foo');"]));
589 resolve(source); 589 resolve(source);
590 assertErrors(source, [ 590 assertErrors(source, [
591 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, 591 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
592 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 592 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
593 verify([source]); 593 verify([source]);
594 } 594 }
595 595
596 void test_fieldFormalParameterNotAssignableToField_fieldType() {
597 Source source = addSource(EngineTestCase.createSource([
598 "class A {",
599 " final int x;",
600 " const A(String this.x);",
601 "}",
602 "var v = const A('foo');"]));
603 resolve(source);
604 assertErrors(source, [
605 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
606 StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE]);
607 verify([source]);
608 }
609
596 void test_fieldFormalParameterNotAssignableToField_extends() { 610 void test_fieldFormalParameterNotAssignableToField_extends() {
597 // According to checked-mode type checking rules, a value of type A is not 611 // According to checked-mode type checking rules, a value of type A is not
598 // assignable to a field of type B, because B extends A (the subtyping 612 // assignable to a field of type B, because B extends A (the subtyping
599 // relationship is in the wrong direction). 613 // relationship is in the wrong direction).
600 Source source = addSource(EngineTestCase.createSource([ 614 Source source = addSource(EngineTestCase.createSource([
601 "class A {", 615 "class A {",
602 " const A();", 616 " const A();",
603 "}", 617 "}",
604 "class B extends A {", 618 "class B extends A {",
605 " const B();", 619 " const B();",
(...skipping 22721 matching lines...) Expand 10 before | Expand all | Expand 10 after
23327 runReflectiveTests(HintCodeTest); 23341 runReflectiveTests(HintCodeTest);
23328 runReflectiveTests(MemberMapTest); 23342 runReflectiveTests(MemberMapTest);
23329 runReflectiveTests(NonErrorResolverTest); 23343 runReflectiveTests(NonErrorResolverTest);
23330 runReflectiveTests(NonHintCodeTest); 23344 runReflectiveTests(NonHintCodeTest);
23331 runReflectiveTests(SimpleResolverTest); 23345 runReflectiveTests(SimpleResolverTest);
23332 runReflectiveTests(StaticTypeWarningCodeTest); 23346 runReflectiveTests(StaticTypeWarningCodeTest);
23333 runReflectiveTests(StaticWarningCodeTest); 23347 runReflectiveTests(StaticWarningCodeTest);
23334 runReflectiveTests(StrictModeTest); 23348 runReflectiveTests(StrictModeTest);
23335 runReflectiveTests(TypePropagationTest); 23349 runReflectiveTests(TypePropagationTest);
23336 } 23350 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698