Skip to content

Commit a23a97a

Browse files
committed
Turn deprecation into error for issue 313
1 parent 12b9f84 commit a23a97a

6 files changed

Lines changed: 33 additions & 14 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The deprecation phase for fully qualified names that bypassed private imports is finished
2+
3+
---
4+
=========================
5+
// a.d
6+
import std.stdio;
7+
=========================
8+
// b.d:
9+
--
10+
import a;
11+
12+
void main()
13+
{
14+
std.stdio.writefln("foo"); // deprecation before patch, now errors
15+
}
16+
==========================
17+
---
18+
19+
In order to compile the example successfully, `public` needs to be added
20+
to the import located in `a.d` : `public import std.stdio;`.

src/dmd/access.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,9 @@ extern (C++) bool checkAccess(Loc loc, Scope* sc, Package p)
463463
}
464464
auto name = p.toPrettyChars();
465465
if (p.isPkgMod == PKG.module_ || p.isModule())
466-
deprecation(loc, "%s `%s` is not accessible here, perhaps add `static import %s;`", p.kind(), name, name);
466+
error(loc, "%s `%s` is not accessible here, perhaps add `static import %s;`", p.kind(), name, name);
467467
else
468-
deprecation(loc, "%s `%s` is not accessible here", p.kind(), name);
468+
error(loc, "%s `%s` is not accessible here", p.kind(), name);
469469
return true;
470470
}
471471

test/compilable/testDIP37.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ void test7()
3030
static import pkgDIP37.datetime;
3131
static assert(!__traits(compiles, def()));
3232
pkgDIP37.datetime.def();
33-
pkgDIP37.datetime.common.def();
3433
}
3534

3635
// https://issues.dlang.org/show_bug.cgi?id=17629

test/fail_compilation/fail313.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
REQUIRED_ARGS: -de
33
TEST_OUTPUT:
44
---
5-
fail_compilation/fail313.d(18): Deprecation: module `imports.b313` is not accessible here, perhaps add `static import imports.b313;`
5+
fail_compilation/fail313.d(18): Error: module `imports.b313` is not accessible here, perhaps add `static import imports.b313;`
66
fail_compilation/fail313.d(25): Deprecation: `imports.a313.core` is not visible from module `test313`
7-
fail_compilation/fail313.d(25): Deprecation: package `core.stdc` is not accessible here
8-
fail_compilation/fail313.d(25): Deprecation: module `core.stdc.stdio` is not accessible here, perhaps add `static import core.stdc.stdio;`
9-
fail_compilation/fail313.d(30): Deprecation: package `imports.pkg313` is not accessible here, perhaps add `static import imports.pkg313;`
7+
fail_compilation/fail313.d(25): Error: package `core.stdc` is not accessible here
8+
fail_compilation/fail313.d(25): Error: module `core.stdc.stdio` is not accessible here, perhaps add `static import core.stdc.stdio;`
9+
fail_compilation/fail313.d(30): Error: package `imports.pkg313` is not accessible here, perhaps add `static import imports.pkg313;`
1010
---
1111
*/
1212
module test313;

test/runnable/testdstress.d

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// PERMUTE_ARGS:
22

3-
module dstress.run.module_01;
3+
module run.module_01;
44

55
import core.memory;
66
import core.exception;
@@ -170,9 +170,9 @@ int i;
170170

171171
void test7()
172172
{
173-
assert(dstress.run.module_01.i==0);
174-
dstress.run.module_01.i++;
175-
assert(dstress.run.module_01.i==1);
173+
assert(run.module_01.i==0);
174+
run.module_01.i++;
175+
assert(run.module_01.i==1);
176176
}
177177

178178
/* ================================ */
@@ -699,7 +699,7 @@ void test32()
699699
assert(!(ti is null));
700700
writefln("%s %d %d", ti.toString(), ti.tsize, (MyUnion32*).sizeof);
701701
assert(ti.tsize==(MyUnion32*).sizeof);
702-
assert(ti.toString()=="dstress.run.module_01.MyUnion32*");
702+
assert(ti.toString()=="run.module_01.MyUnion32*");
703703
}
704704

705705
/* ================================ */

test/runnable/testmodule.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// @uri@ news:ct428n$2qoe$1@digitaldaemon.com
1010
// @url@ nntp://news.digitalmars.com/D.gnu/983
1111

12-
module dstress.run.unicode_06_哪里;
12+
module run.unicode_06_哪里;
1313

1414
int 哪里(int ö){
1515
return ö+2;
1616
}
1717

1818
int main(){
19-
assert(dstress.run.unicode_06_哪里.哪里(2)==4);
19+
assert(run.unicode_06_哪里.哪里(2)==4);
2020
return 0;
2121
}

0 commit comments

Comments
 (0)