diff --git a/.circleci/run.sh b/.circleci/run.sh index 9da64a805b86..7594b1e0b827 100755 --- a/.circleci/run.sh +++ b/.circleci/run.sh @@ -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 diff --git a/VERSION b/VERSION index 0aa03f4b61ab..ceb50d8ce346 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.098.1 +v2.099.0-beta.0 diff --git a/src/dmd/clone.d b/src/dmd/clone.d index 73f7e02b37b2..613ff842a492 100644 --- a/src/dmd/clone.d +++ b/src/dmd/clone.d @@ -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(); diff --git a/src/dmd/dtemplate.d b/src/dmd/dtemplate.d index fb36c5e199e5..61653a1573eb 100644 --- a/src/dmd/dtemplate.d +++ b/src/dmd/dtemplate.d @@ -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; diff --git a/test/runnable/test22717.d b/test/runnable/test22717.d new file mode 100644 index 000000000000..3fd284f6db65 --- /dev/null +++ b/test/runnable/test22717.d @@ -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)); + } +}