Merge pull request #14255 from Geod24/useful-attributes-error

Print the inference error trace for regular inference errors

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2022-07-11 19:23:17 +00:00 committed by GitHub
commit b156f0a9fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 20 deletions

View file

@ -13133,8 +13133,9 @@ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false)
bool checkAddressVar(Scope* sc, Expression exp, VarDeclaration v)
{
//printf("checkAddressVar(exp: %s, v: %s)\n", exp.toChars(), v.toChars());
if (v)
{
if (v is null)
return true;
if (!v.canTakeAddressOf())
{
exp.error("cannot take address of `%s`", exp.toChars());
@ -13153,7 +13154,6 @@ bool checkAddressVar(Scope* sc, Expression exp, VarDeclaration v)
return false;
}
}
}
return true;
}

View file

@ -4466,7 +4466,9 @@ void errorSupplementalInferredSafety(FuncDeclaration fd, int maxDepth, bool depr
errorFunc(s.loc, s.fmtStr,
s.arg0 ? s.arg0.toChars() : "", s.arg1 ? s.arg1.toChars() : "", s.arg2 ? s.arg2.toChars() : "");
}
else if (FuncDeclaration fd2 = cast(FuncDeclaration) s.arg0)
else if (s.arg0.dyncast() == DYNCAST.dsymbol)
{
if (FuncDeclaration fd2 = (cast(Dsymbol) s.arg0).isFuncDeclaration())
{
if (maxDepth > 0)
{
@ -4475,4 +4477,5 @@ void errorSupplementalInferredSafety(FuncDeclaration fd, int maxDepth, bool depr
}
}
}
}
}