viperproject / gobra

Gobra is an automated, modular verifier for Go programs, based on the Viper verification infrastructure.
https://gobra.ethz.ch
Other
111 stars 28 forks source link

Fix purity classification of composite literals #768

Closed jcp19 closed 5 months ago

jcp19 commented 5 months ago

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