epfl-lara / stainless

Verification framework and tool for higher-order Scala programs
https://epfl-lara.github.io/stainless/
Apache License 2.0
349 stars 49 forks source link

Why is `ConcTree.Empty` not a `case object`? #1493

Closed acruise closed 2 months ago

acruise commented 5 months ago

Just out of curiosity... :)

https://github.com/epfl-lara/stainless/blob/536d418f47f2699c7f7bc154a8792204714f5cf8/frontends/benchmarks/verification/valid/ConcTree.scala#L82

mario-bucev commented 5 months ago

Hello! This is needed to be able to declare the T type parameter, which here is necessary because Conc is invariant in T. If we were to make Conc covariant, we could declare ConcTree.Empty as a case object such as here: https://github.com/epfl-lara/stainless/blob/536d418f47f2699c7f7bc154a8792204714f5cf8/frontends/library/stainless/covcollection/List.scala#L715