Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix regression in parseIfStatement #126

Merged
merged 1 commit into from Feb 3, 2017
Merged

fix regression in parseIfStatement #126

merged 1 commit into from Feb 3, 2017

Conversation

ghost
Copy link

@ghost ghost commented Feb 3, 2017

In #106 I broke

 if (TypeCtor(Type) ident = stuff){}

by allowing

 if (TypeCtor ident = stuff){}

It's well tested now.

@Hackerpilot Hackerpilot merged commit fe25e3b into dlang-community:master Feb 3, 2017
@Hackerpilot
Copy link
Collaborator

I should have tested this more before tagging another beta. This change breaks this code:

void main()
{
	if ((a && b) || c)
	{
	}
}

@ghost
Copy link
Author

ghost commented Feb 3, 2017

It must be

            if (currentIs(tok!"("))
                index--;

that must not be called if not typector is consumed.

@ghost
Copy link
Author

ghost commented Feb 3, 2017

Indeed:

            // consume for TypeCtors = identifier
            if (isTypeCtor(current.type))
            {
                while (isTypeCtor(current.type))
                {
                    const prev = current.type;
                    advance();
                    if (current.type == prev)
                        warn("redundant type constructor");
                }
                // goes back for TypeCtor(Type) = identifier
                if (currentIs(tok!"("))
                    index--;
            }

works for all.

@ghost ghost deleted the reg-ifcond branch February 6, 2017 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant