Skip to content

Conversation

legrosbuffle
Copy link
Contributor

Parse Args[0].T as a type in:

struct S(Args...) {
Args[0].T m;
alias T = Args[0].T;
}

See bug 1215 for context.

@9rnsr
Copy link
Contributor

9rnsr commented Mar 25, 2015

Please follow the existing dmd code style:

  • Place the start brace in its own line.
  • Indentation of case statement.
  • Code style for pointer type: T *id;

You can use TEST_OUTPUT: comment to test pragma(msg) result, as same as error diagnostic tests. You can see the examples in fail_compilation directory.

@legrosbuffle
Copy link
Contributor Author

Thanks for the review. Style fixed, please take another look.

@9rnsr
Copy link
Contributor

9rnsr commented Mar 26, 2015

Is this supported? enum i = 1; Args[i].T t;

@legrosbuffle
Copy link
Contributor Author

It's not indeed, thanks for the catch ! Here's a fixed version.

}
else if (t)
{
index->error(loc, "Expected an expression as index, got a type (%s)", t->toChars());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DMD error messages (user-visible ones, anyway) generally start with a lower-case letter.

@dnadlinger
Copy link
Contributor

Sorry for pestering you with yet another round of stylistic nit-picks, but here you go. ;)

I'll defer to Kenji for the actual technical review.

@legrosbuffle
Copy link
Contributor Author

Please do comment, this is my first contribution to dmd, so this is useful :)

@9rnsr
Copy link
Contributor

9rnsr commented Apr 6, 2015

Sorry for late reply.

I reviewed code, and confirmed that the code is enough to support a indexed type with dot identifier.

It looks not smart, but I know that comes from the current dmd internal design. To make things more clean, we need to improve the Type structure design around TypeQualifier, and I think it's not so important at this first step.

LGTM after the code style and test case tweaks.

@legrosbuffle To support the indexed type with dot identifier, we also need to update D grammer. Can you also work for that? If you cannot open a grammer update PR in parallel, I'll file a website bugzilla issue after merging this.

}

case DYNCAST_EXPRESSION:
sm = takeTypeTupleIndex(loc, sc, s, id, (Expression*)id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all casts, insert a space before *.
s/(Expression*)id/(Expression *)id/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

legrosbuffle added a commit to legrosbuffle/dlang.org that referenced this pull request Apr 6, 2015
@@ -0,0 +1,118 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally compilable test is compiled with -c and generates objfile. But the test for 1215 does not have to do it.
So, you can list -o- in REQUIRED_ARGS: to stop backend codegen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks for the suggestion.

@legrosbuffle
Copy link
Contributor Author

Thanks for the comments ! I've also created a PR for the grammar on dlang.org.

@9rnsr
Copy link
Contributor

9rnsr commented Apr 6, 2015

LGTM. Thanks for your awesome work!

@9rnsr
Copy link
Contributor

9rnsr commented Apr 6, 2015

Auto-merge toggled on

9rnsr added a commit that referenced this pull request Apr 6, 2015
@9rnsr 9rnsr merged commit 0b36d54 into dlang:master Apr 6, 2015
@yebblies
Copy link
Contributor

yebblies commented Apr 7, 2015

This should have been squashed down to one or two commits before it was merged.

9rnsr added a commit to 9rnsr/dmd that referenced this pull request Aug 10, 2015
…iled.

If a TypeQualifier is not trivial dot-chain of scope and member symbols, it will be resolved as the equivalent expression.

The new TypeQualified structure introduced in dlang#4516 for issue 1215 is now fully in `TypeQualified::resolveExprType`, and the ICE issue will be solved in it.
9rnsr added a commit to 9rnsr/dmd that referenced this pull request Aug 11, 2015
…iled.

If a TypeQualifier is not trivial dot-chain of scope and member symbols, it will be resolved as the equivalent expression.

The new TypeQualified structure introduced in dlang#4516 for issue 1215 is now fully in `TypeQualified::resolveExprType`, and the ICE issue will be solved in it.
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.

4 participants