Skip to content

Commit

Permalink
Merge pull request #136 from yebblies/issue3836
Browse files Browse the repository at this point in the history
Issue 3836 - [TDPL] obligatory override attribute
  • Loading branch information
WalterBright committed Oct 9, 2011
2 parents 9bcc986 + 167ad23 commit 24c48a8
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void FuncDeclaration::semantic(Scope *sc)

#if DMDV2
if (!isOverride())
warning(loc, "overrides base class function %s, but is not marked with 'override'", fdv->toPrettyChars());
error(loc, "overrides base class function %s, but is not marked with 'override'", fdv->toPrettyChars());
#endif

if (fdv->toParent() == parent)
Expand Down
2 changes: 1 addition & 1 deletion test/compilable/imports/test67a.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Base

class Derived : Base
{
SubI create() {
override SubI create() {
return null;
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/runnable/delegate.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Foo

class Bar : Foo
{
int bar(int i, char[] s) { return 5; }
override int bar(int i, char[] s) { return 5; }
}

void test1()
Expand Down Expand Up @@ -72,9 +72,9 @@ class Foo3

class Bar3 : Foo3
{
int bar(int i, char[] s) { return 48; }
override int bar(int i, char[] s) { return 48; }

int result() { return 48; }
override int result() { return 48; }

void test2()
{
Expand Down Expand Up @@ -268,7 +268,7 @@ class A13

class B13 : A13
{
int f()
override int f()
{
return 2;
}
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/imports/test13a.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ template TPair(T, U) {
public U right() {
return this._right;
}
public boolean opEquals(Object obj) {
override public boolean opEquals(Object obj) {
Pair other = cast(Pair) obj;
if (other !is null) {
return (left() == other.left()) && (right() == other.right());
Expand Down
6 changes: 3 additions & 3 deletions test/runnable/inner.d
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ void test14()

C14 c = new class C14
{
void foo()
override void foo()
{
printf("in inner class\n");
assert(m == 3);
Expand Down Expand Up @@ -506,7 +506,7 @@ void test15()
assert(j == 2);
}

void foo()
override void foo()
{
printf("in inner class\n");
assert(m == 3);
Expand Down Expand Up @@ -758,7 +758,7 @@ class C24 {
}
I24 bar(){
auto i = new class() I24 {
public void callI() {
override public void callI() {
foo();
}
};
Expand Down
8 changes: 4 additions & 4 deletions test/runnable/interface1.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class A : D {

class B : A, D
{
int foo() { return 2; }
override int foo() { return 2; }
}

class C : B, D {
int foo() { return 3; }
override int foo() { return 3; }
}

void test1()
Expand Down Expand Up @@ -56,11 +56,11 @@ class A2 : D2 {
}

class B2 : A2 {
int foo() { printf("B2\n"); return 2; }
override int foo() { printf("B2\n"); return 2; }
}

class C2 : B2, D2 {
int foo() { printf("C2\n"); return 3; }
override int foo() { printf("C2\n"); return 3; }
}

void test2()
Expand Down
10 changes: 5 additions & 5 deletions test/runnable/interface2.d
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class A7 : D7 { int foo() { return 1; } }

class B7 : A7
{
int foo() { return 2; }
override int foo() { return 2; }
D7 me() { return this; }
}

Expand Down Expand Up @@ -333,7 +333,7 @@ class B12 : A12
{
IA12 ia;

IA12 clone() // covariant return value
override IA12 clone() // covariant return value
out (result)
{
printf("B12.clone()\n");
Expand Down Expand Up @@ -373,7 +373,7 @@ class I13

class IA13 : I13
{
int foo() { return 1; }
override int foo() { return 1; }
}

class A13
Expand All @@ -387,7 +387,7 @@ class B13 : A13
{
IA13 ia;

IA13 clone()
override IA13 clone()
out (result)
{
printf("B13.clone()\n");
Expand Down Expand Up @@ -505,7 +505,7 @@ class B16 : A16, I16

this(int d) { data = d; }

B16 foo()
override B16 foo()
{
printf("Called B.foo\n");
return new B16(69);
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/interface3.d
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Writer : IWriter

class FlushWriter : Writer
{
IWriter put (I1 x)
override IWriter put (I1 x)
{
// have superclass handle the I1
super.put (x);
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/mixin1.d
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Bar3

class Code3 : Bar3
{
int func() { printf("Code3.func()\n"); return 2; }
override int func() { printf("Code3.func()\n"); return 2; }
}

void test3()
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/opover2.d
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void test4()

class A5
{
bool opEquals(Object o)
override bool opEquals(Object o)
{
printf("A.opEquals!(%p)\n", o);
return 1;
Expand All @@ -155,7 +155,7 @@ class A5

class B5 : A5
{
bool opEquals(Object o)
override bool opEquals(Object o)
{
printf("B.opEquals!(%p)\n", o);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/template1.d
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ class Abstract(T) : Interface!(T)

class Concrete(T) : Abstract!(T)
{
void foo52() { printf("Concrete.foo52(this = %p)\n", this); }
override void foo52() { printf("Concrete.foo52(this = %p)\n", this); }
}

class Sub(T) : Concrete!(T)
Expand Down
8 changes: 4 additions & 4 deletions test/runnable/test11.d
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ class Abc22

class Def22 : Abc22
{
Bar22 test() { return new Bar22; }
override Bar22 test() { return new Bar22; }
}

void testx22(Abc22 a)
Expand Down Expand Up @@ -1003,7 +1003,7 @@ class A52

class B52 : A52
{
char get() { return 'B'; }
override char get() { return 'B'; }
}

void test52()
Expand Down Expand Up @@ -1050,7 +1050,7 @@ class A54

class B54 : A54
{
void a()
override void a()
{
printf("B54.a\n");
assert(0);
Expand Down Expand Up @@ -1095,7 +1095,7 @@ class A56

class B56 : A56
{
int foo(int x = 7)
override int foo(int x = 7)
{
printf("B56.x = %d\n", x);
return x;
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/test12.d
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ class B46 : A46

class C46 : B46
{
char foo() { return 'c'; }
override char foo() { return 'c'; }
char bar()
{
return B46.foo();
Expand Down
8 changes: 4 additions & 4 deletions test/runnable/test15.d
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ class B14 : A14 {
}

class C14 : B14 {
int show( CA14 a ) { printf("C::show( CA14 )\n"); return 3; }
override int show( CA14 a ) { printf("C::show( CA14 )\n"); return 3; }
alias B14.show show;

alias B14.boat boat;
int boat( CA14 a ) { printf("C::boat( CA14 )\n"); return 3; }
override int boat( CA14 a ) { printf("C::boat( CA14 )\n"); return 3; }
}

class D14 : C14 {
Expand Down Expand Up @@ -740,7 +740,7 @@ class Abstract : Interface

class Concrete : Abstract
{
void foo42() { printf("Concrete.foo42(this = %p)\n", this); }
override void foo42() { printf("Concrete.foo42(this = %p)\n", this); }
}

class Sub : Concrete
Expand Down Expand Up @@ -1012,7 +1012,7 @@ class MyWriter : Writer
{
alias Writer.put put;

int put (bool x){ return 3; }
override int put (bool x){ return 3; }
}

void test55()
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/test16.d
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class B3 : A3

class C3 : B3
{
void foo()
override void foo()
{
printf("C.foo \n" );
super.foo();
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/test23.d
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class UA {
}

class UB : UA {
B29 f() { return null; }
override B29 f() { return null; }
}

class A29
Expand Down
6 changes: 3 additions & 3 deletions test/runnable/test28.d
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ void test17()
abstract class Pen { int foo(); }

class Penfold : Pen {
int foo() { return 1; }
override int foo() { return 1; }
}

class Pinky : Pen {
int foo() { return 2; }
override int foo() { return 2; }
}

class Printer {
Expand Down Expand Up @@ -303,7 +303,7 @@ class B19 : A19
{
alias A19.s s;
static void s(int i) {}
void s() {}
override void s() {}
}

class C19
Expand Down
12 changes: 6 additions & 6 deletions test/runnable/test42.d
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,7 @@ class A143

class B143 : A143
{
void fill() { }
override void fill() { }
}

void test143()
Expand Down Expand Up @@ -2610,8 +2610,8 @@ class A164

abstract class B164 : A164
{
final B164 foo() { return null; }
final B164 foo() const { return null; }
override final B164 foo() { return null; }
override final B164 foo() const { return null; }
}

/***************************************************/
Expand All @@ -2624,8 +2624,8 @@ class A165

abstract class B165 : A165
{
final B165 foo() { return null; }
final const(B165) foo() const { return null; }
override final B165 foo() { return null; }
override final const(B165) foo() const { return null; }
}

/***************************************************/
Expand Down Expand Up @@ -2683,7 +2683,7 @@ class Class171 : Address {

struct FwdStruct { }

int nameLen() { return 0; }
override int nameLen() { return 0; }
}

void test171 ()
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/test8.d
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Foo6

class FooX6 : Foo6
{
int bar() { return y + 5; }
override int bar() { return y + 5; }
}

void test6()
Expand Down Expand Up @@ -231,7 +231,7 @@ class A12

class B12: A12
{
void foo() { super.foo(); }
override void foo() { super.foo(); }
}

void test12()
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/testconst.d
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class C18

class D18 : C18
{
char[] foo() { return null; }
override char[] foo() { return null; }
}

void test18()
Expand Down
Loading

0 comments on commit 24c48a8

Please sign in to comment.