Skip to content

Fix purity classification of composite literals#768

Merged
jcp19 merged 6 commits intomasterfrom
fix_pure_literals
May 21, 2024
Merged

Fix purity classification of composite literals#768
jcp19 merged 6 commits intomasterfrom
fix_pure_literals

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
@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