Commit cc8dbec0 authored by John van Groningen's avatar John van Groningen
Browse files

{} is not allowed in patterns, because array 'denotations' in patterns

are not implemented
parent bf77a4f7
...@@ -2391,16 +2391,17 @@ buildNodeDef lhsExpr rhsExpr ...@@ -2391,16 +2391,17 @@ buildNodeDef lhsExpr rhsExpr
wantRecordOrArrayExp :: !Bool !ParseState -> (ParsedExpr, !ParseState) wantRecordOrArrayExp :: !Bool !ParseState -> (ParsedExpr, !ParseState)
wantRecordOrArrayExp is_pattern pState wantRecordOrArrayExp is_pattern pState
# (token, pState) = nextToken FunctionContext pState # (token, pState) = nextToken FunctionContext pState
| token == CurlyCloseToken
= (PE_ArrayDenot [], pState)
| is_pattern | is_pattern
| token == SquareOpenToken | token == SquareOpenToken
# (elems, pState) = want_array_assignments cIsAPattern pState # (elems, pState) = want_array_assignments cIsAPattern pState
= (PE_ArrayPattern elems, wantToken FunctionContext "array selections in pattern" CurlyCloseToken pState) = (PE_ArrayPattern elems, wantToken FunctionContext "array selections in pattern" CurlyCloseToken pState)
// MW was = (PE_Empty, parseError "array selection" No "No array selection in pattern" pState) | token == CurlyCloseToken
= (PE_Empty, parseError "record or array pattern" No "Array denotation not" pState)
// otherwise // is_pattern && token <> SquareOpenToken // otherwise // is_pattern && token <> SquareOpenToken
= want_record_pattern token pState = want_record_pattern token pState
// otherwise // ~ is_pattern // otherwise // ~ is_pattern
| token == CurlyCloseToken
= (PE_ArrayDenot [], pState)
# (opt_type, pState) = try_type_specification token pState # (opt_type, pState) = try_type_specification token pState
= case opt_type of = case opt_type of
Yes _ Yes _
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment