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

Support for Ghost Types #773

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Support for Ghost Types #773

wants to merge 3 commits into from

Conversation

ArquintL
Copy link
Member

This PR adds support for Ghost Types, i.e., the ability to mark a named type or type alias as ghost such that this type is erased. This feature came up in the context of structs that are declared for verification-only purposes and, thus, contain only ghost fields.

In addition, this PR makes PPermissionType and PPredType ghost types, which did not use to be the case.

@ArquintL ArquintL requested a review from Felalolf June 24, 2024 15:06
@jcp19
Copy link
Contributor

jcp19 commented Jun 24, 2024

Oh, cool!

Do I see it correctly that, for two instances x and y of ghost struct type T (containing at least one field), x == y will always yield true? If so, maybe we can change the encoding such that it matches === in those cases.

Copy link
Contributor

@Felalolf Felalolf left a comment

Choose a reason for hiding this comment

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

I only have one minor comment, the rest seems fine.

case _: PBoolType | _: PIntegerType | _: PFloatType | _: PStringType | _: PFunctionType | _: PInterfaceType => false
case PArrayType(_, elem) => isTypeGhost(elem)
case PSliceType(elem) => isTypeGhost(elem)
case PMapType(key, elem) => isTypeGhost(key) && isTypeGhost(elem)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be a disjunction.

Suggested change
case PMapType(key, elem) => isTypeGhost(key) && isTypeGhost(elem)
case PMapType(key, elem) => isTypeGhost(key) || isTypeGhost(elem)

Copy link
Contributor

Choose a reason for hiding this comment

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

Also do the thing that Joao said

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.

3 participants