Skip to content

Commit f047a03

Browse files
usefahmed07thewilsonator
authored andcommitted
Simplify checkAccess per review
Combine the self-reference check into the existing condition, as suggested by @thewilsonator.
1 parent 6b01de3 commit f047a03

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

compiler/src/dmd/access.d

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,9 @@ bool checkAccess(Loc loc, Scope* sc, Expression e, Dsymbol d)
226226
*/
227227
bool checkAccess(Scope* sc, Package p)
228228
{
229-
if (sc._module == p)
229+
if (sc._module == p || sc._module == p.isPackageMod())
230230
return false;
231231

232-
// https://issues.dlang.org/show_bug.cgi?id=24632
233-
// A `package.d` module referring to its own fully qualified package
234-
// name resolves to the semantic `Package` symbol, not the `Module`
235-
// symbol for `package.d` itself, so the check above misses this case.
236-
// Treat that as a self-reference too.
237-
if (auto m = p.isPackageMod())
238-
if (sc._module == m)
239-
return false;
240-
241232
for (; sc; sc = sc.enclosing)
242233
{
243234
if (sc.scopesym && sc.scopesym.isPackageAccessible(p, Visibility(Visibility.Kind.private_)))

0 commit comments

Comments
 (0)