Issue 8959 - IsExpression should support syntax which has no Identifier in all cases #1255

Merged
merged 2 commits into from Mar 6, 2013

Projects

None yet

5 participants

@9rnsr
D Programming Language member

http://d.puremagic.com/issues/show_bug.cgi?id=8959

This supports additional syntax of IsExpression.

is ( Type :  TypeSpecialization , TemplateParameterList )
is ( Type == TypeSpecialization , TemplateParameterList )
@youxkei

LGTM

@ghost Unknown and 1 other commented on an outdated diff Feb 18, 2013
src/expression.c
*/
- assert(parameters && parameters->dim);
+ if (id)
@ghost
ghost Feb 18, 2013

Avoid duplicating code here. Use:

Identifier *tid = id ? id : Lexer::uniqueId("is_id");
TemplateParameter *tp = new TemplateTypeParameter(loc, tid, NULL, NULL);
parameters->insert(0, tp);
@9rnsr
9rnsr Feb 19, 2013

Good point. Will fix.

@ghost Unknown and 1 other commented on an outdated diff Feb 18, 2013
src/expression.c
@@ -6003,7 +6040,7 @@ Expression *IsExp::semantic(Scope *sc)
}
else
{
- tded = (Type *)dedtypes[0];
+ tded = id ? (Type *)dedtypes[0] : targ;
@ghost
ghost Feb 18, 2013

Why did this line have to change? You're inserting to parameters above, so dedtypes will have at least 1 element. If it's NULL, the next line below will set it to targ. Am I wrong?

@9rnsr
9rnsr Feb 19, 2013

You are right. It had been necessary to avoid access violation during the development of this patch. But now, finally it has been completely unnecessary, and I had just missed it. Will fix.

@ghost

LGTM.

@WalterBright WalterBright was assigned Feb 19, 2013
@9rnsr
D Programming Language member

This is a kind of language enhancement.
So assign to @WalterBright and @andralex .

@MartinNowak
D Programming Language member

It's a useful enhancement, the fact these were missing has already bugged me several times.

@WalterBright WalterBright merged commit c9a411a into dlang:master Mar 6, 2013

1 check passed

Details default Pass: 10
@andralex
D Programming Language member

Great, I was missing these. Thanks @9rnsr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment