From 2341a521a3e07464ef0a580bdf803aed35aab27e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Fri, 8 Sep 2023 11:06:29 +0200 Subject: [PATCH] tests: illustrate issue #1671 --- tests/test-dirs/with-ppx/issue1671-string.t | 124 ++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 tests/test-dirs/with-ppx/issue1671-string.t diff --git a/tests/test-dirs/with-ppx/issue1671-string.t b/tests/test-dirs/with-ppx/issue1671-string.t new file mode 100644 index 0000000000..46d347b6b3 --- /dev/null +++ b/tests/test-dirs/with-ppx/issue1671-string.t @@ -0,0 +1,124 @@ + $ cat >dune-project < (lang dune 2.0) + > EOF + + $ cat >main.ml < let f x = + > [%string + > "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ + > %{x}"] + > ;; + > print_endline @@ f "42";; + > EOF + + $ cat >dune < (executable + > (name main) + > (preprocess (pps ppx_string))) + + $ dune build @check + + $ dune exec ./main.exe + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 42 + +FIX upstream: locs issued by the ppx does not enable Merlin to work as expected + $ $MERLIN single type-enclosing -position 3:7 \ + > -filename main.ml string", + "tail": "no" + } + ], + "notifications": [] + } + +FIXME: Merlin should ignore hidden nodes in occurrences results to prevent +broken renaming + $ $MERLIN single occurrences -identifier-at 1:6 \ + > -filename main.ml + pattern (main.ml[1,0+4]..main.ml[1,0+5]) + Tpat_var \"f/273\" + expression (main.ml[1,0+6]..main.ml[3,21+97]) ghost + Texp_function + Nolabel + [ + + pattern (main.ml[1,0+6]..main.ml[1,0+7]) + Tpat_var \"x/275\" + expression (main.ml[2,10+2]..main.ml[3,21+97]) + attribute \"merlin.hide\" + [] + Texp_apply + expression (main.ml[2,10+2]..main.ml[3,21+97]) + Texp_ident \"Stdlib!.String.concat\" + [ + + Nolabel + expression (main.ml[2,10+2]..main.ml[3,21+97]) + Texp_constant Const_string(\"\",(main.ml[2,10+2]..main.ml[3,21+97]),None) + + Nolabel + expression (main.ml[2,10+2]..main.ml[3,21+97]) + Texp_construct \"::\" + [ + expression (main.ml[3,21+5]..main.ml[3,21+91]) ghost + Texp_constant Const_string(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \",(main.ml[3,21+5]..main.ml[3,21+91]) ghost,None) + expression (main.ml[2,10+2]..main.ml[3,21+97]) + Texp_construct \"::\" + [ + expression (main.ml[3,21+93]..main.ml[3,21+94]) + Texp_ident \"x/275\" + expression (main.ml[2,10+2]..main.ml[3,21+97]) + Texp_construct \"[]\" + [] + ] + ] + ] + ] + ] + structure_item (main.ml[5,122+0]..main.ml[5,122+23]) + Tstr_eval + expression (main.ml[5,122+0]..main.ml[5,122+23]) + Texp_apply + expression (main.ml[5,122+0]..main.ml[5,122+13]) + Texp_ident \"Stdlib!.print_endline\" + [ + + Nolabel + expression (main.ml[5,122+17]..main.ml[5,122+23]) + Texp_apply + expression (main.ml[5,122+17]..main.ml[5,122+18]) + Texp_ident \"f/273\" + [ + + Nolabel + expression (main.ml[5,122+19]..main.ml[5,122+23]) + Texp_constant Const_string(\"42\",(main.ml[5,122+20]..main.ml[5,122+22]),None) + ] + ] + ] + + + ", + "notifications": [] + }