-
Notifications
You must be signed in to change notification settings - Fork 757
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
Parent property implementation #1800
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll likely need to revisit the emit code for resources w/ ancestors to handle ifs and loops differently. There are cases where we need to handle codegen differently for ancestors via parent property vs ancestors via containment. I think most of the tooling features are driven from syntax and not directly from GetAncestors()
.
We probably need some API that distinguishes between parent property and nested cases.
51b46f5
to
8577272
Compare
Codecov Report
@@ Coverage Diff @@
## main #1800 +/- ##
==========================================
+ Coverage 95.30% 95.85% +0.55%
==========================================
Files 377 375 -2
Lines 22696 23103 +407
Branches 15 0 -15
==========================================
+ Hits 21630 22146 +516
+ Misses 1066 957 -109
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public ErrorDiagnostic ResourceTypeIsNotValidParent(string resourceType, string parentResourceType) => new( | ||
TextSpan, | ||
"BCP167", | ||
$"Resource type \"{resourceType}\" is not a valid child resource of parent \"{parentResourceType}\"."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parent [](start = 84, length = 6)
Should the message also say what the permissible types would be? (I haven't yet read how this is used.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I don't think we should list the available child types in the error - the inconsistency is detected via prefix matching (using the type string to check if it's a child), so it feels like it could be inconsistent or potentially misleading to try and detect possible types from the type system.
4d9b58d
to
709a41f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!
Fixes #127