Skip to content

Commit

Permalink
fix Issue 12688 - Strange error if function call is in parentheses
Browse files Browse the repository at this point in the history
`(s.foo).writeln` is parsed as `DotIdExp(TypeExp('s.foo'), 'writeln')`, but the type `s.foo` should be analyzed as dotvar expression.
  • Loading branch information
9rnsr committed May 4, 2014
1 parent 1f1f7fe commit 498d260
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/expression.c
Expand Up @@ -4541,7 +4541,7 @@ Expression *TypeExp::semantic(Scope *sc)
Type *t;
Dsymbol *s;

type->resolve(loc, sc, &e, &t, &s);
type->resolve(loc, sc, &e, &t, &s, true);
if (e)
{
//printf("e = %s %s\n", Token::toChars(e->op), e->toChars());
Expand Down
17 changes: 17 additions & 0 deletions test/compilable/compile1.d
Expand Up @@ -595,3 +595,20 @@ class A12555(T)
static assert(!__traits(compiles, {
class C : A12555!C { }
}));

/***************************************************/
// 12688

void writeln12688(A...)(A) {}

struct S12688
{
int foo() @property { return 1; }
}

void test12688()
{
S12688 s;
s.foo.writeln12688; // ok
(s.foo).writeln12688; // ok <- ng
}

0 comments on commit 498d260

Please sign in to comment.