tests: remove union type

This commit is contained in:
2026-06-02 17:22:19 +02:00
parent 828ec9a3fa
commit 9a934fabfd
2 changed files with 32 additions and 50 deletions

View File

@@ -48,7 +48,7 @@ type Person = {
name: str name: str
// Property with an inline constraint // Property with an inline constraint
age: None | (int where (0 <= _ < 150)) age: Optional[int where (0 <= _ < 150)]
// Property referencing a predicate // Property referencing a predicate
height: float where StrictlyPositive height: float where StrictlyPositive

View File

@@ -1982,123 +1982,99 @@
}, },
{ {
"type": "IDENTIFIER", "type": "IDENTIFIER",
"lexeme": "None", "lexeme": "Optional",
"line": 51, "line": 51,
"column": 10 "column": 10
}, },
{ {
"type": "WHITESPACE", "type": "LEFT_BRACKET",
"lexeme": " ", "lexeme": "[",
"line": 51, "line": 51,
"column": 14 "column": 18
},
{
"type": "PIPE",
"lexeme": "|",
"line": 51,
"column": 15
},
{
"type": "WHITESPACE",
"lexeme": " ",
"line": 51,
"column": 16
},
{
"type": "LEFT_PAREN",
"lexeme": "(",
"line": 51,
"column": 17
}, },
{ {
"type": "IDENTIFIER", "type": "IDENTIFIER",
"lexeme": "int", "lexeme": "int",
"line": 51, "line": 51,
"column": 18 "column": 19
}, },
{ {
"type": "WHITESPACE", "type": "WHITESPACE",
"lexeme": " ", "lexeme": " ",
"line": 51, "line": 51,
"column": 21 "column": 22
}, },
{ {
"type": "WHERE", "type": "WHERE",
"lexeme": "where", "lexeme": "where",
"line": 51, "line": 51,
"column": 22 "column": 23
}, },
{ {
"type": "WHITESPACE", "type": "WHITESPACE",
"lexeme": " ", "lexeme": " ",
"line": 51, "line": 51,
"column": 27 "column": 28
}, },
{ {
"type": "LEFT_PAREN", "type": "LEFT_PAREN",
"lexeme": "(", "lexeme": "(",
"line": 51, "line": 51,
"column": 28 "column": 29
}, },
{ {
"type": "NUMBER", "type": "NUMBER",
"lexeme": "0", "lexeme": "0",
"line": 51, "line": 51,
"column": 29 "column": 30
}, },
{ {
"type": "WHITESPACE", "type": "WHITESPACE",
"lexeme": " ", "lexeme": " ",
"line": 51, "line": 51,
"column": 30 "column": 31
}, },
{ {
"type": "LESS_EQUAL", "type": "LESS_EQUAL",
"lexeme": "<=", "lexeme": "<=",
"line": 51, "line": 51,
"column": 31 "column": 32
}, },
{ {
"type": "WHITESPACE", "type": "WHITESPACE",
"lexeme": " ", "lexeme": " ",
"line": 51, "line": 51,
"column": 33 "column": 34
}, },
{ {
"type": "UNDERSCORE", "type": "UNDERSCORE",
"lexeme": "_", "lexeme": "_",
"line": 51, "line": 51,
"column": 34 "column": 35
}, },
{ {
"type": "WHITESPACE", "type": "WHITESPACE",
"lexeme": " ", "lexeme": " ",
"line": 51, "line": 51,
"column": 35 "column": 36
}, },
{ {
"type": "LESS", "type": "LESS",
"lexeme": "<", "lexeme": "<",
"line": 51, "line": 51,
"column": 36 "column": 37
}, },
{ {
"type": "WHITESPACE", "type": "WHITESPACE",
"lexeme": " ", "lexeme": " ",
"line": 51, "line": 51,
"column": 37 "column": 38
}, },
{ {
"type": "NUMBER", "type": "NUMBER",
"lexeme": "150", "lexeme": "150",
"line": 51, "line": 51,
"column": 38 "column": 39
},
{
"type": "RIGHT_PAREN",
"lexeme": ")",
"line": 51,
"column": 41
}, },
{ {
"type": "RIGHT_PAREN", "type": "RIGHT_PAREN",
@@ -2106,11 +2082,17 @@
"line": 51, "line": 51,
"column": 42 "column": 42
}, },
{
"type": "RIGHT_BRACKET",
"lexeme": "]",
"line": 51,
"column": 43
},
{ {
"type": "NEWLINE", "type": "NEWLINE",
"lexeme": "\n", "lexeme": "\n",
"line": 51, "line": 51,
"column": 43 "column": 44
}, },
{ {
"type": "NEWLINE", "type": "NEWLINE",
@@ -2651,12 +2633,12 @@
"_type": "PropertyStmt", "_type": "PropertyStmt",
"name": "age", "name": "age",
"type": { "type": {
"_type": "UnionType", "_type": "GenericType",
"types": [ "type": {
{
"_type": "NamedType", "_type": "NamedType",
"name": "None" "name": "Optional"
}, },
"params": [
{ {
"_type": "ConstraintType", "_type": "ConstraintType",
"type": { "type": {