Skip to content

Commit

Permalink
Merge branch 'master' of github.com:D-Programming-Language/dmd
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jan 8, 2013
2 parents d2e1cf9 + 18e34e9 commit 95cdea4
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/expression.c
Expand Up @@ -10624,13 +10624,13 @@ Expression *AssignExp::semantic(Scope *sc)
Type *t1 = e1->type->toBasetype();

e2 = e2->inferType(t1);
if (!e2->rvalue())
return new ErrorExp();

e2 = e2->semantic(sc);
if (e2->op == TOKerror)
return new ErrorExp();
e2 = resolveProperties(sc, e2);
if (!e2->rvalue())
return new ErrorExp();

/* Rewrite tuple assignment as a tuple of assignments.
*/
Expand Down
10 changes: 8 additions & 2 deletions src/func.c
Expand Up @@ -631,9 +631,15 @@ void FuncDeclaration::semantic(Scope *sc)

if (!doesoverride && isOverride())
{
Dsymbol *s = cd->search_correct(ident);
Dsymbol *s = NULL;
for (size_t i = 0; i < cd->baseclasses->dim; i++)
{
s = (*cd->baseclasses)[i]->base->search_correct(ident);
if (s) break;
}

if (s)
error("does not override any function, did you mean '%s'", s->toPrettyChars());
error("does not override any function, did you mean to override '%s'?", s->toPrettyChars());
else
error("does not override any function");
}
Expand Down
8 changes: 6 additions & 2 deletions test/d_do_test.d
Expand Up @@ -417,10 +417,14 @@ int main(string[] args)
}
}

compile_output = std.string.strip(compile_output);
compile_output = compile_output.unifyNewLine();

auto m = std.regex.match(compile_output, `Internal error: .*$`);
enforce(!m, m.hit);

if (testArgs.compileOutput !is null)
{
compile_output = std.string.strip(compile_output);
compile_output = compile_output.unifyNewLine();
compile_output = std.regex.replace(compile_output, regex(`DMD v2\.[0-9]+ DEBUG\n`, ""), "");
compile_output = std.regex.replace(compile_output, regex(`\nDMD v2\.[0-9]+ DEBUG`, ""), "");
enforce(compile_output == testArgs.compileOutput,
Expand Down
41 changes: 41 additions & 0 deletions test/fail_compilation/diag9191.d
@@ -0,0 +1,41 @@
/*
TEST_OUTPUT:
---
fail_compilation/diag9191.d(16): Error: function diag9191.C1.aaa does not override any function, did you mean to override 'diag9191.B1.aa'?
fail_compilation/diag9191.d(21): Error: function diag9191.C2.aaa does not override any function, did you mean to override 'diag9191.I1.a'?
fail_compilation/diag9191.d(31): Error: function diag9191.C3.foo does not override any function, did you mean to override 'diag9191.B2._foo'?
fail_compilation/diag9191.d(36): Error: function diag9191.C4.toStringa does not override any function, did you mean to override 'object.Object.toString'?
---
*/

interface I1 { void a(); }
class B1 { void aa(); }

class C1 : B1, I1
{
override void aaa();
}

class C2 : I1
{
override void aaa();
}

class B2
{
void _foo(){}
}

class C3 : B2
{
override void foo(){}
}

class C4
{
override void toStringa(){}
}

void main()
{
}
13 changes: 10 additions & 3 deletions test/fail_compilation/fail44.d
@@ -1,12 +1,19 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail44.d(18): Error: expression bar[i] is void and has no value
---
*/

void Foo()
{
void[] bar;
void[] foo;

bar.length = 50;
foo.length = 50;
for(int i=0; i<50; i++)

for(size_t i=0; i<50; i++)
{
foo[i] = bar[i];
}
Expand Down

0 comments on commit 95cdea4

Please sign in to comment.