-
-
Save recloser/6f1ebf3ca8b1a6027e1051d3849e9261 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static: | |
doAssert int is int | |
doAssert type(1) is int | |
# doAssert string is int # <- compile time error | |
match(either) # Either[string, int] | |
of int: ... | |
of string: ... | |
of bool: | |
static: # this block would be generated by the macro | |
# and inserted in each branch | |
var found = false | |
found = found or (bool is string) # first type is the ident, second is | |
found = found or (bool is int) # the properly typed sym extracted in your macro | |
if not found: | |
error("Bool is not a valid type!") | |
# user branch code goes here... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment