re PR d/90651 (ICE in FuncDeclaration::semantic3, at d/dmd/func.c:1524)

PR d/90651
d/dmd: Merge upstream dmd 78dc31152

Fixes bug where the object module was not always implicitly imported.

Reviewed-on: https://github.com/dlang/dmd/pull/9999

From-SVN: r272340
This commit is contained in:
Iain Buclaw 2019-06-16 07:47:46 +00:00
parent e62b9f8e08
commit 347f5c885f
8 changed files with 51 additions and 2 deletions

View File

@ -1,4 +1,4 @@
bbc5ea66ab41ebd14abd9a0fbb9ca6ef6b2dcb14 78dc311524341a76008b341ff6427e5a16e285db
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository. merge done from the dlang/dmd repository.

View File

@ -679,7 +679,8 @@ void Module::importAll(Scope *)
// If it isn't there, some compiler rewrites, like // If it isn't there, some compiler rewrites, like
// classinst == classinst -> .object.opEquals(classinst, classinst) // classinst == classinst -> .object.opEquals(classinst, classinst)
// would fail inside object.d. // would fail inside object.d.
if (members->dim == 0 || ((*members)[0])->ident != Id::object) if (members->dim == 0 || ((*members)[0])->ident != Id::object ||
(*members)[0]->isImport() == NULL)
{ {
Import *im = new Import(Loc(), NULL, Id::object, NULL, 0); Import *im = new Import(Loc(), NULL, Id::object, NULL, 0);
members->shift(im); members->shift(im);

View File

@ -0,0 +1,3 @@
// PERMUTE_ARGS:
import object;
void fun(string) { }

View File

@ -0,0 +1,9 @@
// PERMUTE_ARGS:
/*
TEST_OUTPUT:
---
fail_compilation/fail19912a.d(8): Error: struct `fail19912a.object` conflicts with import `fail19912a.object` at fail_compilation/fail19912a.d
---
*/
struct object { }
void fun(string) { }

View File

@ -0,0 +1,9 @@
// PERMUTE_ARGS:
/*
TEST_OUTPUT:
---
fail_compilation/fail19912b.d(8): Error: class `fail19912b.object` conflicts with import `fail19912b.object` at fail_compilation/fail19912b.d
---
*/
class object { }
void fun(string) { }

View File

@ -0,0 +1,9 @@
// PERMUTE_ARGS:
/*
TEST_OUTPUT:
---
fail_compilation/fail19912c.d(8): Error: alias `fail19912c.object` conflicts with import `fail19912c.object` at fail_compilation/fail19912c.d
---
*/
alias object = int;
void fun(string) { }

View File

@ -0,0 +1,9 @@
// PERMUTE_ARGS:
/*
TEST_OUTPUT:
---
fail_compilation/fail19912d.d(8): Error: enum `fail19912d.object` conflicts with import `fail19912d.object` at fail_compilation/fail19912d.d
---
*/
enum object { }
void fun(string) { }

View File

@ -0,0 +1,9 @@
// PERMUTE_ARGS:
/*
TEST_OUTPUT:
---
fail_compilation/fail19912e.d(8): Error: function `fail19912e.object` conflicts with import `fail19912e.object` at fail_compilation/fail19912e.d
---
*/
void object() { }
void fun(string) { }