You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ability to resolve partially known error sets #3311
sometimes i run into the case where i have an error set like
KnownError||UnknownError()
it would be helpful if it was possible that this would be recognized as some error set and maybe also allow autocompletions with an error that was part of KnownError.
idk if this is actually a feasible task, but i think it would be cool if it was possible.
This should be extended to not assume that the lhs and rhs are errors sets but also accept an unknown value/type (see isUnknown). All call sites to this function should be updated accordingly to not abort early when lhs or rhs coudn't be resolve to an error set.
Activity
techatrix commentedon Nov 4, 2026
That seems like a very reasonable feature. We should be able to represent an error set that contains errors that could not be resolved:
unknownmay be any expression that doesn't resolve to an error set.Related source code
Error sets are represented in the "InternPool" data structure and currently store a list of all error names:
zls/src/analyser/InternPool.zig
Lines 110 to 113 in b3e6512
This should be extended to have a boolean flag that specifies whether there also are unknown errors.
The logic for the
lhs || rhsis implemented inerrorSetMerge:zls/src/analyser/InternPool.zig
Line 3546 in b3e6512
This should be extended to not assume that the
lhsandrhsare errors sets but also accept an unknown value/type (see isUnknown). All call sites to this function should be updated accordingly to not abort early whenlhsorrhscoudn't be resolve to an error set.Test coverage should be added to tests/analysis/error_union.zig.
iwami4438 commentedon Nov 6, 2026
Hello.
May I take this on?
techatrix commentedon Nov 8, 2026
Yes. You are welcome to work on this. Have a look at the contributing guide if you haven't already on how to get started.