Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Wilson committed Apr 27, 2012
2 parents b551742 + e0fcf85 commit ecee9ca
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -10611,7 +10611,9 @@ Expression *CatAssignExp::semantic(Scope *sc)
(tb2->ty == Tarray || tb2->ty == Tsarray) &&
(e2->implicitConvTo(e1->type)
#if DMDV2
|| tb2->nextOf()->implicitConvTo(tb1next)
|| (tb2->nextOf()->implicitConvTo(tb1next) &&
(tb2->nextOf()->size(0) == tb1next->size(0) ||
tb1next->ty == Tchar || tb1next->ty == Twchar || tb1next->ty == Tdchar))
#endif
)
)
Expand Down
19 changes: 8 additions & 11 deletions src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -3964,17 +3964,14 @@ void UnitTestDeclaration::semantic(Scope *sc)
scope = NULL;
}

if (global.params.useUnitTests)
{
if (!type)
type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);
Scope *sc2 = sc->push();
// It makes no sense for unit tests to be pure or nothrow.
sc2->stc &= ~(STCnothrow | STCpure);
sc2->linkage = LINKd;
FuncDeclaration::semantic(sc2);
sc2->pop();
}
if (!type)
type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);
Scope *sc2 = sc->push();
// It makes no sense for unit tests to be pure or nothrow.
sc2->stc &= ~(STCnothrow | STCpure);
sc2->linkage = LINKd;
FuncDeclaration::semantic(sc2);
sc2->pop();

#if 0
// We're going to need ModuleInfo even if the unit tests are not
Expand Down
9 changes: 8 additions & 1 deletion src/mtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -4749,12 +4749,16 @@ Type *TypePointer::semantic(Loc loc, Scope *sc)
{ transitive();
return merge();
}
#if 1
return merge();
#else
deco = merge()->deco;
/* Don't return merge(), because arg identifiers and default args
* can be different
* even though the types match
*/
return this;
#endif
}


Expand Down Expand Up @@ -6129,13 +6133,16 @@ Type *TypeDelegate::semantic(Loc loc, Scope *sc)
* be removed from next before the merge.
*/

#if 1
return merge();
#else
/* Don't return merge(), because arg identifiers and default args
* can be different
* even though the types match
*/
deco = merge()->deco;
return this;
//return merge();
#endif
}

d_uns64 TypeDelegate::size(Loc loc)
Expand Down
2 changes: 1 addition & 1 deletion src/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ void TemplateDeclaration::semantic(Scope *sc)
}

#if DMDV2
if (/*global.params.useUnitTests &&*/ sc->module)
if (sc->module)
{
// Generate this function as it may be used
// when template is instantiated in other modules
Expand Down
9 changes: 9 additions & 0 deletions test/fail_compilation/fail3895.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import std.stdio;

void main() {
double[] stuff = [1.,2.,3.,4.,5.];
float[] otherStuff;
otherStuff ~= stuff;
writeln(otherStuff);
}

18 changes: 18 additions & 0 deletions test/runnable/xtest46.d
Original file line number Diff line number Diff line change
Expand Up @@ -5031,6 +5031,23 @@ class B1175 : A1175
I1 getI() { return new I2; }
}

/***************************************************/
// 7983

void test7983()
{
class A
{
unittest {}
}
A a;

foreach (name; __traits(allMembers, A))
{
static if (__traits(compiles, &__traits(getMember, a, name))) {}
}
}

/***************************************************/

int main()
Expand Down Expand Up @@ -5263,6 +5280,7 @@ int main()
test7871();
test7906();
test7907();
test7983();

printf("Success\n");
return 0;
Expand Down

0 comments on commit ecee9ca

Please sign in to comment.