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

Fix purity classification of composite literals #768

Merged
merged 6 commits into from
May 21, 2024
Merged

Conversation

jcp19
Copy link
Contributor

@jcp19 jcp19 commented May 19, 2024

Currently, the type system of Gobra disallows array literals like [3]int{} from occurring in strongly pure contexts, even though an array is a value type (similarly to structs). Furthermore, the type system (wrongly) allows slice and map literals in pure contexts, even though it shouldn't because slices and maps are reference types. This PR addresses this classification.

To implement this, I had to fix the function underlyingTypeWithCtxP to allow for ADTs

@jcp19 jcp19 requested a review from ArquintL May 21, 2024 07:59
Copy link
Member

@ArquintL ArquintL left a comment

Choose a reason for hiding this comment

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

LGTM

@jcp19 jcp19 merged commit 2765d8e into master May 21, 2024
2 of 3 checks passed
@jcp19 jcp19 deleted the fix_pure_literals branch May 21, 2024 08:47
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.

2 participants