Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.

Reimplemented support for nested functions/class using a new approach.
Added error on taking address of intrinsic.
Fixed problems with the ->syntaxCopy of TypeFunction delegate exp.
Removed DtoDType and replaced all uses with ->toBasetype() instead.
Removed unused inplace stuff.
Fixed a bunch of issues in the runtime unittests, not complete yet.
Added mini tests.
This commit is contained in:
Tomas Lindquist Olsen
2008-08-10 08:37:38 +02:00
parent b2d860374b
commit 9d7f16b967
39 changed files with 693 additions and 455 deletions

57
tests/mini/aa7.d Normal file
View File

@@ -0,0 +1,57 @@
// adapted from dstress.run.a.associative_array_19_A to catch regressions early
module mini.aa7;
extern (C) int printf(char*, ...);
extern (C) void gc_collect();
union Key{
char x;
}
class Payload {
this(Key value) {
value.x += 1;
_value = value;
}
Key value() {
return _value;
}
Key _value;
}
int main(){
Payload[Key] aa;
Key[] allKeys;
static Key a = { 'a' };
static Key b = { 'b' };
static Key c = { 'c' };
allKeys ~= a;
allKeys ~= b;
allKeys ~= c;
foreach(Key key; allKeys) {
aa[key] = new Payload(key);
}
int i = 0;
foreach(Key key; allKeys) {
printf("1st #%d\n", i++);
assert(key in aa);
}
gc_collect();
i = 0;
foreach(Key key; allKeys) {
printf("2nd #%d\n", i++);
assert(key in aa);
}
return 0;
}

View File

@@ -1,4 +1,4 @@
module tangotests.nested2;
module mini.nested13;
extern(C) int printf(char*, ...);

31
tests/mini/nested16.d Normal file
View File

@@ -0,0 +1,31 @@
module mini.nested16;
void main()
{
int idx = 123;
int func(int* idp)
{
void foo()
{
void bar(int* idp)
{
auto c = new class
{
void mem()
{
scope(exit) ++*idp;
}
};
auto dg = () {
c.mem();
};
dg();
}
bar(idp);
++*idp;
}
foo();
return ++*idp;
}
assert(func(&idx) == 126);
}

45
tests/mini/nested17.d Normal file
View File

@@ -0,0 +1,45 @@
// $HeadURL: svn://svn.berlios.de/dstress/trunk/run/n/nested_class_03_A.d $
// $Date: 2005-06-18 09:15:32 +0200 (Sat, 18 Jun 2005) $
// $Author: thomask $
// @author@ John C <johnch_atms@hotmail.com>
// @date@ 2005-06-09
// @uri@ news:d88vta$vak$1@digitaldaemon.com
//module dstress.run.n.nested_class_03_A;
module mini.nested17;
interface Inner{
int value();
}
class Outer{
int x;
Inner test(){
printf("val = %d\n", x);
return new class Inner {
int y;
this(){
printf("val = %d\n", x);
y=x;
}
int value(){
return y;
}
};
}
}
int main(){
Outer o = new Outer();
o.x=2;
int val = o.test().value();
printf("val = %d\n", val);
assert(val == o.x);
return 0;
}
extern(C) int printf(char*, ...);

27
tests/mini/nested19.d Normal file
View File

@@ -0,0 +1,27 @@
module mini.nested19;
void main()
{
int i = 1;
class C
{
int j = 2;
void func()
{
int k = 3;
void foo()
{
i = i+j+k;
}
foo();
}
}
auto c = new C;
c.func();
assert(i == 6);
}

View File

@@ -21,13 +21,13 @@ void main()
}
}
{
scope c2 = new C2;
c2.func2();
}
auto c2 = new C2;
c2.func2();
}
}
scope c = new C;
auto c = new C;
c.func();
assert(i == 45);
}