diff --git a/CHANGELOG_NEXT.md b/CHANGELOG_NEXT.md index dd7503d02..ea65a31f7 100644 --- a/CHANGELOG_NEXT.md +++ b/CHANGELOG_NEXT.md @@ -46,6 +46,9 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO environment variable adds to the "Package Search Paths." Functionally this is not a breaking change. +* The compiler now parses `~x.fun` as unquoting `x` rather than `x.fun` + and `~(f 5).fun` as unquoting `(f 5)` rather than `(f 5).fun`. + ### Backend changes #### RefC Backend diff --git a/src/Idris/Parser.idr b/src/Idris/Parser.idr index 0be4fc526..09b4b19b2 100644 --- a/src/Idris/Parser.idr +++ b/src/Idris/Parser.idr @@ -631,7 +631,7 @@ mutual decoratedSymbol fname "]" pure ts pure (PQuoteDecl (boundToFC fname b) (collectDefs (concat b.val))) - <|> do b <- bounds (decoratedSymbol fname "~" *> simpleExpr fname indents) + <|> do b <- bounds (decoratedSymbol fname "~" *> simplerExpr fname indents) pure (PUnquote (boundToFC fname b) b.val) <|> do start <- bounds (symbol "(") bracketedExpr fname start indents diff --git a/tests/idris2/error/perror031/Issue3251.idr b/tests/idris2/error/perror031/Issue3251.idr new file mode 100644 index 000000000..7f37a1f54 --- /dev/null +++ b/tests/idris2/error/perror031/Issue3251.idr @@ -0,0 +1,19 @@ +import Language.Reflection + +(.fun) : Nat -> Nat + +x : TTImp + +f : Nat -> TTImp + +useX : TTImp +useX = `(g (~x).fun) + +useX' : TTImp +useX' = `(g ~x.fun) + +useFX : TTImp +useFX = `(g (~(f 5)).fun) + +useFX' : TTImp +useFX' = `(g ~(f 5).fun) diff --git a/tests/idris2/error/perror031/expected b/tests/idris2/error/perror031/expected new file mode 100644 index 000000000..53ff9b0ca --- /dev/null +++ b/tests/idris2/error/perror031/expected @@ -0,0 +1 @@ +1/1: Building Issue3251 (Issue3251.idr) diff --git a/tests/idris2/error/perror031/run b/tests/idris2/error/perror031/run new file mode 100644 index 000000000..345a367bb --- /dev/null +++ b/tests/idris2/error/perror031/run @@ -0,0 +1,3 @@ +. ../../../testutils.sh + +check Issue3251.idr