Open CervEdin opened 1 year ago
I'm afraid that the problem lies in the combination of type aliases with the JSON parser. The parser requires the types as input, but the resolves aliases are not yet known. I will have a look at fixing this in the the close future
Currently a workaround is to use the record definition directly in the definition of the array:
enum nume = { A };
array[int] of record(nume: x): arr;
or to provide the data as DZN
Thank you Jip!
Currently a workaround is to use the record definition directly in the definition of the array:
enum nume = { A }; array[int] of record(nume: x): arr;
or to provide the data as DZN
The inlining work-around of the type definition didn't work on my actual and more complicated problem :/ Although, that may be a separate issue. Trying to see if I can get a small repro
Nested records also result in a segfault, regardless whether the type alias is inlined or not
enum nume = { A };
array[int] of record(record(nume: x) : drocer): arr;
{
"arr": [
{
"drocer": { "x": { "e": "A" } }
}
]
}
A fix for the problem with nested records has already been merged into the develop
branch and should be part of the upcoming release. (And the first problem is no longer a segfault, but still not possible).
@Dekker1 looks like the fix you mentioned (for the nested inline records) made it to the 2.8 release, right?
Yes, this is part of the 2.8 release
I can confirm that nested arrays of records work with JSON parsing in version 2.8.3. However are there any news about the alias resolution being done before the JSON parsing? (Related to Dekker1's answer here)
I'm afraid we haven't found the time yet to change the order of the process, but I will try to get around to it when I can
I can confirm that nested arrays of records work with JSON parsing in version 2.8.3. However are there any news about the alias resolution being done before the JSON parsing? (Related to Dekker1's answer here)
FWIW, I think the best current work-around is introducing a dummy input par
type foo = record(int:a);
array[int] of record(int:a): inline_foos;
array[int] of foo: foos = inline_foos;
This is basically how I get around the issue atm
The following model
model.mzn
and the following json data file
data.json
compiled using MiniZinc version
2.7.6, build 905165378
like thiscrashes with a segfault