Skip to content

Add oneof<...> type declarations - #71

Open
InnocentZero wants to merge 2 commits into
nushell:mainfrom
InnocentZero:oneof-typedecl
Open

Add oneof<...> type declarations#71
InnocentZero wants to merge 2 commits into
nushell:mainfrom
InnocentZero:oneof-typedecl

Conversation

@InnocentZero

Copy link
Copy Markdown
Contributor

Currently, the parser cannot support explicit type declarations for variables of the form oneof<x, y, z>. This commit adds support for that to the typechecker and the resolver.

More importantly, we need to discuss semantics of oneof properly. Atm, the explicit declarations resolve oneof<a> to a to save unnecessary overhead. We can make this an error as well (why would anyone realistically write let x: oneof<int> style declarations?). Apart from this, oneof always expects type arguments and errors otherwise (a cursed implementation would be to have let x: oneof<> typecheck to let x: any instead, but again, do we want it?).

Currently, the parser cannot support explicit type declarations for
variables of the form oneof<x, y, z>. This commit adds support for that
to the typechecker and the resolver.

Signed-off-by: innocentzero <1nn0c3n7z3r0@proton.me>
Signed-off-by: innocentzero <1nn0c3n7z3r0@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant