From 8bb12b909b68a3a65f8ab896eb71294d7ec746fa Mon Sep 17 00:00:00 2001 From: Guido Tack Date: Wed, 10 Jan 2018 14:18:59 +1100 Subject: [PATCH] Catch type error when set literal is declared that contains another set. --- CHANGES.txt | 1 + lib/typecheck.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 121660811..77643f4d4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 ============= diff --git a/lib/typecheck.cpp b/lib/typecheck.cpp index eb1e6ec42..9f79fbdb5 100644 --- a/lib/typecheck.cpp +++ b/lib/typecheck.cpp @@ -820,6 +820,8 @@ namespace MiniZinc { for (unsigned int i=0; itype().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())