diff --git a/src/Idris/ParseOps.hs b/src/Idris/ParseOps.hs index 67190be16..8cd154e0a 100644 --- a/src/Idris/ParseOps.hs +++ b/src/Idris/ParseOps.hs @@ -82,12 +82,16 @@ backtick = Infix (do indentPropHolds gtProp optional namespace @ - OperatorFront ::= (Identifier_t '.')? '(' Operator_t ')'; + OperatorFront ::= + '(' '=' ')' + | (Identifier_t '.')? '(' Operator_t ')' + ; @ -} operatorFront :: IdrisParser Name -operatorFront = maybeWithNS (lchar '(' *> operator <* lchar ')') False [] +operatorFront = try ((lchar '(' *> reservedOp "=" <* lchar ')') >> (return eqTy)) + <|> maybeWithNS (lchar '(' *> operator <* lchar ')') False [] {- | Parses a function (either normal name or operator) diff --git a/test/reg037/expected b/test/reg037/expected new file mode 100644 index 000000000..e69de29bb diff --git a/test/reg037/reg037.idr b/test/reg037/reg037.idr new file mode 100644 index 000000000..91f4e3fa7 --- /dev/null +++ b/test/reg037/reg037.idr @@ -0,0 +1,9 @@ + +--- Parser regression for (=) as a function name (fnName) + +class Foo (t : (A : Type) -> (B : Type) -> A -> B -> Type) where + foo : (A : Type) -> (B : Type) -> (x : A) -> (y : B) -> t A B x y -> t A B x y + +instance Foo (=) where + foo A B x y prf = prf + diff --git a/test/reg037/run b/test/reg037/run new file mode 100755 index 000000000..8041c4b29 --- /dev/null +++ b/test/reg037/run @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +idris --check reg037.idr +rm -f reg037 *.ibc