Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix existing tests to fit improved import mechanism
- Loading branch information
Showing
21 changed files
with
199 additions
and
63 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module imports.test7491a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module imports.test7491b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
module imports.test7491a; | ||
|
||
class B1 | ||
{ | ||
private: | ||
import imports.test7491c; // std.algorithm; | ||
import algorithm = imports.test7491c; | ||
} | ||
class B2 | ||
{ | ||
protected: | ||
import imports.test7491c; // std.algorithm; | ||
import algorithm = imports.test7491c; | ||
} | ||
class B3 | ||
{ | ||
public: | ||
import imports.test7491c; // std.algorithm; | ||
import algorithm = imports.test7491c; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
module imports.test7491b; | ||
|
||
void writeln(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module imports.test7491c; | ||
|
||
void map(alias pred, R)(R) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import imports.test70 : foo; | ||
// PERMUTE_ARGS: | ||
|
||
void foo(int) // overloads with selective import | ||
{ | ||
} | ||
import imports.test70 : foo; | ||
void foo(int) {} | ||
// selective import does not create local alias implicitly | ||
|
||
void bar() | ||
{ | ||
foo(); | ||
static assert(!__traits(compiles, foo())); | ||
foo(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// PERMUTE_ARGS: | ||
|
||
import imports.test71; | ||
|
||
void bar() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,48 @@ | ||
struct Struct | ||
{ | ||
import object; | ||
import imports.test7491a; | ||
import renamed=imports.test7491b; | ||
} | ||
// PERMUTE_ARGS: | ||
|
||
struct AliasThis | ||
{ | ||
Struct _struct; | ||
alias _struct this; | ||
} | ||
module test7491; | ||
import imports.test7491a; | ||
import imports.test7491b; // std.stdio; | ||
import io = imports.test7491b; | ||
|
||
class Base | ||
class C1 : B1 | ||
{ | ||
import object; | ||
import imports.test7491a; | ||
import renamed=imports.test7491b; | ||
} | ||
void foo() | ||
{ | ||
writeln(); | ||
imports.test7491b.writeln(); | ||
io.writeln(); | ||
|
||
class Derived : Base | ||
{ | ||
static assert(!__traits(compiles, map!(a=>a)([1,2,3]))); | ||
static assert(!__traits(compiles, imports.test7491c.map!(a=>a)([1,2,3]))); | ||
static assert(!__traits(compiles, algorithm.map!(a=>a)([1,2,3]))); | ||
} | ||
} | ||
|
||
interface Interface | ||
class C2 : B2 | ||
{ | ||
import object; | ||
import imports.test7491a; | ||
import renamed=imports.test7491b; | ||
void foo() | ||
{ | ||
writeln(); | ||
imports.test7491b.writeln(); | ||
io.writeln(); | ||
|
||
map!(a=>a)([1,2,3]); | ||
imports.test7491c.map!(a=>a)([1,2,3]); | ||
algorithm.map!(a=>a)([1,2,3]); | ||
} | ||
} | ||
|
||
class Impl : Interface | ||
class C3 : B3 | ||
{ | ||
} | ||
void foo() | ||
{ | ||
writeln(); | ||
imports.test7491b.writeln(); | ||
io.writeln(); | ||
|
||
static assert(__traits(compiles, Struct.object)); | ||
static assert(__traits(compiles, Struct.imports)); | ||
static assert(__traits(compiles, Struct.renamed)); | ||
static assert(__traits(compiles, AliasThis.object)); | ||
static assert(__traits(compiles, AliasThis.imports)); | ||
static assert(__traits(compiles, AliasThis.renamed)); | ||
static assert(__traits(compiles, Base.object)); | ||
static assert(__traits(compiles, Base.imports)); | ||
static assert(__traits(compiles, Base.renamed)); | ||
static assert(__traits(compiles, Derived.object)); | ||
static assert(__traits(compiles, Derived.imports)); | ||
static assert(__traits(compiles, Derived.renamed)); | ||
static assert(__traits(compiles, Interface.object)); | ||
static assert(__traits(compiles, Interface.imports)); | ||
static assert(__traits(compiles, Interface.renamed)); | ||
static assert(__traits(compiles, Impl.object)); | ||
static assert(__traits(compiles, Impl.imports)); | ||
static assert(__traits(compiles, Impl.renamed)); | ||
map!(a=>a)([1,2,3]); | ||
imports.test7491c.map!(a=>a)([1,2,3]); | ||
algorithm.map!(a=>a)([1,2,3]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail356a.d(13): Error: no property 'fail356' for type 'int' | ||
--- | ||
*/ | ||
|
||
import imports.fail356; | ||
int imports; // collides with package name | ||
int imports; // doesn't collide with package name | ||
|
||
void main() | ||
{ | ||
auto x = imports.fail356.bar; | ||
// declared 'imports' hides module fully qualified name 'imports.fail356' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail356b.d(13): Error: no property 'max' for type 'string' | ||
--- | ||
*/ | ||
|
||
import imports.fail356 : bar; | ||
int bar; // collides with selective import | ||
string bar; // doesn't collide with selective import | ||
|
||
void main() | ||
{ | ||
auto x = bar.max; | ||
// string 'bar' hides imported int 'bar' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail356c.d(13): Error: function expected before (), not bar of type int | ||
--- | ||
*/ | ||
|
||
import foo = imports.fail356; | ||
int foo; // collides with renamed import | ||
int foo; // doesn't collide with renamed import | ||
|
||
void main() | ||
{ | ||
auto x = foo.bar; // --> rewritten to bar(foo) by UFCS | ||
// declared 'foo' hides renamed module name 'foo' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// EXTRA_SOURCES: imports/ice10598a.d imports/ice10598b.d | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/imports/ice10598a.d(5): Error: undefined identifier 'ice10598b', did you mean 'static import ice10598a'? | ||
fail_compilation/imports/ice10598a.d(5): Error: undefined identifier 'ice10598b', did you mean 'static import ice10598a'? | ||
fail_compilation/imports/ice10598a.d(5): Error: argument has no members | ||
fail_compilation/imports/ice10598a.d(5): Error: false must be an array or pointer type, not bool | ||
fail_compilation/imports/ice10598a.d(5): Error: string expected as second argument of __traits getMember instead of __error | ||
fail_compilation/imports/ice10598a.d(5): Error: alias imports.ice10598a.notImportedType cannot alias an expression false | ||
--- | ||
*/ | ||
|
||
void main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/ice9865.d(9): Error: struct ice9865.Foo no size yet for forward reference | ||
fail_compilation/ice9865.d(8): Error: alias ice9865.Baz cannot resolve | ||
fail_compilation/ice9865.d(9): Error: undefined identifier Baz | ||
fail_compilation/ice9865.d(8): Error: module ice9865b import 'Baz' not found, did you mean 'class Bar'? | ||
--- | ||
*/ | ||
import imports.ice9865b : Baz; | ||
import imports.ice9865b : Baz; | ||
struct Foo { Baz f; } |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
|
||
import std.stdio; | ||
import std.string; | ||
import std.typetuple; | ||
import std.traits; | ||
|
||
|