From d7867c0c1aef3a22832f93d54bf6be6e18a7b70c Mon Sep 17 00:00:00 2001 From: Steve Dunham Date: Mon, 8 Apr 2024 19:58:40 -0700 Subject: [PATCH 1/5] [ parser ] Fix issue parsing unquote --- CHANGELOG_NEXT.md | 3 +++ src/Idris/Parser.idr | 2 +- tests/idris2/error/perror031/Issue3251.idr | 19 +++++++++++++++++++ tests/idris2/error/perror031/expected | 1 + tests/idris2/error/perror031/run | 3 +++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/idris2/error/perror031/Issue3251.idr create mode 100644 tests/idris2/error/perror031/expected create mode 100644 tests/idris2/error/perror031/run diff --git a/CHANGELOG_NEXT.md b/CHANGELOG_NEXT.md index ee8ca072730..a21238294c3 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 0be4fc52621..09b4b19b21b 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 00000000000..7f37a1f549e --- /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 00000000000..53ff9b0ca7a --- /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 00000000000..345a367bb33 --- /dev/null +++ b/tests/idris2/error/perror031/run @@ -0,0 +1,3 @@ +. ../../../testutils.sh + +check Issue3251.idr From bed20133282f3a72f0d2ee83b0dbe7aabde9ab00 Mon Sep 17 00:00:00 2001 From: Steve Dunham Date: Sat, 27 Apr 2024 11:50:00 -0700 Subject: [PATCH 2/5] [ fix ] fix macos ci --- config.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.mk b/config.mk index f15620db59f..4be454c9f64 100644 --- a/config.mk +++ b/config.mk @@ -36,6 +36,12 @@ else SHLIB_SUFFIX := .so endif +# Find homebrew's libgmp on ARM macs +ifneq (,$(wildcard /opt/homebrew/include/gmp.h)) + CPPFLAGS += -I/opt/homebrew/include + LDFLAGS += -L/opt/homebrew/lib +endif + ifneq (, $(findstring freebsd, $(MACHINE))) CFLAGS += -I$(shell /sbin/sysctl -n user.localbase)/include LDFLAGS += -L$(shell /sbin/sysctl -n user.localbase)/lib From 2e27921771abfb13ee56375a2f5c13d6a7a3010a Mon Sep 17 00:00:00 2001 From: Steve Dunham Date: Sat, 27 Apr 2024 14:40:07 -0700 Subject: [PATCH 3/5] [ fix ] propagate LDFLAGS and CPPFLAGS to test makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 36556d36a81..1e828cf8817 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,7 @@ test: testenv @echo "NOTE: \`${MAKE} test\` does not rebuild Idris or the libraries packaged with it; to do that run \`${MAKE}\`" @if [ ! -x "${TARGET}" ]; then echo "ERROR: Missing IDRIS2 executable. Cannot run tests!\n"; exit 1; fi @echo - @${MAKE} -C tests only=$(only) except=$(except) IDRIS2=${TARGET} IDRIS2_PREFIX=${TEST_PREFIX} + @${MAKE} -C tests only=$(only) except=$(except) IDRIS2=${TARGET} IDRIS2_PREFIX=${TEST_PREFIX} CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" retest: testenv From 93bf394370a95b54bd64c8f50fb288b9933c38af Mon Sep 17 00:00:00 2001 From: Steve Dunham Date: Sat, 27 Apr 2024 14:51:25 -0700 Subject: [PATCH 4/5] [ fix ] Use HOMEBREW_PREFIX instead of /opt/homebrew --- config.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config.mk b/config.mk index 4be454c9f64..8372535ef74 100644 --- a/config.mk +++ b/config.mk @@ -37,9 +37,9 @@ else endif # Find homebrew's libgmp on ARM macs -ifneq (,$(wildcard /opt/homebrew/include/gmp.h)) - CPPFLAGS += -I/opt/homebrew/include - LDFLAGS += -L/opt/homebrew/lib +ifneq (,$(wildcard ${HOMEBREW_PREFIX}/include/gmp.h)) + CPPFLAGS += -I${HOMEBREW_PREFIX}/include + LDFLAGS += -L${HOMEBREW_PREFIX}/lib endif ifneq (, $(findstring freebsd, $(MACHINE))) From ed3fe023cb25a5de47830ecded8edcd9ee869209 Mon Sep 17 00:00:00 2001 From: Steve Dunham Date: Sat, 27 Apr 2024 15:31:59 -0700 Subject: [PATCH 5/5] [ fix ] include ambient CFLAGS/LDFLAGS in ccompilerArgs test --- tests/refc/ccompilerArgs/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/refc/ccompilerArgs/run b/tests/refc/ccompilerArgs/run index e91a9c1ef04..ef84ccaefda 100755 --- a/tests/refc/ccompilerArgs/run +++ b/tests/refc/ccompilerArgs/run @@ -20,8 +20,8 @@ cd ./library/ make > /dev/null cd .. -export CFLAGS="-I./library/ -O3" -export LDFLAGS="-L./library/ -Wl,-S" +export CFLAGS="-I./library/ -O3 ${CFLAGS}" +export LDFLAGS="-L./library/ -Wl,-S ${LDFLAGS}" export LDLIBS="-lexternalc" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./library/" export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:./library/"