Skip to content

Commit

Permalink
Merge pull request #2992 from 9rnsr/fix6930
Browse files Browse the repository at this point in the history
[enh] Issue 6930 - combined type of immutable(T) and inout(T) should be inout(const(T))
  • Loading branch information
yebblies committed Dec 21, 2013
2 parents ec34f77 + 2c0ead8 commit 6f4866b
Show file tree
Hide file tree
Showing 12 changed files with 1,341 additions and 818 deletions.
7 changes: 2 additions & 5 deletions src/expression.c
Expand Up @@ -1529,11 +1529,8 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf,
L1:
if (!(p->storageClass & STClazy && p->type->ty == Tvoid))
{
unsigned mod = arg->type->wildConvTo(p->type);
if (mod)
{
wildmatch |= mod;
}
bool isRef = (p->storageClass & (STCref | STCout)) != 0;
wildmatch |= arg->type->deduceWild(p->type, isRef);
}
}
if (done)
Expand Down
29 changes: 17 additions & 12 deletions src/func.c
Expand Up @@ -119,7 +119,6 @@ void FuncDeclaration::semantic(Scope *sc)
AggregateDeclaration *ad;
ClassDeclaration *cd;
InterfaceDeclaration *id;
bool doesoverride;

#if 0
printf("FuncDeclaration::semantic(sc = %p, this = %p, '%s', linkage = %d)\n", sc, this, toPrettyChars(), sc->linkage);
Expand Down Expand Up @@ -277,38 +276,44 @@ void FuncDeclaration::semantic(Scope *sc)
{
case STCimmutable:
case STCimmutable | STCconst:
case STCimmutable | STCconst | STCshared:
case STCimmutable | STCshared:
case STCimmutable | STCwild:
case STCimmutable | STCconst | STCwild:
case STCimmutable | STCconst | STCshared | STCwild:
case STCimmutable | STCwild | STCconst:
case STCimmutable | STCshared:
case STCimmutable | STCshared | STCconst:
case STCimmutable | STCshared | STCwild:
case STCimmutable | STCshared | STCwild | STCconst:
// Don't use immutableOf(), as that will do a merge()
type = type->makeImmutable();
break;

case STCconst:
case STCconst | STCwild:
type = type->makeConst();
break;

case STCshared | STCconst:
case STCshared | STCconst | STCwild:
type = type->makeSharedConst();
case STCwild:
type = type->makeWild();
break;

case STCwild | STCconst:
type = type->makeWildConst();
break;

case STCshared:
type = type->makeShared();
break;

case STCwild:
type = type->makeWild();
case STCshared | STCconst:
type = type->makeSharedConst();
break;

case STCshared | STCwild:
type = type->makeSharedWild();
break;

case STCshared | STCwild | STCconst:
type = type->makeSharedWildConst();
break;

case 0:
break;

Expand Down Expand Up @@ -487,7 +492,7 @@ void FuncDeclaration::semantic(Scope *sc)
vi = cd->baseClass ? findVtblIndex((Dsymbols*)&cd->baseClass->vtbl, (int)cd->baseClass->vtbl.dim)
: -1;

doesoverride = false;
bool doesoverride = false;
switch (vi)
{
case -1:
Expand Down
10 changes: 6 additions & 4 deletions src/glue.c
Expand Up @@ -1288,18 +1288,20 @@ unsigned Type::totym()
break;
case MODconst:
case MODwild:
case MODwildconst:
t |= mTYconst;
break;
case MODimmutable:
t |= mTYimmutable;
break;
case MODshared:
t |= mTYshared;
break;
case MODshared | MODwild:
case MODshared | MODconst:
case MODshared | MODwild:
case MODshared | MODwildconst:
t |= mTYshared | mTYconst;
break;
case MODimmutable:
t |= mTYimmutable;
break;
default:
assert(0);
}
Expand Down

0 comments on commit 6f4866b

Please sign in to comment.