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
15 changes: 10 additions & 5 deletions .circleci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,19 @@ install_deps() {
}

setup_repos() {
# set a default in case we run into rate limit restrictions
local base_branch=""
if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then
base_branch=$((curl -fsSL https://api.github.com/repos/dlang/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER || echo) | jq -r '.base.ref')
else
if [ -z "${CIRCLE_PR_NUMBER:-}" ]; then
# no PR
base_branch=$CIRCLE_BRANCH
elif [ -z "${CIRCLE_PR_REPONAME:-}" ]; then
# PR originating from the official dlang repo
base_branch=$CIRCLE_BRANCH
else
# PR from a fork
base_branch=$( (curl -fsSL https://api.github.com/repos/dlang/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER || echo) | jq -r '.base.ref')
# set a default in case we run into rate limit restrictions
base_branch=${base_branch:-master}
fi
base_branch=${base_branch:-"master"}

# merge testee PR with base branch (master) before testing
if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.098.1
v2.099.0-beta.0
5 changes: 4 additions & 1 deletion src/dmd/clone.d
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,10 @@ FuncDeclaration buildXopEquals(StructDeclaration sd, Scope* sc)
fop.generated = true;
Expression e1 = new IdentifierExp(loc, Id.p);
Expression e2 = new IdentifierExp(loc, Id.q);
Expression e = new EqualExp(EXP.equal, loc, e1, e2);
// TODO: simplify as soon as `git describe` for DMD master yields v2.099+
Expression e = global.versionNumber() >= 2099
? new EqualExp(EXP.equal, loc, e2, e1)
: new EqualExp(EXP.equal, loc, e1, e2);
fop.fbody = new ReturnStatement(loc, e);
uint errors = global.startGagging(); // Do not report errors
Scope* sc2 = sc.push();
Expand Down
9 changes: 8 additions & 1 deletion src/dmd/dtemplate.d
Original file line number Diff line number Diff line change
Expand Up @@ -7799,15 +7799,22 @@ struct TemplateInstanceBox
{
bool res = void;
if (ti.inst && s.ti.inst)
{
/* This clause is only used when an instance with errors
* is replaced with a correct instance.
*/
res = ti is s.ti;
}
else
{
/* Used when a proposed instance is used to see if there's
* an existing instance.
*/
res = (cast()s.ti).equalsx(cast()ti);
static if (__VERSION__ >= 2099)
res = (cast()ti).equalsx(cast()s.ti);
else // https://issues.dlang.org/show_bug.cgi?id=22717
res = (cast()s.ti).equalsx(cast()ti);
}

debug (FindExistingInstance) ++(res ? nHits : nCollisions);
return res;
Expand Down
35 changes: 35 additions & 0 deletions test/runnable/test22717.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// PERMUTE_ARGS: -version=XopEquals

void main()
{
// TODO: remove as soon as `git describe` for DMD master yields v2.099+
static if (__VERSION__ >= 2099)
{
static struct S
{
int value;

version (XopEquals)
{
bool opEquals(const S rhs) const
{
assert(this.value == 42);
return true;
}
}
else
{
bool opEquals(const ref S rhs) const
{
assert(this.value == 42);
return true;
}
}
}

auto a = S(42);
auto b = S(24);
auto ti = typeid(S);
assert(ti.equals(&a, &b));
}
}