Tweaks to NONE parsing and tests

This commit is contained in:
Bruce Hill 2024-11-25 15:59:35 -05:00
parent 32532836b9
commit 922b585700
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -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