Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -6609,6 +6609,11 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
result = e;
return;
}

// for static alias this: https://issues.dlang.org/show_bug.cgi?id=17684
if (exp.e1.op == TOK.type)
exp.e1 = resolveAliasThis(sc, exp.e1);

auto e1x = resolveProperties(sc, exp.e1);
if (e1x.op == TOK.error)
{
Expand Down
6 changes: 6 additions & 0 deletions test/runnable/test17684.d
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ bool boolTest(T)()
}
assert(t == functionCall(t));

t = true; // tests CastExp
assert(t == cast(bool)t);

t = true;
return t; // tests ReturnStatement
}
Expand All @@ -108,6 +111,9 @@ int intTest(T)()
assert(t <= 42);
assert(42 >= t);

t = 42; // tests CastExp
assert(42 == cast(int)t);

// These currently don't work for properties due to https://issues.dlang.org/show_bug.cgi?id=8006
static if (!(typeid(T) is typeid(StructProperty!int)) && !(typeid(T) is typeid(ClassProperty!int)))
{
Expand Down