Skip to content

Commit

Permalink
re-fix bug 6242
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jul 5, 2011
1 parent 5ac7c66 commit 697c5d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/func.c
Expand Up @@ -837,9 +837,6 @@ void FuncDeclaration::semantic3(Scope *sc)
}
#endif

frequire = mergeFrequire(frequire);
fensure = mergeFensure(fensure);

if (frequire)
{
for (int i = 0; i < foverrides.dim; i++)
Expand All @@ -854,6 +851,9 @@ void FuncDeclaration::semantic3(Scope *sc)
}
}

frequire = mergeFrequire(frequire);
fensure = mergeFensure(fensure);

if (fbody || frequire || fensure)
{
/* Symbol table into which we place parameters and nested functions,
Expand Down
4 changes: 3 additions & 1 deletion test/runnable/testcontracts.d
Expand Up @@ -193,6 +193,7 @@ void test5()

/*******************************************/

/+
// http://d.puremagic.com/issues/show_bug.cgi?id=3722
class Bug3722A
Expand All @@ -209,6 +210,7 @@ void test6()
auto x = new Bug3722B();
x.fun();
}
+/

/*******************************************/

Expand All @@ -219,7 +221,7 @@ int main()
test3();
test4();
test5();
test6();
// test6();

printf("Success\n");
return 0;
Expand Down

3 comments on commit 697c5d5

@yebblies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this should work, the reason for my additional changes is that:
class A { void func() {} }
class B : A { void func() in {} body {} }
class C : B { void func() in {} body {} }
Will give two error messages.
I think pull #192 can be completely reverted, as #196 made the code it was fixing illegal.
This would mean removing the test from testcontracts completely, and restoring the old body of mergeFrequire.

@WalterBright
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but I think I'll leave it for now as it is semantically correct.

@yebblies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I'll make a patch to clean it up after the release.

Please sign in to comment.