Skip to content

Commit

Permalink
Catch type error when set literal is declared that contains another set.
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Jan 10, 2018
1 parent 34fbaf8 commit 8bb12b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Bug fixes:
- Fix evaluation of comprehensions in recursive functions.
- Fix output of Gurobi backend when used in conjunction with solns2out.
- Fix pthread linking for mzn-cbc.
- Catch type error when set literal is declared that contains another set.

Version 2.1.6
=============
Expand Down
2 changes: 2 additions & 0 deletions lib/typecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,8 @@ namespace MiniZinc {
for (unsigned int i=0; i<sl.v().size(); i++) {
if (sl.v()[i]->type().dim() > 0)
throw TypeError(_env,sl.v()[i]->loc(),"set literals cannot contain arrays");
if (sl.v()[i]->type().is_set())
throw TypeError(_env,sl.v()[i]->loc(),"set literals cannot contain sets");
if (sl.v()[i]->type().isvar())
ty.ti(Type::TI_VAR);
if (sl.v()[i]->type().isopt())
Expand Down

0 comments on commit 8bb12b9

Please sign in to comment.