Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
tp = target.getDeclaredType(dpos, pathToTp) and
conditionSatisfiesConstraintTypeAt(_, condition, constraint, TypePath::nil(),
constraintRootType) and
constraintRootType = target.getDeclaredType(dpos, TypePath::nil()) and
constraintRootType.getATypeParameter() = pathToTp.getHead() and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does this change do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It will mean the same thing whenever getDeclaredType is functional (which it should be), but I have a mild preference for the rewrite.

argRootType = condition.getTypeAt(TypePath::nil())
)
}
Expand Down Expand Up @@ -1445,19 +1445,19 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
}

pragma[nomagic]
private predicate argRootTypeSatisfiesTargetTypeCand(
Type argRootType, Access a, AccessEnvironment e, Declaration target, AccessPosition apos,
TypeParameter tp, TypePath pathToTp
private predicate accessTargetsWithArgRootType(
Access a, AccessEnvironment e, Declaration target, AccessPosition apos, Type t
) {
target = a.getTarget(e) and
argRootTypeSatisfiesTargetTypeCand(argRootType, target, apos, tp, pathToTp) and
not exists(getTypeArgument(a, target, tp, _))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I notice this not exists(getTypeArgument... constraint does not show up in the new code. Is that correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch, I'll reintroduce it.

t = a.getInferredType(e, apos, TypePath::nil())
}

private newtype TRelevantAccess =
MkRelevantAccess(Access a, AccessPosition apos, AccessEnvironment e) {
argRootTypeSatisfiesTargetTypeCand(a.getInferredType(e, apos, TypePath::nil()), a, e, _,
apos, _, _)
exists(Declaration target, Type t |
accessTargetsWithArgRootType(a, e, target, apos, t) and
argRootTypeSatisfiesTargetTypeCand(t, target, apos, _, _)
)
}

private class RelevantAccess extends MkRelevantAccess {
Expand Down Expand Up @@ -1525,9 +1525,12 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
Access a, AccessEnvironment e, Declaration target, TypePath path, Type t, TypeParameter tp
) {
exists(AccessPosition apos, TypePath pathToTp |
argRootTypeSatisfiesTargetTypeCand(_, a, e, target, apos, tp, pathToTp) and
SatisfiesParameterConstraint::satisfiesConstraint(MkRelevantAccess(a, apos, e),
MkRelevantTarget(target, apos), pathToTp.appendInverse(path), t)
argRootTypeSatisfiesTargetTypeCand(_, target, pragma[only_bind_into](apos), tp, pathToTp) and
SatisfiesParameterConstraint::satisfiesConstraint(MkRelevantAccess(a,
pragma[only_bind_into](apos), e),
MkRelevantTarget(target, pragma[only_bind_into](apos)), pathToTp.appendInverse(path),
t) and
not exists(getTypeArgument(a, target, tp, _))
)
}
}
Expand Down
Loading