diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-08-27 21:07:20 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-08-27 23:04:38 +0200 |
| commit | 880c36a666e3ee36066719a09a5294be2cfa3e93 (patch) | |
| tree | 9401ebb95540c983cb910ec2d7b65218c4901d23 | |
| parent | 0cbbe31c5f16df73dcc3a73b37cac4a72948f3a6 (diff) | |
| -rw-r--r-- | src/Parser/Expr.hs | 11 | ||||
| -rw-r--r-- | test/asset/parser/type-annotation.et | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/Parser/Expr.hs b/src/Parser/Expr.hs index 4603dda..89fa208 100644 --- a/src/Parser/Expr.hs +++ b/src/Parser/Expr.hs @@ -560,5 +560,12 @@ applyFunctionArguments args sexpr@(SomeExpr (expr :: Expr a)) typeExpr :: TestParser SomeExprType typeExpr = do off <- stateOffset <$> getParserState - name <- constrName <?> "type constructor name" - lookupType off name + choice + [ do + name <- constrName <?> "type constructor name" + lookupType off name + , do + between (symbol "[") (symbol "]") $ do + inner <- typeExpr + return $ ExprTypeApp (ExprTypeConstr1 (Proxy :: Proxy [])) [ inner ] + ] diff --git a/test/asset/parser/type-annotation.et b/test/asset/parser/type-annotation.et index 7e5d81e..9740768 100644 --- a/test/asset/parser/type-annotation.et +++ b/test/asset/parser/type-annotation.et @@ -1,7 +1,8 @@ def fun (a : String) and (b : Integer) proc (p : Process): - let c = [ a, "x" ] + let c = [ a, "x" ] : [ String ] let d = [ a ] - let e = [ b : Integer, 43 : Integer ] + let e = [ b : Integer, 43 : Integer ]:[Integer] + let f = [[ c, ["y"]]] : [[[ String ] ] ] guard (c /= d) guard (e == e) |