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

Side by Side Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java

Issue 9168020: Issue 985: Default class without constructor does not cause a compile-time error (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Nits Created 8 years, 11 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 | « compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.resolver; 5 package com.google.dart.compiler.resolver;
6 6
7 import com.google.common.base.Joiner; 7 import com.google.common.base.Joiner;
8 import com.google.dart.compiler.DartCompilationError; 8 import com.google.dart.compiler.DartCompilationError;
9 import com.google.dart.compiler.ErrorCode; 9 import com.google.dart.compiler.ErrorCode;
10 import com.google.dart.compiler.ast.DartClass; 10 import com.google.dart.compiler.ast.DartClass;
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 556
557 public void testFactoryBadTypeArgs8() { 557 public void testFactoryBadTypeArgs8() {
558 // Invoke constructor in factory method with (wrong) type args 558 // Invoke constructor in factory method with (wrong) type args
559 resolveAndTest(Joiner.on("\n").join( 559 resolveAndTest(Joiner.on("\n").join(
560 "class Object {}", 560 "class Object {}",
561 "interface int {}", 561 "interface int {}",
562 "interface A<T> default B<T> {", 562 "interface A<T> default B<T> {",
563 " A();", 563 " A();",
564 "}", 564 "}",
565 "class B<T extends int> {", 565 "class B<T extends int> {",
566 " A() {}", 566 " factory A() {}",
567 "}"), 567 "}"),
568 ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY); 568 ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
569 } 569 }
570 570
571 public void testFactoryBadTypeArgs9() { 571 public void testFactoryBadTypeArgs9() {
572 // Invoke constructor in factory method with (wrong) type args 572 // Invoke constructor in factory method with (wrong) type args
573 resolveAndTest(Joiner.on("\n").join( 573 resolveAndTest(Joiner.on("\n").join(
574 "class Object {}", 574 "class Object {}",
575 "interface int {}", 575 "interface int {}",
576 "interface A<T> default B<T extends int> {", 576 "interface A<T> default B<T extends int> {",
577 " A();", 577 " A();",
578 "}", 578 "}",
579 "class B<T> {", 579 "class B<T> {",
580 " A() {}", 580 " factory A() {}",
581 "}"), 581 "}"),
582 ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY); 582 ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
583 } 583 }
584 584
585 public void testFactoryBadTypeArgs11() { 585 public void testFactoryBadTypeArgs11() {
586 // Invoke constructor in factory method with (wrong) type args 586 // Invoke constructor in factory method with (wrong) type args
587 resolveAndTest(Joiner.on("\n").join( 587 resolveAndTest(Joiner.on("\n").join(
588 "class Object {}", 588 "class Object {}",
589 "interface int {}", 589 "interface int {}",
590 "interface A<T> default Bogus {", 590 "interface A<T> default Bogus {",
591 "}", 591 "}",
592 "class B<T> {", 592 "class B<T> {",
593 "}"), 593 "}"),
594 ResolverErrorCode.NO_SUCH_TYPE); 594 ResolverErrorCode.NO_SUCH_TYPE);
595 } 595 }
596 596
597 public void testFactoryBadTypeArgs10() { 597 public void testFactoryBadTypeArgs10() {
598 // Invoke constructor in factory method with (wrong) type args 598 // Invoke constructor in factory method with (wrong) type args
599 resolveAndTest(Joiner.on("\n").join( 599 resolveAndTest(Joiner.on("\n").join(
600 "class Object {}", 600 "class Object {}",
601 "interface int {}", 601 "interface int {}",
602 "interface A<T> default B {", 602 "interface A<T> default B {",
603 " A();", 603 " A();",
604 "}", 604 "}",
605 "class B {", 605 "class B {",
606 " A() {}", 606 " factory A() {}",
607 "}"), 607 "}"),
608 ResolverErrorCode.DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS); 608 ResolverErrorCode.DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS);
609 } 609 }
610 public void testBadDefaultTypeArgs11() { 610 public void testBadDefaultTypeArgs11() {
611 // Example from spec v0.6 611 // Example from spec v0.6
612 resolveAndTest(Joiner.on("\n").join( 612 resolveAndTest(Joiner.on("\n").join(
613 "class Object{}", 613 "class Object{}",
614 "interface Hashable {}", 614 "interface Hashable {}",
615 "class HashMapImplementation<K extends Hashable, V> {", 615 "class HashMapImplementation<K extends Hashable, V> {",
616 "}", 616 "}",
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 "class Object {}", 1106 "class Object {}",
1107 "interface Interface {", 1107 "interface Interface {",
1108 " foo([y,x]);", 1108 " foo([y,x]);",
1109 "}", 1109 "}",
1110 "class Class implements Interface {", 1110 "class Class implements Interface {",
1111 " foo([x,y]) {}", // error 1111 " foo([x,y]) {}", // error
1112 "}"), 1112 "}"),
1113 ResolverErrorCode.CANNOT_OVERRIDE_METHOD_ORDER_NAMED_PARAMS); 1113 ResolverErrorCode.CANNOT_OVERRIDE_METHOD_ORDER_NAMED_PARAMS);
1114 } 1114 }
1115 } 1115 }
OLDNEW
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698