3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-15 11:35:42 +00:00

Fix Java API ClassCastException when getting EnumSort of constant

- Add EnumSort(Context ctx, long obj) constructor to allow creating
  EnumSort from an existing native sort object
- Modify Sort.create() to detect enum sorts (all constructors have
  arity 0) and return EnumSort instead of DatatypeSort, mirroring
  Z3's own is_enum_sort implementation

Closes #7335
This commit is contained in:
copilot-swe-agent[bot] 2026-07-13 03:52:14 +00:00 committed by GitHub
parent 431f0223f0
commit 4e48303776
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -92,6 +92,11 @@ public class EnumSort<R> extends Sort
return new FuncDecl<>(getContext(), Native.getDatatypeSortRecognizer(getContext().nCtx(), getNativeObject(), inx));
}
EnumSort(Context ctx, long obj)
{
super(ctx, obj);
}
EnumSort(Context ctx, Symbol name, Symbol[] enumNames)
{
super(ctx, Native.mkEnumerationSort(ctx.nCtx(),