MiniZinc Record Mismatch Errors

5 views
Skip to first unread message

David Lloyd

unread,
Sep 17, 2025, 6:30:13 AM (19 hours ago) Sep 17
to MiniZinc


Let's say I muddle up a declaration and get:


```
fl-generated:51.74-334:

MiniZinc: type error: cannot determine coercion from type record(opt bot: boolValue, string: comment, fieldType: fieldType, opt bot: floatValue, int: id, opt bot: intValue, opt bot: isPresent, string: name, int: ref, solutionType: solveType, string: stringValue, int: weight) to type record(opt string: comment, int: id, opt int: intValue, string: name, int: ref, solutionType: solveType, opt int: weight)

Process finished with non-zero exit code 1.
```

This is a "correct" error as such but I have some annoyances:
  1. Surely the compiler could "know" what type of record both those records are meant to be, or take a reasonable guess.
    1. It knows what the record SHOULD be via its declaration
    2. It knows what the second, nested record SHOULD be (it happens to be this part that is causing the issue)
MiniZinc: type error: cannot determine coercion from record(opt bot: boolValue, string: comment, fieldType: fieldType, opt bot: floatValue, int: id, opt bot: intValue, opt bot: isPresent, string: name, int: ref, solutionType: solveType, string: stringValue, int: weight) to type `FieldInfoIntoType` record(opt string: comment, int: id, opt int: intValue, string: name, int: ref, solutionType: solveType, opt int: weight)

NOTICE I've added the `FieldInfoIntType`.

I *know* what a `FieldInfoIntType` should look like (i.e. its shape) but if you just spit out `type record(... the definition)` I'm just going to get confused.

The *shorter* way of saying this, is why can't the error messages include the record type(s) it is looking for if it gets a mismatch? Or the type name in general...

Reply all
Reply to author
Forward
0 new messages