From d6ebbd5039954ecd47463802a16b5d8d7f223eef Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 25 Nov 2025 10:23:02 +0100 Subject: fix(haskell): correct use of supertypes in `(decl)` patterns Problem: These patterns were impossible, since children need to be children of every subtype of a supertype to be captured in this way. As subtypes could appear as children themselves, the query code silently "skipped over" the supertype restriction in the pattern. This was fixed in tree-sitter v0.26.0, which now (correctly) flags these patterns as "impossible". Solution: Add the appropriate child nodes explicitly. --- runtime/queries/haskell/highlights.scm | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index 0880f020e..de0eaf0a1 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -121,7 +121,21 @@ ; ---------------------------------------------------------------------------- ; Functions and variables -(decl +(decl/signature + [ + name: (variable) @function + names: (binding_list + (variable) @function) + ]) + +(decl/function + [ + name: (variable) @function + names: (binding_list + (variable) @function) + ]) + +(decl/bind [ name: (variable) @function names: (binding_list @@ -142,7 +156,14 @@ type: (type)) . (decl - name: (variable) @variable) + [ + (signature + name: (variable) @variable) + (function + name: (variable) @variable) + (bind + name: (variable) @variable) + ]) match: (_) (#eq? @_name @variable)) @@ -160,7 +181,14 @@ (#eq? @_type "IO")) . (decl - name: (variable) @function) + [ + (signature + name: (variable) @function) + (function + name: (variable) @function) + (bind + name: (variable) @function) + ]) match: (_) (#eq? @_name @function)) -- cgit v1.2.3-70-g09d2