Tweaks to NONE parsing and tests
This commit is contained in:
parent
32532836b9
commit
922b585700
5
parse.c
5
parse.c
@ -1535,9 +1535,12 @@ PARSER(parse_none) {
|
||||
if (!match_word(&pos, "NONE"))
|
||||
return NULL;
|
||||
|
||||
const char *none_end = pos;
|
||||
spaces(&pos);
|
||||
if (!match(&pos, ":"))
|
||||
return NewAST(ctx->file, start, pos, None, .type=NULL);
|
||||
return NewAST(ctx->file, start, none_end, None, .type=NULL);
|
||||
|
||||
spaces(&pos);
|
||||
type_ast_t *type = parse_type(ctx, pos);
|
||||
if (!type) return NULL;
|
||||
return NewAST(ctx->file, start, type->end, None, .type=type);
|
||||
|
@ -22,9 +22,7 @@ func main():
|
||||
>> Num.INF:isinf()
|
||||
= yes
|
||||
|
||||
>> Num.NAN
|
||||
= NONE : Num?
|
||||
>> nan := Num.NAN
|
||||
>> nan := NONE : Num
|
||||
= NONE : Num?
|
||||
>> nan == nan
|
||||
= yes
|
||||
|
Loading…
Reference in New Issue
Block a user