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

ADT must appear only in strictly positive positions when using Map #1547

Open
LioTree opened this issue Jul 24, 2024 · 0 comments
Open

ADT must appear only in strictly positive positions when using Map #1547

LioTree opened this issue Jul 24, 2024 · 0 comments

Comments

@LioTree
Copy link

LioTree commented Jul 24, 2024

When I tried the following example, I got the error "ADT Value must appear only in strictly positive positions of Value." I got the same result using Map[String, Value].

import stainless.lang.Map

abstract class Value 
case class Test(env: Map[String, Value]) extends Value

#783 provides some information, although I have difficulty understanding it due to my lack of related knowledge. What I can understand is that situations like the following may cause problems:

case class Test2[K](a: K => String)

abstract class Value 
case class Test(env: Test2[Value]) extends Value

But why is Map also being rejected? Clearly, its constructor does not include such a definition. In

def polarity(polarities: mutable.Map[(Identifier,Identifier),Polarity]) = Nothing
, we can see that the polarities of types like Map, Set, and Bag are all set to Nothing, which leads to the error message. Is this an overly conservative approach?

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

No branches or pull requests

1 participant