mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
Fix bugzilla 24583 - di generator emits return scope and scope return in wrong order (#16595)
This commit is contained in:
parent
3457a5902d
commit
c0fcaa0e96
5 changed files with 28 additions and 10 deletions
|
@ -3933,9 +3933,9 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
|
|||
buf.writeByte(' ');
|
||||
}
|
||||
|
||||
void ignoreReturn(string str)
|
||||
void dg(string str)
|
||||
{
|
||||
if (str != "return")
|
||||
if (str != "return" && str != "scope")
|
||||
{
|
||||
// don't write 'ref' for ctors
|
||||
if ((ident == Id.ctor) && str == "ref")
|
||||
|
@ -3944,7 +3944,7 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
|
|||
buf.writeByte(' ');
|
||||
}
|
||||
}
|
||||
t.attributesApply(&ignoreReturn);
|
||||
t.attributesApply(&dg);
|
||||
|
||||
if (t.linkage > LINK.d && hgs.ddoc != 1 && !hgs.hdrgen)
|
||||
{
|
||||
|
@ -3977,7 +3977,15 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
|
|||
buf.writeByte(')');
|
||||
}
|
||||
parametersToBuffer(t.parameterList, buf, hgs);
|
||||
if (t.isreturn)
|
||||
if (t.isreturnscope && !t.isreturninferred)
|
||||
{
|
||||
buf.writestring(" return scope");
|
||||
}
|
||||
else if (t.isScopeQual && !t.isscopeinferred)
|
||||
{
|
||||
buf.writestring(" scope");
|
||||
}
|
||||
if (t.isreturn && !t.isreturnscope && !t.isreturninferred)
|
||||
{
|
||||
buf.writestring(" return");
|
||||
}
|
||||
|
|
|
@ -575,12 +575,17 @@ struct SafeS
|
|||
return this;
|
||||
}
|
||||
|
||||
ref SafeS foo3() return scope
|
||||
ref SafeS foo3() scope
|
||||
{
|
||||
static SafeS s;
|
||||
return s;
|
||||
}
|
||||
|
||||
ref SafeS foo4() scope return
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
int* p;
|
||||
}
|
||||
|
||||
|
|
|
@ -517,8 +517,9 @@ struct SafeS
|
|||
@safe
|
||||
{
|
||||
ref SafeS foo() return;
|
||||
scope SafeS foo2() return;
|
||||
ref scope SafeS foo3() return;
|
||||
SafeS foo2() return scope;
|
||||
ref SafeS foo3() scope;
|
||||
ref SafeS foo4() scope return;
|
||||
int* p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -653,15 +653,19 @@ struct SafeS
|
|||
{
|
||||
return this;
|
||||
}
|
||||
scope SafeS foo2() return
|
||||
SafeS foo2() return scope
|
||||
{
|
||||
return this;
|
||||
}
|
||||
ref scope SafeS foo3() return
|
||||
ref SafeS foo3() scope
|
||||
{
|
||||
static SafeS s;
|
||||
return s;
|
||||
}
|
||||
ref SafeS foo4() scope return
|
||||
{
|
||||
return this;
|
||||
}
|
||||
int* p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/retref2.d(18): Error: function `ref int retref2.D.foo(return ref int)` does not override any function, did you mean to override `ref int retref2.C.foo(ref int)`?
|
||||
fail_compilation/retref2.d(19): Error: function `ref scope int retref2.D.bar() return` does not override any function, did you mean to override `ref int retref2.C.bar()`?
|
||||
fail_compilation/retref2.d(19): Error: function `ref int retref2.D.bar() scope return` does not override any function, did you mean to override `ref int retref2.C.bar()`?
|
||||
---
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue