-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C#: Implement ContentSet
#17207
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
C#: Implement ContentSet
#17207
Conversation
c698128
to
d2760b9
Compare
d2760b9
to
d638b5c
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.
Looks very nice!
cached | ||
newtype TContentSet = | ||
TSingletonContent(Content c) { not c instanceof PropertyContent } or | ||
TPropertyContentSet(Property p) { p.isUnboundDeclaration() } |
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.
Shouldn't the corresponding TPropertyContent
injector be deleted from TContent
if Content
has been replaced with ContentSet
everywhere (it looks like it will require a re-write of ContentApprox
)?
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.
We still need Content
, so that can't be deleted. ContentSet
is a type used to represent sets of Content
s with just a single entity.
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.
Yes, I get that we need the Content
type. I am just trying to understand whether we need an injector for properties both as a part of Content
and ContentSet
?
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.
We could in principle have just a single injector for TContentSet
, but having two makes it more explicit that properties need special treatment.
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.
Ok - thank you!
this.isProperty(p1) and | ||
p2 = result.(PropertyContent).getProperty() | ||
| | ||
p1 = p2 |
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.
Doesn't that follow implicitly from p1.getOverridee*().getUnboundDeclaration() = p2
as property contents are always unbound declarations?
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.
Yes, you are right.
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.
LGTM!
Storing into properties and reading out of properties takes overriding into account. For example, in
this.Prop = "taint"
stores into the propertyC.Prop
, whereas((I)this).Prop
read fromI.Prop
. Before this PR,((I)this).Prop
would give rise to two read steps: one forI.Prop
and one forC.Prop
. In general, this meant that property reads would fan out to all possible compatible properties, which is better solved usingContentSet
s.