Skip to content

Commit

Permalink
Merge pull request #595 from 9rnsr/fix7190
Browse files Browse the repository at this point in the history
Issue 7190 - Tuple length incorrect
  • Loading branch information
WalterBright committed Jan 1, 2012
2 parents 0e5e1b7 + f2635c9 commit 3912454
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mtype.c
Expand Up @@ -7219,6 +7219,7 @@ Expression *TypeStruct::dotExp(Scope *sc, Expression *e, Identifier *ident)
* (e.field0, e.field1, e.field2, ...)
*/
e = e->semantic(sc); // do this before turning on noaccesscheck
e->type->size(); // do semantic of type
Expressions *exps = new Expressions;
exps->reserve(sym->fields.dim);
for (size_t i = 0; i < sym->fields.dim; i++)
Expand Down Expand Up @@ -7672,6 +7673,7 @@ Expression *TypeClass::dotExp(Scope *sc, Expression *e, Identifier *ident)
/* Create a TupleExp
*/
e = e->semantic(sc); // do this before turning on noaccesscheck
e->type->size(); // do semantic of type
Expressions *exps = new Expressions;
exps->reserve(sym->fields.dim);
for (size_t i = 0; i < sym->fields.dim; i++)
Expand Down
@@ -0,0 +1,7 @@
module example7190.controllers.HomeController;

import serenity7190.core.Controller;

class HomeController : Controller {
mixin register!(HomeController);
}
11 changes: 11 additions & 0 deletions test/compilable/extra-files/example7190/models/HomeModel.d
@@ -0,0 +1,11 @@
module example7190.models.HomeModel;

import serenity7190.core.Model;

struct Article {
ulong id;
}

class HomeModel : Model {
private SqlitePersister!Article mArticles;
}
8 changes: 8 additions & 0 deletions test/compilable/extra-files/serenity7190/core/Controller.d
@@ -0,0 +1,8 @@
class Controller {
mixin template register(T : Controller) {
enum _s_pkg = __traits(parent, __traits(parent, __traits(parent, T))).stringof["package ".length .. $];

enum _s_model = T.stringof[0 .. $-`Controller`.length] ~ `Model`;
mixin(q{enum _ = is(} ~ _s_pkg ~ q{.models.} ~ _s_model ~ q{.} ~ _s_model ~ q{ : serenity7190.core.Model.Model);});
}
}
5 changes: 5 additions & 0 deletions test/compilable/extra-files/serenity7190/core/Model.d
@@ -0,0 +1,5 @@
class SqlitePersister(T) {
static assert(T.tupleof.length > 0, T.stringof ~ `(` ~ (T.tupleof.length + '0') ~ `): ` ~ T.tupleof.stringof);
}

class Model {}
7 changes: 7 additions & 0 deletions test/compilable/test7190.d
@@ -0,0 +1,7 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -c -Icompilable/extra-files

import example7190.controllers.HomeController;
import example7190.models.HomeModel;

void main(){}

0 comments on commit 3912454

Please sign in to comment.