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

MiniZinc too pedantic about the type of an empty list? #664

Closed
matsc-at-sics-se opened this issue Apr 4, 2023 · 0 comments
Closed

MiniZinc too pedantic about the type of an empty list? #664

matsc-at-sics-se opened this issue Apr 4, 2023 · 0 comments
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release

Comments

@matsc-at-sics-se
Copy link

The following happens in all versions that I have tried.
If it's not a bug, it's certainly non-intuitive.

$ cat bug1.mzn 
array[1..3] of set of int: C = [{1},{2},{3}];
array[int] of set of int: F(int: t) =
  if t = 3 then [] else [C[t+1] | _ in 1..2] ++ F(t+1) endif;
output ["F = \(F(0));\n"];
$ minizinc bug1.mzn 
Error: type error: type mismatch in branches of conditional. `then' branch has type `array[int] of bot', but `else' branch has type `array[int] of set of int'
/home/matsc/Coursera/Ass8/models/bug1.mzn:3.17-18
$ cat bug2.mzn 
array[1..3] of set of int: C = [{1},{2},{3}];
array[int] of set of int: F(int: t) =
  if t = 3 then [{}] else [C[t+1] | _ in 1..2] ++ F(t+1) endif;
output ["F = \(F(0));\n"];
$ minizinc bug2.mzn 
F = [1..1, 1..1, 2..2, 2..2, 3..3, 3..3, {}];
----------
@Dekker1 Dekker1 added bug resolved Issue is resolved and the feature or fix will be part of next release labels Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release
Projects
None yet
Development

No branches or pull requests

2 participants