potassco / clintest

🧪 A test framework for clingo programs
https://potassco.org/clintest/
MIT License
7 stars 1 forks source link

Allow empty connectives #23

Closed teiesti closed 4 months ago

teiesti commented 5 months ago

Empty connectives, like assertion.And() work but they are disallowed by their type declaration. Change their type so that they are allowed.

E.g., change

def __init__(self, *args: Assertion) -> None:

to

def __init__(self, *args: Optional[Assertion]) -> None:
teiesti commented 4 months ago

There seems to be no bug.

This document specifies that the type of args in

def __init__(self, *args: Assertion) -> None:

is tuple[Annotation, ...].

Furthermore, the same document specifies that tuple[Annotation, ...] stands for a tuple with zero or more Annotation elements. Having zero Annotation elements is precisely what an empty connective is meant to have. Thus, the current type declaration is correct.

Given this explanation, I'd also argue that

def __init__(self, *args: Optional[Assertion]) -> None:

would allow And(True_, None), which is wrong.

Unless further evidence is presented, I'll close this issue.

@mihammer97